@evanpurkhiser/eslint-config 0.12.0 → 0.13.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/README.md +14 -0
- package/common.js +96 -0
- package/index.js +1 -116
- package/package.json +9 -5
- package/react.js +18 -0
package/README.md
CHANGED
|
@@ -16,3 +16,17 @@ module.exports = {
|
|
|
16
16
|
extends: ['@evanpurkhiser'],
|
|
17
17
|
};
|
|
18
18
|
```
|
|
19
|
+
|
|
20
|
+
The default configuration is for React apps, but you can select from the
|
|
21
|
+
following configurations
|
|
22
|
+
|
|
23
|
+
- `common` - ES6 and Typescript rules
|
|
24
|
+
- `react` - React specific rules
|
|
25
|
+
|
|
26
|
+
For example:
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
module.exports = {
|
|
30
|
+
extends: ['@evanpurkhiser/eslint-config/common'],
|
|
31
|
+
};
|
|
32
|
+
```
|
package/common.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
extends: [
|
|
3
|
+
'eslint:recommended',
|
|
4
|
+
'plugin:prettier/recommended',
|
|
5
|
+
'plugin:@typescript-eslint/recommended',
|
|
6
|
+
],
|
|
7
|
+
plugins: ['prettier', 'import', '@typescript-eslint', 'simple-import-sort'],
|
|
8
|
+
parser: '@typescript-eslint/parser',
|
|
9
|
+
|
|
10
|
+
parserOptions: {
|
|
11
|
+
ecmaVersion: 6,
|
|
12
|
+
sourceType: 'module',
|
|
13
|
+
ecmaFeatures: {
|
|
14
|
+
jsx: true,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
rules: {
|
|
19
|
+
// Best practices
|
|
20
|
+
'array-callback-return': ['warn'],
|
|
21
|
+
'consistent-return': ['warn'],
|
|
22
|
+
'no-caller': ['warn'],
|
|
23
|
+
'no-else-return': ['error', {allowElseIf: false}],
|
|
24
|
+
'no-extra-label': ['error'],
|
|
25
|
+
'no-floating-decimal': ['error'],
|
|
26
|
+
'no-implied-eval': ['error'],
|
|
27
|
+
'no-lone-blocks': ['error'],
|
|
28
|
+
'no-return-await': ['error'],
|
|
29
|
+
'no-self-compare': ['error'],
|
|
30
|
+
'no-sequences': ['error'],
|
|
31
|
+
'no-useless-call': ['warn'],
|
|
32
|
+
'no-useless-concat': ['warn'],
|
|
33
|
+
'no-useless-return': ['warn'],
|
|
34
|
+
'require-await': ['warn'],
|
|
35
|
+
curly: ['error'],
|
|
36
|
+
eqeqeq: ['error'],
|
|
37
|
+
radix: ['warn'],
|
|
38
|
+
|
|
39
|
+
// Variables
|
|
40
|
+
'no-undef-init': ['warn'],
|
|
41
|
+
|
|
42
|
+
// Style (mostly handled by prettier)
|
|
43
|
+
'eol-last': ['error', 'always'],
|
|
44
|
+
'new-parens': ['error'],
|
|
45
|
+
'padded-blocks': ['warn', 'never'],
|
|
46
|
+
'spaced-comment': ['warn', 'always'],
|
|
47
|
+
|
|
48
|
+
// ECMA 6
|
|
49
|
+
'no-var': ['error'],
|
|
50
|
+
'prefer-arrow-callback': ['warn'],
|
|
51
|
+
'prefer-const': ['error'],
|
|
52
|
+
'prefer-destructuring': ['off'],
|
|
53
|
+
'prefer-numeric-literals': ['warn'],
|
|
54
|
+
'prefer-rest-params': ['warn'],
|
|
55
|
+
'prefer-spread': ['warn'],
|
|
56
|
+
'prefer-template': ['warn'],
|
|
57
|
+
'arrow-body-style': ['error', 'as-needed'],
|
|
58
|
+
|
|
59
|
+
// disabled for typescript
|
|
60
|
+
'no-unused-expressions': ['off'],
|
|
61
|
+
|
|
62
|
+
// Typescript
|
|
63
|
+
'@typescript-eslint/explicit-function-return-type': ['off'],
|
|
64
|
+
'@typescript-eslint/no-use-before-define': ['off'],
|
|
65
|
+
'@typescript-eslint/no-explicit-any': ['off'],
|
|
66
|
+
'@typescript-eslint/no-non-null-assertion': ['off'],
|
|
67
|
+
'@typescript-eslint/explicit-module-boundary-types': ['off'],
|
|
68
|
+
'@typescript-eslint/no-unused-vars': ['error', {argsIgnorePattern: '^_'}],
|
|
69
|
+
'@typescript-eslint/no-unused-expressions': ['error'],
|
|
70
|
+
|
|
71
|
+
// see: https://github.com/typescript-eslint/typescript-eslint/issues/420
|
|
72
|
+
'@typescript-eslint/no-useless-constructor': 'error',
|
|
73
|
+
|
|
74
|
+
// Sort imports
|
|
75
|
+
'simple-import-sort/exports': 'error',
|
|
76
|
+
'simple-import-sort/imports': [
|
|
77
|
+
'error',
|
|
78
|
+
{
|
|
79
|
+
groups: [
|
|
80
|
+
// Side effect imports.
|
|
81
|
+
['^\\u0000'],
|
|
82
|
+
// Packages. `react` related packages come first.
|
|
83
|
+
['^react', '^@?\\w'],
|
|
84
|
+
// Node.js builtins.
|
|
85
|
+
[`^(${require('module').builtinModules.join('|')})(/|$)`],
|
|
86
|
+
// Internal packages.
|
|
87
|
+
['^(src|app)(/.*|$)'],
|
|
88
|
+
// Parent imports. Put `..` last.
|
|
89
|
+
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
|
|
90
|
+
// Other relative imports. Put same-folder imports and `.` last.
|
|
91
|
+
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
};
|
package/index.js
CHANGED
|
@@ -1,118 +1,3 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
extends: [
|
|
3
|
-
'eslint:recommended',
|
|
4
|
-
'plugin:react/recommended',
|
|
5
|
-
'plugin:react-hooks/recommended',
|
|
6
|
-
'plugin:prettier/recommended',
|
|
7
|
-
'plugin:@typescript-eslint/recommended',
|
|
8
|
-
],
|
|
9
|
-
plugins: [
|
|
10
|
-
'react',
|
|
11
|
-
'react-hooks',
|
|
12
|
-
'prettier',
|
|
13
|
-
'import',
|
|
14
|
-
'@typescript-eslint',
|
|
15
|
-
'simple-import-sort',
|
|
16
|
-
],
|
|
17
|
-
parser: '@typescript-eslint/parser',
|
|
18
|
-
|
|
19
|
-
parserOptions: {
|
|
20
|
-
ecmaVersion: 6,
|
|
21
|
-
sourceType: 'module',
|
|
22
|
-
ecmaFeatures: {
|
|
23
|
-
jsx: true,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
settings: {
|
|
28
|
-
react: {version: 'detect'},
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
rules: {
|
|
32
|
-
// Best practices
|
|
33
|
-
'array-callback-return': ['warn'],
|
|
34
|
-
'consistent-return': ['warn'],
|
|
35
|
-
'no-caller': ['warn'],
|
|
36
|
-
'no-else-return': ['error', {allowElseIf: false}],
|
|
37
|
-
'no-extra-label': ['error'],
|
|
38
|
-
'no-floating-decimal': ['error'],
|
|
39
|
-
'no-implied-eval': ['error'],
|
|
40
|
-
'no-lone-blocks': ['error'],
|
|
41
|
-
'no-return-await': ['error'],
|
|
42
|
-
'no-self-compare': ['error'],
|
|
43
|
-
'no-sequences': ['error'],
|
|
44
|
-
'no-useless-call': ['warn'],
|
|
45
|
-
'no-useless-concat': ['warn'],
|
|
46
|
-
'no-useless-return': ['warn'],
|
|
47
|
-
'require-await': ['warn'],
|
|
48
|
-
curly: ['error'],
|
|
49
|
-
eqeqeq: ['error'],
|
|
50
|
-
radix: ['warn'],
|
|
51
|
-
|
|
52
|
-
// Variables
|
|
53
|
-
'no-undef-init': ['warn'],
|
|
54
|
-
|
|
55
|
-
// Style (mostly handled by prettier)
|
|
56
|
-
'eol-last': ['error', 'always'],
|
|
57
|
-
'new-parens': ['error'],
|
|
58
|
-
'padded-blocks': ['warn', 'never'],
|
|
59
|
-
'spaced-comment': ['warn', 'always'],
|
|
60
|
-
|
|
61
|
-
// ECMA 6
|
|
62
|
-
'no-var': ['error'],
|
|
63
|
-
'prefer-arrow-callback': ['warn'],
|
|
64
|
-
'prefer-const': ['error'],
|
|
65
|
-
'prefer-destructuring': ['off'],
|
|
66
|
-
'prefer-numeric-literals': ['warn'],
|
|
67
|
-
'prefer-rest-params': ['warn'],
|
|
68
|
-
'prefer-spread': ['warn'],
|
|
69
|
-
'prefer-template': ['warn'],
|
|
70
|
-
'arrow-body-style': ['error', 'as-needed'],
|
|
71
|
-
|
|
72
|
-
// React
|
|
73
|
-
'react/prop-types': ['off'],
|
|
74
|
-
'react/display-name': ['off'],
|
|
75
|
-
'react/no-access-state-in-setstate': ['warn'],
|
|
76
|
-
'react/no-this-in-sfc': ['warn'],
|
|
77
|
-
'react/prefer-stateless-function': ['warn'],
|
|
78
|
-
'react/jsx-boolean-value': ['warn'],
|
|
79
|
-
'react/jsx-pascal-case': ['warn'],
|
|
80
|
-
|
|
81
|
-
// disabled for typescript
|
|
82
|
-
'no-unused-expressions': ['off'],
|
|
83
|
-
|
|
84
|
-
// Typescript
|
|
85
|
-
'@typescript-eslint/explicit-function-return-type': ['off'],
|
|
86
|
-
'@typescript-eslint/no-use-before-define': ['off'],
|
|
87
|
-
'@typescript-eslint/no-explicit-any': ['off'],
|
|
88
|
-
'@typescript-eslint/no-non-null-assertion': ['off'],
|
|
89
|
-
'@typescript-eslint/explicit-module-boundary-types': ['off'],
|
|
90
|
-
'@typescript-eslint/no-unused-vars': ['error', {argsIgnorePattern: '^_'}],
|
|
91
|
-
'@typescript-eslint/no-unused-expressions': ['error'],
|
|
92
|
-
|
|
93
|
-
// see: https://github.com/typescript-eslint/typescript-eslint/issues/420
|
|
94
|
-
'@typescript-eslint/no-useless-constructor': 'error',
|
|
95
|
-
|
|
96
|
-
// Sort imports
|
|
97
|
-
'simple-import-sort/exports': 'error',
|
|
98
|
-
'simple-import-sort/imports': [
|
|
99
|
-
'error',
|
|
100
|
-
{
|
|
101
|
-
groups: [
|
|
102
|
-
// Side effect imports.
|
|
103
|
-
['^\\u0000'],
|
|
104
|
-
// Packages. `react` related packages come first.
|
|
105
|
-
['^react', '^@?\\w'],
|
|
106
|
-
// Node.js builtins.
|
|
107
|
-
[`^(${require('module').builtinModules.join('|')})(/|$)`],
|
|
108
|
-
// Internal packages.
|
|
109
|
-
['^(src|app)(/.*|$)'],
|
|
110
|
-
// Parent imports. Put `..` last.
|
|
111
|
-
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
|
|
112
|
-
// Other relative imports. Put same-folder imports and `.` last.
|
|
113
|
-
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
|
|
114
|
-
],
|
|
115
|
-
},
|
|
116
|
-
],
|
|
117
|
-
},
|
|
2
|
+
extends: ['./common', './react'],
|
|
118
3
|
};
|
package/package.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evanpurkhiser/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Evan Purkhiser's personal eslint configuration",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": "https://github.com/evanpurkhiser/eslint-config",
|
|
7
7
|
"author": "Evan Purkhiser",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
11
|
-
"@typescript-eslint/parser": "^5.
|
|
10
|
+
"@typescript-eslint/eslint-plugin": "^5.40.1",
|
|
11
|
+
"@typescript-eslint/parser": "^5.40.1",
|
|
12
12
|
"babel-eslint": "^10.0.1",
|
|
13
13
|
"eslint-config-prettier": "^8.5.0",
|
|
14
14
|
"eslint-plugin-babel": "^5.3.1",
|
|
15
15
|
"eslint-plugin-import": "^2.26.0",
|
|
16
16
|
"eslint-plugin-prettier": "^4.2.1",
|
|
17
|
-
"eslint-plugin-react": "^7.
|
|
17
|
+
"eslint-plugin-react": "^7.31.10",
|
|
18
18
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
19
|
-
"eslint-plugin-simple-import-sort": "^
|
|
19
|
+
"eslint-plugin-simple-import-sort": "^8.0.0"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"eslint": ">=3.0.0",
|
|
@@ -24,5 +24,9 @@
|
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"prettier": "^2.7.1"
|
|
27
|
+
},
|
|
28
|
+
"volta": {
|
|
29
|
+
"node": "16.18.0",
|
|
30
|
+
"yarn": "1.22.18"
|
|
27
31
|
}
|
|
28
32
|
}
|
package/react.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
extends: ['plugin:react/recommended', 'plugin:react-hooks/recommended'],
|
|
3
|
+
plugins: ['react', 'react-hooks'],
|
|
4
|
+
|
|
5
|
+
settings: {
|
|
6
|
+
react: {version: 'detect'},
|
|
7
|
+
},
|
|
8
|
+
|
|
9
|
+
rules: {
|
|
10
|
+
'react/prop-types': ['off'],
|
|
11
|
+
'react/display-name': ['off'],
|
|
12
|
+
'react/no-access-state-in-setstate': ['warn'],
|
|
13
|
+
'react/no-this-in-sfc': ['warn'],
|
|
14
|
+
'react/prefer-stateless-function': ['warn'],
|
|
15
|
+
'react/jsx-boolean-value': ['warn'],
|
|
16
|
+
'react/jsx-pascal-case': ['warn'],
|
|
17
|
+
},
|
|
18
|
+
};
|