@commercetools-frontend/eslint-config-mc-app 21.2.1 → 21.3.4
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/CHANGELOG.md +30 -0
- package/helpers/rules-presets.js +293 -0
- package/index.js +90 -30
- package/package.json +15 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @commercetools-frontend/eslint-config-mc-app
|
|
2
2
|
|
|
3
|
+
## 21.3.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2546](https://github.com/commercetools/merchant-center-application-kit/pull/2546) [`dc76e5a9`](https://github.com/commercetools/merchant-center-application-kit/commit/dc76e5a9a7f875dadf2ed5a11c48a1ddff7b431c) Thanks [@renovate](https://github.com/apps/renovate)! - Upgrade dependencies
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`dc76e5a9`](https://github.com/commercetools/merchant-center-application-kit/commit/dc76e5a9a7f875dadf2ed5a11c48a1ddff7b431c)]:
|
|
10
|
+
- @commercetools-frontend/babel-preset-mc-app@21.3.4
|
|
11
|
+
|
|
12
|
+
## 21.3.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#2532](https://github.com/commercetools/merchant-center-application-kit/pull/2532) [`4ae0e602`](https://github.com/commercetools/merchant-center-application-kit/commit/4ae0e6020b67ed343b59c7a9280a11eec8054da5) Thanks [@emmenko](https://github.com/emmenko)! - Fix regression of overriding test specific rules.
|
|
17
|
+
|
|
18
|
+
## 21.3.0
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [#2526](https://github.com/commercetools/merchant-center-application-kit/pull/2526) [`e336802f`](https://github.com/commercetools/merchant-center-application-kit/commit/e336802f173f7e919604b3edc922ba096a2b85e5) Thanks [@emmenko](https://github.com/emmenko)! - Merge `eslint-config-react-app` into our `@commercetools-frontend/eslint-config-mc-app`. This should avoid any ESLint error related to merging different configs.
|
|
23
|
+
|
|
24
|
+
* [#2520](https://github.com/commercetools/merchant-center-application-kit/pull/2520) [`6f3a2083`](https://github.com/commercetools/merchant-center-application-kit/commit/6f3a2083efac387e9a2994fbaaeb18914e739aa8) Thanks [@renovate](https://github.com/apps/renovate)! - Upgrade dependencies
|
|
25
|
+
|
|
26
|
+
- [#2521](https://github.com/commercetools/merchant-center-application-kit/pull/2521) [`913459f3`](https://github.com/commercetools/merchant-center-application-kit/commit/913459f3eb2b2faafba06b585e7c02776002888b) Thanks [@emmenko](https://github.com/emmenko)! - Define the `BABEL_ENV` variable in the ESLint config, to ensure VSCode is able to parse the Babel config.
|
|
27
|
+
|
|
28
|
+
* [#2528](https://github.com/commercetools/merchant-center-application-kit/pull/2528) [`9235a721`](https://github.com/commercetools/merchant-center-application-kit/commit/9235a721df2be2ca5753994cd11312d577d0b293) Thanks [@renovate](https://github.com/apps/renovate)! - Update dependencies
|
|
29
|
+
|
|
30
|
+
* Updated dependencies [[`6f3a2083`](https://github.com/commercetools/merchant-center-application-kit/commit/6f3a2083efac387e9a2994fbaaeb18914e739aa8)]:
|
|
31
|
+
- @commercetools-frontend/babel-preset-mc-app@21.3.0
|
|
32
|
+
|
|
3
33
|
## 21.2.1
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains rules copied from other libraries, to make it easier to differentiate with
|
|
3
|
+
* our own rules and to better maintain them.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// The ESLint browser environment defines all browser globals as valid,
|
|
7
|
+
// even though most people don't know some of them exist (e.g. `name` or `status`).
|
|
8
|
+
// This is dangerous as it hides accidentally undefined variables.
|
|
9
|
+
// We deny the globals that we deem potentially confusing.
|
|
10
|
+
// To use them, explicitly reference them, e.g. `window.name` or `window.status`.
|
|
11
|
+
const restrictedGlobals = require('confusing-browser-globals');
|
|
12
|
+
|
|
13
|
+
const { statusCode } = require('./eslint');
|
|
14
|
+
|
|
15
|
+
// NOTE: When adding rules here, you need to make sure they are compatible with
|
|
16
|
+
// `typescript-eslint`, as some rules such as `no-array-constructor` aren't compatible.
|
|
17
|
+
// https://github.com/facebook/create-react-app/blob/main/packages/eslint-config-react-app/index.js
|
|
18
|
+
const craRules = {
|
|
19
|
+
base: {
|
|
20
|
+
// http://eslint.org/docs/rules/
|
|
21
|
+
'array-callback-return': statusCode.warn,
|
|
22
|
+
'default-case': [statusCode.warn, { commentPattern: '^no default$' }],
|
|
23
|
+
'dot-location': [statusCode.warn, 'property'],
|
|
24
|
+
eqeqeq: [statusCode.warn, 'smart'],
|
|
25
|
+
'new-parens': statusCode.warn,
|
|
26
|
+
'no-array-constructor': statusCode.warn,
|
|
27
|
+
'no-caller': statusCode.warn,
|
|
28
|
+
'no-cond-assign': [statusCode.warn, 'except-parens'],
|
|
29
|
+
'no-const-assign': statusCode.warn,
|
|
30
|
+
'no-control-regex': statusCode.warn,
|
|
31
|
+
'no-delete-var': statusCode.warn,
|
|
32
|
+
'no-dupe-args': statusCode.warn,
|
|
33
|
+
'no-dupe-class-members': statusCode.warn,
|
|
34
|
+
'no-dupe-keys': statusCode.warn,
|
|
35
|
+
'no-duplicate-case': statusCode.warn,
|
|
36
|
+
'no-empty-character-class': statusCode.warn,
|
|
37
|
+
'no-empty-pattern': statusCode.warn,
|
|
38
|
+
'no-eval': statusCode.warn,
|
|
39
|
+
'no-ex-assign': statusCode.warn,
|
|
40
|
+
'no-extend-native': statusCode.warn,
|
|
41
|
+
'no-extra-bind': statusCode.warn,
|
|
42
|
+
'no-extra-label': statusCode.warn,
|
|
43
|
+
'no-fallthrough': statusCode.warn,
|
|
44
|
+
'no-func-assign': statusCode.warn,
|
|
45
|
+
'no-implied-eval': statusCode.warn,
|
|
46
|
+
'no-invalid-regexp': statusCode.warn,
|
|
47
|
+
'no-iterator': statusCode.warn,
|
|
48
|
+
'no-label-var': statusCode.warn,
|
|
49
|
+
'no-labels': [statusCode.warn, { allowLoop: true, allowSwitch: false }],
|
|
50
|
+
'no-lone-blocks': statusCode.warn,
|
|
51
|
+
'no-loop-func': statusCode.warn,
|
|
52
|
+
'no-mixed-operators': [
|
|
53
|
+
statusCode.warn,
|
|
54
|
+
{
|
|
55
|
+
groups: [
|
|
56
|
+
['&', '|', '^', '~', '<<', '>>', '>>>'],
|
|
57
|
+
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
|
|
58
|
+
['&&', '||'],
|
|
59
|
+
['in', 'instanceof'],
|
|
60
|
+
],
|
|
61
|
+
allowSamePrecedence: false,
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
'no-multi-str': statusCode.warn,
|
|
65
|
+
'no-global-assign': statusCode.warn,
|
|
66
|
+
'no-unsafe-negation': statusCode.warn,
|
|
67
|
+
'no-new-func': statusCode.warn,
|
|
68
|
+
'no-new-object': statusCode.warn,
|
|
69
|
+
'no-new-symbol': statusCode.warn,
|
|
70
|
+
'no-new-wrappers': statusCode.warn,
|
|
71
|
+
'no-obj-calls': statusCode.warn,
|
|
72
|
+
'no-octal': statusCode.warn,
|
|
73
|
+
'no-octal-escape': statusCode.warn,
|
|
74
|
+
'no-redeclare': statusCode.warn,
|
|
75
|
+
'no-regex-spaces': statusCode.warn,
|
|
76
|
+
'no-restricted-syntax': [statusCode.warn, 'WithStatement'],
|
|
77
|
+
'no-script-url': statusCode.warn,
|
|
78
|
+
'no-self-assign': statusCode.warn,
|
|
79
|
+
'no-self-compare': statusCode.warn,
|
|
80
|
+
'no-sequences': statusCode.warn,
|
|
81
|
+
'no-shadow-restricted-names': statusCode.warn,
|
|
82
|
+
'no-sparse-arrays': statusCode.warn,
|
|
83
|
+
'no-template-curly-in-string': statusCode.warn,
|
|
84
|
+
'no-this-before-super': statusCode.warn,
|
|
85
|
+
'no-throw-literal': statusCode.warn,
|
|
86
|
+
'no-undef': statusCode.error,
|
|
87
|
+
'no-restricted-globals': [statusCode.error].concat(restrictedGlobals),
|
|
88
|
+
'no-unreachable': statusCode.warn,
|
|
89
|
+
'no-unused-expressions': [
|
|
90
|
+
statusCode.error,
|
|
91
|
+
{
|
|
92
|
+
allowShortCircuit: true,
|
|
93
|
+
allowTernary: true,
|
|
94
|
+
allowTaggedTemplates: true,
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
'no-unused-labels': statusCode.warn,
|
|
98
|
+
'no-unused-vars': [
|
|
99
|
+
statusCode.warn,
|
|
100
|
+
{
|
|
101
|
+
args: 'none',
|
|
102
|
+
ignoreRestSiblings: true,
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
'no-use-before-define': [
|
|
106
|
+
statusCode.warn,
|
|
107
|
+
{
|
|
108
|
+
functions: false,
|
|
109
|
+
classes: false,
|
|
110
|
+
variables: false,
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
'no-useless-computed-key': statusCode.warn,
|
|
114
|
+
'no-useless-concat': statusCode.warn,
|
|
115
|
+
'no-useless-constructor': statusCode.warn,
|
|
116
|
+
'no-useless-escape': statusCode.warn,
|
|
117
|
+
'no-useless-rename': [
|
|
118
|
+
statusCode.warn,
|
|
119
|
+
{
|
|
120
|
+
ignoreDestructuring: false,
|
|
121
|
+
ignoreImport: false,
|
|
122
|
+
ignoreExport: false,
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
'no-with': statusCode.warn,
|
|
126
|
+
'no-whitespace-before-property': statusCode.warn,
|
|
127
|
+
'react-hooks/exhaustive-deps': statusCode.warn,
|
|
128
|
+
'require-yield': statusCode.warn,
|
|
129
|
+
'rest-spread-spacing': [statusCode.warn, 'never'],
|
|
130
|
+
strict: [statusCode.warn, 'never'],
|
|
131
|
+
'unicode-bom': [statusCode.warn, 'never'],
|
|
132
|
+
'use-isnan': statusCode.warn,
|
|
133
|
+
'valid-typeof': statusCode.warn,
|
|
134
|
+
'no-restricted-properties': [
|
|
135
|
+
statusCode.error,
|
|
136
|
+
{
|
|
137
|
+
object: 'require',
|
|
138
|
+
property: 'ensure',
|
|
139
|
+
message:
|
|
140
|
+
'Please use import() instead. More info: https://facebook.github.io/create-react-app/docs/code-splitting',
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
object: 'System',
|
|
144
|
+
property: 'import',
|
|
145
|
+
message:
|
|
146
|
+
'Please use import() instead. More info: https://facebook.github.io/create-react-app/docs/code-splitting',
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
'getter-return': statusCode.warn,
|
|
150
|
+
|
|
151
|
+
// https://github.com/benmosher/eslint-plugin-import/tree/master/docs/rules
|
|
152
|
+
'import/first': statusCode.error,
|
|
153
|
+
'import/no-amd': statusCode.error,
|
|
154
|
+
'import/no-anonymous-default-export': statusCode.warn,
|
|
155
|
+
'import/no-webpack-loader-syntax': statusCode.error,
|
|
156
|
+
|
|
157
|
+
// https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules
|
|
158
|
+
'react/forbid-foreign-prop-types': [
|
|
159
|
+
statusCode.warn,
|
|
160
|
+
{ allowInPropTypes: true },
|
|
161
|
+
],
|
|
162
|
+
'react/jsx-no-comment-textnodes': statusCode.warn,
|
|
163
|
+
'react/jsx-no-duplicate-props': statusCode.warn,
|
|
164
|
+
'react/jsx-no-target-blank': statusCode.warn,
|
|
165
|
+
'react/jsx-no-undef': statusCode.error,
|
|
166
|
+
'react/jsx-pascal-case': [
|
|
167
|
+
statusCode.warn,
|
|
168
|
+
{
|
|
169
|
+
allowAllCaps: true,
|
|
170
|
+
ignore: [],
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
'react/no-danger-with-children': statusCode.warn,
|
|
174
|
+
// Disabled because of undesirable warnings
|
|
175
|
+
// See https://github.com/facebook/create-react-app/issues/5204 for
|
|
176
|
+
// blockers until its re-enabled
|
|
177
|
+
// 'react/no-deprecated': statusCode.warn,
|
|
178
|
+
'react/no-direct-mutation-state': statusCode.warn,
|
|
179
|
+
'react/no-is-mounted': statusCode.warn,
|
|
180
|
+
'react/no-typos': statusCode.error,
|
|
181
|
+
'react/require-render-return': statusCode.error,
|
|
182
|
+
'react/style-prop-object': statusCode.warn,
|
|
183
|
+
|
|
184
|
+
// https://github.com/evcohen/eslint-plugin-jsx-a11y/tree/master/docs/rules
|
|
185
|
+
'jsx-a11y/alt-text': statusCode.warn,
|
|
186
|
+
'jsx-a11y/anchor-has-content': statusCode.warn,
|
|
187
|
+
'jsx-a11y/anchor-is-valid': [
|
|
188
|
+
statusCode.warn,
|
|
189
|
+
{
|
|
190
|
+
aspects: ['noHref', 'invalidHref'],
|
|
191
|
+
},
|
|
192
|
+
],
|
|
193
|
+
'jsx-a11y/aria-activedescendant-has-tabindex': statusCode.warn,
|
|
194
|
+
'jsx-a11y/aria-props': statusCode.warn,
|
|
195
|
+
'jsx-a11y/aria-proptypes': statusCode.warn,
|
|
196
|
+
'jsx-a11y/aria-role': [statusCode.warn, { ignoreNonDOM: true }],
|
|
197
|
+
'jsx-a11y/aria-unsupported-elements': statusCode.warn,
|
|
198
|
+
'jsx-a11y/heading-has-content': statusCode.warn,
|
|
199
|
+
'jsx-a11y/iframe-has-title': statusCode.warn,
|
|
200
|
+
'jsx-a11y/img-redundant-alt': statusCode.warn,
|
|
201
|
+
'jsx-a11y/no-access-key': statusCode.warn,
|
|
202
|
+
'jsx-a11y/no-distracting-elements': statusCode.warn,
|
|
203
|
+
'jsx-a11y/no-redundant-roles': statusCode.warn,
|
|
204
|
+
'jsx-a11y/role-has-required-aria-props': statusCode.warn,
|
|
205
|
+
'jsx-a11y/role-supports-aria-props': statusCode.warn,
|
|
206
|
+
'jsx-a11y/scope': statusCode.warn,
|
|
207
|
+
|
|
208
|
+
// https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks
|
|
209
|
+
'react-hooks/rules-of-hooks': statusCode.error,
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
typescript: {
|
|
213
|
+
// TypeScript's `noFallthroughCasesInSwitch` option is more robust (#6906)
|
|
214
|
+
'default-case': statusCode.off,
|
|
215
|
+
// 'tsc' already handles this (https://github.com/typescript-eslint/typescript-eslint/issues/291)
|
|
216
|
+
'no-dupe-class-members': statusCode.off,
|
|
217
|
+
// 'tsc' already handles this (https://github.com/typescript-eslint/typescript-eslint/issues/477)
|
|
218
|
+
'no-undef': statusCode.off,
|
|
219
|
+
|
|
220
|
+
// Add TypeScript specific rules (and turn off ESLint equivalents)
|
|
221
|
+
'@typescript-eslint/consistent-type-assertions': statusCode.warn,
|
|
222
|
+
'no-array-constructor': statusCode.off,
|
|
223
|
+
'@typescript-eslint/no-array-constructor': statusCode.warn,
|
|
224
|
+
'no-redeclare': statusCode.off,
|
|
225
|
+
'@typescript-eslint/no-redeclare': statusCode.warn,
|
|
226
|
+
'no-use-before-define': statusCode.off,
|
|
227
|
+
'@typescript-eslint/no-use-before-define': [
|
|
228
|
+
statusCode.warn,
|
|
229
|
+
{
|
|
230
|
+
functions: false,
|
|
231
|
+
classes: false,
|
|
232
|
+
variables: false,
|
|
233
|
+
typedefs: false,
|
|
234
|
+
},
|
|
235
|
+
],
|
|
236
|
+
'no-unused-expressions': statusCode.off,
|
|
237
|
+
'@typescript-eslint/no-unused-expressions': [
|
|
238
|
+
statusCode.error,
|
|
239
|
+
{
|
|
240
|
+
allowShortCircuit: true,
|
|
241
|
+
allowTernary: true,
|
|
242
|
+
allowTaggedTemplates: true,
|
|
243
|
+
},
|
|
244
|
+
],
|
|
245
|
+
'no-unused-vars': statusCode.off,
|
|
246
|
+
'@typescript-eslint/no-unused-vars': [
|
|
247
|
+
statusCode.warn,
|
|
248
|
+
{
|
|
249
|
+
args: 'none',
|
|
250
|
+
ignoreRestSiblings: true,
|
|
251
|
+
},
|
|
252
|
+
],
|
|
253
|
+
'no-useless-constructor': statusCode.off,
|
|
254
|
+
'@typescript-eslint/no-useless-constructor': statusCode.warn,
|
|
255
|
+
},
|
|
256
|
+
|
|
257
|
+
jest: {
|
|
258
|
+
// https://github.com/jest-community/eslint-plugin-jest
|
|
259
|
+
'jest/no-conditional-expect': statusCode.error,
|
|
260
|
+
'jest/no-identical-title': statusCode.error,
|
|
261
|
+
'jest/no-interpolation-in-snapshots': statusCode.error,
|
|
262
|
+
'jest/no-jasmine-globals': statusCode.error,
|
|
263
|
+
'jest/no-jest-import': statusCode.error,
|
|
264
|
+
'jest/no-mocks-import': statusCode.error,
|
|
265
|
+
'jest/valid-describe-callback': statusCode.error,
|
|
266
|
+
'jest/valid-expect': statusCode.error,
|
|
267
|
+
'jest/valid-expect-in-promise': statusCode.error,
|
|
268
|
+
'jest/valid-title': statusCode.warn,
|
|
269
|
+
|
|
270
|
+
// https://github.com/testing-library/eslint-plugin-testing-library
|
|
271
|
+
'testing-library/await-async-query': statusCode.error,
|
|
272
|
+
'testing-library/await-async-utils': statusCode.error,
|
|
273
|
+
'testing-library/no-await-sync-query': statusCode.error,
|
|
274
|
+
'testing-library/no-container': statusCode.error,
|
|
275
|
+
'testing-library/no-debugging-utils': statusCode.error,
|
|
276
|
+
'testing-library/no-dom-import': [statusCode.error, 'react'],
|
|
277
|
+
'testing-library/no-node-access': statusCode.error,
|
|
278
|
+
'testing-library/no-promise-in-fire-event': statusCode.error,
|
|
279
|
+
'testing-library/no-render-in-setup': statusCode.error,
|
|
280
|
+
'testing-library/no-unnecessary-act': statusCode.error,
|
|
281
|
+
'testing-library/no-wait-for-empty-callback': statusCode.error,
|
|
282
|
+
'testing-library/no-wait-for-multiple-assertions': statusCode.error,
|
|
283
|
+
'testing-library/no-wait-for-side-effects': statusCode.error,
|
|
284
|
+
'testing-library/no-wait-for-snapshot': statusCode.error,
|
|
285
|
+
'testing-library/prefer-find-by': statusCode.error,
|
|
286
|
+
'testing-library/prefer-presence-queries': statusCode.error,
|
|
287
|
+
'testing-library/prefer-query-by-disappearance': statusCode.error,
|
|
288
|
+
'testing-library/prefer-screen-queries': statusCode.error,
|
|
289
|
+
'testing-library/render-result-naming-convention': statusCode.error,
|
|
290
|
+
},
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
exports.craRules = craRules;
|
package/index.js
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
|
+
process.env.BABEL_ENV = 'production';
|
|
2
|
+
|
|
1
3
|
// This is a workaround for https://github.com/eslint/eslint/issues/3458
|
|
2
4
|
require('@rushstack/eslint-patch/modern-module-resolution');
|
|
3
5
|
|
|
4
6
|
const { statusCode, allSupportedExtensions } = require('./helpers/eslint');
|
|
5
7
|
const hasJsxRuntime = require('./helpers/has-jsx-runtime');
|
|
8
|
+
const { craRules } = require('./helpers/rules-presets');
|
|
6
9
|
|
|
7
10
|
/**
|
|
8
11
|
* @type {import("eslint").Linter.Config}
|
|
9
12
|
*/
|
|
10
13
|
module.exports = {
|
|
14
|
+
root: true,
|
|
15
|
+
|
|
16
|
+
parser: '@babel/eslint-parser',
|
|
17
|
+
|
|
11
18
|
parserOptions: {
|
|
19
|
+
sourceType: 'module',
|
|
20
|
+
requireConfigFile: false,
|
|
12
21
|
babelOptions: {
|
|
13
22
|
presets: [
|
|
14
23
|
require.resolve(
|
|
@@ -17,33 +26,53 @@ module.exports = {
|
|
|
17
26
|
],
|
|
18
27
|
},
|
|
19
28
|
},
|
|
29
|
+
|
|
30
|
+
env: {
|
|
31
|
+
browser: true,
|
|
32
|
+
commonjs: true,
|
|
33
|
+
es6: true,
|
|
34
|
+
jest: true,
|
|
35
|
+
node: true,
|
|
36
|
+
},
|
|
37
|
+
|
|
20
38
|
extends: [
|
|
21
|
-
// https://github.com/facebook/create-react-app/tree/master/packages/eslint-config-react-app
|
|
22
|
-
'react-app',
|
|
23
|
-
'react-app/jest',
|
|
24
39
|
// https://github.com/cypress-io/eslint-plugin-cypress
|
|
25
40
|
'plugin:cypress/recommended',
|
|
26
|
-
// https://github.com/
|
|
41
|
+
// https://github.com/import-js/eslint-plugin-import
|
|
27
42
|
'plugin:import/errors',
|
|
28
43
|
'plugin:import/warnings',
|
|
29
44
|
'plugin:import/typescript',
|
|
30
|
-
// https://github.com/jest-community/eslint-plugin-jest
|
|
31
|
-
'plugin:jest/recommended',
|
|
32
45
|
// https://github.com/yannickcr/eslint-plugin-react
|
|
33
46
|
'plugin:react/recommended',
|
|
34
|
-
// https://github.com/testing-library/eslint-plugin-testing-library
|
|
35
|
-
'plugin:testing-library/react',
|
|
36
47
|
// https://github.com/prettier/prettier-eslint
|
|
37
48
|
// NOTE: this should go last.
|
|
38
49
|
'prettier',
|
|
39
50
|
],
|
|
51
|
+
|
|
40
52
|
plugins: [
|
|
41
|
-
// https://github.com/
|
|
42
|
-
'
|
|
53
|
+
// https://github.com/import-js/eslint-plugin-import
|
|
54
|
+
'import',
|
|
55
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y
|
|
56
|
+
'jsx-a11y',
|
|
57
|
+
// https://github.com/yannickcr/eslint-plugin-react
|
|
58
|
+
'react',
|
|
59
|
+
// https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks
|
|
60
|
+
'react-hooks',
|
|
43
61
|
// https://github.com/prettier/prettier-eslint
|
|
44
62
|
'prettier',
|
|
45
63
|
],
|
|
64
|
+
|
|
65
|
+
settings: {
|
|
66
|
+
'import/resolver': {
|
|
67
|
+
node: {
|
|
68
|
+
extensions: allSupportedExtensions,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
|
|
46
73
|
rules: {
|
|
74
|
+
...craRules.base,
|
|
75
|
+
|
|
47
76
|
// NOTE: The regular rule does not support do-expressions. The equivalent rule of babel does.
|
|
48
77
|
'no-unused-expressions': statusCode.off,
|
|
49
78
|
|
|
@@ -71,19 +100,6 @@ module.exports = {
|
|
|
71
100
|
'import/no-named-as-default-member': statusCode.off,
|
|
72
101
|
'import/no-unresolved': statusCode.error,
|
|
73
102
|
|
|
74
|
-
// Jest
|
|
75
|
-
'jest/expect-expect': statusCode.off,
|
|
76
|
-
'jest/no-identical-title': statusCode.warn,
|
|
77
|
-
'jest/no-focused-tests': statusCode.error,
|
|
78
|
-
|
|
79
|
-
// RTL
|
|
80
|
-
'testing-library/prefer-presence-queries': statusCode.error,
|
|
81
|
-
'testing-library/await-async-query': statusCode.error,
|
|
82
|
-
// Enabling these would be a breaking change to the config
|
|
83
|
-
'testing-library/render-result-naming-convention': statusCode.off,
|
|
84
|
-
'testing-library/prefer-screen-queries': statusCode.off,
|
|
85
|
-
'testing-library/no-container': statusCode.warn,
|
|
86
|
-
|
|
87
103
|
// React
|
|
88
104
|
'react/jsx-uses-vars': statusCode.error,
|
|
89
105
|
'react/no-deprecated': statusCode.error,
|
|
@@ -93,24 +109,68 @@ module.exports = {
|
|
|
93
109
|
'react/react-in-jsx-scope': statusCode.off,
|
|
94
110
|
}),
|
|
95
111
|
},
|
|
96
|
-
|
|
97
|
-
'import/resolver': {
|
|
98
|
-
node: {
|
|
99
|
-
extensions: allSupportedExtensions,
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
},
|
|
112
|
+
|
|
103
113
|
overrides: [
|
|
104
114
|
{
|
|
105
115
|
files: ['*.{spec,test}.*'],
|
|
116
|
+
env: {
|
|
117
|
+
'jest/globals': true,
|
|
118
|
+
},
|
|
119
|
+
extends: [
|
|
120
|
+
// https://github.com/jest-community/eslint-plugin-jest
|
|
121
|
+
'plugin:jest/recommended',
|
|
122
|
+
// https://github.com/testing-library/eslint-plugin-testing-library
|
|
123
|
+
'plugin:testing-library/react',
|
|
124
|
+
// https://github.com/prettier/prettier-eslint
|
|
125
|
+
// NOTE: this should go last.
|
|
126
|
+
'prettier',
|
|
127
|
+
],
|
|
128
|
+
plugins: [
|
|
129
|
+
'testing-library',
|
|
130
|
+
// https://github.com/jest-community/eslint-plugin-jest
|
|
131
|
+
'jest',
|
|
132
|
+
// https://github.com/testing-library/eslint-plugin-jest-dom
|
|
133
|
+
'jest-dom',
|
|
134
|
+
// https://github.com/prettier/prettier-eslint
|
|
135
|
+
'prettier',
|
|
136
|
+
],
|
|
106
137
|
rules: {
|
|
138
|
+
...craRules.jest,
|
|
139
|
+
|
|
140
|
+
// React
|
|
107
141
|
'react/display-name': statusCode.off,
|
|
142
|
+
|
|
143
|
+
// Jest
|
|
144
|
+
'jest/expect-expect': statusCode.off,
|
|
145
|
+
'jest/no-identical-title': statusCode.warn,
|
|
146
|
+
'jest/no-focused-tests': statusCode.error,
|
|
147
|
+
|
|
148
|
+
// RTL
|
|
149
|
+
'testing-library/prefer-presence-queries': statusCode.error,
|
|
150
|
+
'testing-library/await-async-query': statusCode.error,
|
|
151
|
+
// Enabling these would be a breaking change to the config
|
|
152
|
+
'testing-library/render-result-naming-convention': statusCode.off,
|
|
153
|
+
'testing-library/prefer-screen-queries': statusCode.off,
|
|
154
|
+
'testing-library/no-container': statusCode.warn,
|
|
108
155
|
},
|
|
109
156
|
},
|
|
110
157
|
{
|
|
111
158
|
files: ['**/*.ts?(x)'],
|
|
159
|
+
parser: '@typescript-eslint/parser',
|
|
160
|
+
parserOptions: {
|
|
161
|
+
ecmaVersion: 2018,
|
|
162
|
+
sourceType: 'module',
|
|
163
|
+
ecmaFeatures: {
|
|
164
|
+
jsx: true,
|
|
165
|
+
},
|
|
166
|
+
// typescript-eslint specific options
|
|
167
|
+
warnOnUnsupportedTypeScriptVersion: true,
|
|
168
|
+
},
|
|
169
|
+
plugins: ['@typescript-eslint'],
|
|
112
170
|
extends: ['prettier'],
|
|
113
171
|
rules: {
|
|
172
|
+
...craRules.typescript,
|
|
173
|
+
|
|
114
174
|
// TypeScript
|
|
115
175
|
'@typescript-eslint/ban-types': statusCode.off,
|
|
116
176
|
'@typescript-eslint/naming-convention': statusCode.off,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend/eslint-config-mc-app",
|
|
3
|
-
"version": "21.
|
|
3
|
+
"version": "21.3.4",
|
|
4
4
|
"description": "ESLint config used by a Custom Application.",
|
|
5
5
|
"bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
|
|
6
6
|
"repository": {
|
|
@@ -15,29 +15,30 @@
|
|
|
15
15
|
"access": "public"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@
|
|
19
|
-
"@
|
|
20
|
-
"@
|
|
21
|
-
"@
|
|
22
|
-
"eslint-
|
|
23
|
-
"eslint
|
|
24
|
-
"
|
|
18
|
+
"@babel/core": "^7.17.9",
|
|
19
|
+
"@babel/eslint-parser": "^7.17.0",
|
|
20
|
+
"@commercetools-frontend/babel-preset-mc-app": "^21.3.4",
|
|
21
|
+
"@rushstack/eslint-patch": "^1.1.2",
|
|
22
|
+
"@typescript-eslint/eslint-plugin": "^5.19.0",
|
|
23
|
+
"@typescript-eslint/parser": "^5.19.0",
|
|
24
|
+
"confusing-browser-globals": "^1.0.11",
|
|
25
|
+
"eslint-config-prettier": "^8.5.0",
|
|
26
|
+
"eslint-import-resolver-typescript": "^2.7.1",
|
|
25
27
|
"eslint-plugin-cypress": "^2.12.1",
|
|
26
|
-
"eslint-plugin-
|
|
27
|
-
"eslint-plugin-import": "^2.25.4",
|
|
28
|
+
"eslint-plugin-import": "^2.26.0",
|
|
28
29
|
"eslint-plugin-jest": "^25.7.0",
|
|
29
30
|
"eslint-plugin-jest-dom": "^4.0.1",
|
|
30
31
|
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
31
32
|
"eslint-plugin-prettier": "^4.0.0",
|
|
32
|
-
"eslint-plugin-react": "^7.
|
|
33
|
-
"eslint-plugin-react-hooks": "^4.
|
|
34
|
-
"eslint-plugin-testing-library": "^5.0
|
|
33
|
+
"eslint-plugin-react": "^7.29.4",
|
|
34
|
+
"eslint-plugin-react-hooks": "^4.4.0",
|
|
35
|
+
"eslint-plugin-testing-library": "^5.3.0"
|
|
35
36
|
},
|
|
36
37
|
"peerDependencies": {
|
|
37
38
|
"eslint": "8.x"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
|
-
"eslint": "8.
|
|
41
|
+
"eslint": "8.13.0"
|
|
41
42
|
},
|
|
42
43
|
"engines": {
|
|
43
44
|
"node": ">=14"
|