@indigo-reemploi/eslint-config-client 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 +36 -0
- package/eslint.mjs +107 -0
- package/index.mjs +4 -0
- package/package.json +34 -0
- package/prettier.mjs +11 -0
- package/rules/import.mjs +280 -0
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Config Eslint partagé pour les services Client
|
|
2
|
+
|
|
3
|
+
Comment utiliser :
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
yarn add @indigo-reemploi/eslint-config-client
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```javascript
|
|
10
|
+
// eslint.config.mjs
|
|
11
|
+
import { eslint } from "@indigo-reemploi/eslint-config-client";
|
|
12
|
+
|
|
13
|
+
export default [
|
|
14
|
+
...eslint
|
|
15
|
+
];
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
And for prettier
|
|
19
|
+
```javascript
|
|
20
|
+
// prettier.config.mjs
|
|
21
|
+
import { prettier } from "@indigo-reemploi/eslint-config-client";
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
...prettier
|
|
25
|
+
};
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Pour développer la config en local
|
|
29
|
+
|
|
30
|
+
A chaque changement, aller dans le repo dans lequel on veut tester la config (par exemple circular-client) et lancer la commande :
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# dans circular-client
|
|
34
|
+
yarn add ../eslint-config-client
|
|
35
|
+
yarn run lint:fix
|
|
36
|
+
```
|
package/eslint.mjs
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import eslint from "@eslint/js";
|
|
2
|
+
import simpleImportSort from "eslint-plugin-simple-import-sort";
|
|
3
|
+
import tseslint from "typescript-eslint";
|
|
4
|
+
import tailwind from "eslint-plugin-tailwindcss";
|
|
5
|
+
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
|
6
|
+
import unusedImports from 'eslint-plugin-unused-imports';
|
|
7
|
+
import jest from 'eslint-plugin-jest';
|
|
8
|
+
import jsxA11y from 'eslint-plugin-jsx-a11y';
|
|
9
|
+
import react from 'eslint-plugin-react';
|
|
10
|
+
import importRules from './rules/import.mjs';
|
|
11
|
+
|
|
12
|
+
export default tseslint.config(
|
|
13
|
+
eslint.configs.recommended,
|
|
14
|
+
...tseslint.configs.recommended,
|
|
15
|
+
...tailwind.configs["flat/recommended"],
|
|
16
|
+
jest.configs["flat/recommended"],
|
|
17
|
+
jsxA11y.flatConfigs.recommended,
|
|
18
|
+
react.configs.flat.recommended,
|
|
19
|
+
{
|
|
20
|
+
rules: {
|
|
21
|
+
// from eslint-config-airbnb
|
|
22
|
+
'react/display-name': ['off', { ignoreTranspilerName: false }],
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
settings: {
|
|
27
|
+
react: {
|
|
28
|
+
version: "detect"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
languageOptions: {
|
|
34
|
+
parserOptions: {
|
|
35
|
+
projectService: true,
|
|
36
|
+
// tsconfigRootDir: import.meta.dirname,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
plugins: {
|
|
42
|
+
"simple-import-sort": simpleImportSort,
|
|
43
|
+
},
|
|
44
|
+
rules: {
|
|
45
|
+
"simple-import-sort/imports": "error",
|
|
46
|
+
"simple-import-sort/exports": "error",
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
plugins: {
|
|
51
|
+
'unused-imports': unusedImports
|
|
52
|
+
},
|
|
53
|
+
rules: {
|
|
54
|
+
'unused-imports/no-unused-imports': 'error',
|
|
55
|
+
'unused-imports/no-unused-vars': [
|
|
56
|
+
'warn',
|
|
57
|
+
{ 'vars': 'all', 'varsIgnorePattern': '^_', 'args': 'after-used', 'argsIgnorePattern': '^_' }
|
|
58
|
+
],
|
|
59
|
+
"@typescript-eslint/no-unused-vars": [
|
|
60
|
+
"error",
|
|
61
|
+
{
|
|
62
|
+
"args": "all",
|
|
63
|
+
"argsIgnorePattern": "^_",
|
|
64
|
+
"caughtErrors": "all",
|
|
65
|
+
"caughtErrorsIgnorePattern": "^_",
|
|
66
|
+
"destructuredArrayIgnorePattern": "^_",
|
|
67
|
+
"varsIgnorePattern": "^_",
|
|
68
|
+
"ignoreRestSiblings": true
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
rules: {
|
|
75
|
+
'@typescript-eslint/no-explicit-any': [
|
|
76
|
+
'error',
|
|
77
|
+
{
|
|
78
|
+
ignoreRestArgs: true,
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
importRules,
|
|
84
|
+
// {
|
|
85
|
+
// plugins: {
|
|
86
|
+
// 'react-hooks': fixupPluginRules(reactHooks),
|
|
87
|
+
// },
|
|
88
|
+
// rules: {
|
|
89
|
+
// // ...
|
|
90
|
+
// ...reactHooks.configs.recommended.rules,
|
|
91
|
+
// // maybe to change but something from our old config disabled it
|
|
92
|
+
// 'react-hooks/exhaustive-deps': 'off'
|
|
93
|
+
// },
|
|
94
|
+
// },
|
|
95
|
+
{
|
|
96
|
+
rules: {
|
|
97
|
+
// our custom rules
|
|
98
|
+
'jest/expect-expect': 'off',
|
|
99
|
+
'tailwindcss/no-custom-classname': 'off',
|
|
100
|
+
'react/prop-types': 'off',
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
eslintPluginPrettierRecommended,
|
|
104
|
+
{
|
|
105
|
+
ignores: ['**/*.stories.*']
|
|
106
|
+
}
|
|
107
|
+
);
|
package/index.mjs
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@indigo-reemploi/eslint-config-client",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Shared eslint config for Client",
|
|
5
|
+
"main": "index.mjs",
|
|
6
|
+
"files": ["eslint.mjs", "prettier.mjs", "./rules"],
|
|
7
|
+
"author": "Antoine Torrini",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"packageManager": "yarn@1.22.22",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@eslint/compat": "^1.1.1",
|
|
12
|
+
"@eslint/js": "^9.4.0",
|
|
13
|
+
"@types/eslint__js": "^8.42.3",
|
|
14
|
+
"@typescript-eslint/parser": "^8.0.1",
|
|
15
|
+
"eslint": "^9.4.0",
|
|
16
|
+
"eslint-config-prettier": "^9.1.0",
|
|
17
|
+
"eslint-plugin-astro": "^1.2.2",
|
|
18
|
+
"eslint-plugin-import": "^2.29.1",
|
|
19
|
+
"eslint-plugin-jest": "^28.7.0",
|
|
20
|
+
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
21
|
+
"eslint-plugin-oxlint": "^0.4.0",
|
|
22
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
23
|
+
"eslint-plugin-react": "^7.35.0",
|
|
24
|
+
"eslint-plugin-simple-import-sort": "^12.1.0",
|
|
25
|
+
"eslint-plugin-tailwindcss": "^3.17.4",
|
|
26
|
+
"eslint-plugin-unused-imports": "^4.0.1",
|
|
27
|
+
"prettier": "^3.3.3",
|
|
28
|
+
"prettier-plugin-tailwindcss": "^0.6.6",
|
|
29
|
+
"typescript-eslint": "^7.13.0"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"jest": "^29.7.0"
|
|
33
|
+
}
|
|
34
|
+
}
|
package/prettier.mjs
ADDED
package/rules/import.mjs
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import { fixupPluginRules } from '@eslint/compat';
|
|
2
|
+
import importPlugin from 'eslint-plugin-import';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
plugins: {
|
|
6
|
+
'import': fixupPluginRules(importPlugin),
|
|
7
|
+
},
|
|
8
|
+
settings: {
|
|
9
|
+
"import/resolver": {
|
|
10
|
+
"node": {
|
|
11
|
+
"extensions": [
|
|
12
|
+
".mjs",
|
|
13
|
+
".js",
|
|
14
|
+
".jsx",
|
|
15
|
+
".json",
|
|
16
|
+
".ts",
|
|
17
|
+
".tsx",
|
|
18
|
+
".d.ts"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"import/parsers": {
|
|
23
|
+
"@typescript-eslint/parser": [
|
|
24
|
+
".ts",
|
|
25
|
+
".tsx",
|
|
26
|
+
".d.ts"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"import/extensions": [
|
|
30
|
+
".js",
|
|
31
|
+
".mjs",
|
|
32
|
+
".jsx",
|
|
33
|
+
".ts",
|
|
34
|
+
".tsx",
|
|
35
|
+
".d.ts"
|
|
36
|
+
],
|
|
37
|
+
"import/external-module-folders": [
|
|
38
|
+
"node_modules",
|
|
39
|
+
"node_modules/@types"
|
|
40
|
+
],
|
|
41
|
+
"import/core-modules": [],
|
|
42
|
+
"import/ignore": [
|
|
43
|
+
"node_modules",
|
|
44
|
+
"\\.(coffee|scss|css|less|hbs|svg|json)$"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
rules: {
|
|
48
|
+
"import/extensions": [
|
|
49
|
+
"off",
|
|
50
|
+
"ignorePackages",
|
|
51
|
+
{
|
|
52
|
+
"js": "never",
|
|
53
|
+
"mjs": "never",
|
|
54
|
+
"jsx": "never",
|
|
55
|
+
"ts": "never",
|
|
56
|
+
"tsx": "never"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"import/prefer-default-export": [
|
|
60
|
+
"off"
|
|
61
|
+
],
|
|
62
|
+
"import/named": [
|
|
63
|
+
"off"
|
|
64
|
+
],
|
|
65
|
+
"import/no-named-as-default-member": [
|
|
66
|
+
"off"
|
|
67
|
+
],
|
|
68
|
+
"import/no-unresolved": [
|
|
69
|
+
"off",
|
|
70
|
+
{
|
|
71
|
+
"commonjs": true,
|
|
72
|
+
"caseSensitive": true,
|
|
73
|
+
"caseSensitiveStrict": false
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"import/no-extraneous-dependencies": [
|
|
77
|
+
"error",
|
|
78
|
+
{
|
|
79
|
+
"devDependencies": [
|
|
80
|
+
"test/**",
|
|
81
|
+
"tests/**",
|
|
82
|
+
"spec/**",
|
|
83
|
+
"**/__tests__/**",
|
|
84
|
+
"**/__mocks__/**",
|
|
85
|
+
"test.{js,jsx}",
|
|
86
|
+
"test.{ts,tsx}",
|
|
87
|
+
"test-*.{js,jsx}",
|
|
88
|
+
"test-*.{ts,tsx}",
|
|
89
|
+
"**/*{.,_}{test,spec}.{js,jsx}",
|
|
90
|
+
"**/*{.,_}{test,spec}.{ts,tsx}",
|
|
91
|
+
"**/jest.config.js",
|
|
92
|
+
"**/jest.config.ts",
|
|
93
|
+
"**/jest.setup.js",
|
|
94
|
+
"**/jest.setup.ts",
|
|
95
|
+
"**/vue.config.js",
|
|
96
|
+
"**/vue.config.ts",
|
|
97
|
+
"**/webpack.config.js",
|
|
98
|
+
"**/webpack.config.ts",
|
|
99
|
+
"**/webpack.config.*.js",
|
|
100
|
+
"**/webpack.config.*.ts",
|
|
101
|
+
"**/rollup.config.js",
|
|
102
|
+
"**/rollup.config.ts",
|
|
103
|
+
"**/rollup.config.*.js",
|
|
104
|
+
"**/rollup.config.*.ts",
|
|
105
|
+
"**/gulpfile.js",
|
|
106
|
+
"**/gulpfile.ts",
|
|
107
|
+
"**/gulpfile.*.js",
|
|
108
|
+
"**/gulpfile.*.ts",
|
|
109
|
+
"**/Gruntfile{,.js}",
|
|
110
|
+
"**/Gruntfile{,.ts}",
|
|
111
|
+
"**/protractor.conf.js",
|
|
112
|
+
"**/protractor.conf.ts",
|
|
113
|
+
"**/protractor.conf.*.js",
|
|
114
|
+
"**/protractor.conf.*.ts",
|
|
115
|
+
"**/karma.conf.js",
|
|
116
|
+
"**/karma.conf.ts",
|
|
117
|
+
"**/.eslintrc.js",
|
|
118
|
+
"**/.eslintrc.ts"
|
|
119
|
+
],
|
|
120
|
+
"optionalDependencies": false
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
"import/default": [
|
|
124
|
+
"off"
|
|
125
|
+
],
|
|
126
|
+
"import/namespace": [
|
|
127
|
+
"off"
|
|
128
|
+
],
|
|
129
|
+
"import/export": [
|
|
130
|
+
"error"
|
|
131
|
+
],
|
|
132
|
+
"import/no-named-as-default": [
|
|
133
|
+
"error"
|
|
134
|
+
],
|
|
135
|
+
"import/no-deprecated": [
|
|
136
|
+
"off"
|
|
137
|
+
],
|
|
138
|
+
"import/no-mutable-exports": [
|
|
139
|
+
"error"
|
|
140
|
+
],
|
|
141
|
+
"import/no-commonjs": [
|
|
142
|
+
"off"
|
|
143
|
+
],
|
|
144
|
+
"import/no-amd": [
|
|
145
|
+
"error"
|
|
146
|
+
],
|
|
147
|
+
"import/no-nodejs-modules": [
|
|
148
|
+
"off"
|
|
149
|
+
],
|
|
150
|
+
"import/first": [
|
|
151
|
+
"error"
|
|
152
|
+
],
|
|
153
|
+
"import/imports-first": [
|
|
154
|
+
"off"
|
|
155
|
+
],
|
|
156
|
+
"import/no-duplicates": [
|
|
157
|
+
"error"
|
|
158
|
+
],
|
|
159
|
+
"import/no-namespace": [
|
|
160
|
+
"off"
|
|
161
|
+
],
|
|
162
|
+
"import/order": [
|
|
163
|
+
"error",
|
|
164
|
+
{
|
|
165
|
+
"groups": [
|
|
166
|
+
[
|
|
167
|
+
"builtin",
|
|
168
|
+
"external",
|
|
169
|
+
"internal"
|
|
170
|
+
]
|
|
171
|
+
],
|
|
172
|
+
"distinctGroup": true,
|
|
173
|
+
"warnOnUnassignedImports": false
|
|
174
|
+
}
|
|
175
|
+
],
|
|
176
|
+
"import/newline-after-import": [
|
|
177
|
+
"error"
|
|
178
|
+
],
|
|
179
|
+
"import/no-restricted-paths": [
|
|
180
|
+
"off"
|
|
181
|
+
],
|
|
182
|
+
"import/max-dependencies": [
|
|
183
|
+
"off",
|
|
184
|
+
{
|
|
185
|
+
"max": 10
|
|
186
|
+
}
|
|
187
|
+
],
|
|
188
|
+
"import/no-absolute-path": [
|
|
189
|
+
"error"
|
|
190
|
+
],
|
|
191
|
+
"import/no-dynamic-require": [
|
|
192
|
+
"error"
|
|
193
|
+
],
|
|
194
|
+
"import/no-internal-modules": [
|
|
195
|
+
"off",
|
|
196
|
+
{
|
|
197
|
+
"allow": []
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
"import/unambiguous": [
|
|
201
|
+
"off"
|
|
202
|
+
],
|
|
203
|
+
"import/no-webpack-loader-syntax": [
|
|
204
|
+
"error"
|
|
205
|
+
],
|
|
206
|
+
"import/no-unassigned-import": [
|
|
207
|
+
"off"
|
|
208
|
+
],
|
|
209
|
+
"import/no-named-default": [
|
|
210
|
+
"error"
|
|
211
|
+
],
|
|
212
|
+
"import/no-anonymous-default-export": [
|
|
213
|
+
"off",
|
|
214
|
+
{
|
|
215
|
+
"allowArray": false,
|
|
216
|
+
"allowArrowFunction": false,
|
|
217
|
+
"allowAnonymousClass": false,
|
|
218
|
+
"allowAnonymousFunction": false,
|
|
219
|
+
"allowLiteral": false,
|
|
220
|
+
"allowObject": false
|
|
221
|
+
}
|
|
222
|
+
],
|
|
223
|
+
"import/exports-last": [
|
|
224
|
+
"off"
|
|
225
|
+
],
|
|
226
|
+
"import/group-exports": [
|
|
227
|
+
"off"
|
|
228
|
+
],
|
|
229
|
+
"import/no-default-export": [
|
|
230
|
+
"off"
|
|
231
|
+
],
|
|
232
|
+
"import/no-named-export": [
|
|
233
|
+
"off"
|
|
234
|
+
],
|
|
235
|
+
"import/no-self-import": [
|
|
236
|
+
"error"
|
|
237
|
+
],
|
|
238
|
+
"import/no-cycle": [
|
|
239
|
+
"error",
|
|
240
|
+
{
|
|
241
|
+
"maxDepth": "∞",
|
|
242
|
+
"ignoreExternal": false,
|
|
243
|
+
"allowUnsafeDynamicCyclicDependency": false
|
|
244
|
+
}
|
|
245
|
+
],
|
|
246
|
+
"import/no-useless-path-segments": [
|
|
247
|
+
"error",
|
|
248
|
+
{
|
|
249
|
+
"commonjs": true
|
|
250
|
+
}
|
|
251
|
+
],
|
|
252
|
+
"import/dynamic-import-chunkname": [
|
|
253
|
+
"off",
|
|
254
|
+
{
|
|
255
|
+
"importFunctions": [],
|
|
256
|
+
"webpackChunknameFormat": "[0-9a-zA-Z-_/.]+"
|
|
257
|
+
}
|
|
258
|
+
],
|
|
259
|
+
"import/no-relative-parent-imports": [
|
|
260
|
+
"off"
|
|
261
|
+
],
|
|
262
|
+
"import/no-unused-modules": [
|
|
263
|
+
"off",
|
|
264
|
+
{
|
|
265
|
+
"ignoreExports": [],
|
|
266
|
+
"missingExports": true,
|
|
267
|
+
"unusedExports": true
|
|
268
|
+
}
|
|
269
|
+
],
|
|
270
|
+
"import/no-import-module-exports": [
|
|
271
|
+
"error",
|
|
272
|
+
{
|
|
273
|
+
"exceptions": []
|
|
274
|
+
}
|
|
275
|
+
],
|
|
276
|
+
"import/no-relative-packages": [
|
|
277
|
+
"error"
|
|
278
|
+
]
|
|
279
|
+
}
|
|
280
|
+
}
|