@viclafouch/eslint-config-viclafouch 4.1.0 → 4.1.1-beta.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/package.json +9 -9
- package/rules/imports.js +32 -2
- package/rules/typescript.js +32 -32
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viclafouch/eslint-config-viclafouch",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.1-beta.1",
|
|
4
4
|
"description": "ESLint and Prettier Config from Victor de la Fouchardiere",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"keywords": [
|
|
@@ -31,24 +31,24 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@total-typescript/ts-reset": "^0.4.2",
|
|
33
33
|
"get-tsconfig": "^4.6.2",
|
|
34
|
-
"@babel/core": "^7.22.
|
|
35
|
-
"@babel/eslint-parser": "^7.22.
|
|
36
|
-
"@next/eslint-plugin-next": "^13.4.
|
|
34
|
+
"@babel/core": "^7.22.8",
|
|
35
|
+
"@babel/eslint-parser": "^7.22.7",
|
|
36
|
+
"@next/eslint-plugin-next": "^13.4.9",
|
|
37
37
|
"@rushstack/eslint-patch": "^1.3.2",
|
|
38
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
39
|
-
"@typescript-eslint/parser": "^
|
|
40
|
-
"babel-loader": "^9.1.
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
39
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
40
|
+
"babel-loader": "^9.1.3",
|
|
41
41
|
"eslint": "^8.44.0",
|
|
42
42
|
"eslint-config-prettier": "^8.8.0",
|
|
43
43
|
"eslint-plugin-import": "^2.27.5",
|
|
44
44
|
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
45
|
-
"eslint-plugin-prettier": "^
|
|
45
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
46
46
|
"eslint-plugin-promise": "^6.1.1",
|
|
47
47
|
"eslint-plugin-react": "^7.32.2",
|
|
48
48
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
49
49
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
50
50
|
"eslint-plugin-testing-library": "^5.11.0",
|
|
51
|
-
"prettier": "^
|
|
51
|
+
"prettier": "^3.0.0",
|
|
52
52
|
"typescript": "^5.x.x"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
package/rules/imports.js
CHANGED
|
@@ -7,11 +7,41 @@ module.exports = {
|
|
|
7
7
|
},
|
|
8
8
|
plugins: ['simple-import-sort', 'import'],
|
|
9
9
|
rules: {
|
|
10
|
-
'simple-import-sort/imports': 'error',
|
|
11
10
|
'simple-import-sort/exports': 'error',
|
|
12
11
|
'import/first': 'error',
|
|
13
12
|
'import/newline-after-import': 'error',
|
|
14
|
-
'import/no-duplicates': 'error'
|
|
13
|
+
'import/no-duplicates': 'error',
|
|
14
|
+
'simple-import-sort/imports': [
|
|
15
|
+
'error',
|
|
16
|
+
{
|
|
17
|
+
groups: [
|
|
18
|
+
[
|
|
19
|
+
// Anything that starts with react
|
|
20
|
+
// e.g: import { useState } from 'react'
|
|
21
|
+
// e.g: import { useFela } from 'react-fela'
|
|
22
|
+
'^react',
|
|
23
|
+
// Anything that starts with next
|
|
24
|
+
// e.g: import { useRouter } from 'next/router'
|
|
25
|
+
'^next',
|
|
26
|
+
// Anything that starts with a letter
|
|
27
|
+
// e.g: import Downshift from 'downshift'
|
|
28
|
+
'^[a-z]',
|
|
29
|
+
// Anything that starts with @
|
|
30
|
+
// e.g: import { yupResolver } from '@hookform/resolvers/yup'
|
|
31
|
+
'^@',
|
|
32
|
+
// Anything that starts with a dot
|
|
33
|
+
// e.g: import { matchIsDate } from './utils/date
|
|
34
|
+
'^\\.',
|
|
35
|
+
// Side effect imports from lib
|
|
36
|
+
// e.g: import 'react-toastify/dist/ReactToastify.css'
|
|
37
|
+
'^\\u0000',
|
|
38
|
+
// Side effect import that starts with a dot
|
|
39
|
+
// e.g: import './setup-config'
|
|
40
|
+
'^\\u0000\\.'
|
|
41
|
+
]
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
]
|
|
15
45
|
},
|
|
16
46
|
settings: {
|
|
17
47
|
'import/resolver': {
|
package/rules/typescript.js
CHANGED
|
@@ -14,87 +14,87 @@ module.exports = {
|
|
|
14
14
|
'import/parsers': {
|
|
15
15
|
'@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts']
|
|
16
16
|
},
|
|
17
|
-
// Append 'ts' extensions to
|
|
17
|
+
// Append 'ts' extensions to @viclafouch/eslint 'import/resolver' setting
|
|
18
18
|
// Original: ['.mjs', '.js', '.json']
|
|
19
19
|
'import/resolver': {
|
|
20
20
|
node: {
|
|
21
21
|
extensions: ['.mjs', '.js', '.json', '.ts', '.d.ts']
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
// Append 'ts' extensions to
|
|
24
|
+
// Append 'ts' extensions to @viclafouch/eslint 'import/extensions' setting
|
|
25
25
|
// Original: ['.js', '.mjs', '.jsx']
|
|
26
26
|
'import/extensions': ['.js', '.mjs', '.jsx', '.ts', '.tsx', '.d.ts'],
|
|
27
27
|
// Resolve type definition packages
|
|
28
28
|
'import/external-module-folders': ['node_modules', 'node_modules/@types']
|
|
29
29
|
},
|
|
30
30
|
rules: {
|
|
31
|
-
// Replace
|
|
31
|
+
// Replace @viclafouch/eslint 'default-param-last' rule with '@typescript-eslint' version
|
|
32
32
|
// https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/default-param-last.md
|
|
33
33
|
'default-param-last': 'off',
|
|
34
34
|
'@typescript-eslint/default-param-last':
|
|
35
35
|
baseBestPracticesRules['default-param-last'],
|
|
36
36
|
|
|
37
|
-
// Replace
|
|
37
|
+
// Replace @viclafouch/eslint 'dot-notation' rule with '@typescript-eslint' version
|
|
38
38
|
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/dot-notation.md
|
|
39
39
|
'dot-notation': 'off',
|
|
40
40
|
'@typescript-eslint/dot-notation': baseBestPracticesRules['dot-notation'],
|
|
41
41
|
|
|
42
|
-
// Replace
|
|
42
|
+
// Replace @viclafouch/eslint 'no-empty-function' rule with '@typescript-eslint' version
|
|
43
43
|
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-function.md
|
|
44
44
|
'no-empty-function': 'off',
|
|
45
45
|
'@typescript-eslint/no-empty-function':
|
|
46
46
|
baseBestPracticesRules['no-empty-function'],
|
|
47
47
|
|
|
48
|
-
// Replace
|
|
48
|
+
// Replace @viclafouch/eslint 'no-extra-semi' rule with '@typescript-eslint' version
|
|
49
49
|
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-semi.md
|
|
50
50
|
'no-extra-semi': 'off',
|
|
51
51
|
'@typescript-eslint/no-extra-semi': baseErrorsRules['no-extra-semi'],
|
|
52
52
|
|
|
53
|
-
// Replace
|
|
53
|
+
// Replace @viclafouch/eslint 'no-redeclare' rule with '@typescript-eslint' version
|
|
54
54
|
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-redeclare.md
|
|
55
55
|
'no-redeclare': 'off',
|
|
56
56
|
'@typescript-eslint/no-redeclare': baseBestPracticesRules['no-redeclare'],
|
|
57
57
|
|
|
58
|
-
// Replace
|
|
58
|
+
// Replace @viclafouch/eslint 'no-shadow' rule with '@typescript-eslint' version
|
|
59
59
|
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
|
|
60
60
|
'no-shadow': 'off',
|
|
61
61
|
'@typescript-eslint/no-shadow': baseVariablesRules['no-shadow'],
|
|
62
62
|
|
|
63
|
-
// Replace
|
|
63
|
+
// Replace @viclafouch/eslint 'no-throw-literal' rule with '@typescript-eslint' version
|
|
64
64
|
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-throw-literal.md
|
|
65
65
|
'no-throw-literal': 'off',
|
|
66
66
|
'@typescript-eslint/no-throw-literal':
|
|
67
67
|
baseBestPracticesRules['no-throw-literal'],
|
|
68
68
|
|
|
69
|
-
// Replace
|
|
69
|
+
// Replace @viclafouch/eslint 'no-unused-expressions' rule with '@typescript-eslint' version
|
|
70
70
|
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-expressions.md
|
|
71
71
|
'no-unused-expressions': 'off',
|
|
72
72
|
'@typescript-eslint/no-unused-expressions':
|
|
73
73
|
baseBestPracticesRules['no-unused-expressions'],
|
|
74
74
|
|
|
75
|
-
// Replace
|
|
75
|
+
// Replace @viclafouch/eslint 'no-unused-vars' rule with '@typescript-eslint' version
|
|
76
76
|
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md
|
|
77
77
|
'no-unused-vars': 'off',
|
|
78
78
|
'@typescript-eslint/no-unused-vars': baseVariablesRules['no-unused-vars'],
|
|
79
79
|
|
|
80
|
-
// Replace
|
|
80
|
+
// Replace @viclafouch/eslint 'no-use-before-define' rule with '@typescript-eslint' version
|
|
81
81
|
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.md
|
|
82
82
|
'no-use-before-define': 'off',
|
|
83
83
|
'@typescript-eslint/no-use-before-define':
|
|
84
84
|
baseVariablesRules['no-use-before-define'],
|
|
85
85
|
|
|
86
|
-
// Replace
|
|
86
|
+
// Replace @viclafouch/eslint 'no-useless-constructor' rule with '@typescript-eslint' version
|
|
87
87
|
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-useless-constructor.md
|
|
88
88
|
'no-useless-constructor': 'off',
|
|
89
89
|
'@typescript-eslint/no-useless-constructor':
|
|
90
90
|
baseES6Rules['no-useless-constructor'],
|
|
91
91
|
|
|
92
|
-
// Replace
|
|
92
|
+
// Replace @viclafouch/eslint 'require-await' rule with '@typescript-eslint' version
|
|
93
93
|
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/require-await.md
|
|
94
94
|
'require-await': 'off',
|
|
95
95
|
'@typescript-eslint/require-await': baseES6Rules['require-await'],
|
|
96
96
|
|
|
97
|
-
// Replace
|
|
97
|
+
// Replace @viclafouch/eslint 'no-return-await' rule with '@typescript-eslint' version
|
|
98
98
|
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/return-await.md
|
|
99
99
|
'no-return-await': 'off',
|
|
100
100
|
'@typescript-eslint/return-await': [
|
|
@@ -112,28 +112,28 @@ module.exports = {
|
|
|
112
112
|
selector: 'typeLike',
|
|
113
113
|
format: ['PascalCase']
|
|
114
114
|
}
|
|
115
|
-
],
|
|
116
|
-
|
|
117
|
-
'@typescript-eslint/ban-types': [
|
|
118
|
-
'error',
|
|
119
|
-
{
|
|
120
|
-
types: {
|
|
121
|
-
// Omit is not strict enought
|
|
122
|
-
Omit: {
|
|
123
|
-
// https://twitter.com/erikras/status/1673694889974833152
|
|
124
|
-
message:
|
|
125
|
-
'Use StrictOmit instead by using reset.d.ts from @viclafouch/eslint-config-viclafouch/reset.d. See https://github.com/viclafouch/eslint-config-viclafouch#better-typing',
|
|
126
|
-
fixWith: 'StrictOmit'
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
115
|
]
|
|
116
|
+
|
|
117
|
+
// '@typescript-eslint/ban-types': [
|
|
118
|
+
// 'error',
|
|
119
|
+
// {
|
|
120
|
+
// types: {
|
|
121
|
+
// // Omit is not strict enought
|
|
122
|
+
// Omit: {
|
|
123
|
+
// // https://twitter.com/erikras/status/1673694889974833152
|
|
124
|
+
// message:
|
|
125
|
+
// 'Use StrictOmit instead by using reset.d.ts from @viclafouch/eslint-config-viclafouch/reset.d. See https://github.com/viclafouch/eslint-config-viclafouch#better-typing',
|
|
126
|
+
// fixWith: 'StrictOmit'
|
|
127
|
+
// }
|
|
128
|
+
// }
|
|
129
|
+
// }
|
|
130
|
+
// ]
|
|
131
131
|
},
|
|
132
132
|
overrides: [
|
|
133
133
|
{
|
|
134
134
|
files: ['*.ts?(x)'],
|
|
135
135
|
rules: {
|
|
136
|
-
// The following rules are enabled in
|
|
136
|
+
// The following rules are enabled in @viclafouch/eslint config, but are already checked (more thoroughly) by the TypeScript compiler
|
|
137
137
|
// Some of the rules also fail in TypeScript files, for example: https://github.com/typescript-eslint/typescript-eslint/issues/662#issuecomment-507081586
|
|
138
138
|
// Rules are inspired by: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslint-recommended.ts
|
|
139
139
|
'constructor-super': 'off',
|
|
@@ -154,7 +154,7 @@ module.exports = {
|
|
|
154
154
|
'no-unreachable': 'off',
|
|
155
155
|
'no-unsafe-negation': 'off',
|
|
156
156
|
'valid-typeof': 'off',
|
|
157
|
-
// The following rules are enabled in
|
|
157
|
+
// The following rules are enabled in @viclafouch/eslint config, but are recommended to be disabled within TypeScript projects
|
|
158
158
|
// See: https://github.com/typescript-eslint/typescript-eslint/blob/13583e65f5973da2a7ae8384493c5e00014db51b/docs/linting/TROUBLESHOOTING.md#eslint-plugin-import
|
|
159
159
|
'import/named': 'off',
|
|
160
160
|
'import/no-named-as-default-member': 'off',
|