eslint-config-seek 0.0.0-typescript-config-20221028024455 → 0.0.0-unpin-again-20250318235934
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -11
- package/base.js +235 -0
- package/extensions.js +2 -0
- package/index.js +62 -0
- package/package.json +26 -26
- package/.eslintrc.js +0 -216
package/README.md
CHANGED
|
@@ -5,27 +5,31 @@
|
|
|
5
5
|
|
|
6
6
|
This package includes the shareable ESLint configuration used by [SEEK](https://github.com/seek-oss/).
|
|
7
7
|
|
|
8
|
-
## Usage in sku Projects
|
|
8
|
+
## Usage in sku and skuba Projects
|
|
9
9
|
|
|
10
|
-
The easiest way to use this configuration is with [sku](https://github.com/seek-oss/sku)
|
|
10
|
+
The easiest way to use this configuration is with [sku](https://github.com/seek-oss/sku) or [skuba](https://github.com/seek-oss/skuba).
|
|
11
11
|
|
|
12
|
-
**You don’t need to install it separately in sku projects.**
|
|
12
|
+
**You don’t need to install it separately in sku and skuba projects.**
|
|
13
13
|
|
|
14
|
-
## Usage Outside of sku
|
|
14
|
+
## Usage Outside of sku and skuba
|
|
15
15
|
|
|
16
|
-
If you want to use this ESLint configuration in a project not built with sku, you can install it with following steps.
|
|
16
|
+
If you want to use this ESLint configuration in a project not built with sku or skuba, you can install it with following steps.
|
|
17
17
|
|
|
18
|
-
First, install this package,
|
|
18
|
+
First, install this package, and the necessary peer dependencies listed in this project's [package.json](package.json).
|
|
19
19
|
|
|
20
|
-
Then create a file named
|
|
20
|
+
Then create a file named `eslint.config.js` with the following contents in the root folder of your project:
|
|
21
21
|
|
|
22
22
|
```js
|
|
23
|
-
|
|
24
|
-
"extends": "seek"
|
|
25
|
-
}
|
|
23
|
+
module.exports = require('eslint-config-seek');
|
|
26
24
|
```
|
|
27
25
|
|
|
28
|
-
|
|
26
|
+
The default configuration includes support for React projects. For projects that are not based on React, the "base" configuration should be used instead:
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
module.exports = require('eslint-config-seek/base');
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
You can override the settings from `eslint-config-seek` by editing the `eslint.config.js` file. Learn more about [configuring ESLint](https://eslint.org/docs/latest/use/configure/) on the ESLint website.
|
|
29
33
|
|
|
30
34
|
## License
|
|
31
35
|
|
package/base.js
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
const importX = require('eslint-plugin-import-x');
|
|
2
|
+
const globals = require('globals');
|
|
3
|
+
const jestPlugin = require('eslint-plugin-jest');
|
|
4
|
+
const cypress = require('eslint-plugin-cypress/flat');
|
|
5
|
+
const eslintConfigPrettier = require('eslint-config-prettier');
|
|
6
|
+
const tseslint = require('typescript-eslint');
|
|
7
|
+
|
|
8
|
+
const OFF = 0;
|
|
9
|
+
const ERROR = 2;
|
|
10
|
+
|
|
11
|
+
const baseRules = {
|
|
12
|
+
// Possible Errors
|
|
13
|
+
'no-console': ERROR,
|
|
14
|
+
'no-unexpected-multiline': ERROR,
|
|
15
|
+
'block-scoped-var': ERROR,
|
|
16
|
+
curly: [ERROR, 'all'],
|
|
17
|
+
'default-case': ERROR,
|
|
18
|
+
'dot-notation': ERROR,
|
|
19
|
+
eqeqeq: [ERROR, 'always', { null: 'ignore' }],
|
|
20
|
+
'guard-for-in': ERROR,
|
|
21
|
+
'no-alert': ERROR,
|
|
22
|
+
'no-caller': ERROR,
|
|
23
|
+
'no-div-regex': ERROR,
|
|
24
|
+
'no-else-return': ERROR,
|
|
25
|
+
'no-eval': ERROR,
|
|
26
|
+
'no-extend-native': ERROR,
|
|
27
|
+
'no-extra-bind': ERROR,
|
|
28
|
+
'no-fallthrough': ERROR,
|
|
29
|
+
'no-floating-decimal': ERROR,
|
|
30
|
+
'no-implicit-coercion': ERROR,
|
|
31
|
+
'no-implied-eval': ERROR,
|
|
32
|
+
'no-iterator': ERROR,
|
|
33
|
+
'no-labels': ERROR,
|
|
34
|
+
'no-lone-blocks': ERROR,
|
|
35
|
+
'no-loop-func': ERROR,
|
|
36
|
+
'no-multi-str': ERROR,
|
|
37
|
+
'no-new-func': ERROR,
|
|
38
|
+
'no-new-wrappers': ERROR,
|
|
39
|
+
'no-new': ERROR,
|
|
40
|
+
'no-octal-escape': ERROR,
|
|
41
|
+
'no-param-reassign': ERROR,
|
|
42
|
+
'no-proto': ERROR,
|
|
43
|
+
'no-return-assign': ERROR,
|
|
44
|
+
'no-script-url': ERROR,
|
|
45
|
+
'no-self-compare': ERROR,
|
|
46
|
+
'no-sequences': ERROR,
|
|
47
|
+
'no-throw-literal': ERROR,
|
|
48
|
+
'no-useless-call': ERROR,
|
|
49
|
+
'no-void': ERROR,
|
|
50
|
+
radix: ERROR,
|
|
51
|
+
'vars-on-top': ERROR,
|
|
52
|
+
yoda: ERROR,
|
|
53
|
+
strict: [ERROR, 'never'],
|
|
54
|
+
'no-label-var': ERROR,
|
|
55
|
+
'no-shadow': ERROR,
|
|
56
|
+
'no-undef-init': ERROR,
|
|
57
|
+
'no-unused-vars': [
|
|
58
|
+
ERROR,
|
|
59
|
+
{ argsIgnorePattern: '^_', ignoreRestSiblings: true },
|
|
60
|
+
],
|
|
61
|
+
'handle-callback-err': ERROR,
|
|
62
|
+
'no-new-require': ERROR,
|
|
63
|
+
'no-path-concat': ERROR,
|
|
64
|
+
'no-process-exit': ERROR,
|
|
65
|
+
'no-restricted-modules': ERROR,
|
|
66
|
+
'no-sync': ERROR,
|
|
67
|
+
'linebreak-style': [ERROR, 'unix'],
|
|
68
|
+
'new-cap': ERROR,
|
|
69
|
+
'no-lonely-if': ERROR,
|
|
70
|
+
'no-nested-ternary': ERROR,
|
|
71
|
+
'no-unneeded-ternary': ERROR,
|
|
72
|
+
'spaced-comment': [ERROR, 'always'],
|
|
73
|
+
'no-var': ERROR,
|
|
74
|
+
'object-shorthand': ERROR,
|
|
75
|
+
'prefer-const': ERROR,
|
|
76
|
+
'prefer-spread': ERROR,
|
|
77
|
+
'prefer-template': ERROR,
|
|
78
|
+
// Allow devs to choose between performance and richer stack traces
|
|
79
|
+
// https://eslint.org/docs/rules/no-return-await#when-not-to-use-it
|
|
80
|
+
// https://github.com/goldbergyoni/nodebestpractices/blob/master@%7B2022-01-01T00:00:00Z%7D/sections/errorhandling/returningpromises.md
|
|
81
|
+
'no-return-await': OFF,
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const { js: jsExtensions, ts: tsExtensions } = require('./extensions');
|
|
85
|
+
const allExtensions = [...jsExtensions, ...tsExtensions];
|
|
86
|
+
|
|
87
|
+
const settings = {
|
|
88
|
+
'import-x/resolver': {
|
|
89
|
+
typescript: true,
|
|
90
|
+
node: true,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
module.exports = [
|
|
95
|
+
{
|
|
96
|
+
plugins: {
|
|
97
|
+
jest: jestPlugin,
|
|
98
|
+
cypress,
|
|
99
|
+
'@typescript-eslint': tseslint.plugin,
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
importX.flatConfigs.typescript,
|
|
103
|
+
{
|
|
104
|
+
rules: importX.flatConfigs.errors.rules,
|
|
105
|
+
files: [`**/*.{${jsExtensions}}`],
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
rules: importX.flatConfigs.warnings.rules,
|
|
109
|
+
files: [`**/*.{${jsExtensions}}`],
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
languageOptions: {
|
|
113
|
+
globals: {
|
|
114
|
+
...globals.node,
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
parserOptions: {
|
|
118
|
+
requireConfigFile: false,
|
|
119
|
+
ecmaVersion: 'latest',
|
|
120
|
+
sourceType: 'module',
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
settings,
|
|
124
|
+
rules: baseRules,
|
|
125
|
+
},
|
|
126
|
+
eslintConfigPrettier,
|
|
127
|
+
...[...tseslint.configs.recommended, ...tseslint.configs.stylistic].map(
|
|
128
|
+
({ plugins, ...config }) => ({
|
|
129
|
+
...config,
|
|
130
|
+
files: [`**/*.{${tsExtensions}}`],
|
|
131
|
+
}),
|
|
132
|
+
),
|
|
133
|
+
{
|
|
134
|
+
files: [`**/*.{${tsExtensions}}`],
|
|
135
|
+
|
|
136
|
+
languageOptions: {
|
|
137
|
+
parser: tseslint.parser,
|
|
138
|
+
|
|
139
|
+
parserOptions: {
|
|
140
|
+
projectService: true,
|
|
141
|
+
warnOnUnsupportedTypeScriptVersion: false,
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
settings,
|
|
145
|
+
rules: {
|
|
146
|
+
'@typescript-eslint/array-type': [ERROR, { default: 'array-simple' }],
|
|
147
|
+
'@typescript-eslint/consistent-type-definitions': OFF,
|
|
148
|
+
'@typescript-eslint/no-unused-expressions': ERROR,
|
|
149
|
+
'@typescript-eslint/no-unused-vars': [
|
|
150
|
+
ERROR,
|
|
151
|
+
{ argsIgnorePattern: '^_', ignoreRestSiblings: true },
|
|
152
|
+
],
|
|
153
|
+
'@typescript-eslint/no-use-before-define': OFF,
|
|
154
|
+
'@typescript-eslint/no-non-null-assertion': OFF,
|
|
155
|
+
'@typescript-eslint/ban-ts-comment': OFF,
|
|
156
|
+
'@typescript-eslint/no-explicit-any': OFF,
|
|
157
|
+
'@typescript-eslint/explicit-function-return-type': OFF,
|
|
158
|
+
'@typescript-eslint/no-empty-function': OFF,
|
|
159
|
+
'@typescript-eslint/no-empty-interface': OFF,
|
|
160
|
+
'@typescript-eslint/no-inferrable-types': [
|
|
161
|
+
ERROR,
|
|
162
|
+
{ ignoreParameters: true },
|
|
163
|
+
],
|
|
164
|
+
// prefer TypeScript exhaustiveness checking
|
|
165
|
+
// https://www.typescriptlang.org/docs/handbook/advanced-types.html#exhaustiveness-checking
|
|
166
|
+
'default-case': OFF,
|
|
167
|
+
'arrow-body-style': [ERROR, 'as-needed'],
|
|
168
|
+
// Use `typescript-eslint`'s no-shadow to avoid false positives with enums
|
|
169
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
|
|
170
|
+
'no-shadow': OFF,
|
|
171
|
+
'@typescript-eslint/no-shadow': ERROR,
|
|
172
|
+
|
|
173
|
+
// These two rules deal with autofixing type imports/exports
|
|
174
|
+
// https://typescript-eslint.io/rules/consistent-type-imports
|
|
175
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
176
|
+
ERROR,
|
|
177
|
+
{ fixStyle: 'inline-type-imports' },
|
|
178
|
+
],
|
|
179
|
+
// https://typescript-eslint.io/rules/consistent-type-exports
|
|
180
|
+
'@typescript-eslint/consistent-type-exports': [
|
|
181
|
+
ERROR,
|
|
182
|
+
{ fixMixedExportsWithInlineTypeSpecifier: true },
|
|
183
|
+
],
|
|
184
|
+
// https://typescript-eslint.io/rules/no-import-type-side-effects
|
|
185
|
+
'@typescript-eslint/no-import-type-side-effects': ERROR,
|
|
186
|
+
|
|
187
|
+
// This rule deals with merging multiple imports from the same module.
|
|
188
|
+
// In this case, we want type imports to be inlined when merging with the other imports.
|
|
189
|
+
// However, there is a pending PR which improves the behaviour of this rule https://github.com/import-js/eslint-plugin-import/pull/2716
|
|
190
|
+
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-duplicates.md#inline-type-imports
|
|
191
|
+
'import-x/no-duplicates': [ERROR, { 'prefer-inline': true }],
|
|
192
|
+
'import-x/export': ERROR,
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
files: [`**/*.{${jsExtensions}}`],
|
|
197
|
+
languageOptions: {
|
|
198
|
+
globals: {},
|
|
199
|
+
},
|
|
200
|
+
settings,
|
|
201
|
+
rules: {
|
|
202
|
+
'no-undef': ERROR,
|
|
203
|
+
'no-use-before-define': [ERROR, { functions: false }],
|
|
204
|
+
'no-unused-expressions': ERROR,
|
|
205
|
+
'import-x/no-unresolved': [
|
|
206
|
+
ERROR,
|
|
207
|
+
{ commonjs: true, amd: true, ignore: ['.svg$', '^file?'] },
|
|
208
|
+
],
|
|
209
|
+
'import-x/no-duplicates': ERROR,
|
|
210
|
+
'import-x/export': ERROR,
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
...jestPlugin.configs['flat/recommended'],
|
|
215
|
+
files: [
|
|
216
|
+
`**/__tests__/**/*.{${allExtensions}}`,
|
|
217
|
+
`**/*.@(spec|test).{${allExtensions}}`,
|
|
218
|
+
],
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
files: [
|
|
222
|
+
`**/__tests__/**/*.{${allExtensions}}`,
|
|
223
|
+
`**/*.@(spec|test).{${allExtensions}}`,
|
|
224
|
+
],
|
|
225
|
+
languageOptions: {
|
|
226
|
+
globals: {
|
|
227
|
+
...globals.jest,
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
...cypress.configs.recommended,
|
|
233
|
+
files: [`**/cypress/**/*.{${allExtensions}}`],
|
|
234
|
+
},
|
|
235
|
+
];
|
package/extensions.js
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const react = require('eslint-plugin-react');
|
|
2
|
+
const reactHooks = require('eslint-plugin-react-hooks');
|
|
3
|
+
const base = require('./base');
|
|
4
|
+
|
|
5
|
+
const globals = require('globals');
|
|
6
|
+
|
|
7
|
+
const OFF = 0;
|
|
8
|
+
const ERROR = 2;
|
|
9
|
+
|
|
10
|
+
const reactRules = {
|
|
11
|
+
'react/prefer-es6-class': [ERROR, 'always'],
|
|
12
|
+
'react/self-closing-comp': ERROR,
|
|
13
|
+
'react/jsx-pascal-case': ERROR,
|
|
14
|
+
'react-hooks/rules-of-hooks': ERROR,
|
|
15
|
+
'react-hooks/exhaustive-deps': ERROR,
|
|
16
|
+
'react/no-children-prop': ERROR,
|
|
17
|
+
'react/display-name': OFF,
|
|
18
|
+
'react/prop-types': OFF,
|
|
19
|
+
'react/jsx-curly-brace-presence': [
|
|
20
|
+
ERROR,
|
|
21
|
+
{ props: 'never', children: 'ignore', propElementValues: 'always' },
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
module.exports = [
|
|
26
|
+
react.configs.flat.recommended,
|
|
27
|
+
react.configs.flat['jsx-runtime'],
|
|
28
|
+
...base,
|
|
29
|
+
{
|
|
30
|
+
plugins: {
|
|
31
|
+
react,
|
|
32
|
+
'react-hooks': reactHooks,
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
languageOptions: {
|
|
36
|
+
globals: globals.browser,
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
settings: {
|
|
40
|
+
react: {
|
|
41
|
+
version: 'detect',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
rules: reactRules,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
files: ['**/*.tsx'],
|
|
49
|
+
|
|
50
|
+
rules: {
|
|
51
|
+
// temporary override until everybody removes the React import
|
|
52
|
+
'@typescript-eslint/no-unused-vars': [
|
|
53
|
+
ERROR,
|
|
54
|
+
{
|
|
55
|
+
argsIgnorePattern: '^_',
|
|
56
|
+
ignoreRestSiblings: true,
|
|
57
|
+
varsIgnorePattern: '^React$',
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
];
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-seek",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-unpin-again-20250318235934",
|
|
4
4
|
"description": "ESLint configuration used by SEEK",
|
|
5
|
-
"main": ".
|
|
5
|
+
"main": "index.js",
|
|
6
6
|
"files": [
|
|
7
|
-
".
|
|
7
|
+
"index.js",
|
|
8
|
+
"base.js",
|
|
9
|
+
"extensions.js"
|
|
8
10
|
],
|
|
9
11
|
"repository": {
|
|
10
12
|
"type": "git",
|
|
@@ -17,38 +19,36 @@
|
|
|
17
19
|
},
|
|
18
20
|
"homepage": "https://github.com/seek-oss/eslint-config-seek#readme",
|
|
19
21
|
"dependencies": {
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"eslint-
|
|
26
|
-
"eslint-
|
|
27
|
-
"eslint-plugin-
|
|
28
|
-
"
|
|
29
|
-
"eslint-plugin-jest": "^27.1.3",
|
|
30
|
-
"eslint-plugin-react": "^7.31.10",
|
|
31
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
32
|
-
"find-root": "^1.1.0"
|
|
22
|
+
"typescript-eslint": "^8.6.0",
|
|
23
|
+
"eslint-config-prettier": "^10.0.0",
|
|
24
|
+
"eslint-import-resolver-typescript": "^3.6.3",
|
|
25
|
+
"eslint-plugin-cypress": "^4.0.0",
|
|
26
|
+
"eslint-plugin-import-x": "^4.9.0",
|
|
27
|
+
"eslint-plugin-jest": "^28.8.0",
|
|
28
|
+
"eslint-plugin-react": "^7.35.0",
|
|
29
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
30
|
+
"globals": "^16.0.0"
|
|
33
31
|
},
|
|
34
32
|
"devDependencies": {
|
|
35
|
-
"@changesets/cli": "2.
|
|
36
|
-
"@changesets/get-github-info": "0.
|
|
37
|
-
"eslint": "8.
|
|
38
|
-
"prettier": "
|
|
39
|
-
"typescript": "
|
|
33
|
+
"@changesets/cli": "^2.27.7",
|
|
34
|
+
"@changesets/get-github-info": "^0.6.0",
|
|
35
|
+
"eslint": "^9.8.0",
|
|
36
|
+
"prettier": "^3.3.3",
|
|
37
|
+
"typescript": "~5.7.0"
|
|
40
38
|
},
|
|
41
39
|
"peerDependencies": {
|
|
42
|
-
"eslint": ">=
|
|
43
|
-
"typescript": ">=
|
|
40
|
+
"eslint": ">=9.9.1",
|
|
41
|
+
"typescript": ">=5.5.4"
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=18.18.0"
|
|
44
45
|
},
|
|
45
|
-
"packageManager": "pnpm@7.14.0",
|
|
46
46
|
"volta": {
|
|
47
|
-
"node": "
|
|
47
|
+
"node": "22.14.0"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"release": "changeset publish",
|
|
51
|
-
"test": "eslint .",
|
|
51
|
+
"test": "eslint --config index.js . && eslint --config base.js .",
|
|
52
52
|
"changeset-version": "changeset version && prettier --write ."
|
|
53
53
|
}
|
|
54
54
|
}
|
package/.eslintrc.js
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const root = require('find-root')(process.cwd());
|
|
3
|
-
|
|
4
|
-
const OFF = 0;
|
|
5
|
-
const ERROR = 2;
|
|
6
|
-
|
|
7
|
-
const baseRules = {
|
|
8
|
-
// Possible Errors
|
|
9
|
-
'no-console': ERROR,
|
|
10
|
-
'no-unexpected-multiline': ERROR,
|
|
11
|
-
'block-scoped-var': ERROR,
|
|
12
|
-
curly: [ERROR, 'all'],
|
|
13
|
-
'default-case': ERROR,
|
|
14
|
-
'dot-notation': ERROR,
|
|
15
|
-
eqeqeq: [ERROR, 'always', { null: 'ignore' }],
|
|
16
|
-
'guard-for-in': ERROR,
|
|
17
|
-
'no-alert': ERROR,
|
|
18
|
-
'no-caller': ERROR,
|
|
19
|
-
'no-div-regex': ERROR,
|
|
20
|
-
'no-else-return': ERROR,
|
|
21
|
-
'no-eval': ERROR,
|
|
22
|
-
'no-extend-native': ERROR,
|
|
23
|
-
'no-extra-bind': ERROR,
|
|
24
|
-
'no-floating-decimal': ERROR,
|
|
25
|
-
'no-implicit-coercion': ERROR,
|
|
26
|
-
'no-implied-eval': ERROR,
|
|
27
|
-
'no-iterator': ERROR,
|
|
28
|
-
'no-labels': ERROR,
|
|
29
|
-
'no-lone-blocks': ERROR,
|
|
30
|
-
'no-loop-func': ERROR,
|
|
31
|
-
'no-multi-str': ERROR,
|
|
32
|
-
'no-new-func': ERROR,
|
|
33
|
-
'no-new-wrappers': ERROR,
|
|
34
|
-
'no-new': ERROR,
|
|
35
|
-
'no-octal-escape': ERROR,
|
|
36
|
-
'no-param-reassign': ERROR,
|
|
37
|
-
'no-proto': ERROR,
|
|
38
|
-
'no-return-assign': ERROR,
|
|
39
|
-
'no-script-url': ERROR,
|
|
40
|
-
'no-self-compare': ERROR,
|
|
41
|
-
'no-sequences': ERROR,
|
|
42
|
-
'no-throw-literal': ERROR,
|
|
43
|
-
'no-useless-call': ERROR,
|
|
44
|
-
'no-void': ERROR,
|
|
45
|
-
radix: ERROR,
|
|
46
|
-
'vars-on-top': ERROR,
|
|
47
|
-
yoda: ERROR,
|
|
48
|
-
strict: [ERROR, 'never'],
|
|
49
|
-
'no-label-var': ERROR,
|
|
50
|
-
'no-shadow': ERROR,
|
|
51
|
-
'no-undef-init': ERROR,
|
|
52
|
-
'no-unused-vars': [
|
|
53
|
-
ERROR,
|
|
54
|
-
{ argsIgnorePattern: '^_', ignoreRestSiblings: true },
|
|
55
|
-
],
|
|
56
|
-
'handle-callback-err': ERROR,
|
|
57
|
-
'no-new-require': ERROR,
|
|
58
|
-
'no-path-concat': ERROR,
|
|
59
|
-
'no-process-exit': ERROR,
|
|
60
|
-
'no-restricted-modules': ERROR,
|
|
61
|
-
'no-sync': ERROR,
|
|
62
|
-
'linebreak-style': [ERROR, 'unix'],
|
|
63
|
-
'new-cap': ERROR,
|
|
64
|
-
'no-lonely-if': ERROR,
|
|
65
|
-
'no-nested-ternary': ERROR,
|
|
66
|
-
'no-unneeded-ternary': ERROR,
|
|
67
|
-
'spaced-comment': [ERROR, 'always'],
|
|
68
|
-
'no-var': ERROR,
|
|
69
|
-
'object-shorthand': ERROR,
|
|
70
|
-
'prefer-const': ERROR,
|
|
71
|
-
'prefer-spread': ERROR,
|
|
72
|
-
'prefer-template': ERROR,
|
|
73
|
-
// Allow devs to choose between performance and richer stack traces
|
|
74
|
-
// https://eslint.org/docs/rules/no-return-await#when-not-to-use-it
|
|
75
|
-
// https://github.com/goldbergyoni/nodebestpractices/blob/master@%7B2022-01-01T00:00:00Z%7D/sections/errorhandling/returningpromises.md
|
|
76
|
-
'no-return-await': OFF,
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const reactRules = {
|
|
80
|
-
'react/prefer-es6-class': [ERROR, 'always'],
|
|
81
|
-
'react/self-closing-comp': ERROR,
|
|
82
|
-
'react/jsx-pascal-case': ERROR,
|
|
83
|
-
'react-hooks/rules-of-hooks': ERROR,
|
|
84
|
-
'react-hooks/exhaustive-deps': ERROR,
|
|
85
|
-
'react/no-children-prop': ERROR,
|
|
86
|
-
'react/display-name': OFF,
|
|
87
|
-
'react/prop-types': OFF,
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
/** @type {import('eslint').Linter.Config} */
|
|
91
|
-
const baseConfig = {
|
|
92
|
-
parser: '@babel/eslint-parser',
|
|
93
|
-
parserOptions: {
|
|
94
|
-
babelOptions: {
|
|
95
|
-
presets: ['@babel/preset-react'],
|
|
96
|
-
},
|
|
97
|
-
requireConfigFile: false,
|
|
98
|
-
sourceType: 'module',
|
|
99
|
-
},
|
|
100
|
-
root: true,
|
|
101
|
-
env: {
|
|
102
|
-
browser: true,
|
|
103
|
-
node: true,
|
|
104
|
-
},
|
|
105
|
-
settings: {
|
|
106
|
-
react: {
|
|
107
|
-
version: 'detect',
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
plugins: ['react', 'react-hooks', 'import'],
|
|
111
|
-
extends: [
|
|
112
|
-
'plugin:react/recommended',
|
|
113
|
-
// this config enables eslint-plugin-import to resolve JavaScript and TypeScript files
|
|
114
|
-
// https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/config/typescript.js
|
|
115
|
-
// Some rules provided by eslint-plugin-import e.g. `import/no-duplicates` don't work without it
|
|
116
|
-
'plugin:import/typescript',
|
|
117
|
-
'prettier',
|
|
118
|
-
],
|
|
119
|
-
rules: {
|
|
120
|
-
...baseRules,
|
|
121
|
-
...reactRules,
|
|
122
|
-
},
|
|
123
|
-
overrides: [
|
|
124
|
-
{
|
|
125
|
-
// TypeScript config
|
|
126
|
-
files: ['**/*.ts', '**/*.tsx'],
|
|
127
|
-
parser: '@typescript-eslint/parser',
|
|
128
|
-
parserOptions: {
|
|
129
|
-
ecmaVersion: 2018,
|
|
130
|
-
sourceType: 'module',
|
|
131
|
-
},
|
|
132
|
-
extends: [
|
|
133
|
-
'plugin:@typescript-eslint/eslint-recommended',
|
|
134
|
-
'plugin:@typescript-eslint/recommended',
|
|
135
|
-
'prettier',
|
|
136
|
-
],
|
|
137
|
-
settings: {
|
|
138
|
-
// adds comprehensive TypeScript support to eslint-plugin-import
|
|
139
|
-
// https://github.com/import-js/eslint-import-resolver-typescript
|
|
140
|
-
'import/resolver': {
|
|
141
|
-
typescript: {},
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
rules: {
|
|
145
|
-
'@typescript-eslint/no-unused-expressions': ERROR,
|
|
146
|
-
'@typescript-eslint/no-unused-vars': [
|
|
147
|
-
ERROR,
|
|
148
|
-
{ argsIgnorePattern: '^_', ignoreRestSiblings: true },
|
|
149
|
-
],
|
|
150
|
-
'@typescript-eslint/no-use-before-define': OFF,
|
|
151
|
-
'@typescript-eslint/no-non-null-assertion': OFF,
|
|
152
|
-
'@typescript-eslint/ban-ts-comment': OFF,
|
|
153
|
-
'@typescript-eslint/no-explicit-any': OFF,
|
|
154
|
-
'@typescript-eslint/explicit-function-return-type': OFF,
|
|
155
|
-
'@typescript-eslint/no-empty-function': OFF,
|
|
156
|
-
'@typescript-eslint/no-empty-interface': OFF,
|
|
157
|
-
'@typescript-eslint/no-inferrable-types': [
|
|
158
|
-
ERROR,
|
|
159
|
-
{ ignoreParameters: true },
|
|
160
|
-
],
|
|
161
|
-
// prefer TypeScript exhaustiveness checking
|
|
162
|
-
// https://www.typescriptlang.org/docs/handbook/advanced-types.html#exhaustiveness-checking
|
|
163
|
-
'default-case': OFF,
|
|
164
|
-
'arrow-body-style': [ERROR, 'as-needed'],
|
|
165
|
-
// Use `typescript-eslint`'s no-shadow to avoid false positives with enums
|
|
166
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
|
|
167
|
-
'no-shadow': OFF,
|
|
168
|
-
'@typescript-eslint/no-shadow': ERROR,
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
// JavaScript config
|
|
173
|
-
files: ['**/*.js', '**/*.jsx'],
|
|
174
|
-
env: {
|
|
175
|
-
es6: true,
|
|
176
|
-
},
|
|
177
|
-
extends: ['plugin:import/errors', 'plugin:import/warnings'],
|
|
178
|
-
settings: {
|
|
179
|
-
'import/resolver': {
|
|
180
|
-
node: {
|
|
181
|
-
moduleDirectory: [root, path.join(root, 'node_modules')],
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
rules: {
|
|
186
|
-
'no-use-before-define': [ERROR, { functions: false }],
|
|
187
|
-
'no-unused-expressions': ERROR,
|
|
188
|
-
'import/no-unresolved': [
|
|
189
|
-
ERROR,
|
|
190
|
-
{ commonjs: true, amd: true, ignore: ['.svg$', '^file?'] },
|
|
191
|
-
],
|
|
192
|
-
'import/no-duplicates': ERROR,
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
// Jest config
|
|
197
|
-
files: ['**/__tests__/**/*.{js,ts,tsx}', '**/*.@(spec|test).{js,ts,tsx}'],
|
|
198
|
-
env: {
|
|
199
|
-
jest: true,
|
|
200
|
-
},
|
|
201
|
-
extends: ['plugin:jest/recommended'],
|
|
202
|
-
plugins: ['jest'],
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
// Cypress config
|
|
206
|
-
files: ['cypress/**/*.{js,ts,tsx}'],
|
|
207
|
-
env: {
|
|
208
|
-
'cypress/globals': true,
|
|
209
|
-
},
|
|
210
|
-
extends: ['plugin:cypress/recommended'],
|
|
211
|
-
plugins: ['cypress'],
|
|
212
|
-
},
|
|
213
|
-
],
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
module.exports = baseConfig;
|