-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patheslint.config.mjs
More file actions
170 lines (152 loc) · 4.65 KB
/
eslint.config.mjs
File metadata and controls
170 lines (152 loc) · 4.65 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
import { globalIgnores } from 'eslint/config';
import { fileURLToPath } from 'node:url';
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import sonarjs from 'eslint-plugin-sonarjs';
import importPlugin from 'eslint-plugin-import';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
// eslint.config.js
import { defineConfig } from 'eslint/config';
const __filename = fileURLToPath(import.meta.url);
export default defineConfig([
eslint.configs.recommended,
...tseslint.configs.recommended,
globalIgnores([
'**/node_modules',
'packages/*/lib',
'!**/.storybook',
'.storybook/public',
'**/demo.stories.jsx',
'**/mock.stories.js',
'**/demo.stories.tsx',
'**/demo.test.tsx',
'**/*.test.tsx',
'**/mock.stories.ts',
'**/*.mdx',
'**/webpack.config.js',
'src/helpers/config_access.js',
'**/*.html',
'**/*.css',
'**/*.json',
'**/*.md',
'**/*.svg',
'**/*.zip',
'**/*.d.ts',
'*.storybook/*',
'**/*.cjs',
'**/*.mjs',
'**/paths.js',
'dist/*',
'lib/*',
'**/ext-libs.js'
]),
{
languageOptions: {
globals: {
PCore: 'readonly',
window: true,
console: true,
document: true,
fetch: true
},
ecmaVersion: 13,
sourceType: 'script',
parserOptions: {
project: 'tsconfig.json',
ecmaFeatures: {
jsx: true
}
}
},
settings: {
'import/resolver': {
typescript: {},
react: {
version: 'detect'
},
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx']
}
},
react: {
version: 'detect'
}
},
plugins: { sonarjs, import: importPlugin, react, 'react-hooks': reactHooks },
rules: {
'react/jsx-filename-extension': [0, { extensions: ['.jsx', '*.tsx'] }],
// Prettier recommends running separately from a linter.
// https://prettier.io/docs/en/integrating-with-linters.html#notes
'prettier/prettier': 'off',
// Disable rules from shared configs we're not ready for yet.
'sonarjs/cognitive-complexity': ['error', 20],
'sonarjs/no-duplicate-string': 'off',
//
// Initial release: turning these off; phase in to "warn" or "error" over time
// For "quotes" and "@typescript-eslint/quotes", see override below for .ts/.tsx files
'import/extensions': ['off', 'never'],
'import/named': 'off',
'import/no-cycle': 'off',
'import/no-duplicates': 'off',
'import/no-extraneous-dependencies': 'off',
'import/no-named-as-default': 'off',
'import/no-named-as-default-member': 'off',
'import/no-self-import': 'off',
'import/no-unresolved': 'off',
'import/no-useless-path-segments': 'off',
'import/order': 'off',
'no-underscore-dangle': 'off', // TODO : adhere to standard naming
'no-restricted-syntax': 'warn', // TODO : fix for-in loops
'jsx-a11y/alt-text': 'off',
'jsx-a11y/anchor-is-valid': 'off',
'jsx-a11y/click-events-have-key-events': 'off',
'jsx-a11y/label-has-associated-control': 'off',
'jsx-a11y/no-static-element-interactions': 'off',
'@typescript-eslint/naming-convention': 'off', // prefer warn but needs different parserOptions
'@typescript-eslint/ban-types': 'off', // also, see override below
'@typescript-eslint/no-explicit-any': 'off', // prefer warn but needs different parserOptions
'@typescript-eslint/no-empty-object-type': 'off', // prefer warn but needs different parserOptions
'@typescript-eslint/ban-ts-comment': 'off', // prefer warn but needs different parserOptions
'@typescript-eslint/no-unsafe-function-type': 'off',
'import/no-relative-packages': 'off' // arnab
}
},
{
files: ['**/*.@(ts|tsx)'],
rules: {
'@typescript-eslint/method-signature-style': ['error', 'property'],
quotes: 'off',
'@typescript-eslint/quotes': 'off'
}
},
{
files: ['**/*.@(jsx|tsx|mdx)'],
rules: {
'react/react-in-jsx-scope': 'off',
'react-hooks/rules-of-hooks': 'off',
'react-hooks/exhaustive-deps': 'off'
}
},
{
files: ['**/*.@(ts|tsx)'],
rules: {
'no-console': 'off',
'import/prefer-default-export': 'off',
'import/no-relative-packages': 'off',
'react/jsx-fragments': 'off',
'react/react-in-jsx-scope': 'off',
'react-hooks/exhaustive-deps': 'off'
}
},
{
files: ['**/*.@(js|jsx|ts|tsx|mdx)'],
rules: {}
},
{
files: ['*/**/mocks/**.@(mocks|styles).@(tsx|ts)'],
rules: {
'import/prefer-default-export': ['off']
}
}
]);