@thermarthae/eslint-config 2.0.0 → 3.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/README.md +4 -4
- package/base.cjs +0 -2
- package/index.cjs +45 -20
- package/package.json +20 -24
- package/shared.cjs +60 -67
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @thermarthae/eslint-config
|
|
2
2
|
|
|
3
|
-
Just
|
|
3
|
+
Just an Eslint config.
|
|
4
4
|
|
|
5
5
|
## ✨ Setup
|
|
6
6
|
|
|
@@ -9,13 +9,13 @@ Just a personalized [Airbnb](https://www.npmjs.com/package/eslint-config-airbnb)
|
|
|
9
9
|
This step assumes that you have already installed Eslint and Typescript.
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
yarn add -D @thermarthae/eslint-config @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-simple-import-sort
|
|
12
|
+
yarn add -D @thermarthae/eslint-config @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-simple-import-sort @stylistic/eslint-plugin
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
If you don't need React support:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
yarn add -D @thermarthae/eslint-config @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-import eslint-plugin-simple-import-sort
|
|
18
|
+
yarn add -D @thermarthae/eslint-config @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-import eslint-plugin-simple-import-sort @stylistic/eslint-plugin
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
### 2) Configure ESLint
|
|
@@ -27,7 +27,7 @@ An example `.eslintrc.cjs`:
|
|
|
27
27
|
```js
|
|
28
28
|
module.exports = {
|
|
29
29
|
// If you don't need React support:
|
|
30
|
-
// extends: ['@thermarthae/eslint-config/base'],
|
|
30
|
+
// extends: ['@thermarthae/eslint-config/base.cjs'],
|
|
31
31
|
extends: ['@thermarthae/eslint-config'],
|
|
32
32
|
};
|
|
33
33
|
```
|
package/base.cjs
CHANGED
package/index.cjs
CHANGED
|
@@ -1,30 +1,55 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
extends: [
|
|
3
|
-
'airbnb',
|
|
4
|
-
'airbnb-typescript',
|
|
5
|
-
'airbnb/hooks',
|
|
6
|
-
'plugin:react/jsx-runtime',
|
|
7
3
|
'./shared.cjs',
|
|
4
|
+
'plugin:react/recommended',
|
|
5
|
+
'plugin:react/jsx-runtime',
|
|
6
|
+
'plugin:react-hooks/recommended',
|
|
7
|
+
'plugin:jsx-a11y/recommended',
|
|
8
8
|
],
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
'@typescript-eslint/member-ordering': 0, // `react/sort-comp` is handling this out
|
|
14
|
-
'consistent-return': 0, // annoys inside react hooks
|
|
15
|
-
},
|
|
9
|
+
plugins: ['jsx-a11y'],
|
|
10
|
+
settings: {
|
|
11
|
+
react: {
|
|
12
|
+
version: 'detect',
|
|
16
13
|
},
|
|
17
|
-
|
|
14
|
+
},
|
|
18
15
|
rules: {
|
|
19
|
-
'react/
|
|
20
|
-
'react/function-component-definition': 0,
|
|
21
|
-
'react/jsx-indent': ['error', 'tab'],
|
|
22
|
-
'react/jsx-indent-props': ['error', 'tab'],
|
|
23
|
-
'react/jsx-props-no-spreading': 0,
|
|
16
|
+
'react/no-unknown-property': 0,
|
|
24
17
|
'react/no-children-prop': 0,
|
|
25
18
|
'react/prop-types': 0,
|
|
26
|
-
'react/
|
|
27
|
-
'react/
|
|
28
|
-
'react/
|
|
19
|
+
'react/jsx-boolean-value': ['error', 'never', { always: [] }],
|
|
20
|
+
'react/jsx-closing-bracket-location': ['error', 'line-aligned'],
|
|
21
|
+
'react/jsx-closing-tag-location': 'error',
|
|
22
|
+
'react/jsx-curly-spacing': ['error', 'never', { allowMultiline: true }],
|
|
23
|
+
'react/jsx-max-props-per-line': ['error', { maximum: 1, when: 'multiline' }],
|
|
24
|
+
'react/self-closing-comp': 'error',
|
|
25
|
+
'react/jsx-wrap-multilines': ['error', {
|
|
26
|
+
declaration: 'parens-new-line',
|
|
27
|
+
assignment: 'parens-new-line',
|
|
28
|
+
return: 'parens-new-line',
|
|
29
|
+
arrow: 'parens-new-line',
|
|
30
|
+
condition: 'parens-new-line',
|
|
31
|
+
logical: 'parens-new-line',
|
|
32
|
+
prop: 'parens-new-line',
|
|
33
|
+
}],
|
|
34
|
+
'react/jsx-first-prop-new-line': 'error',
|
|
35
|
+
'react/jsx-tag-spacing': ['error', {
|
|
36
|
+
closingSlash: 'never',
|
|
37
|
+
beforeSelfClosing: 'always',
|
|
38
|
+
afterOpening: 'never',
|
|
39
|
+
beforeClosing: 'never',
|
|
40
|
+
}],
|
|
41
|
+
'react/void-dom-elements-no-children': 'error',
|
|
42
|
+
'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never', propElementValues: 'always' }],
|
|
43
|
+
'react/jsx-one-expression-per-line': ['error', { allow: 'single-child' }],
|
|
44
|
+
'react/button-has-type': ['error', {
|
|
45
|
+
button: true,
|
|
46
|
+
submit: true,
|
|
47
|
+
reset: false,
|
|
48
|
+
}],
|
|
49
|
+
'react/jsx-props-no-multi-spaces': 'error',
|
|
50
|
+
'react/jsx-curly-newline': 'error',
|
|
51
|
+
'react/jsx-no-useless-fragment': 'error',
|
|
52
|
+
'react/jsx-no-constructed-context-values': 'error',
|
|
53
|
+
'react/no-unstable-nested-components': 'error',
|
|
29
54
|
},
|
|
30
55
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thermarthae/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"main": "index.cjs",
|
|
5
5
|
"description": "Just a personal eslint config",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,34 +14,33 @@
|
|
|
14
14
|
"index.cjs",
|
|
15
15
|
"shared.cjs"
|
|
16
16
|
],
|
|
17
|
-
"packageManager": "yarn@
|
|
17
|
+
"packageManager": "yarn@4.1.0+sha256.81a00df816059803e6b5148acf03ce313cad36b7f6e5af6efa040a15981a6ffb",
|
|
18
18
|
"scripts": {
|
|
19
|
-
"update": "yarn set version latest",
|
|
20
19
|
"pnpify": "yarn dlx @yarnpkg/sdks vscode"
|
|
21
20
|
},
|
|
22
|
-
"
|
|
23
|
-
"eslint-
|
|
24
|
-
"eslint-
|
|
25
|
-
"eslint-config-airbnb-typescript": "^17.0.0"
|
|
21
|
+
"resolutions": {
|
|
22
|
+
"@stylistic/eslint-plugin-plus/@typescript-eslint/utils": "^7.1.0",
|
|
23
|
+
"@stylistic/eslint-plugin-ts/@typescript-eslint/utils": "^7.1.0"
|
|
26
24
|
},
|
|
27
25
|
"devDependencies": {
|
|
28
|
-
"@
|
|
29
|
-
"@typescript-eslint/
|
|
30
|
-
"eslint": "^
|
|
31
|
-
"eslint
|
|
32
|
-
"eslint-plugin-
|
|
33
|
-
"
|
|
26
|
+
"@stylistic/eslint-plugin": "^1.6.2",
|
|
27
|
+
"@typescript-eslint/eslint-plugin": "^7.1.0",
|
|
28
|
+
"@typescript-eslint/parser": "^7.1.0",
|
|
29
|
+
"eslint": "^8.57.0",
|
|
30
|
+
"eslint-plugin-import": "^2.29.1",
|
|
31
|
+
"eslint-plugin-simple-import-sort": "^12.0.0",
|
|
32
|
+
"typescript": "^5.3.3"
|
|
34
33
|
},
|
|
35
34
|
"peerDependencies": {
|
|
36
|
-
"@
|
|
37
|
-
"@typescript-eslint/parser": "^
|
|
38
|
-
"eslint": "^8.
|
|
39
|
-
"eslint-plugin-import": "^2.
|
|
40
|
-
"eslint-plugin-jsx-a11y": "^6.
|
|
41
|
-
"eslint-plugin-react": "^7.
|
|
35
|
+
"@stylistic/eslint-plugin": "^1.6.2",
|
|
36
|
+
"@typescript-eslint/parser": "^6.20.0 || ^7.1.0",
|
|
37
|
+
"eslint": "^8.56.0",
|
|
38
|
+
"eslint-plugin-import": "^2.29.1",
|
|
39
|
+
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
40
|
+
"eslint-plugin-react": "^7.33.2",
|
|
42
41
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
43
|
-
"eslint-plugin-simple-import-sort": "^
|
|
44
|
-
"typescript": "^
|
|
42
|
+
"eslint-plugin-simple-import-sort": "^12.0.0",
|
|
43
|
+
"typescript": "^5.3.3"
|
|
45
44
|
},
|
|
46
45
|
"peerDependenciesMeta": {
|
|
47
46
|
"eslint-config-prettier": {
|
|
@@ -55,9 +54,6 @@
|
|
|
55
54
|
},
|
|
56
55
|
"eslint-plugin-react-hooks": {
|
|
57
56
|
"optional": true
|
|
58
|
-
},
|
|
59
|
-
"eslint-plugin-simple-import-sort": {
|
|
60
|
-
"optional": true
|
|
61
57
|
}
|
|
62
58
|
}
|
|
63
59
|
}
|
package/shared.cjs
CHANGED
|
@@ -1,15 +1,38 @@
|
|
|
1
|
+
const stylistic = require('@stylistic/eslint-plugin');
|
|
2
|
+
|
|
3
|
+
const customized = stylistic.configs.customize({
|
|
4
|
+
indent: 'tab',
|
|
5
|
+
semi: true,
|
|
6
|
+
jsx: false,
|
|
7
|
+
braceStyle: '1tbs',
|
|
8
|
+
quoteProps: 'as-needed',
|
|
9
|
+
});
|
|
10
|
+
|
|
1
11
|
module.exports = {
|
|
2
12
|
extends: [
|
|
3
|
-
'
|
|
4
|
-
'plugin:@typescript-eslint/recommended-
|
|
13
|
+
'eslint:recommended',
|
|
14
|
+
'plugin:@typescript-eslint/recommended-type-checked',
|
|
15
|
+
'plugin:@typescript-eslint/stylistic-type-checked',
|
|
16
|
+
'plugin:@stylistic/disable-legacy',
|
|
5
17
|
],
|
|
6
|
-
plugins: [
|
|
18
|
+
plugins: [
|
|
19
|
+
'@typescript-eslint',
|
|
20
|
+
'import',
|
|
21
|
+
'simple-import-sort',
|
|
22
|
+
'@stylistic',
|
|
23
|
+
],
|
|
24
|
+
parser: '@typescript-eslint/parser',
|
|
7
25
|
parserOptions: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
warnOnUnsupportedTypeScriptVersion: false,
|
|
26
|
+
project: true,
|
|
27
|
+
sourceType: 'module',
|
|
11
28
|
},
|
|
12
29
|
overrides: [
|
|
30
|
+
{
|
|
31
|
+
files: ['*.cjs'],
|
|
32
|
+
env: {
|
|
33
|
+
node: true,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
13
36
|
{
|
|
14
37
|
files: ['*.cjs', '*.js'],
|
|
15
38
|
rules: {
|
|
@@ -20,14 +43,22 @@ module.exports = {
|
|
|
20
43
|
'@typescript-eslint/no-var-requires': 0,
|
|
21
44
|
},
|
|
22
45
|
},
|
|
23
|
-
{
|
|
24
|
-
files: '*.d.ts',
|
|
25
|
-
rules: {
|
|
26
|
-
'import/prefer-default-export': 0,
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
46
|
],
|
|
30
47
|
rules: {
|
|
48
|
+
...customized.rules,
|
|
49
|
+
'@stylistic/arrow-parens': ['error', 'as-needed', {
|
|
50
|
+
requireForBlockBody: true,
|
|
51
|
+
}],
|
|
52
|
+
'@stylistic/linebreak-style': ['error', 'windows'],
|
|
53
|
+
'@stylistic/max-len': ['error', { code: 120 }],
|
|
54
|
+
'@stylistic/no-multiple-empty-lines': ['error', {
|
|
55
|
+
max: 3,
|
|
56
|
+
maxBOF: 0,
|
|
57
|
+
maxEOF: 1,
|
|
58
|
+
}],
|
|
59
|
+
'@stylistic/max-statements-per-line': 0,
|
|
60
|
+
'@stylistic/indent-binary-ops': 0,
|
|
61
|
+
//
|
|
31
62
|
'@typescript-eslint/array-type': ['error', {
|
|
32
63
|
default: 'array-simple',
|
|
33
64
|
}],
|
|
@@ -35,63 +66,16 @@ module.exports = {
|
|
|
35
66
|
assertionStyle: 'as',
|
|
36
67
|
objectLiteralTypeAssertions: 'allow-as-parameter',
|
|
37
68
|
}],
|
|
38
|
-
'@typescript-eslint/
|
|
39
|
-
'@typescript-eslint/
|
|
40
|
-
'@typescript-eslint/
|
|
41
|
-
multiline: {
|
|
42
|
-
delimiter: 'semi',
|
|
43
|
-
requireLast: true,
|
|
44
|
-
},
|
|
45
|
-
singleline: {
|
|
46
|
-
delimiter: 'semi',
|
|
47
|
-
requireLast: false,
|
|
48
|
-
},
|
|
49
|
-
}],
|
|
50
|
-
'@typescript-eslint/member-ordering': 'error',
|
|
51
|
-
'@typescript-eslint/no-explicit-any': 0,
|
|
69
|
+
'@typescript-eslint/consistent-type-definitions': 0,
|
|
70
|
+
'@typescript-eslint/no-unused-vars': 0,
|
|
71
|
+
'@typescript-eslint/no-empty-function': 0,
|
|
52
72
|
'@typescript-eslint/no-misused-promises': ['error', {
|
|
53
73
|
checksVoidReturn: false,
|
|
54
74
|
}],
|
|
55
|
-
'@typescript-eslint/no-
|
|
56
|
-
'@typescript-eslint/no-
|
|
57
|
-
'@typescript-eslint/no-unsafe-assignment': 0, // its not very performant
|
|
58
|
-
'@typescript-eslint/prefer-optional-chain': 'error',
|
|
75
|
+
'@typescript-eslint/no-unnecessary-type-arguments': 'warn',
|
|
76
|
+
'@typescript-eslint/no-shadow': 'error',
|
|
59
77
|
'@typescript-eslint/promise-function-async': 'error',
|
|
60
|
-
|
|
61
|
-
requireForBlockBody: true,
|
|
62
|
-
}],
|
|
63
|
-
'import/no-cycle': 0,
|
|
64
|
-
'import/no-named-as-default': 0, // its not very performant
|
|
65
|
-
'linebreak-style': ['error', 'windows'],
|
|
66
|
-
'max-len': ['error', { code: 120 }],
|
|
67
|
-
'no-console': 0,
|
|
68
|
-
'no-multiple-empty-lines': ['error', {
|
|
69
|
-
max: 3,
|
|
70
|
-
maxBOF: 0,
|
|
71
|
-
maxEOF: 1,
|
|
72
|
-
}],
|
|
73
|
-
'no-param-reassign': ['error', {
|
|
74
|
-
ignorePropertyModificationsFor: [
|
|
75
|
-
'request',
|
|
76
|
-
'reply',
|
|
77
|
-
'session',
|
|
78
|
-
],
|
|
79
|
-
props: true,
|
|
80
|
-
}],
|
|
81
|
-
'no-restricted-exports': 0,
|
|
82
|
-
'no-restricted-syntax': [
|
|
83
|
-
'error',
|
|
84
|
-
{
|
|
85
|
-
selector: 'ForInStatement',
|
|
86
|
-
message: 'for..in loops iterate over the entire prototype chain,'
|
|
87
|
-
+ ' which is virtually never what you want. Use Object.{keys,values,entries},'
|
|
88
|
-
+ ' and iterate over the resulting array.',
|
|
89
|
-
},
|
|
90
|
-
],
|
|
91
|
-
'no-tabs': 0,
|
|
92
|
-
'no-void': ['error', {
|
|
93
|
-
allowAsStatement: true,
|
|
94
|
-
}],
|
|
78
|
+
//
|
|
95
79
|
'simple-import-sort/imports': ['warn', {
|
|
96
80
|
groups: [
|
|
97
81
|
// Side effect imports.
|
|
@@ -118,8 +102,17 @@ module.exports = {
|
|
|
118
102
|
],
|
|
119
103
|
],
|
|
120
104
|
}],
|
|
121
|
-
|
|
122
|
-
|
|
105
|
+
//
|
|
106
|
+
'no-param-reassign': ['error', {
|
|
107
|
+
ignorePropertyModificationsFor: [
|
|
108
|
+
'request',
|
|
109
|
+
'reply',
|
|
110
|
+
'session',
|
|
111
|
+
'state',
|
|
112
|
+
],
|
|
113
|
+
props: true,
|
|
123
114
|
}],
|
|
115
|
+
'no-void': ['error', { allowAsStatement: true }],
|
|
116
|
+
yoda: ['error', 'never', { exceptRange: true }],
|
|
124
117
|
},
|
|
125
118
|
};
|