-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheslint.config.js
85 lines (77 loc) · 2.01 KB
/
eslint.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/* eslint-disable no-undef */
/* eslint-disable no-unused-vars */
const { FlatCompat } = require('@eslint/eslintrc');
const js = require('@eslint/js');
const typescriptEslintPlugin = require('@typescript-eslint/eslint-plugin');
const typescriptEslintParser = require('@typescript-eslint/parser');
const reactPlugin = require('eslint-plugin-react');
const tsdocPlugin = require('eslint-plugin-tsdoc');
const wordpressEslintPlugin = require('@wordpress/eslint-plugin');
const compat = new FlatCompat({
baseDirectory: __dirname,
});
module.exports = [
// Basis-Konfiguration für JavaScript
js.configs.recommended,
// Gemeinsame Konfiguration für alle Dateien
...compat.config({
plugins: ['react', 'tsdoc', '@wordpress'],
settings: {
react: {
version: 'detect',
},
},
env: {
browser: true,
},
rules: {
'react/jsx-key': 'error',
'tsdoc/syntax': 'warn',
// Weitere gemeinsame Regeln
},
}),
// Spezifische Konfiguration für TypeScript-Dateien
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parser: typescriptEslintParser,
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
ecmaVersion: 2020,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
},
plugins: {
'@typescript-eslint': typescriptEslintPlugin,
'@typescript-eslint/tsdoc': tsdocPlugin,
},
rules: {
// TypeScript-spezifische Regeln
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error"],
'no-console': 'off'
// Weitere TypeScript-Regeln
},
},
// Spezifische Konfiguration für JavaScript-Dateien
{
files: ['**/*.js', '**/*.jsx'],
languageOptions: {
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
},
rules: {
'no-unused-vars': 'error',
'no-console': 'off',
},
},
];