@will-stone/eslint-config 5.0.2 → 6.0.0
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/_for_rule_checking.js +4 -2
- package/jest.js +6 -3
- package/package.json +12 -12
- package/rules/built-in.js +3 -0
- package/rules/jest.js +38 -0
- package/rules/typescript.js +2 -1
package/_for_rule_checking.js
CHANGED
|
@@ -4,18 +4,20 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
const tsRules = require('./rules/typescript')
|
|
7
|
+
const jestRules = require('./rules/jest')
|
|
7
8
|
|
|
8
9
|
module.exports = {
|
|
9
|
-
plugins: ['@typescript-eslint'],
|
|
10
|
+
plugins: ['@typescript-eslint', 'jest'],
|
|
10
11
|
extends: [
|
|
11
12
|
require.resolve('./javascript'),
|
|
12
13
|
require.resolve('./react'),
|
|
13
14
|
require.resolve('./node'),
|
|
14
|
-
require.resolve('./jest'),
|
|
15
15
|
require.resolve('./prettier'),
|
|
16
16
|
],
|
|
17
17
|
rules: {
|
|
18
18
|
// Use the TS rules directly as eslint-find-rules cannot see `overrides`.
|
|
19
19
|
...tsRules,
|
|
20
|
+
// Use the TS rules directly as eslint-find-rules cannot see `overrides`.
|
|
21
|
+
...jestRules,
|
|
20
22
|
},
|
|
21
23
|
}
|
package/jest.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@will-stone/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "My ESLint config",
|
|
6
6
|
"repository": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"author": "Will Stone",
|
|
11
11
|
"scripts": {
|
|
12
|
-
"eslint-find-unused-rules": "eslint-find-rules --unused ./_for_rule_checking.js > ./unused-rules.txt",
|
|
12
|
+
"eslint-find-unused-rules": "npx eslint-find-rules --unused ./_for_rule_checking.js > ./unused-rules.txt",
|
|
13
13
|
"eslint-print-rules": "eslint --no-eslintrc -c ./_for_rule_checking.js --print-config ./_for_rule_checking.js > rules.json"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
@@ -17,22 +17,22 @@
|
|
|
17
17
|
"eslint-config-prettier": "^8.3.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"eslint-find-rules": "^
|
|
20
|
+
"eslint-find-rules": "^4.0.0"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
24
|
-
"@typescript-eslint/parser": "^5.
|
|
25
|
-
"eslint": "^
|
|
26
|
-
"eslint-plugin-import": "^2.25.
|
|
27
|
-
"eslint-plugin-jest": "^25.2.
|
|
28
|
-
"eslint-plugin-jsx-a11y": "^6.
|
|
23
|
+
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
|
24
|
+
"@typescript-eslint/parser": "^5.4.0",
|
|
25
|
+
"eslint": "^8.2.0",
|
|
26
|
+
"eslint-plugin-import": "^2.25.3",
|
|
27
|
+
"eslint-plugin-jest": "^25.2.4",
|
|
28
|
+
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
29
29
|
"eslint-plugin-node": "^11.1.0",
|
|
30
30
|
"eslint-plugin-prettier": "^4.0.0",
|
|
31
|
-
"eslint-plugin-react": "^7.
|
|
32
|
-
"eslint-plugin-react-hooks": "^4.
|
|
31
|
+
"eslint-plugin-react": "^7.27.1",
|
|
32
|
+
"eslint-plugin-react-hooks": "^4.3.0",
|
|
33
33
|
"eslint-plugin-simple-import-sort": "^7.0.0",
|
|
34
34
|
"eslint-plugin-switch-case": "^1.1.2",
|
|
35
|
-
"eslint-plugin-unicorn": "^38.0.
|
|
35
|
+
"eslint-plugin-unicorn": "^38.0.1",
|
|
36
36
|
"typescript": "4.x"
|
|
37
37
|
},
|
|
38
38
|
"peerDependenciesMeta": {
|
package/rules/built-in.js
CHANGED
|
@@ -584,6 +584,8 @@ module.exports = {
|
|
|
584
584
|
// likely an error due to incomplete refactoring.
|
|
585
585
|
'no-unused-labels': 'warn',
|
|
586
586
|
|
|
587
|
+
'no-unused-private-class-members': 'error',
|
|
588
|
+
|
|
587
589
|
// Variables must be used unless name starts with "ignored"
|
|
588
590
|
'no-unused-vars': ['error', { varsIgnorePattern: '[iI]gnored' }],
|
|
589
591
|
|
|
@@ -658,6 +660,7 @@ module.exports = {
|
|
|
658
660
|
'padding-line-between-statements': [
|
|
659
661
|
'warn',
|
|
660
662
|
{ blankLine: 'always', prev: 'multiline-block-like', next: '*' },
|
|
663
|
+
{ blankLine: 'always', prev: '*', next: 'multiline-block-like' },
|
|
661
664
|
],
|
|
662
665
|
|
|
663
666
|
// Can cause issues when Prettier is enabled
|
package/rules/jest.js
CHANGED
|
@@ -4,29 +4,61 @@ module.exports = {
|
|
|
4
4
|
// describe -> it
|
|
5
5
|
'jest/consistent-test-it': ['error', { fn: 'test', withinDescribe: 'it' }],
|
|
6
6
|
|
|
7
|
+
// Enforce assertion to be made in a test body
|
|
8
|
+
'jest/expect-expect': 'error',
|
|
9
|
+
|
|
7
10
|
'jest/max-nested-describe': 'off',
|
|
8
11
|
|
|
9
12
|
// Consistent expect methods
|
|
10
13
|
'jest/no-alias-methods': 'error',
|
|
11
14
|
|
|
15
|
+
'jest/no-commented-out-tests': 'error',
|
|
16
|
+
|
|
12
17
|
// Prevent calling expect conditionally
|
|
13
18
|
'jest/no-conditional-expect': 'error',
|
|
14
19
|
|
|
20
|
+
'jest/no-deprecated-functions': 'warn',
|
|
21
|
+
|
|
22
|
+
'jest/no-disabled-tests': 'warn',
|
|
23
|
+
|
|
24
|
+
// Avoid using a callback in asynchronous tests and hooks
|
|
25
|
+
'jest/no-done-callback': 'error',
|
|
26
|
+
|
|
15
27
|
// Do not allow multiple beforeEach, for example
|
|
16
28
|
'jest/no-duplicate-hooks': 'error',
|
|
17
29
|
|
|
30
|
+
// Disallow using exports in files containing tests
|
|
31
|
+
'jest/no-export': 'error',
|
|
32
|
+
|
|
33
|
+
'jest/no-focused-tests': 'error',
|
|
34
|
+
|
|
18
35
|
'jest/no-hooks': 'off',
|
|
19
36
|
|
|
37
|
+
'jest/no-identical-title': 'error',
|
|
38
|
+
|
|
20
39
|
// Conditional logic in tests is usually an indication that a test is attempting to cover too much
|
|
21
40
|
'jest/no-if': 'error',
|
|
22
41
|
|
|
42
|
+
// Disallow string interpolation inside snapshots
|
|
43
|
+
'jest/no-interpolation-in-snapshots': 'error',
|
|
44
|
+
|
|
45
|
+
'jest/no-jasmine-globals': 'warn',
|
|
46
|
+
|
|
47
|
+
'jest/no-jest-import': 'error',
|
|
48
|
+
|
|
23
49
|
'jest/no-large-snapshots': 'off',
|
|
24
50
|
|
|
51
|
+
// Disallow manually importing from __mocks__
|
|
52
|
+
'jest/no-mocks-import': 'error',
|
|
53
|
+
|
|
25
54
|
'jest/no-restricted-matchers': 'off',
|
|
26
55
|
|
|
27
56
|
// No standalone expect in a describe block
|
|
28
57
|
'jest/no-standalone-expect': 'error',
|
|
29
58
|
|
|
59
|
+
// Use .only and .skip over f and x
|
|
60
|
+
'jest/no-test-prefixes': 'warn',
|
|
61
|
+
|
|
30
62
|
// Tests shouldn't return anything
|
|
31
63
|
'jest/no-test-return-statement': 'error',
|
|
32
64
|
|
|
@@ -69,6 +101,12 @@ module.exports = {
|
|
|
69
101
|
|
|
70
102
|
'jest/require-top-level-describe': 'off',
|
|
71
103
|
|
|
104
|
+
'jest/valid-describe-callback': 'error',
|
|
105
|
+
|
|
106
|
+
'jest/valid-expect': 'error',
|
|
107
|
+
|
|
108
|
+
'jest/valid-expect-in-promise': 'error',
|
|
109
|
+
|
|
72
110
|
// Titles are...
|
|
73
111
|
// - not empty
|
|
74
112
|
// - is a string
|
package/rules/typescript.js
CHANGED
|
@@ -37,7 +37,7 @@ module.exports = {
|
|
|
37
37
|
// ts transpiles let/const to var, so no need for vars any more
|
|
38
38
|
'no-var': 'error',
|
|
39
39
|
// ts provides better types with const
|
|
40
|
-
'prefer-const': '
|
|
40
|
+
'prefer-const': 'warn',
|
|
41
41
|
// ts provides better types with rest args over arguments
|
|
42
42
|
'prefer-rest-params': 'error',
|
|
43
43
|
// ts transpiles spread to apply, so no need for manual apply
|
|
@@ -77,6 +77,7 @@ module.exports = {
|
|
|
77
77
|
* These are for type checking which I don't use eslint for
|
|
78
78
|
*/
|
|
79
79
|
'@typescript-eslint/await-thenable': 'off',
|
|
80
|
+
'@typescript-eslint/consistent-type-exports': 'off',
|
|
80
81
|
'@typescript-eslint/dot-notation': 'off',
|
|
81
82
|
'@typescript-eslint/naming-convention': 'off',
|
|
82
83
|
'@typescript-eslint/no-base-to-string': 'off',
|