@commencis/eslint-config 2.4.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/CHANGELOG.md +12 -0
- package/README.md +46 -48
- package/dist/{flatConfig-Cm6wkwA_.d.ts → config.types-M1gOzpFJ.d.mts} +12 -6
- package/dist/configFactory-D_qKOxEp.mjs +574 -0
- package/dist/configs/javascript.d.mts +8 -0
- package/dist/configs/javascript.mjs +9 -0
- package/dist/configs/native.d.mts +8 -0
- package/dist/configs/native.mjs +12 -0
- package/dist/configs/next.d.mts +8 -0
- package/dist/configs/next.mjs +13 -0
- package/dist/configs/react.d.mts +8 -0
- package/dist/configs/react.mjs +12 -0
- package/dist/configs/typescript.d.mts +8 -0
- package/dist/configs/typescript.mjs +9 -0
- package/dist/index.d.mts +17 -0
- package/dist/index.mjs +7 -0
- package/package.json +24 -36
- package/dist/configs/base.d.ts +0 -8
- package/dist/configs/base.js +0 -245
- package/dist/configs/next.d.ts +0 -6
- package/dist/configs/next.js +0 -301
- package/dist/configs/prettier.d.ts +0 -6
- package/dist/configs/prettier.js +0 -9
- package/dist/configs/react-native.d.ts +0 -6
- package/dist/configs/react-native.js +0 -300
- package/dist/configs/react.d.ts +0 -6
- package/dist/configs/react.js +0 -300
- package/dist/configs/typescript.d.ts +0 -6
- package/dist/configs/typescript.js +0 -135
- package/dist/configs/vue.d.ts +0 -6
- package/dist/configs/vue.js +0 -313
- package/dist/index.d.ts +0 -14
- package/dist/index.js +0 -358
package/dist/configs/prettier.js
DELETED
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
// src/configs/base.ts
|
|
2
|
-
import eslint from "@eslint/js";
|
|
3
|
-
import globals from "globals";
|
|
4
|
-
|
|
5
|
-
// src/plugins/importSortPlugin.ts
|
|
6
|
-
import simpleImportSortPlugin from "eslint-plugin-simple-import-sort";
|
|
7
|
-
|
|
8
|
-
// src/rules/importSortRules.ts
|
|
9
|
-
function asTypeOnly(pattern) {
|
|
10
|
-
const base = pattern.endsWith("$") ? pattern.slice(0, -1) : pattern;
|
|
11
|
-
return `${base}\\u0000$`;
|
|
12
|
-
}
|
|
13
|
-
function withTypeFirst(group) {
|
|
14
|
-
return group.flatMap((pattern) => [asTypeOnly(pattern), pattern]);
|
|
15
|
-
}
|
|
16
|
-
function exact(p) {
|
|
17
|
-
return `^@/${p}$`;
|
|
18
|
-
}
|
|
19
|
-
function subpath(p) {
|
|
20
|
-
return `^@/${p}/.+$`;
|
|
21
|
-
}
|
|
22
|
-
function expandFolders(folders) {
|
|
23
|
-
return folders.flatMap((name) => [exact(name), subpath(name)]);
|
|
24
|
-
}
|
|
25
|
-
var GROUPS = {
|
|
26
|
-
// Side effects (simple-import-sort prefixes side-effects with \u0000 at the start)
|
|
27
|
-
SIDE_EFFECTS: ["^\\u0000"],
|
|
28
|
-
// Main frameworks & libraries
|
|
29
|
-
FRAMEWORKS: [
|
|
30
|
-
"^(react(-native|-dom)?(/.*)?)$",
|
|
31
|
-
"^next",
|
|
32
|
-
"^vue",
|
|
33
|
-
"^nuxt",
|
|
34
|
-
"^@angular(/.*|$)",
|
|
35
|
-
"^expo",
|
|
36
|
-
"^node"
|
|
37
|
-
],
|
|
38
|
-
// External packages
|
|
39
|
-
EXTERNAL: ["^@commencis", "^@?\\w"],
|
|
40
|
-
// Internal common directories
|
|
41
|
-
INTERNAL_COMMON: expandFolders([
|
|
42
|
-
"config",
|
|
43
|
-
"types",
|
|
44
|
-
"interfaces",
|
|
45
|
-
"constants",
|
|
46
|
-
"helpers",
|
|
47
|
-
"utils",
|
|
48
|
-
"lib"
|
|
49
|
-
]),
|
|
50
|
-
// Component directories
|
|
51
|
-
COMPONENTS: expandFolders([
|
|
52
|
-
"providers",
|
|
53
|
-
"layouts",
|
|
54
|
-
"pages",
|
|
55
|
-
"modules",
|
|
56
|
-
"features",
|
|
57
|
-
"components"
|
|
58
|
-
]),
|
|
59
|
-
// Internal root alias (catch-all leftover @/ imports except styles and assets)
|
|
60
|
-
INTERNAL_ROOT: ["^@/(?!.*\\.(s?css|svg|png)$).+$"],
|
|
61
|
-
// Relative parent imports then same-dir relatives
|
|
62
|
-
RELATIVE_PARENT: ["^\\.\\.(?!/?$)", "^\\.\\./?$"],
|
|
63
|
-
RELATIVE_SAME: ["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
|
|
64
|
-
// Assets
|
|
65
|
-
ASSETS: [
|
|
66
|
-
"(asset(s?)|public|static|images)(/.*|$)",
|
|
67
|
-
"^@/.+\\.(svg|png)$",
|
|
68
|
-
"^.+\\.svg$",
|
|
69
|
-
"^.+\\.png$"
|
|
70
|
-
],
|
|
71
|
-
// Styles
|
|
72
|
-
STYLES: [
|
|
73
|
-
// side-effect - virtual css imports
|
|
74
|
-
"^\\u0000.+\\.s?css$",
|
|
75
|
-
// root alias css imports
|
|
76
|
-
"^@/.+\\.s?css$",
|
|
77
|
-
// relative css imports
|
|
78
|
-
"^(\\.{1,2}/).+\\.s?css$"
|
|
79
|
-
]
|
|
80
|
-
};
|
|
81
|
-
var importSortRules = {
|
|
82
|
-
"simple-import-sort/imports": [
|
|
83
|
-
"error",
|
|
84
|
-
{
|
|
85
|
-
groups: [
|
|
86
|
-
GROUPS.SIDE_EFFECTS,
|
|
87
|
-
withTypeFirst(GROUPS.FRAMEWORKS),
|
|
88
|
-
withTypeFirst(GROUPS.EXTERNAL),
|
|
89
|
-
withTypeFirst(GROUPS.INTERNAL_COMMON),
|
|
90
|
-
withTypeFirst(GROUPS.COMPONENTS),
|
|
91
|
-
withTypeFirst(GROUPS.INTERNAL_ROOT),
|
|
92
|
-
withTypeFirst(GROUPS.RELATIVE_PARENT),
|
|
93
|
-
withTypeFirst(GROUPS.RELATIVE_SAME),
|
|
94
|
-
GROUPS.ASSETS,
|
|
95
|
-
GROUPS.STYLES
|
|
96
|
-
]
|
|
97
|
-
}
|
|
98
|
-
],
|
|
99
|
-
"simple-import-sort/exports": "error"
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
// src/rules/nextPluginRules.ts
|
|
103
|
-
var nextPluginRules = {
|
|
104
|
-
// Breaks with ESLint 9, should be activated after the next plugin is updated
|
|
105
|
-
"@next/next/no-duplicate-head": "off"
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
// src/rules/reactHooksRules.ts
|
|
109
|
-
var reactHooksRules = {
|
|
110
|
-
"react-hooks/exhaustive-deps": "warn",
|
|
111
|
-
"react-hooks/rules-of-hooks": "error"
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
// src/rules/reactRules.ts
|
|
115
|
-
var reactRules = {
|
|
116
|
-
// Disable JS specific rules
|
|
117
|
-
"react/jsx-filename-extension": "off",
|
|
118
|
-
"react/default-props-match-prop-types": "off",
|
|
119
|
-
"react/prop-types": "off",
|
|
120
|
-
// Breaks @typescript-eslint/parser
|
|
121
|
-
"react/jsx-indent": "off",
|
|
122
|
-
"react/no-typos": "off",
|
|
123
|
-
"react/jsx-closing-tag-location": "off",
|
|
124
|
-
"react/jsx-wrap-multilines": "off",
|
|
125
|
-
// No longer necessary
|
|
126
|
-
// https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#eslint
|
|
127
|
-
"react/jsx-uses-react": "off",
|
|
128
|
-
"react/react-in-jsx-scope": "off",
|
|
129
|
-
// We are not planning to utilize rules below
|
|
130
|
-
"react/jsx-props-no-spreading": "off"
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
// src/rules/typescriptRules.ts
|
|
134
|
-
var typescriptRules = {
|
|
135
|
-
"@typescript-eslint/consistent-type-definitions": "off",
|
|
136
|
-
"@typescript-eslint/no-empty-function": "off",
|
|
137
|
-
"@typescript-eslint/array-type": "off",
|
|
138
|
-
"@typescript-eslint/explicit-function-return-type": "error",
|
|
139
|
-
"@typescript-eslint/consistent-type-imports": [
|
|
140
|
-
"error",
|
|
141
|
-
{
|
|
142
|
-
prefer: "type-imports",
|
|
143
|
-
fixStyle: "separate-type-imports"
|
|
144
|
-
}
|
|
145
|
-
],
|
|
146
|
-
"@typescript-eslint/no-unused-vars": [
|
|
147
|
-
"error",
|
|
148
|
-
{
|
|
149
|
-
argsIgnorePattern: "^_",
|
|
150
|
-
caughtErrorsIgnorePattern: "^_",
|
|
151
|
-
destructuredArrayIgnorePattern: "^_",
|
|
152
|
-
varsIgnorePattern: "^_"
|
|
153
|
-
}
|
|
154
|
-
]
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
// src/plugins/importSortPlugin.ts
|
|
158
|
-
var importSortPluginConfig = {
|
|
159
|
-
name: "commencis/plugin:simple-import-sort",
|
|
160
|
-
plugins: {
|
|
161
|
-
"simple-import-sort": simpleImportSortPlugin
|
|
162
|
-
},
|
|
163
|
-
rules: {
|
|
164
|
-
...importSortRules
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
// src/plugins/jsxA11yPlugin.ts
|
|
169
|
-
import jsxA11yPlugin from "eslint-plugin-jsx-a11y";
|
|
170
|
-
|
|
171
|
-
// src/constants/index.ts
|
|
172
|
-
var JSX_TSX_FILE_PATTERNS = ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"];
|
|
173
|
-
|
|
174
|
-
// src/plugins/jsxA11yPlugin.ts
|
|
175
|
-
var jsxA11yPluginConfig = {
|
|
176
|
-
name: "commencis/plugin:jsx-a11y",
|
|
177
|
-
files: JSX_TSX_FILE_PATTERNS,
|
|
178
|
-
plugins: {
|
|
179
|
-
"jsx-a11y": jsxA11yPlugin
|
|
180
|
-
},
|
|
181
|
-
languageOptions: { ...jsxA11yPlugin.flatConfigs.recommended.languageOptions },
|
|
182
|
-
rules: {
|
|
183
|
-
...jsxA11yPlugin.flatConfigs.recommended.rules
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
// src/plugins/nextPlugin.ts
|
|
188
|
-
import nextPlugin from "@next/eslint-plugin-next";
|
|
189
|
-
var nextPluginConfig = {
|
|
190
|
-
name: "commencis/plugin:next",
|
|
191
|
-
files: JSX_TSX_FILE_PATTERNS,
|
|
192
|
-
plugins: {
|
|
193
|
-
"@next/next": nextPlugin
|
|
194
|
-
},
|
|
195
|
-
rules: {
|
|
196
|
-
...nextPlugin.configs.recommended.rules,
|
|
197
|
-
...nextPlugin.configs["core-web-vitals"].rules,
|
|
198
|
-
...nextPluginRules
|
|
199
|
-
},
|
|
200
|
-
ignores: [".next/*"]
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
// src/plugins/reactHooksPlugin.ts
|
|
204
|
-
import reactHooksPlugin from "eslint-plugin-react-hooks";
|
|
205
|
-
var reactHooksPluginConfig = {
|
|
206
|
-
name: "commencis/plugin:react-hooks",
|
|
207
|
-
files: JSX_TSX_FILE_PATTERNS,
|
|
208
|
-
plugins: {
|
|
209
|
-
"react-hooks": reactHooksPlugin
|
|
210
|
-
},
|
|
211
|
-
rules: { ...reactHooksRules }
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
// src/plugins/reactPlugin.ts
|
|
215
|
-
import reactPlugin from "eslint-plugin-react";
|
|
216
|
-
var { recommended: recommendedConfig, "jsx-runtime": jsxRuntimeConfig } = reactPlugin.configs.flat;
|
|
217
|
-
var reactPluginConfig = {
|
|
218
|
-
name: "commencis/plugin:react",
|
|
219
|
-
files: JSX_TSX_FILE_PATTERNS,
|
|
220
|
-
languageOptions: {
|
|
221
|
-
...recommendedConfig.languageOptions
|
|
222
|
-
},
|
|
223
|
-
plugins: {
|
|
224
|
-
react: reactPlugin
|
|
225
|
-
},
|
|
226
|
-
rules: {
|
|
227
|
-
...recommendedConfig.rules,
|
|
228
|
-
...jsxRuntimeConfig.rules,
|
|
229
|
-
...reactRules
|
|
230
|
-
},
|
|
231
|
-
settings: {
|
|
232
|
-
react: {
|
|
233
|
-
version: "detect"
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
// src/plugins/vuePlugin.ts
|
|
239
|
-
import vuePlugin from "eslint-plugin-vue";
|
|
240
|
-
var vuePluginConfig = [
|
|
241
|
-
...vuePlugin.configs["flat/recommended"],
|
|
242
|
-
{
|
|
243
|
-
name: "commencis/plugin:vue"
|
|
244
|
-
}
|
|
245
|
-
];
|
|
246
|
-
|
|
247
|
-
// src/configs/base.ts
|
|
248
|
-
var base_default = [
|
|
249
|
-
eslint.configs.recommended,
|
|
250
|
-
importSortPluginConfig,
|
|
251
|
-
{
|
|
252
|
-
name: "commencis/base",
|
|
253
|
-
languageOptions: {
|
|
254
|
-
ecmaVersion: 2022,
|
|
255
|
-
globals: {
|
|
256
|
-
...globals.browser,
|
|
257
|
-
...globals.es2021,
|
|
258
|
-
...globals.node,
|
|
259
|
-
...globals.serviceworker
|
|
260
|
-
}
|
|
261
|
-
},
|
|
262
|
-
rules: {
|
|
263
|
-
"no-console": "warn"
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
];
|
|
267
|
-
|
|
268
|
-
// src/configs/prettier.ts
|
|
269
|
-
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
|
|
270
|
-
var prettier_default = [
|
|
271
|
-
eslintPluginPrettierRecommended,
|
|
272
|
-
{ name: "commencis/prettier" }
|
|
273
|
-
];
|
|
274
|
-
|
|
275
|
-
// src/configs/typescript.ts
|
|
276
|
-
import tseslint from "typescript-eslint";
|
|
277
|
-
var typescript_default = [
|
|
278
|
-
...tseslint.configs.strict,
|
|
279
|
-
...tseslint.configs.stylistic,
|
|
280
|
-
{
|
|
281
|
-
name: "commencis/typescript",
|
|
282
|
-
rules: {
|
|
283
|
-
...typescriptRules
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
];
|
|
287
|
-
|
|
288
|
-
// src/configs/react-native.ts
|
|
289
|
-
var react_native_default = [
|
|
290
|
-
...base_default,
|
|
291
|
-
...typescript_default,
|
|
292
|
-
reactPluginConfig,
|
|
293
|
-
reactHooksPluginConfig,
|
|
294
|
-
jsxA11yPluginConfig,
|
|
295
|
-
...prettier_default,
|
|
296
|
-
{ name: "commencis/react-native" }
|
|
297
|
-
];
|
|
298
|
-
export {
|
|
299
|
-
react_native_default as default
|
|
300
|
-
};
|
package/dist/configs/react.d.ts
DELETED
package/dist/configs/react.js
DELETED
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
// src/configs/base.ts
|
|
2
|
-
import eslint from "@eslint/js";
|
|
3
|
-
import globals from "globals";
|
|
4
|
-
|
|
5
|
-
// src/plugins/importSortPlugin.ts
|
|
6
|
-
import simpleImportSortPlugin from "eslint-plugin-simple-import-sort";
|
|
7
|
-
|
|
8
|
-
// src/rules/importSortRules.ts
|
|
9
|
-
function asTypeOnly(pattern) {
|
|
10
|
-
const base = pattern.endsWith("$") ? pattern.slice(0, -1) : pattern;
|
|
11
|
-
return `${base}\\u0000$`;
|
|
12
|
-
}
|
|
13
|
-
function withTypeFirst(group) {
|
|
14
|
-
return group.flatMap((pattern) => [asTypeOnly(pattern), pattern]);
|
|
15
|
-
}
|
|
16
|
-
function exact(p) {
|
|
17
|
-
return `^@/${p}$`;
|
|
18
|
-
}
|
|
19
|
-
function subpath(p) {
|
|
20
|
-
return `^@/${p}/.+$`;
|
|
21
|
-
}
|
|
22
|
-
function expandFolders(folders) {
|
|
23
|
-
return folders.flatMap((name) => [exact(name), subpath(name)]);
|
|
24
|
-
}
|
|
25
|
-
var GROUPS = {
|
|
26
|
-
// Side effects (simple-import-sort prefixes side-effects with \u0000 at the start)
|
|
27
|
-
SIDE_EFFECTS: ["^\\u0000"],
|
|
28
|
-
// Main frameworks & libraries
|
|
29
|
-
FRAMEWORKS: [
|
|
30
|
-
"^(react(-native|-dom)?(/.*)?)$",
|
|
31
|
-
"^next",
|
|
32
|
-
"^vue",
|
|
33
|
-
"^nuxt",
|
|
34
|
-
"^@angular(/.*|$)",
|
|
35
|
-
"^expo",
|
|
36
|
-
"^node"
|
|
37
|
-
],
|
|
38
|
-
// External packages
|
|
39
|
-
EXTERNAL: ["^@commencis", "^@?\\w"],
|
|
40
|
-
// Internal common directories
|
|
41
|
-
INTERNAL_COMMON: expandFolders([
|
|
42
|
-
"config",
|
|
43
|
-
"types",
|
|
44
|
-
"interfaces",
|
|
45
|
-
"constants",
|
|
46
|
-
"helpers",
|
|
47
|
-
"utils",
|
|
48
|
-
"lib"
|
|
49
|
-
]),
|
|
50
|
-
// Component directories
|
|
51
|
-
COMPONENTS: expandFolders([
|
|
52
|
-
"providers",
|
|
53
|
-
"layouts",
|
|
54
|
-
"pages",
|
|
55
|
-
"modules",
|
|
56
|
-
"features",
|
|
57
|
-
"components"
|
|
58
|
-
]),
|
|
59
|
-
// Internal root alias (catch-all leftover @/ imports except styles and assets)
|
|
60
|
-
INTERNAL_ROOT: ["^@/(?!.*\\.(s?css|svg|png)$).+$"],
|
|
61
|
-
// Relative parent imports then same-dir relatives
|
|
62
|
-
RELATIVE_PARENT: ["^\\.\\.(?!/?$)", "^\\.\\./?$"],
|
|
63
|
-
RELATIVE_SAME: ["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
|
|
64
|
-
// Assets
|
|
65
|
-
ASSETS: [
|
|
66
|
-
"(asset(s?)|public|static|images)(/.*|$)",
|
|
67
|
-
"^@/.+\\.(svg|png)$",
|
|
68
|
-
"^.+\\.svg$",
|
|
69
|
-
"^.+\\.png$"
|
|
70
|
-
],
|
|
71
|
-
// Styles
|
|
72
|
-
STYLES: [
|
|
73
|
-
// side-effect - virtual css imports
|
|
74
|
-
"^\\u0000.+\\.s?css$",
|
|
75
|
-
// root alias css imports
|
|
76
|
-
"^@/.+\\.s?css$",
|
|
77
|
-
// relative css imports
|
|
78
|
-
"^(\\.{1,2}/).+\\.s?css$"
|
|
79
|
-
]
|
|
80
|
-
};
|
|
81
|
-
var importSortRules = {
|
|
82
|
-
"simple-import-sort/imports": [
|
|
83
|
-
"error",
|
|
84
|
-
{
|
|
85
|
-
groups: [
|
|
86
|
-
GROUPS.SIDE_EFFECTS,
|
|
87
|
-
withTypeFirst(GROUPS.FRAMEWORKS),
|
|
88
|
-
withTypeFirst(GROUPS.EXTERNAL),
|
|
89
|
-
withTypeFirst(GROUPS.INTERNAL_COMMON),
|
|
90
|
-
withTypeFirst(GROUPS.COMPONENTS),
|
|
91
|
-
withTypeFirst(GROUPS.INTERNAL_ROOT),
|
|
92
|
-
withTypeFirst(GROUPS.RELATIVE_PARENT),
|
|
93
|
-
withTypeFirst(GROUPS.RELATIVE_SAME),
|
|
94
|
-
GROUPS.ASSETS,
|
|
95
|
-
GROUPS.STYLES
|
|
96
|
-
]
|
|
97
|
-
}
|
|
98
|
-
],
|
|
99
|
-
"simple-import-sort/exports": "error"
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
// src/rules/nextPluginRules.ts
|
|
103
|
-
var nextPluginRules = {
|
|
104
|
-
// Breaks with ESLint 9, should be activated after the next plugin is updated
|
|
105
|
-
"@next/next/no-duplicate-head": "off"
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
// src/rules/reactHooksRules.ts
|
|
109
|
-
var reactHooksRules = {
|
|
110
|
-
"react-hooks/exhaustive-deps": "warn",
|
|
111
|
-
"react-hooks/rules-of-hooks": "error"
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
// src/rules/reactRules.ts
|
|
115
|
-
var reactRules = {
|
|
116
|
-
// Disable JS specific rules
|
|
117
|
-
"react/jsx-filename-extension": "off",
|
|
118
|
-
"react/default-props-match-prop-types": "off",
|
|
119
|
-
"react/prop-types": "off",
|
|
120
|
-
// Breaks @typescript-eslint/parser
|
|
121
|
-
"react/jsx-indent": "off",
|
|
122
|
-
"react/no-typos": "off",
|
|
123
|
-
"react/jsx-closing-tag-location": "off",
|
|
124
|
-
"react/jsx-wrap-multilines": "off",
|
|
125
|
-
// No longer necessary
|
|
126
|
-
// https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#eslint
|
|
127
|
-
"react/jsx-uses-react": "off",
|
|
128
|
-
"react/react-in-jsx-scope": "off",
|
|
129
|
-
// We are not planning to utilize rules below
|
|
130
|
-
"react/jsx-props-no-spreading": "off"
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
// src/rules/typescriptRules.ts
|
|
134
|
-
var typescriptRules = {
|
|
135
|
-
"@typescript-eslint/consistent-type-definitions": "off",
|
|
136
|
-
"@typescript-eslint/no-empty-function": "off",
|
|
137
|
-
"@typescript-eslint/array-type": "off",
|
|
138
|
-
"@typescript-eslint/explicit-function-return-type": "error",
|
|
139
|
-
"@typescript-eslint/consistent-type-imports": [
|
|
140
|
-
"error",
|
|
141
|
-
{
|
|
142
|
-
prefer: "type-imports",
|
|
143
|
-
fixStyle: "separate-type-imports"
|
|
144
|
-
}
|
|
145
|
-
],
|
|
146
|
-
"@typescript-eslint/no-unused-vars": [
|
|
147
|
-
"error",
|
|
148
|
-
{
|
|
149
|
-
argsIgnorePattern: "^_",
|
|
150
|
-
caughtErrorsIgnorePattern: "^_",
|
|
151
|
-
destructuredArrayIgnorePattern: "^_",
|
|
152
|
-
varsIgnorePattern: "^_"
|
|
153
|
-
}
|
|
154
|
-
]
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
// src/plugins/importSortPlugin.ts
|
|
158
|
-
var importSortPluginConfig = {
|
|
159
|
-
name: "commencis/plugin:simple-import-sort",
|
|
160
|
-
plugins: {
|
|
161
|
-
"simple-import-sort": simpleImportSortPlugin
|
|
162
|
-
},
|
|
163
|
-
rules: {
|
|
164
|
-
...importSortRules
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
// src/plugins/jsxA11yPlugin.ts
|
|
169
|
-
import jsxA11yPlugin from "eslint-plugin-jsx-a11y";
|
|
170
|
-
|
|
171
|
-
// src/constants/index.ts
|
|
172
|
-
var JSX_TSX_FILE_PATTERNS = ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"];
|
|
173
|
-
|
|
174
|
-
// src/plugins/jsxA11yPlugin.ts
|
|
175
|
-
var jsxA11yPluginConfig = {
|
|
176
|
-
name: "commencis/plugin:jsx-a11y",
|
|
177
|
-
files: JSX_TSX_FILE_PATTERNS,
|
|
178
|
-
plugins: {
|
|
179
|
-
"jsx-a11y": jsxA11yPlugin
|
|
180
|
-
},
|
|
181
|
-
languageOptions: { ...jsxA11yPlugin.flatConfigs.recommended.languageOptions },
|
|
182
|
-
rules: {
|
|
183
|
-
...jsxA11yPlugin.flatConfigs.recommended.rules
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
// src/plugins/nextPlugin.ts
|
|
188
|
-
import nextPlugin from "@next/eslint-plugin-next";
|
|
189
|
-
var nextPluginConfig = {
|
|
190
|
-
name: "commencis/plugin:next",
|
|
191
|
-
files: JSX_TSX_FILE_PATTERNS,
|
|
192
|
-
plugins: {
|
|
193
|
-
"@next/next": nextPlugin
|
|
194
|
-
},
|
|
195
|
-
rules: {
|
|
196
|
-
...nextPlugin.configs.recommended.rules,
|
|
197
|
-
...nextPlugin.configs["core-web-vitals"].rules,
|
|
198
|
-
...nextPluginRules
|
|
199
|
-
},
|
|
200
|
-
ignores: [".next/*"]
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
// src/plugins/reactHooksPlugin.ts
|
|
204
|
-
import reactHooksPlugin from "eslint-plugin-react-hooks";
|
|
205
|
-
var reactHooksPluginConfig = {
|
|
206
|
-
name: "commencis/plugin:react-hooks",
|
|
207
|
-
files: JSX_TSX_FILE_PATTERNS,
|
|
208
|
-
plugins: {
|
|
209
|
-
"react-hooks": reactHooksPlugin
|
|
210
|
-
},
|
|
211
|
-
rules: { ...reactHooksRules }
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
// src/plugins/reactPlugin.ts
|
|
215
|
-
import reactPlugin from "eslint-plugin-react";
|
|
216
|
-
var { recommended: recommendedConfig, "jsx-runtime": jsxRuntimeConfig } = reactPlugin.configs.flat;
|
|
217
|
-
var reactPluginConfig = {
|
|
218
|
-
name: "commencis/plugin:react",
|
|
219
|
-
files: JSX_TSX_FILE_PATTERNS,
|
|
220
|
-
languageOptions: {
|
|
221
|
-
...recommendedConfig.languageOptions
|
|
222
|
-
},
|
|
223
|
-
plugins: {
|
|
224
|
-
react: reactPlugin
|
|
225
|
-
},
|
|
226
|
-
rules: {
|
|
227
|
-
...recommendedConfig.rules,
|
|
228
|
-
...jsxRuntimeConfig.rules,
|
|
229
|
-
...reactRules
|
|
230
|
-
},
|
|
231
|
-
settings: {
|
|
232
|
-
react: {
|
|
233
|
-
version: "detect"
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
// src/plugins/vuePlugin.ts
|
|
239
|
-
import vuePlugin from "eslint-plugin-vue";
|
|
240
|
-
var vuePluginConfig = [
|
|
241
|
-
...vuePlugin.configs["flat/recommended"],
|
|
242
|
-
{
|
|
243
|
-
name: "commencis/plugin:vue"
|
|
244
|
-
}
|
|
245
|
-
];
|
|
246
|
-
|
|
247
|
-
// src/configs/base.ts
|
|
248
|
-
var base_default = [
|
|
249
|
-
eslint.configs.recommended,
|
|
250
|
-
importSortPluginConfig,
|
|
251
|
-
{
|
|
252
|
-
name: "commencis/base",
|
|
253
|
-
languageOptions: {
|
|
254
|
-
ecmaVersion: 2022,
|
|
255
|
-
globals: {
|
|
256
|
-
...globals.browser,
|
|
257
|
-
...globals.es2021,
|
|
258
|
-
...globals.node,
|
|
259
|
-
...globals.serviceworker
|
|
260
|
-
}
|
|
261
|
-
},
|
|
262
|
-
rules: {
|
|
263
|
-
"no-console": "warn"
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
];
|
|
267
|
-
|
|
268
|
-
// src/configs/prettier.ts
|
|
269
|
-
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
|
|
270
|
-
var prettier_default = [
|
|
271
|
-
eslintPluginPrettierRecommended,
|
|
272
|
-
{ name: "commencis/prettier" }
|
|
273
|
-
];
|
|
274
|
-
|
|
275
|
-
// src/configs/typescript.ts
|
|
276
|
-
import tseslint from "typescript-eslint";
|
|
277
|
-
var typescript_default = [
|
|
278
|
-
...tseslint.configs.strict,
|
|
279
|
-
...tseslint.configs.stylistic,
|
|
280
|
-
{
|
|
281
|
-
name: "commencis/typescript",
|
|
282
|
-
rules: {
|
|
283
|
-
...typescriptRules
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
];
|
|
287
|
-
|
|
288
|
-
// src/configs/react.ts
|
|
289
|
-
var react_default = [
|
|
290
|
-
...base_default,
|
|
291
|
-
...typescript_default,
|
|
292
|
-
reactPluginConfig,
|
|
293
|
-
reactHooksPluginConfig,
|
|
294
|
-
jsxA11yPluginConfig,
|
|
295
|
-
...prettier_default,
|
|
296
|
-
{ name: "commencis/react" }
|
|
297
|
-
];
|
|
298
|
-
export {
|
|
299
|
-
react_default as default
|
|
300
|
-
};
|