@dr.pogodin/eslint-configs 0.2.0 → 0.2.2
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 +4 -2
- package/config/javascript.js +4 -8
- package/config/jest.js +12 -3
- package/config/react.js +0 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -100,8 +100,10 @@ combined and extended as necessary for the needs of host projects.
|
|
|
100
100
|
[`configs.javascript`]: #configsjavascript
|
|
101
101
|
|
|
102
102
|
Intended for JavaScript code, it applies to the files [ESLint] considers as
|
|
103
|
-
JavaScript by default: `**/*.js`, `**/*.cjs`, `**/*.mjs
|
|
104
|
-
|
|
103
|
+
JavaScript by default: `**/*.js`, `**/*.cjs`, `**/*.mjs`, as well as to any
|
|
104
|
+
other files matched by other config objects in your config (_i.e._ it does not
|
|
105
|
+
include `files` key, see [ESLint docs for related configuration details](https://eslint.org/docs/latest/use/configure/configuration-files#specifying-files-and-ignores));
|
|
106
|
+
and it applies to them the following rule sets:
|
|
105
107
|
|
|
106
108
|
- [ESLint Core Rules](https://eslint.org/docs/latest/rules) —
|
|
107
109
|
the `recommended` rule set, with minor overrides, and many additional rules
|
package/config/javascript.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { defineConfig } from 'eslint/config';
|
|
4
4
|
import importPlugin from 'eslint-plugin-import';
|
|
5
|
+
|
|
5
6
|
import perfectionist from 'eslint-plugin-perfectionist';
|
|
6
7
|
import { Alphabet } from 'eslint-plugin-perfectionist/alphabet';
|
|
7
8
|
|
|
@@ -280,19 +281,14 @@ function newConfig({ noPerf } = {}) {
|
|
|
280
281
|
// eslint-disable-next-line import/no-named-as-default-member
|
|
281
282
|
extentions.push(perfectionist.configs['recommended-custom']);
|
|
282
283
|
|
|
283
|
-
// TODO: For now it is disabled because of the following Perfectionist bug:
|
|
284
|
-
// https://github.com/azat-io/eslint-plugin-perfectionist/issues/688
|
|
285
|
-
// and we'll keep using "import/order" rule here until the issue is addressed.
|
|
286
|
-
rules['perfectionist/sort-imports'] = 'off';
|
|
287
|
-
rules['import/order'] = ['error', {
|
|
288
|
-
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
|
289
|
-
}];
|
|
290
|
-
|
|
291
284
|
settings.perfectionist = {
|
|
292
285
|
alphabet: Alphabet.generateRecommendedAlphabet()
|
|
293
286
|
.placeAllWithCaseBeforeAllWithOtherCase('uppercase')
|
|
287
|
+
.placeCharacterBefore({ characterAfter: '-', characterBefore: '/' })
|
|
294
288
|
.getCharacters(),
|
|
295
289
|
ignoreCase: false,
|
|
290
|
+
newlinesBetween: 'ignore',
|
|
291
|
+
newlinesInside: 'ignore',
|
|
296
292
|
partitionByNewLine: true,
|
|
297
293
|
};
|
|
298
294
|
}
|
package/config/jest.js
CHANGED
|
@@ -17,9 +17,7 @@ export default defineConfig([{
|
|
|
17
17
|
'jest/no-conditional-in-test': 'error',
|
|
18
18
|
'jest/no-confusing-set-timeout': 'error',
|
|
19
19
|
'jest/no-duplicate-hooks': 'error',
|
|
20
|
-
'jest/no-error-equal': 'error',
|
|
21
20
|
'jest/no-test-return-statement': 'error',
|
|
22
|
-
'jest/no-unnecessary-assertion': 'error',
|
|
23
21
|
'jest/no-unneeded-async-expect-function': 'error',
|
|
24
22
|
'jest/no-untyped-mock-factory': 'error',
|
|
25
23
|
'jest/padding-around-after-all-blocks': 'error',
|
|
@@ -44,11 +42,22 @@ export default defineConfig([{
|
|
|
44
42
|
'jest/prefer-to-have-been-called-times': 'error',
|
|
45
43
|
'jest/prefer-todo': 'error',
|
|
46
44
|
'jest/require-to-throw-message': 'error',
|
|
47
|
-
'jest/valid-expect-with-promise': 'error',
|
|
48
45
|
'jest/valid-mock-module-path': 'error',
|
|
49
46
|
|
|
50
47
|
'no-console': 'off',
|
|
51
48
|
|
|
52
49
|
'@typescript-eslint/unbound-method': 'off',
|
|
53
50
|
},
|
|
51
|
+
}, {
|
|
52
|
+
// NOTE: These rules require type information, hence they are applied for TS
|
|
53
|
+
// files only.
|
|
54
|
+
names: 'dr.pogodin/jest/typescript',
|
|
55
|
+
|
|
56
|
+
files: ['**/ts', '**/tsx'],
|
|
57
|
+
plugins: { jest: pluginJest },
|
|
58
|
+
rules: {
|
|
59
|
+
'jest/no-error-equal': 'error',
|
|
60
|
+
'jest/no-unnecessary-assertion': 'error',
|
|
61
|
+
'jest/valid-expect-with-promise': 'error',
|
|
62
|
+
},
|
|
54
63
|
}]);
|
package/config/react.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { defineConfig } from 'eslint/config';
|
|
2
2
|
|
|
3
3
|
import jsxA11y from 'eslint-plugin-jsx-a11y';
|
|
4
|
-
import perfectionist from 'eslint-plugin-perfectionist';
|
|
5
4
|
import react from 'eslint-plugin-react';
|
|
6
5
|
import reactHooks from 'eslint-plugin-react-hooks';
|
|
7
6
|
|
|
@@ -18,7 +17,6 @@ export default defineConfig([{
|
|
|
18
17
|
},
|
|
19
18
|
},
|
|
20
19
|
plugins: {
|
|
21
|
-
perfectionist,
|
|
22
20
|
react,
|
|
23
21
|
},
|
|
24
22
|
settings: {
|
|
@@ -28,14 +26,6 @@ export default defineConfig([{
|
|
|
28
26
|
},
|
|
29
27
|
|
|
30
28
|
rules: {
|
|
31
|
-
// Rules provided by "eslint-plugin-perfectionist"
|
|
32
|
-
// NOTE: Not necessary when default JS config is used, which already
|
|
33
|
-
// includes it... but we keep it around to avoid any changes for consumers
|
|
34
|
-
// who may include this config without our default JS/TS one.
|
|
35
|
-
'perfectionist/sort-jsx-props': ['error', {
|
|
36
|
-
type: 'natural',
|
|
37
|
-
}],
|
|
38
|
-
|
|
39
29
|
// Rules provided by "eslint-plugin-jsx-a11y".
|
|
40
30
|
'jsx-a11y/anchor-ambiguous-text': 'error',
|
|
41
31
|
'jsx-a11y/control-has-associated-label': 'error',
|