@thermarthae/eslint-config 0.1.1 → 2.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 +44 -50
- package/{base.js → base.cjs} +7 -6
- package/{index.js → index.cjs} +30 -27
- package/package.json +31 -29
- package/{shared.js → shared.cjs} +40 -2
package/README.md
CHANGED
|
@@ -1,50 +1,44 @@
|
|
|
1
|
-
# @thermarthae/eslint-config
|
|
2
|
-
|
|
3
|
-
Just a personalized [Airbnb](https://www.npmjs.com/package/eslint-config-airbnb) Eslint config.
|
|
4
|
-
|
|
5
|
-
## ✨ Setup
|
|
6
|
-
|
|
7
|
-
### 1) Install
|
|
8
|
-
|
|
9
|
-
This step assumes that you have already installed Eslint and Typescript.
|
|
10
|
-
|
|
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
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
If you don't need React support:
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
yarn add -D @thermarthae/eslint-config @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-import
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
### 2) Configure ESLint
|
|
22
|
-
|
|
23
|
-
Add `"extends": "@thermarthae/eslint-config"` to your ESLint config file.
|
|
24
|
-
|
|
25
|
-
An example `.eslintrc.
|
|
26
|
-
|
|
27
|
-
```js
|
|
28
|
-
module.exports = {
|
|
29
|
-
// If you don't need React support:
|
|
30
|
-
// extends: ['@thermarthae/eslint-config/base'],
|
|
31
|
-
extends: ['@thermarthae/eslint-config'],
|
|
32
|
-
};
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
**Note**: If your `tsconfig.json` is not in the same directory as `package.json`, you will have to set the path yourself:
|
|
36
|
-
|
|
37
|
-
```diff
|
|
38
|
-
module.exports = {
|
|
39
|
-
extends: ['@thermarthae/eslint-config'],
|
|
40
|
-
+ parserOptions: {
|
|
41
|
-
+ project: './foo/bar/tsconfig.json',
|
|
42
|
-
+ },
|
|
43
|
-
};
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## 📝 License
|
|
47
|
-
|
|
48
|
-
Copyright © 2020 [thermarthae](https://github.com/thermarthae).
|
|
49
|
-
|
|
50
|
-
This project is [MIT](https://github.com/thermarthae/eslint-config/blob/master/LICENSE.md) licensed.
|
|
1
|
+
# @thermarthae/eslint-config
|
|
2
|
+
|
|
3
|
+
Just a personalized [Airbnb](https://www.npmjs.com/package/eslint-config-airbnb) Eslint config.
|
|
4
|
+
|
|
5
|
+
## ✨ Setup
|
|
6
|
+
|
|
7
|
+
### 1) Install
|
|
8
|
+
|
|
9
|
+
This step assumes that you have already installed Eslint and Typescript.
|
|
10
|
+
|
|
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
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
If you don't need React support:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
yarn add -D @thermarthae/eslint-config @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-import eslint-plugin-simple-import-sort
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### 2) Configure ESLint
|
|
22
|
+
|
|
23
|
+
Add `"extends": "@thermarthae/eslint-config"` to your ESLint config file.
|
|
24
|
+
|
|
25
|
+
An example `.eslintrc.cjs`:
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
module.exports = {
|
|
29
|
+
// If you don't need React support:
|
|
30
|
+
// extends: ['@thermarthae/eslint-config/base'],
|
|
31
|
+
extends: ['@thermarthae/eslint-config'],
|
|
32
|
+
};
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Note**: If your `tsconfig.json` is not in the same directory as `package.json`, you will have to set the path yourself:
|
|
36
|
+
|
|
37
|
+
```diff
|
|
38
|
+
module.exports = {
|
|
39
|
+
extends: ['@thermarthae/eslint-config'],
|
|
40
|
+
+ parserOptions: {
|
|
41
|
+
+ project: './foo/bar/tsconfig.json',
|
|
42
|
+
+ },
|
|
43
|
+
};
|
|
44
|
+
```
|
package/{base.js → base.cjs}
RENAMED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
extends: [
|
|
3
|
-
'airbnb-
|
|
4
|
-
'
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
module.exports = {
|
|
2
|
+
extends: [
|
|
3
|
+
'airbnb-base',
|
|
4
|
+
'airbnb-typescript/base',
|
|
5
|
+
'./shared.cjs',
|
|
6
|
+
],
|
|
7
|
+
};
|
package/{index.js → index.cjs}
RENAMED
|
@@ -1,27 +1,30 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
extends: [
|
|
3
|
-
'airbnb
|
|
4
|
-
'airbnb
|
|
5
|
-
'
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
'react/
|
|
20
|
-
'react/
|
|
21
|
-
'react/
|
|
22
|
-
'react/
|
|
23
|
-
'react/
|
|
24
|
-
'react/
|
|
25
|
-
'react/
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
module.exports = {
|
|
2
|
+
extends: [
|
|
3
|
+
'airbnb',
|
|
4
|
+
'airbnb-typescript',
|
|
5
|
+
'airbnb/hooks',
|
|
6
|
+
'plugin:react/jsx-runtime',
|
|
7
|
+
'./shared.cjs',
|
|
8
|
+
],
|
|
9
|
+
overrides: [
|
|
10
|
+
{
|
|
11
|
+
files: '*.tsx',
|
|
12
|
+
rules: {
|
|
13
|
+
'@typescript-eslint/member-ordering': 0, // `react/sort-comp` is handling this out
|
|
14
|
+
'consistent-return': 0, // annoys inside react hooks
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
rules: {
|
|
19
|
+
'react/destructuring-assignment': 0,
|
|
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,
|
|
24
|
+
'react/no-children-prop': 0,
|
|
25
|
+
'react/prop-types': 0,
|
|
26
|
+
'react/require-default-props': 0,
|
|
27
|
+
'react/state-in-constructor': ['error', 'never'],
|
|
28
|
+
'react/static-property-placement': ['error', 'static public field'],
|
|
29
|
+
},
|
|
30
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thermarthae/eslint-config",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"main": "index.
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"main": "index.cjs",
|
|
5
5
|
"description": "Just a personal eslint config",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "thermarthae <thermarthae@protonmail.com>",
|
|
@@ -10,44 +10,43 @@
|
|
|
10
10
|
"url": "git+https://github.com/thermarthae/eslint-config.git"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
|
-
"base.
|
|
14
|
-
"index.
|
|
15
|
-
"shared.
|
|
13
|
+
"base.cjs",
|
|
14
|
+
"index.cjs",
|
|
15
|
+
"shared.cjs"
|
|
16
16
|
],
|
|
17
|
-
"
|
|
18
|
-
"node": ">=10"
|
|
19
|
-
},
|
|
17
|
+
"packageManager": "yarn@3.4.1",
|
|
20
18
|
"scripts": {
|
|
21
19
|
"update": "yarn set version latest",
|
|
22
|
-
"pnpify": "yarn dlx @yarnpkg/
|
|
23
|
-
},
|
|
24
|
-
"resolutions": {
|
|
25
|
-
"eslint-config-airbnb-typescript/@typescript-eslint/parser": "*",
|
|
26
|
-
"eslint-config-airbnb-typescript/eslint-config-airbnb": "*",
|
|
27
|
-
"eslint-config-airbnb-typescript/eslint-config-airbnb-base": "*"
|
|
20
|
+
"pnpify": "yarn dlx @yarnpkg/sdks vscode"
|
|
28
21
|
},
|
|
29
22
|
"dependencies": {
|
|
30
|
-
"eslint-config-airbnb": "^
|
|
31
|
-
"eslint-config-airbnb-
|
|
23
|
+
"eslint-config-airbnb": "^19.0.4",
|
|
24
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
25
|
+
"eslint-config-airbnb-typescript": "^17.0.0"
|
|
32
26
|
},
|
|
33
27
|
"devDependencies": {
|
|
34
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
35
|
-
"@typescript-eslint/parser": "^
|
|
36
|
-
"eslint": "^
|
|
37
|
-
"eslint-plugin-import": "^2.
|
|
38
|
-
"
|
|
28
|
+
"@typescript-eslint/eslint-plugin": "^5.55.0",
|
|
29
|
+
"@typescript-eslint/parser": "^5.55.0",
|
|
30
|
+
"eslint": "^8.36.0",
|
|
31
|
+
"eslint-plugin-import": "^2.27.5",
|
|
32
|
+
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
33
|
+
"typescript": "^4.9.5"
|
|
39
34
|
},
|
|
40
35
|
"peerDependencies": {
|
|
41
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
42
|
-
"@typescript-eslint/parser": "^
|
|
43
|
-
"eslint": "^
|
|
44
|
-
"eslint-plugin-import": "^2.
|
|
45
|
-
"eslint-plugin-jsx-a11y": "^6.
|
|
46
|
-
"eslint-plugin-react": "^7.
|
|
47
|
-
"eslint-plugin-react-hooks": "^4.
|
|
48
|
-
"
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "^5.55.0",
|
|
37
|
+
"@typescript-eslint/parser": "^5.55.0",
|
|
38
|
+
"eslint": "^8.36.0",
|
|
39
|
+
"eslint-plugin-import": "^2.27.5",
|
|
40
|
+
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
41
|
+
"eslint-plugin-react": "^7.32.2",
|
|
42
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
43
|
+
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
44
|
+
"typescript": "^4.9.5 || ^5.0.0"
|
|
49
45
|
},
|
|
50
46
|
"peerDependenciesMeta": {
|
|
47
|
+
"eslint-config-prettier": {
|
|
48
|
+
"optional": true
|
|
49
|
+
},
|
|
51
50
|
"eslint-plugin-jsx-a11y": {
|
|
52
51
|
"optional": true
|
|
53
52
|
},
|
|
@@ -56,6 +55,9 @@
|
|
|
56
55
|
},
|
|
57
56
|
"eslint-plugin-react-hooks": {
|
|
58
57
|
"optional": true
|
|
58
|
+
},
|
|
59
|
+
"eslint-plugin-simple-import-sort": {
|
|
60
|
+
"optional": true
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
63
|
}
|
package/{shared.js → shared.cjs}
RENAMED
|
@@ -3,14 +3,15 @@ module.exports = {
|
|
|
3
3
|
'plugin:@typescript-eslint/recommended',
|
|
4
4
|
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
|
5
5
|
],
|
|
6
|
+
plugins: ['simple-import-sort'],
|
|
6
7
|
parserOptions: {
|
|
7
|
-
ecmaVersion:
|
|
8
|
+
ecmaVersion: 'latest',
|
|
8
9
|
project: 'tsconfig.json',
|
|
9
10
|
warnOnUnsupportedTypeScriptVersion: false,
|
|
10
11
|
},
|
|
11
12
|
overrides: [
|
|
12
13
|
{
|
|
13
|
-
files: '*.js',
|
|
14
|
+
files: ['*.cjs', '*.js'],
|
|
14
15
|
rules: {
|
|
15
16
|
'@typescript-eslint/ban-ts-comment': 0,
|
|
16
17
|
'@typescript-eslint/no-unsafe-assignment': 0,
|
|
@@ -61,6 +62,7 @@ module.exports = {
|
|
|
61
62
|
}],
|
|
62
63
|
'import/no-cycle': 0,
|
|
63
64
|
'import/no-named-as-default': 0, // its not very performant
|
|
65
|
+
'linebreak-style': ['error', 'windows'],
|
|
64
66
|
'max-len': ['error', { code: 120 }],
|
|
65
67
|
'no-console': 0,
|
|
66
68
|
'no-multiple-empty-lines': ['error', {
|
|
@@ -76,10 +78,46 @@ module.exports = {
|
|
|
76
78
|
],
|
|
77
79
|
props: true,
|
|
78
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
|
+
],
|
|
79
91
|
'no-tabs': 0,
|
|
80
92
|
'no-void': ['error', {
|
|
81
93
|
allowAsStatement: true,
|
|
82
94
|
}],
|
|
95
|
+
'simple-import-sort/imports': ['warn', {
|
|
96
|
+
groups: [
|
|
97
|
+
// Side effect imports.
|
|
98
|
+
['^\\u0000'],
|
|
99
|
+
[
|
|
100
|
+
'^node:',
|
|
101
|
+
'react',
|
|
102
|
+
// Things that start with a letter (or digit or underscore), or `@` followed by a letter.
|
|
103
|
+
'^@?\\w',
|
|
104
|
+
],
|
|
105
|
+
// Absolute imports and other imports such as Vue-style `@/foo`.
|
|
106
|
+
['^'],
|
|
107
|
+
[
|
|
108
|
+
// ../whatever/
|
|
109
|
+
'^\\.\\./(?=.*/)',
|
|
110
|
+
// ../
|
|
111
|
+
'^\\.\\./',
|
|
112
|
+
],
|
|
113
|
+
[
|
|
114
|
+
// ./whatever/
|
|
115
|
+
'^\\./(?=.*/)',
|
|
116
|
+
// ./
|
|
117
|
+
'^\\./',
|
|
118
|
+
],
|
|
119
|
+
],
|
|
120
|
+
}],
|
|
83
121
|
yoda: ['error', 'never', {
|
|
84
122
|
exceptRange: true,
|
|
85
123
|
}],
|