-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy patheslint.config.js
102 lines (100 loc) · 3.43 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
const typescriptEslintParser = require('@typescript-eslint/parser');
const eslintPluginSonarjs = require('eslint-plugin-sonarjs');
const { FlatCompat } = require('@eslint/eslintrc');
const globals = require('globals');
const js = require('@eslint/js');
const compat = new FlatCompat({
recommendedConfig: js.configs.recommended,
baseDirectory: __dirname,
});
module.exports = [
// ...compat.extends('./eslint.vite.js'),
js.configs.recommended,
...compat.extends(
'eslint:recommended',
'plugin:compat/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:sonarjs/recommended-legacy',
'plugin:prettier/recommended',
),
{ plugins: { sonarjs: eslintPluginSonarjs } },
{
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.ts'],
paths: ['src'],
},
},
},
},
{
languageOptions: {
parser: typescriptEslintParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
globals: {
...globals.node,
...globals.browser,
...globals.es6,
...globals.jest,
},
},
},
{
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-empty-function': 'warn',
'@typescript-eslint/no-empty-interface': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-unused-vars': ['error', { ignoreRestSiblings: true }],
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-useless-escape': 'off',
'array-callback-return': 'warn',
'import/named': 'off',
'import/namespace': 'off',
'import/no-duplicates': 'error',
'import/no-named-as-default-member': 'off',
'import/no-named-as-default': 'off',
'import/no-unresolved': 'off',
'no-console': 'off',
'no-debugger': 'error',
'no-duplicate-imports': 0,
'no-nested-ternary': 'warn',
'no-unneeded-ternary': 'warn',
'no-unused-expressions': 'off',
'no-unused-vars': 'off',
'sonarjs/cognitive-complexity': ['off', 100],
'sonarjs/no-all-duplicated-branches': 'warn',
'sonarjs/no-collapsible-if': 'warn',
'sonarjs/no-collection-size-mischeck': 'warn',
'sonarjs/no-duplicate-string': 'warn',
'sonarjs/no-duplicated-branches': 'warn',
'sonarjs/no-empty-collection': 'warn',
'sonarjs/no-extra-arguments': 'warn',
'sonarjs/no-gratuitous-expressions': 'warn',
'sonarjs/no-identical-expressions': 'warn',
'sonarjs/no-identical-functions': 'warn',
'sonarjs/no-ignored-return': 'off',
'sonarjs/no-misleading-array-reverse': 'off',
'sonarjs/no-nested-template-literals': 'warn',
'sonarjs/no-redundant-boolean': 'warn',
'sonarjs/no-redundant-jump': 'warn',
'sonarjs/no-small-switch': 'warn',
'sonarjs/no-unused-collection': 'warn',
'sonarjs/prefer-object-literal': 'warn',
'sonarjs/prefer-single-boolean-return': 'warn',
'sonarjs/todo-tag': 'off',
complexity: ['off', 25],
eqeqeq: ['warn', 'smart'],
},
},
{ ignores: ['node_modules/', 'dist/', 'coverage/', '**/scratch/', 'server/', '**/*.test.ts'] },
];