@indigo-reemploi/eslint-config-api 0.0.1 → 0.0.2
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 +23 -3
- package/package.json +6 -3
- package/src/eslint.mjs +67 -0
- package/src/index.mjs +4 -0
- package/src/prettier.mjs +9 -0
- package/src/rules/import.mjs +190 -0
- package/.gitlab-ci.yml +0 -10
- package/.yarnrc.yml +0 -1
- package/index.mjs +0 -37
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Config Eslint partagé pour les services
|
|
1
|
+
# Config Eslint partagé pour les services Api
|
|
2
2
|
|
|
3
3
|
Comment utiliser :
|
|
4
4
|
|
|
@@ -8,9 +8,29 @@ yarn add @indigo-reemploi/eslint-config-api
|
|
|
8
8
|
|
|
9
9
|
```javascript
|
|
10
10
|
// eslint.config.mjs
|
|
11
|
-
import
|
|
11
|
+
import { eslint } from "@indigo-reemploi/eslint-config-api";
|
|
12
12
|
|
|
13
13
|
export default [
|
|
14
|
-
...
|
|
14
|
+
...eslint
|
|
15
15
|
];
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
And for prettier
|
|
19
|
+
```javascript
|
|
20
|
+
// prettier.config.mjs
|
|
21
|
+
import { prettier } from "@indigo-reemploi/eslint-config-api";
|
|
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-api) et lancer la commande :
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# dans circular-api
|
|
34
|
+
yarn add ../eslint-config-api
|
|
35
|
+
yarn run format
|
|
16
36
|
```
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indigo-reemploi/eslint-config-api",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Shared eslint config for API",
|
|
5
|
-
"main": "index.mjs",
|
|
5
|
+
"main": "./src/index.mjs",
|
|
6
|
+
"files": [
|
|
7
|
+
"./src"
|
|
8
|
+
],
|
|
6
9
|
"author": "Antoine Torrini",
|
|
7
10
|
"license": "MIT",
|
|
8
11
|
"packageManager": "yarn@1.22.22",
|
|
@@ -14,10 +17,10 @@
|
|
|
14
17
|
"eslint-config-prettier": "^9.1.0",
|
|
15
18
|
"eslint-plugin-astro": "^1.2.2",
|
|
16
19
|
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
17
|
-
"eslint-plugin-oxlint": "^0.4.0",
|
|
18
20
|
"eslint-plugin-prettier": "^5.2.1",
|
|
19
21
|
"eslint-plugin-simple-import-sort": "^12.1.0",
|
|
20
22
|
"eslint-plugin-tailwindcss": "^3.17.3",
|
|
23
|
+
"prettier": "^3.3.3",
|
|
21
24
|
"typescript-eslint": "^7.13.0"
|
|
22
25
|
}
|
|
23
26
|
}
|
package/src/eslint.mjs
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import eslint from '@eslint/js';
|
|
2
|
+
import simpleImportSort from 'eslint-plugin-simple-import-sort';
|
|
3
|
+
import tseslint from 'typescript-eslint';
|
|
4
|
+
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
|
5
|
+
|
|
6
|
+
export default tseslint.config(
|
|
7
|
+
eslint.configs.recommended,
|
|
8
|
+
...tseslint.configs.recommended,
|
|
9
|
+
{
|
|
10
|
+
languageOptions: {
|
|
11
|
+
parserOptions: {
|
|
12
|
+
projectService: true,
|
|
13
|
+
// tsconfigRootDir: import.meta.dirname,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
plugins: {
|
|
19
|
+
'simple-import-sort': simpleImportSort,
|
|
20
|
+
},
|
|
21
|
+
rules: {
|
|
22
|
+
'simple-import-sort/imports': 'error',
|
|
23
|
+
'simple-import-sort/exports': 'error',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
rules: {
|
|
28
|
+
'@typescript-eslint/no-explicit-any': [
|
|
29
|
+
'error',
|
|
30
|
+
{
|
|
31
|
+
ignoreRestArgs: true,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
'@typescript-eslint/interface-name-prefix': [
|
|
35
|
+
'off'
|
|
36
|
+
],
|
|
37
|
+
'@typescript-eslint/explicit-module-boundary-types': [
|
|
38
|
+
'off'
|
|
39
|
+
],
|
|
40
|
+
'@typescript-eslint/no-var-requires': [
|
|
41
|
+
'off'
|
|
42
|
+
],
|
|
43
|
+
'@typescript-eslint/explicit-function-return-type': [
|
|
44
|
+
'error',
|
|
45
|
+
{
|
|
46
|
+
'allowExpressions': true,
|
|
47
|
+
'allowTypedFunctionExpressions': true
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
'max-len': [
|
|
51
|
+
'error',
|
|
52
|
+
{
|
|
53
|
+
'code': '200',
|
|
54
|
+
'ignoreUrls': true,
|
|
55
|
+
'ignoreComments': false,
|
|
56
|
+
'ignoreRegExpLiterals': true,
|
|
57
|
+
'ignoreStrings': false,
|
|
58
|
+
'ignoreTemplateLiterals': false
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
'eqeqeq': [
|
|
62
|
+
'error'
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
eslintPluginPrettierRecommended
|
|
67
|
+
);
|
package/src/index.mjs
ADDED
package/src/prettier.mjs
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
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: [".mjs", ".js", ".jsx", ".json", ".ts", ".tsx", ".d.ts"],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
"import/parsers": {
|
|
15
|
+
"@typescript-eslint/parser": [".ts", ".tsx", ".d.ts"],
|
|
16
|
+
},
|
|
17
|
+
"import/extensions": [".js", ".mjs", ".jsx", ".ts", ".tsx", ".d.ts"],
|
|
18
|
+
"import/external-module-folders": ["node_modules", "node_modules/@types"],
|
|
19
|
+
"import/core-modules": [],
|
|
20
|
+
"import/ignore": [
|
|
21
|
+
"node_modules",
|
|
22
|
+
"\\.(coffee|scss|css|less|hbs|svg|json)$",
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
rules: {
|
|
26
|
+
"import/extensions": [
|
|
27
|
+
"off",
|
|
28
|
+
"ignorePackages",
|
|
29
|
+
{
|
|
30
|
+
js: "never",
|
|
31
|
+
mjs: "never",
|
|
32
|
+
jsx: "never",
|
|
33
|
+
ts: "never",
|
|
34
|
+
tsx: "never",
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
"import/prefer-default-export": ["off"],
|
|
38
|
+
"import/named": ["off"],
|
|
39
|
+
"import/no-named-as-default-member": ["off"],
|
|
40
|
+
"import/no-unresolved": [
|
|
41
|
+
"off",
|
|
42
|
+
{
|
|
43
|
+
commonjs: true,
|
|
44
|
+
caseSensitive: true,
|
|
45
|
+
caseSensitiveStrict: false,
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
"import/no-extraneous-dependencies": [
|
|
49
|
+
"error",
|
|
50
|
+
{
|
|
51
|
+
devDependencies: [
|
|
52
|
+
"test/**",
|
|
53
|
+
"tests/**",
|
|
54
|
+
"spec/**",
|
|
55
|
+
"**/__tests__/**",
|
|
56
|
+
"**/__mocks__/**",
|
|
57
|
+
"test.{js,jsx}",
|
|
58
|
+
"test.{ts,tsx}",
|
|
59
|
+
"test-*.{js,jsx}",
|
|
60
|
+
"test-*.{ts,tsx}",
|
|
61
|
+
"**/*{.,_}{test,spec}.{js,jsx}",
|
|
62
|
+
"**/*{.,_}{test,spec}.{ts,tsx}",
|
|
63
|
+
"**/jest.config.js",
|
|
64
|
+
"**/jest.config.ts",
|
|
65
|
+
"**/jest.setup.js",
|
|
66
|
+
"**/jest.setup.ts",
|
|
67
|
+
"**/vue.config.js",
|
|
68
|
+
"**/vue.config.ts",
|
|
69
|
+
"**/webpack.config.js",
|
|
70
|
+
"**/webpack.config.ts",
|
|
71
|
+
"**/webpack.config.*.js",
|
|
72
|
+
"**/webpack.config.*.ts",
|
|
73
|
+
"**/rollup.config.js",
|
|
74
|
+
"**/rollup.config.ts",
|
|
75
|
+
"**/rollup.config.*.js",
|
|
76
|
+
"**/rollup.config.*.ts",
|
|
77
|
+
"**/gulpfile.js",
|
|
78
|
+
"**/gulpfile.ts",
|
|
79
|
+
"**/gulpfile.*.js",
|
|
80
|
+
"**/gulpfile.*.ts",
|
|
81
|
+
"**/Gruntfile{,.js}",
|
|
82
|
+
"**/Gruntfile{,.ts}",
|
|
83
|
+
"**/protractor.conf.js",
|
|
84
|
+
"**/protractor.conf.ts",
|
|
85
|
+
"**/protractor.conf.*.js",
|
|
86
|
+
"**/protractor.conf.*.ts",
|
|
87
|
+
"**/karma.conf.js",
|
|
88
|
+
"**/karma.conf.ts",
|
|
89
|
+
"**/.eslintrc.js",
|
|
90
|
+
"**/.eslintrc.ts",
|
|
91
|
+
],
|
|
92
|
+
optionalDependencies: false,
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
"import/default": ["off"],
|
|
96
|
+
"import/namespace": ["off"],
|
|
97
|
+
"import/export": ["error"],
|
|
98
|
+
"import/no-named-as-default": ["error"],
|
|
99
|
+
"import/no-deprecated": ["off"],
|
|
100
|
+
"import/no-mutable-exports": ["error"],
|
|
101
|
+
"import/no-commonjs": ["off"],
|
|
102
|
+
"import/no-amd": ["error"],
|
|
103
|
+
"import/no-nodejs-modules": ["off"],
|
|
104
|
+
"import/first": ["error"],
|
|
105
|
+
"import/imports-first": ["off"],
|
|
106
|
+
"import/no-duplicates": ["error"],
|
|
107
|
+
"import/no-namespace": ["off"],
|
|
108
|
+
"import/order": [
|
|
109
|
+
"error",
|
|
110
|
+
{
|
|
111
|
+
groups: [["builtin", "external", "internal"]],
|
|
112
|
+
distinctGroup: true,
|
|
113
|
+
warnOnUnassignedImports: false,
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
"import/newline-after-import": ["error"],
|
|
117
|
+
"import/no-restricted-paths": ["off"],
|
|
118
|
+
"import/max-dependencies": [
|
|
119
|
+
"off",
|
|
120
|
+
{
|
|
121
|
+
max: 10,
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
"import/no-absolute-path": ["error"],
|
|
125
|
+
"import/no-dynamic-require": ["error"],
|
|
126
|
+
"import/no-internal-modules": [
|
|
127
|
+
"off",
|
|
128
|
+
{
|
|
129
|
+
allow: [],
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
"import/unambiguous": ["off"],
|
|
133
|
+
"import/no-webpack-loader-syntax": ["error"],
|
|
134
|
+
"import/no-unassigned-import": ["off"],
|
|
135
|
+
"import/no-named-default": ["error"],
|
|
136
|
+
"import/no-anonymous-default-export": [
|
|
137
|
+
"off",
|
|
138
|
+
{
|
|
139
|
+
allowArray: false,
|
|
140
|
+
allowArrowFunction: false,
|
|
141
|
+
allowAnonymousClass: false,
|
|
142
|
+
allowAnonymousFunction: false,
|
|
143
|
+
allowLiteral: false,
|
|
144
|
+
allowObject: false,
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
"import/exports-last": ["off"],
|
|
148
|
+
"import/group-exports": ["off"],
|
|
149
|
+
"import/no-default-export": ["off"],
|
|
150
|
+
"import/no-named-export": ["off"],
|
|
151
|
+
"import/no-self-import": ["error"],
|
|
152
|
+
"import/no-cycle": [
|
|
153
|
+
"error",
|
|
154
|
+
{
|
|
155
|
+
maxDepth: "∞",
|
|
156
|
+
ignoreExternal: false,
|
|
157
|
+
allowUnsafeDynamicCyclicDependency: false,
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
"import/no-useless-path-segments": [
|
|
161
|
+
"error",
|
|
162
|
+
{
|
|
163
|
+
commonjs: true,
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
"import/dynamic-import-chunkname": [
|
|
167
|
+
"off",
|
|
168
|
+
{
|
|
169
|
+
importFunctions: [],
|
|
170
|
+
webpackChunknameFormat: "[0-9a-zA-Z-_/.]+",
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
"import/no-relative-parent-imports": ["off"],
|
|
174
|
+
"import/no-unused-modules": [
|
|
175
|
+
"off",
|
|
176
|
+
{
|
|
177
|
+
ignoreExports: [],
|
|
178
|
+
missingExports: true,
|
|
179
|
+
unusedExports: true,
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
"import/no-import-module-exports": [
|
|
183
|
+
"error",
|
|
184
|
+
{
|
|
185
|
+
exceptions: [],
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
"import/no-relative-packages": ["error"],
|
|
189
|
+
},
|
|
190
|
+
};
|
package/.gitlab-ci.yml
DELETED
package/.yarnrc.yml
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
yarnPath: .yarn/releases/yarn-1.22.22.cjs
|
package/index.mjs
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import eslint from "@eslint/js";
|
|
2
|
-
import simpleImportSort from "eslint-plugin-simple-import-sort";
|
|
3
|
-
import tseslint from "typescript-eslint";
|
|
4
|
-
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
|
5
|
-
|
|
6
|
-
export default tseslint.config(
|
|
7
|
-
eslint.configs.recommended,
|
|
8
|
-
...tseslint.configs.recommended,
|
|
9
|
-
{
|
|
10
|
-
languageOptions: {
|
|
11
|
-
parserOptions: {
|
|
12
|
-
projectService: true,
|
|
13
|
-
// tsconfigRootDir: import.meta.dirname,
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
plugins: {
|
|
19
|
-
"simple-import-sort": simpleImportSort,
|
|
20
|
-
},
|
|
21
|
-
rules: {
|
|
22
|
-
"simple-import-sort/imports": "error",
|
|
23
|
-
"simple-import-sort/exports": "error",
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
rules: {
|
|
28
|
-
'@typescript-eslint/no-explicit-any': [
|
|
29
|
-
'error',
|
|
30
|
-
{
|
|
31
|
-
ignoreRestArgs: true,
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
eslintPluginPrettierRecommended
|
|
37
|
-
);
|