@fullstacksjs/eslint-config 6.8.2 → 7.0.0-1
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 +12 -1
- package/base.js +9 -2
- package/jest.js +1 -1
- package/nextjs.js +24 -0
- package/package.json +18 -18
- package/rules/es2015.js +8 -7
- package/rules/jest.js +15 -3
- package/rules/react.js +4 -0
- package/rules/typescript.js +2 -1
package/README.md
CHANGED
|
@@ -58,6 +58,16 @@ Just extend from `@fullstacksjs`:
|
|
|
58
58
|
|
|
59
59
|
It reads your root `package.json` dependencies and includes necessary rules.
|
|
60
60
|
|
|
61
|
+
## NextJS
|
|
62
|
+
|
|
63
|
+
[NextJS](https://nextjs.org/) config is subset of base config which is compatible with builtin NextJS eslint config.
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"extends": ["@fullstacksjs/eslint-config/nextjs"]
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
61
71
|
## Advanced Usage
|
|
62
72
|
|
|
63
73
|
```jsonc
|
|
@@ -96,6 +106,7 @@ If you need more advanced `typescript-eslint` rules, then you can extend from `"
|
|
|
96
106
|
* @typescript-eslint/eslint-plugin
|
|
97
107
|
* eslint-plugin-import
|
|
98
108
|
* eslint-plugin-jest
|
|
109
|
+
* eslint-plugin-jest-formatting
|
|
99
110
|
* eslint-plugin-cypress
|
|
100
111
|
* eslint-plugin-jsx-a11y
|
|
101
112
|
* eslint-plugin-prettier
|
|
@@ -104,7 +115,7 @@ If you need more advanced `typescript-eslint` rules, then you can extend from `"
|
|
|
104
115
|
* eslint-plugin-simple-import-sort
|
|
105
116
|
* eslint-plugin-fp
|
|
106
117
|
* eslint-plugin-node
|
|
107
|
-
* eslint-plugin-promise
|
|
118
|
+
* ~~eslint-plugin-promise~~ ⚠️ Disabled in v7-beta, because it's not currently supports eslint@8 ([Issue](https://github.com/xjamundx/eslint-plugin-promise/issues/218))
|
|
108
119
|
|
|
109
120
|
That's all. Feel free to use 💛
|
|
110
121
|
|
package/base.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
plugins: [
|
|
2
|
+
plugins: [
|
|
3
|
+
'prettier',
|
|
4
|
+
'import',
|
|
5
|
+
'simple-import-sort',
|
|
6
|
+
// 'promise' PENDING: https://github.com/xjamundx/eslint-plugin-promise/issues/218
|
|
7
|
+
'node',
|
|
8
|
+
'fp',
|
|
9
|
+
],
|
|
3
10
|
parserOptions: {
|
|
4
11
|
ecmaVersion: 2020,
|
|
5
12
|
sourceType: 'module',
|
|
@@ -27,7 +34,7 @@ module.exports = {
|
|
|
27
34
|
'./rules/style',
|
|
28
35
|
'./rules/variables',
|
|
29
36
|
'./rules/fp',
|
|
30
|
-
'./rules/promise',
|
|
37
|
+
// './rules/promise', PENDING: https://github.com/xjamundx/eslint-plugin-promise/issues/218
|
|
31
38
|
'./rules/node',
|
|
32
39
|
'prettier',
|
|
33
40
|
],
|
package/jest.js
CHANGED
package/nextjs.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
plugins: ['prettier', 'simple-import-sort', 'promise', 'node', 'fp'],
|
|
3
|
+
parserOptions: {
|
|
4
|
+
ecmaVersion: 2020,
|
|
5
|
+
sourceType: 'module',
|
|
6
|
+
requireConfigFile: false,
|
|
7
|
+
},
|
|
8
|
+
env: {
|
|
9
|
+
browser: true,
|
|
10
|
+
es6: true,
|
|
11
|
+
node: true,
|
|
12
|
+
},
|
|
13
|
+
extends: [
|
|
14
|
+
'./rules/base',
|
|
15
|
+
'./rules/es2015',
|
|
16
|
+
'./rules/forbidden',
|
|
17
|
+
'./rules/style',
|
|
18
|
+
'./rules/variables',
|
|
19
|
+
'./rules/fp',
|
|
20
|
+
'./rules/promise',
|
|
21
|
+
'./rules/node',
|
|
22
|
+
'prettier',
|
|
23
|
+
],
|
|
24
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fullstacksjs/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "fullstacks <fullstacksjs@gmail.com>",
|
|
6
6
|
"description": "fullstacks eslint config",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"index.js",
|
|
18
18
|
"jest.js",
|
|
19
19
|
"cypress.js",
|
|
20
|
+
"nextjs.js",
|
|
20
21
|
"react.js",
|
|
21
22
|
"typescript.js",
|
|
22
23
|
"typecheck.js",
|
|
@@ -30,7 +31,6 @@
|
|
|
30
31
|
"check-rules:typescript": "eslint-find-rules --no-core --unused ./tests/typescript.js",
|
|
31
32
|
"check-rules:cypress": "eslint-find-rules --no-core --unused ./tests/cypress.js",
|
|
32
33
|
"test": "npm-run-all --parallel check-rules:*",
|
|
33
|
-
"prepare": "husky install",
|
|
34
34
|
"prepublishOnly": "pinst --disable",
|
|
35
35
|
"postpublish": "pinst --enable",
|
|
36
36
|
"pre-commit": "npm run test && lint-staged"
|
|
@@ -38,41 +38,41 @@
|
|
|
38
38
|
"main": "index.js",
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@frontendmonster/utils": "0.3.11",
|
|
41
|
-
"@typescript-eslint/eslint-plugin": "4.
|
|
42
|
-
"@typescript-eslint/parser": "4.
|
|
41
|
+
"@typescript-eslint/eslint-plugin": "5.4.0",
|
|
42
|
+
"@typescript-eslint/parser": "5.4.0",
|
|
43
43
|
"eslint-config-prettier": "8.3.0",
|
|
44
44
|
"eslint-import-resolver-typescript": "2.5.0",
|
|
45
45
|
"eslint-plugin-cypress": "2.12.1",
|
|
46
46
|
"eslint-plugin-fp": "2.3.0",
|
|
47
|
-
"eslint-plugin-import": "2.25.
|
|
48
|
-
"eslint-plugin-jest": "
|
|
49
|
-
"eslint-plugin-
|
|
47
|
+
"eslint-plugin-import": "2.25.3",
|
|
48
|
+
"eslint-plugin-jest-formatting": "3.1.0",
|
|
49
|
+
"eslint-plugin-jest": "25.2.4",
|
|
50
|
+
"eslint-plugin-jsx-a11y": "6.5.1",
|
|
50
51
|
"eslint-plugin-node": "11.1.0",
|
|
51
52
|
"eslint-plugin-prettier": "4.0.0",
|
|
52
|
-
"eslint-plugin-
|
|
53
|
-
"eslint-plugin-react": "7.
|
|
54
|
-
"eslint-plugin-react-hooks": "4.2.0",
|
|
53
|
+
"eslint-plugin-react-hooks": "4.3.0",
|
|
54
|
+
"eslint-plugin-react": "7.27.1",
|
|
55
55
|
"eslint-plugin-simple-import-sort": "7.0.0",
|
|
56
56
|
"lodash.has": "4.5.2",
|
|
57
57
|
"read-pkg-up": "7.0.1"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"eslint": "
|
|
61
|
-
"eslint-find-rules": "
|
|
62
|
-
"husky": "7.0.
|
|
63
|
-
"lint-staged": "
|
|
64
|
-
"np": "7.
|
|
60
|
+
"eslint": "8.3.0",
|
|
61
|
+
"eslint-find-rules": "4.0.0",
|
|
62
|
+
"husky": "7.0.4",
|
|
63
|
+
"lint-staged": "12.0.3",
|
|
64
|
+
"np": "7.6.0",
|
|
65
65
|
"npm-run-all": "4.1.5",
|
|
66
66
|
"pinst": "2.1.6",
|
|
67
67
|
"prettier": "2.4.1",
|
|
68
|
-
"typescript": "4.
|
|
68
|
+
"typescript": "4.5.2"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"eslint": "7",
|
|
71
|
+
"eslint": ">=7",
|
|
72
72
|
"prettier": "2",
|
|
73
73
|
"react": ">=16",
|
|
74
74
|
"typescript": "4",
|
|
75
|
-
"cypress": "8"
|
|
75
|
+
"cypress": ">=8"
|
|
76
76
|
},
|
|
77
77
|
"peerDependenciesMeta": {
|
|
78
78
|
"typescript": {
|
package/rules/es2015.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
rules: {
|
|
3
3
|
'class-methods-use-this': 'off',
|
|
4
|
+
'constructor-super': 'error',
|
|
5
|
+
'no-await-in-loop': 'error',
|
|
4
6
|
'no-class-assign': 'error',
|
|
7
|
+
'no-const-assign': 'error',
|
|
8
|
+
'no-dupe-class-members': 'error',
|
|
5
9
|
'no-duplicate-imports': 'off', // Handled by import plugin
|
|
10
|
+
'no-new-symbol': 'error',
|
|
6
11
|
'no-restricted-imports': 'off',
|
|
7
12
|
'no-return-await': 'error',
|
|
13
|
+
'no-this-before-super': 'error',
|
|
14
|
+
'no-unused-expressions': 'off',
|
|
15
|
+
'no-unused-private-class-members': 'warn',
|
|
8
16
|
'no-useless-computed-key': 'error',
|
|
9
17
|
'no-useless-constructor': 'error',
|
|
10
18
|
'no-useless-rename': 'error',
|
|
@@ -17,12 +25,5 @@ module.exports = {
|
|
|
17
25
|
'prefer-template': 'error',
|
|
18
26
|
'require-yield': 'error',
|
|
19
27
|
'symbol-description': 'error',
|
|
20
|
-
'constructor-super': 'error',
|
|
21
|
-
'no-await-in-loop': 'error',
|
|
22
|
-
'no-const-assign': 'error',
|
|
23
|
-
'no-dupe-class-members': 'error',
|
|
24
|
-
'no-new-symbol': 'error',
|
|
25
|
-
'no-this-before-super': 'error',
|
|
26
|
-
'no-unused-expressions': 'off',
|
|
27
28
|
},
|
|
28
29
|
};
|
package/rules/jest.js
CHANGED
|
@@ -30,27 +30,39 @@ module.exports = {
|
|
|
30
30
|
'jest/no-truthy-falsy': 'off',
|
|
31
31
|
'jest/prefer-called-with': 'error',
|
|
32
32
|
'jest/prefer-expect-assertions': 'off',
|
|
33
|
+
'jest/prefer-expect-resolves': 'warn',
|
|
33
34
|
'jest/prefer-hooks-on-top': 'error',
|
|
34
35
|
'jest/prefer-inline-snapshots': 'off',
|
|
36
|
+
'jest/prefer-lowercase-title': 'off',
|
|
35
37
|
'jest/prefer-spy-on': 'off',
|
|
36
38
|
'jest/prefer-strict-equal': 'off',
|
|
37
39
|
'jest/prefer-to-be-null': 'off',
|
|
38
40
|
'jest/prefer-to-be-undefined': 'off',
|
|
41
|
+
'jest/prefer-to-be': 'warn',
|
|
39
42
|
'jest/prefer-to-contain': 'warn',
|
|
40
43
|
'jest/prefer-to-have-length': 'warn',
|
|
41
44
|
'jest/prefer-todo': 'warn',
|
|
45
|
+
'jest/require-hook': 'error',
|
|
42
46
|
'jest/require-to-throw-message': 'off',
|
|
43
47
|
'jest/require-top-level-describe': 'off',
|
|
44
48
|
'jest/unbound-method': 'error',
|
|
49
|
+
'jest/valid-describe-callback': 'error',
|
|
45
50
|
'jest/valid-describe': 'error',
|
|
46
51
|
'jest/valid-expect-in-promise': 'error',
|
|
47
52
|
'jest/valid-expect': 'error',
|
|
48
53
|
'jest/valid-title': 'warn',
|
|
49
54
|
|
|
55
|
+
// jest-formatiing
|
|
56
|
+
'jest-formatting/padding-around-after-all-blocks': 'warn',
|
|
57
|
+
'jest-formatting/padding-around-after-each-blocks': 'warn',
|
|
58
|
+
'jest-formatting/padding-around-all': 'warn',
|
|
59
|
+
'jest-formatting/padding-around-before-all-blocks': 'warn',
|
|
60
|
+
'jest-formatting/padding-around-before-each-blocks': 'warn',
|
|
61
|
+
'jest-formatting/padding-around-describe-blocks': 'warn',
|
|
62
|
+
'jest-formatting/padding-around-expect-groups': 'warn',
|
|
63
|
+
'jest-formatting/padding-around-test-blocks': 'warn',
|
|
64
|
+
|
|
50
65
|
// conflicts
|
|
51
66
|
'@typescript-eslint/unbound-method': 'off',
|
|
52
67
|
},
|
|
53
|
-
env: {
|
|
54
|
-
'jest/globals': true,
|
|
55
|
-
},
|
|
56
68
|
};
|
package/rules/react.js
CHANGED
|
@@ -40,6 +40,7 @@ module.exports = {
|
|
|
40
40
|
'react/no-access-state-in-setstate': 'error',
|
|
41
41
|
'react/no-adjacent-inline-elements': 'error',
|
|
42
42
|
'react/no-array-index-key': 'warn',
|
|
43
|
+
'react/no-arrow-function-lifecycle': 'error',
|
|
43
44
|
'react/no-children-prop': 'off',
|
|
44
45
|
'react/no-danger-with-children': 'error',
|
|
45
46
|
'react/no-danger': 'off',
|
|
@@ -48,8 +49,10 @@ module.exports = {
|
|
|
48
49
|
'react/no-did-update-set-state': 'error',
|
|
49
50
|
'react/no-direct-mutation-state': 'error',
|
|
50
51
|
'react/no-find-dom-node': 'error',
|
|
52
|
+
'react/no-invalid-html-attribute': 'warn',
|
|
51
53
|
'react/no-is-mounted': 'error',
|
|
52
54
|
'react/no-multi-comp': 'off',
|
|
55
|
+
'react/no-namespace': 'error',
|
|
53
56
|
'react/no-redundant-should-component-update': 'error',
|
|
54
57
|
'react/no-render-return-value': 'error',
|
|
55
58
|
'react/no-set-state': 'off',
|
|
@@ -60,6 +63,7 @@ module.exports = {
|
|
|
60
63
|
'react/no-unknown-property': 'error',
|
|
61
64
|
'react/no-unsafe': 'warn',
|
|
62
65
|
'react/no-unstable-nested-components': ['error', { allowAsProps: true }],
|
|
66
|
+
'react/no-unused-class-component-methods': 'warn',
|
|
63
67
|
'react/no-unused-prop-types': 'error',
|
|
64
68
|
'react/no-unused-state': 'error',
|
|
65
69
|
'react/no-will-update-set-state': 'error',
|
package/rules/typescript.js
CHANGED
|
@@ -19,7 +19,6 @@ module.exports = {
|
|
|
19
19
|
'@typescript-eslint/consistent-indexed-object-style': 'off',
|
|
20
20
|
'@typescript-eslint/consistent-type-assertions': 'error',
|
|
21
21
|
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
|
|
22
|
-
'@typescript-eslint/consistent-type-imports': 'off',
|
|
23
22
|
'@typescript-eslint/default-param-last': 'warn',
|
|
24
23
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
25
24
|
'@typescript-eslint/explicit-member-accessibility': 'off',
|
|
@@ -58,6 +57,8 @@ module.exports = {
|
|
|
58
57
|
'@typescript-eslint/no-redeclare': ['off', { ignoreDeclarationMerge: true }], // useful in FP.
|
|
59
58
|
'@typescript-eslint/no-require-imports': 'error',
|
|
60
59
|
'@typescript-eslint/no-restricted-imports': 'off',
|
|
60
|
+
'@typescript-eslint/consistent-type-imports': ['warn', { prefer: 'type-imports', disallowTypeAnnotations: true }],
|
|
61
|
+
'@typescript-eslint/consistent-type-exports': 'warn',
|
|
61
62
|
'@typescript-eslint/no-shadow': 'error',
|
|
62
63
|
'@typescript-eslint/no-this-alias': 'error',
|
|
63
64
|
'@typescript-eslint/no-type-alias': 'off',
|