@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
|
@@ -0,0 +1,574 @@
|
|
|
1
|
+
import globals from "globals";
|
|
2
|
+
import simpleImportSortPlugin from "eslint-plugin-simple-import-sort";
|
|
3
|
+
import nextPlugin from "@next/eslint-plugin-next";
|
|
4
|
+
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
|
|
5
|
+
import jsxA11yPlugin from "eslint-plugin-jsx-a11y";
|
|
6
|
+
import reactPlugin from "eslint-plugin-react";
|
|
7
|
+
import reactHooksPlugin from "eslint-plugin-react-hooks";
|
|
8
|
+
import { parser, plugin } from "typescript-eslint";
|
|
9
|
+
|
|
10
|
+
//#region src/rulesets/base.ruleset.ts
|
|
11
|
+
const baseRuleset = {
|
|
12
|
+
languageOptions: {
|
|
13
|
+
ecmaVersion: "latest",
|
|
14
|
+
globals: {
|
|
15
|
+
...globals.browser,
|
|
16
|
+
...globals.es2021,
|
|
17
|
+
...globals.node,
|
|
18
|
+
...globals.serviceworker
|
|
19
|
+
},
|
|
20
|
+
parserOptions: {
|
|
21
|
+
ecmaFeatures: { jsx: true },
|
|
22
|
+
ecmaVersion: "latest",
|
|
23
|
+
sourceType: "module"
|
|
24
|
+
},
|
|
25
|
+
sourceType: "module"
|
|
26
|
+
},
|
|
27
|
+
linterOptions: {
|
|
28
|
+
reportUnusedDisableDirectives: "error",
|
|
29
|
+
reportUnusedInlineConfigs: "error"
|
|
30
|
+
},
|
|
31
|
+
name: "@commencis/base"
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/rulesets/ignores.ruleset.ts
|
|
36
|
+
const ignoresRuleset = {
|
|
37
|
+
ignores: [
|
|
38
|
+
"**/node_modules",
|
|
39
|
+
"**/.yarn",
|
|
40
|
+
"**/.yalc",
|
|
41
|
+
"**/package-lock.json",
|
|
42
|
+
"**/yarn.lock",
|
|
43
|
+
"**/pnpm-lock.yaml",
|
|
44
|
+
"**/dist",
|
|
45
|
+
"**/build",
|
|
46
|
+
"**/out",
|
|
47
|
+
"**/storybook-static",
|
|
48
|
+
"**/coverage",
|
|
49
|
+
"**/__snapshots__",
|
|
50
|
+
"**/.nuxt",
|
|
51
|
+
"**/.next",
|
|
52
|
+
"**/.svelte-kit",
|
|
53
|
+
"**/next-env.d.ts",
|
|
54
|
+
"**/.changeset",
|
|
55
|
+
"**/.idea",
|
|
56
|
+
"**/.cache",
|
|
57
|
+
"**/CHANGELOG*.md",
|
|
58
|
+
"**/LICENSE*"
|
|
59
|
+
],
|
|
60
|
+
name: "@commencis/ignores"
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/constants/globs.ts
|
|
65
|
+
/**
|
|
66
|
+
* Glob patterns using minimatch syntax for matching source files.
|
|
67
|
+
* These patterns are used to configure ESLint file matching.
|
|
68
|
+
*
|
|
69
|
+
* @see https://github.com/isaacs/minimatch
|
|
70
|
+
*/
|
|
71
|
+
const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
72
|
+
const GLOB_TS = "**/*.?([cm])ts";
|
|
73
|
+
const GLOB_TSX = "**/*.?([cm])tsx";
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/utils/import.utils.ts
|
|
77
|
+
/**
|
|
78
|
+
* Turn a normal "from" regex into a “type-only” variant that matches
|
|
79
|
+
* the same sources *when* they’re type-only imports.
|
|
80
|
+
* simple-import-sort appends \u0000 to type-only import sources.
|
|
81
|
+
*/
|
|
82
|
+
function asTypeOnly(pattern) {
|
|
83
|
+
return `${pattern.endsWith("$") ? pattern.slice(0, -1) : pattern}\\u0000$`;
|
|
84
|
+
}
|
|
85
|
+
function withTypeFirst(group) {
|
|
86
|
+
return group.flatMap((pattern) => [asTypeOnly(pattern), pattern]);
|
|
87
|
+
}
|
|
88
|
+
function exact(p) {
|
|
89
|
+
return `^@/${p}$`;
|
|
90
|
+
}
|
|
91
|
+
function subpath(p) {
|
|
92
|
+
return `^@/${p}/.+$`;
|
|
93
|
+
}
|
|
94
|
+
function expandFolders(folders) {
|
|
95
|
+
return folders.flatMap((name) => [exact(name), subpath(name)]);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/rulesets/import.ruleset.ts
|
|
100
|
+
const GROUPS = {
|
|
101
|
+
SIDE_EFFECTS: ["^\\u0000"],
|
|
102
|
+
FRAMEWORKS: [
|
|
103
|
+
"^(react(-native|-dom)?(/.*)?)$",
|
|
104
|
+
"^next",
|
|
105
|
+
"^vue",
|
|
106
|
+
"^nuxt",
|
|
107
|
+
"^@angular(/.*|$)",
|
|
108
|
+
"^expo",
|
|
109
|
+
"^node"
|
|
110
|
+
],
|
|
111
|
+
EXTERNAL: ["^@commencis", "^@?\\w"],
|
|
112
|
+
INTERNAL_COMMON: expandFolders([
|
|
113
|
+
"config",
|
|
114
|
+
"types",
|
|
115
|
+
"interfaces",
|
|
116
|
+
"constants",
|
|
117
|
+
"helpers",
|
|
118
|
+
"utils",
|
|
119
|
+
"lib"
|
|
120
|
+
]),
|
|
121
|
+
COMPONENTS: expandFolders([
|
|
122
|
+
"providers",
|
|
123
|
+
"layouts",
|
|
124
|
+
"pages",
|
|
125
|
+
"modules",
|
|
126
|
+
"features",
|
|
127
|
+
"components"
|
|
128
|
+
]),
|
|
129
|
+
INTERNAL_ROOT: ["^@/(?!.*\\.(s?css|svg|png)$).+$"],
|
|
130
|
+
RELATIVE_PARENT: ["^\\.\\.(?!/?$)", "^\\.\\./?$"],
|
|
131
|
+
RELATIVE_SAME: [
|
|
132
|
+
"^\\./(?=.*/)(?!/?$)",
|
|
133
|
+
"^\\.(?!/?$)",
|
|
134
|
+
"^\\./?$"
|
|
135
|
+
],
|
|
136
|
+
ASSETS: [
|
|
137
|
+
"(asset(s?)|public|static|images)(/.*|$)",
|
|
138
|
+
"^@/.+\\.(svg|png)$",
|
|
139
|
+
"^.+\\.svg$",
|
|
140
|
+
"^.+\\.png$"
|
|
141
|
+
],
|
|
142
|
+
STYLES: [
|
|
143
|
+
"^\\u0000.+\\.s?css$",
|
|
144
|
+
"^@/.+\\.s?css$",
|
|
145
|
+
"^(\\.{1,2}/).+\\.s?css$"
|
|
146
|
+
]
|
|
147
|
+
};
|
|
148
|
+
const importRuleset = {
|
|
149
|
+
files: [GLOB_SRC],
|
|
150
|
+
plugins: { "simple-import-sort": simpleImportSortPlugin },
|
|
151
|
+
rules: {
|
|
152
|
+
"simple-import-sort/imports": ["error", { groups: [
|
|
153
|
+
GROUPS.SIDE_EFFECTS,
|
|
154
|
+
withTypeFirst(GROUPS.FRAMEWORKS),
|
|
155
|
+
withTypeFirst(GROUPS.EXTERNAL),
|
|
156
|
+
withTypeFirst(GROUPS.INTERNAL_COMMON),
|
|
157
|
+
withTypeFirst(GROUPS.COMPONENTS),
|
|
158
|
+
withTypeFirst(GROUPS.INTERNAL_ROOT),
|
|
159
|
+
withTypeFirst(GROUPS.RELATIVE_PARENT),
|
|
160
|
+
withTypeFirst(GROUPS.RELATIVE_SAME),
|
|
161
|
+
GROUPS.ASSETS,
|
|
162
|
+
GROUPS.STYLES
|
|
163
|
+
] }],
|
|
164
|
+
"simple-import-sort/exports": "error"
|
|
165
|
+
},
|
|
166
|
+
name: "@commencis/import"
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region src/rulesets/javascript.ruleset.ts
|
|
171
|
+
const javascriptRuleset = {
|
|
172
|
+
files: [GLOB_SRC],
|
|
173
|
+
rules: {
|
|
174
|
+
"constructor-super": "error",
|
|
175
|
+
"for-direction": "error",
|
|
176
|
+
"getter-return": "error",
|
|
177
|
+
"no-async-promise-executor": "error",
|
|
178
|
+
"no-case-declarations": "error",
|
|
179
|
+
"no-class-assign": "error",
|
|
180
|
+
"no-compare-neg-zero": "error",
|
|
181
|
+
"no-cond-assign": "error",
|
|
182
|
+
"no-console": "warn",
|
|
183
|
+
"no-const-assign": "error",
|
|
184
|
+
"no-constant-binary-expression": "error",
|
|
185
|
+
"no-constant-condition": "error",
|
|
186
|
+
"no-control-regex": "error",
|
|
187
|
+
"no-debugger": "error",
|
|
188
|
+
"no-delete-var": "error",
|
|
189
|
+
"no-dupe-args": "error",
|
|
190
|
+
"no-dupe-class-members": "error",
|
|
191
|
+
"no-dupe-else-if": "error",
|
|
192
|
+
"no-dupe-keys": "error",
|
|
193
|
+
"no-duplicate-case": "error",
|
|
194
|
+
"no-empty": "error",
|
|
195
|
+
"no-empty-character-class": "error",
|
|
196
|
+
"no-empty-pattern": "error",
|
|
197
|
+
"no-empty-static-block": "error",
|
|
198
|
+
"no-ex-assign": "error",
|
|
199
|
+
"no-extra-boolean-cast": "error",
|
|
200
|
+
"no-fallthrough": "error",
|
|
201
|
+
"no-func-assign": "error",
|
|
202
|
+
"no-global-assign": "error",
|
|
203
|
+
"no-import-assign": "error",
|
|
204
|
+
"no-invalid-regexp": "error",
|
|
205
|
+
"no-irregular-whitespace": "error",
|
|
206
|
+
"no-loss-of-precision": "error",
|
|
207
|
+
"no-misleading-character-class": "error",
|
|
208
|
+
"no-new-native-nonconstructor": "error",
|
|
209
|
+
"no-nonoctal-decimal-escape": "error",
|
|
210
|
+
"no-obj-calls": "error",
|
|
211
|
+
"no-octal": "error",
|
|
212
|
+
"no-prototype-builtins": "error",
|
|
213
|
+
"no-redeclare": "error",
|
|
214
|
+
"no-regex-spaces": "error",
|
|
215
|
+
"no-self-assign": "error",
|
|
216
|
+
"no-setter-return": "error",
|
|
217
|
+
"no-shadow-restricted-names": "error",
|
|
218
|
+
"no-sparse-arrays": "error",
|
|
219
|
+
"no-this-before-super": "error",
|
|
220
|
+
"no-undef": "error",
|
|
221
|
+
"no-unexpected-multiline": "error",
|
|
222
|
+
"no-unreachable": "error",
|
|
223
|
+
"no-unsafe-finally": "error",
|
|
224
|
+
"no-unsafe-negation": "error",
|
|
225
|
+
"no-unsafe-optional-chaining": "error",
|
|
226
|
+
"no-unused-labels": "error",
|
|
227
|
+
"no-unused-private-class-members": "error",
|
|
228
|
+
"no-unused-vars": "error",
|
|
229
|
+
"no-useless-backreference": "error",
|
|
230
|
+
"no-useless-catch": "error",
|
|
231
|
+
"no-useless-escape": "error",
|
|
232
|
+
"no-with": "error",
|
|
233
|
+
"require-yield": "error",
|
|
234
|
+
"use-isnan": "error",
|
|
235
|
+
"valid-typeof": "error"
|
|
236
|
+
},
|
|
237
|
+
name: "@commencis/javascript"
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
//#endregion
|
|
241
|
+
//#region src/rulesets/next.ruleset.ts
|
|
242
|
+
const nextRuleset = {
|
|
243
|
+
files: [GLOB_SRC],
|
|
244
|
+
plugins: { "@next/next": nextPlugin },
|
|
245
|
+
rules: {
|
|
246
|
+
"@next/next/google-font-display": "warn",
|
|
247
|
+
"@next/next/google-font-preconnect": "warn",
|
|
248
|
+
"@next/next/next-script-for-ga": "warn",
|
|
249
|
+
"@next/next/no-async-client-component": "warn",
|
|
250
|
+
"@next/next/no-before-interactive-script-outside-document": "warn",
|
|
251
|
+
"@next/next/no-css-tags": "warn",
|
|
252
|
+
"@next/next/no-head-element": "warn",
|
|
253
|
+
"@next/next/no-img-element": "warn",
|
|
254
|
+
"@next/next/no-page-custom-font": "warn",
|
|
255
|
+
"@next/next/no-styled-jsx-in-document": "warn",
|
|
256
|
+
"@next/next/no-title-in-document-head": "warn",
|
|
257
|
+
"@next/next/no-typos": "warn",
|
|
258
|
+
"@next/next/no-unwanted-polyfillio": "warn",
|
|
259
|
+
"@next/next/inline-script-id": "error",
|
|
260
|
+
"@next/next/no-assign-module-variable": "error",
|
|
261
|
+
"@next/next/no-document-import-in-page": "error",
|
|
262
|
+
"@next/next/no-duplicate-head": "error",
|
|
263
|
+
"@next/next/no-head-import-in-document": "error",
|
|
264
|
+
"@next/next/no-script-component-in-head": "error",
|
|
265
|
+
"@next/next/no-html-link-for-pages": "error",
|
|
266
|
+
"@next/next/no-sync-scripts": "error"
|
|
267
|
+
},
|
|
268
|
+
name: "@commencis/nextjs"
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
//#endregion
|
|
272
|
+
//#region src/rulesets/prettier.ruleset.ts
|
|
273
|
+
const prettierRuleset = {
|
|
274
|
+
...eslintPluginPrettierRecommended,
|
|
275
|
+
files: [GLOB_SRC],
|
|
276
|
+
name: "@commencis/prettier"
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
//#endregion
|
|
280
|
+
//#region src/rulesets/react.ruleset.ts
|
|
281
|
+
function reactRuleset(options) {
|
|
282
|
+
const { reactCompiler = false, jsxA11y = true } = options ?? {};
|
|
283
|
+
return {
|
|
284
|
+
files: [GLOB_SRC],
|
|
285
|
+
plugins: {
|
|
286
|
+
react: reactPlugin,
|
|
287
|
+
"react-hooks": reactHooksPlugin,
|
|
288
|
+
...jsxA11y ? { "jsx-a11y": jsxA11yPlugin } : {}
|
|
289
|
+
},
|
|
290
|
+
rules: {
|
|
291
|
+
"react/display-name": "error",
|
|
292
|
+
"react/jsx-key": "error",
|
|
293
|
+
"react/jsx-no-comment-textnodes": "error",
|
|
294
|
+
"react/jsx-no-duplicate-props": "error",
|
|
295
|
+
"react/jsx-no-target-blank": "error",
|
|
296
|
+
"react/jsx-no-undef": "error",
|
|
297
|
+
"react/jsx-uses-vars": "error",
|
|
298
|
+
"react/no-children-prop": "error",
|
|
299
|
+
"react/no-danger-with-children": "error",
|
|
300
|
+
"react/no-deprecated": "error",
|
|
301
|
+
"react/no-direct-mutation-state": "error",
|
|
302
|
+
"react/no-find-dom-node": "error",
|
|
303
|
+
"react/no-is-mounted": "error",
|
|
304
|
+
"react/no-render-return-value": "error",
|
|
305
|
+
"react/no-string-refs": "error",
|
|
306
|
+
"react/no-unescaped-entities": "error",
|
|
307
|
+
"react/no-unknown-property": "error",
|
|
308
|
+
"react/no-unsafe": "off",
|
|
309
|
+
"react/require-render-return": "error",
|
|
310
|
+
"react/jsx-filename-extension": "off",
|
|
311
|
+
"react/default-props-match-prop-types": "off",
|
|
312
|
+
"react/prop-types": "off",
|
|
313
|
+
"react/jsx-indent": "off",
|
|
314
|
+
"react/no-typos": "off",
|
|
315
|
+
"react/jsx-closing-tag-location": "off",
|
|
316
|
+
"react/jsx-wrap-multilines": "off",
|
|
317
|
+
"react/jsx-uses-react": "off",
|
|
318
|
+
"react/react-in-jsx-scope": "off",
|
|
319
|
+
"react/jsx-props-no-spreading": "off",
|
|
320
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
321
|
+
"react-hooks/rules-of-hooks": "error",
|
|
322
|
+
...reactCompiler ? {
|
|
323
|
+
"react-hooks/config": "error",
|
|
324
|
+
"react-hooks/error-boundaries": "error",
|
|
325
|
+
"react-hooks/component-hook-factories": "error",
|
|
326
|
+
"react-hooks/gating": "error",
|
|
327
|
+
"react-hooks/globals": "error",
|
|
328
|
+
"react-hooks/immutability": "error",
|
|
329
|
+
"react-hooks/preserve-manual-memoization": "error",
|
|
330
|
+
"react-hooks/purity": "error",
|
|
331
|
+
"react-hooks/refs": "error",
|
|
332
|
+
"react-hooks/set-state-in-effect": "error",
|
|
333
|
+
"react-hooks/set-state-in-render": "error",
|
|
334
|
+
"react-hooks/static-components": "error",
|
|
335
|
+
"react-hooks/unsupported-syntax": "warn",
|
|
336
|
+
"react-hooks/use-memo": "error",
|
|
337
|
+
"react-hooks/incompatible-library": "warn"
|
|
338
|
+
} : {},
|
|
339
|
+
...jsxA11y ? {
|
|
340
|
+
"jsx-a11y/alt-text": "error",
|
|
341
|
+
"jsx-a11y/anchor-ambiguous-text": "off",
|
|
342
|
+
"jsx-a11y/anchor-has-content": "error",
|
|
343
|
+
"jsx-a11y/anchor-is-valid": "error",
|
|
344
|
+
"jsx-a11y/aria-activedescendant-has-tabindex": "error",
|
|
345
|
+
"jsx-a11y/aria-props": "error",
|
|
346
|
+
"jsx-a11y/aria-proptypes": "error",
|
|
347
|
+
"jsx-a11y/aria-role": "error",
|
|
348
|
+
"jsx-a11y/aria-unsupported-elements": "error",
|
|
349
|
+
"jsx-a11y/autocomplete-valid": "error",
|
|
350
|
+
"jsx-a11y/click-events-have-key-events": "error",
|
|
351
|
+
"jsx-a11y/control-has-associated-label": ["off", {
|
|
352
|
+
ignoreElements: [
|
|
353
|
+
"audio",
|
|
354
|
+
"canvas",
|
|
355
|
+
"embed",
|
|
356
|
+
"input",
|
|
357
|
+
"textarea",
|
|
358
|
+
"tr",
|
|
359
|
+
"video"
|
|
360
|
+
],
|
|
361
|
+
ignoreRoles: [
|
|
362
|
+
"grid",
|
|
363
|
+
"listbox",
|
|
364
|
+
"menu",
|
|
365
|
+
"menubar",
|
|
366
|
+
"radiogroup",
|
|
367
|
+
"row",
|
|
368
|
+
"tablist",
|
|
369
|
+
"toolbar",
|
|
370
|
+
"tree",
|
|
371
|
+
"treegrid"
|
|
372
|
+
],
|
|
373
|
+
includeRoles: ["alert", "dialog"]
|
|
374
|
+
}],
|
|
375
|
+
"jsx-a11y/heading-has-content": "error",
|
|
376
|
+
"jsx-a11y/html-has-lang": "error",
|
|
377
|
+
"jsx-a11y/iframe-has-title": "error",
|
|
378
|
+
"jsx-a11y/img-redundant-alt": "error",
|
|
379
|
+
"jsx-a11y/interactive-supports-focus": ["error", { tabbable: [
|
|
380
|
+
"button",
|
|
381
|
+
"checkbox",
|
|
382
|
+
"link",
|
|
383
|
+
"searchbox",
|
|
384
|
+
"spinbutton",
|
|
385
|
+
"switch",
|
|
386
|
+
"textbox"
|
|
387
|
+
] }],
|
|
388
|
+
"jsx-a11y/label-has-associated-control": "error",
|
|
389
|
+
"jsx-a11y/label-has-for": "off",
|
|
390
|
+
"jsx-a11y/media-has-caption": "error",
|
|
391
|
+
"jsx-a11y/mouse-events-have-key-events": "error",
|
|
392
|
+
"jsx-a11y/no-access-key": "error",
|
|
393
|
+
"jsx-a11y/no-autofocus": "error",
|
|
394
|
+
"jsx-a11y/no-distracting-elements": "error",
|
|
395
|
+
"jsx-a11y/no-interactive-element-to-noninteractive-role": ["error", {
|
|
396
|
+
tr: ["none", "presentation"],
|
|
397
|
+
canvas: ["img"]
|
|
398
|
+
}],
|
|
399
|
+
"jsx-a11y/no-noninteractive-element-interactions": ["error", {
|
|
400
|
+
handlers: [
|
|
401
|
+
"onClick",
|
|
402
|
+
"onError",
|
|
403
|
+
"onLoad",
|
|
404
|
+
"onMouseDown",
|
|
405
|
+
"onMouseUp",
|
|
406
|
+
"onKeyPress",
|
|
407
|
+
"onKeyDown",
|
|
408
|
+
"onKeyUp"
|
|
409
|
+
],
|
|
410
|
+
alert: [
|
|
411
|
+
"onKeyUp",
|
|
412
|
+
"onKeyDown",
|
|
413
|
+
"onKeyPress"
|
|
414
|
+
],
|
|
415
|
+
body: ["onError", "onLoad"],
|
|
416
|
+
dialog: [
|
|
417
|
+
"onKeyUp",
|
|
418
|
+
"onKeyDown",
|
|
419
|
+
"onKeyPress"
|
|
420
|
+
],
|
|
421
|
+
iframe: ["onError", "onLoad"],
|
|
422
|
+
img: ["onError", "onLoad"]
|
|
423
|
+
}],
|
|
424
|
+
"jsx-a11y/no-noninteractive-element-to-interactive-role": ["error", {
|
|
425
|
+
ul: [
|
|
426
|
+
"listbox",
|
|
427
|
+
"menu",
|
|
428
|
+
"menubar",
|
|
429
|
+
"radiogroup",
|
|
430
|
+
"tablist",
|
|
431
|
+
"tree",
|
|
432
|
+
"treegrid"
|
|
433
|
+
],
|
|
434
|
+
ol: [
|
|
435
|
+
"listbox",
|
|
436
|
+
"menu",
|
|
437
|
+
"menubar",
|
|
438
|
+
"radiogroup",
|
|
439
|
+
"tablist",
|
|
440
|
+
"tree",
|
|
441
|
+
"treegrid"
|
|
442
|
+
],
|
|
443
|
+
li: [
|
|
444
|
+
"menuitem",
|
|
445
|
+
"menuitemradio",
|
|
446
|
+
"menuitemcheckbox",
|
|
447
|
+
"option",
|
|
448
|
+
"row",
|
|
449
|
+
"tab",
|
|
450
|
+
"treeitem"
|
|
451
|
+
],
|
|
452
|
+
table: ["grid"],
|
|
453
|
+
td: ["gridcell"],
|
|
454
|
+
fieldset: ["radiogroup", "presentation"]
|
|
455
|
+
}],
|
|
456
|
+
"jsx-a11y/no-noninteractive-tabindex": ["error", {
|
|
457
|
+
tags: [],
|
|
458
|
+
roles: ["tabpanel"],
|
|
459
|
+
allowExpressionValues: true
|
|
460
|
+
}],
|
|
461
|
+
"jsx-a11y/no-redundant-roles": "error",
|
|
462
|
+
"jsx-a11y/no-static-element-interactions": ["error", {
|
|
463
|
+
allowExpressionValues: true,
|
|
464
|
+
handlers: [
|
|
465
|
+
"onClick",
|
|
466
|
+
"onMouseDown",
|
|
467
|
+
"onMouseUp",
|
|
468
|
+
"onKeyPress",
|
|
469
|
+
"onKeyDown",
|
|
470
|
+
"onKeyUp"
|
|
471
|
+
]
|
|
472
|
+
}],
|
|
473
|
+
"jsx-a11y/role-has-required-aria-props": "error",
|
|
474
|
+
"jsx-a11y/role-supports-aria-props": "error",
|
|
475
|
+
"jsx-a11y/scope": "error",
|
|
476
|
+
"jsx-a11y/tabindex-no-positive": "error"
|
|
477
|
+
} : {}
|
|
478
|
+
},
|
|
479
|
+
settings: { react: { version: "detect" } },
|
|
480
|
+
name: "@commencis/react"
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
//#endregion
|
|
485
|
+
//#region src/rulesets/typescript.ruleset.ts
|
|
486
|
+
const typescriptRuleset = {
|
|
487
|
+
files: [GLOB_TS, GLOB_TSX],
|
|
488
|
+
plugins: { "@typescript-eslint": plugin },
|
|
489
|
+
languageOptions: {
|
|
490
|
+
parser,
|
|
491
|
+
sourceType: "module"
|
|
492
|
+
},
|
|
493
|
+
rules: {
|
|
494
|
+
"@typescript-eslint/ban-ts-comment": ["error", { minimumDescriptionLength: 10 }],
|
|
495
|
+
"no-array-constructor": "off",
|
|
496
|
+
"@typescript-eslint/no-array-constructor": "error",
|
|
497
|
+
"@typescript-eslint/no-duplicate-enum-values": "error",
|
|
498
|
+
"@typescript-eslint/no-dynamic-delete": "error",
|
|
499
|
+
"@typescript-eslint/no-empty-object-type": "error",
|
|
500
|
+
"@typescript-eslint/no-explicit-any": "error",
|
|
501
|
+
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
|
502
|
+
"@typescript-eslint/no-extraneous-class": "error",
|
|
503
|
+
"@typescript-eslint/no-invalid-void-type": "error",
|
|
504
|
+
"@typescript-eslint/no-misused-new": "error",
|
|
505
|
+
"@typescript-eslint/no-namespace": "error",
|
|
506
|
+
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
|
|
507
|
+
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
|
508
|
+
"@typescript-eslint/no-non-null-assertion": "error",
|
|
509
|
+
"@typescript-eslint/no-require-imports": "error",
|
|
510
|
+
"@typescript-eslint/no-this-alias": "error",
|
|
511
|
+
"@typescript-eslint/no-unnecessary-type-constraint": "error",
|
|
512
|
+
"@typescript-eslint/no-unsafe-declaration-merging": "error",
|
|
513
|
+
"@typescript-eslint/no-unsafe-function-type": "error",
|
|
514
|
+
"no-unused-expressions": "off",
|
|
515
|
+
"@typescript-eslint/no-unused-expressions": "error",
|
|
516
|
+
"no-unused-vars": "off",
|
|
517
|
+
"no-useless-constructor": "off",
|
|
518
|
+
"@typescript-eslint/no-useless-constructor": "error",
|
|
519
|
+
"@typescript-eslint/no-wrapper-object-types": "error",
|
|
520
|
+
"@typescript-eslint/prefer-as-const": "error",
|
|
521
|
+
"@typescript-eslint/prefer-literal-enum-member": "error",
|
|
522
|
+
"@typescript-eslint/prefer-namespace-keyword": "error",
|
|
523
|
+
"@typescript-eslint/triple-slash-reference": "error",
|
|
524
|
+
"@typescript-eslint/unified-signatures": "error",
|
|
525
|
+
"@typescript-eslint/adjacent-overload-signatures": "error",
|
|
526
|
+
"@typescript-eslint/ban-tslint-comment": "error",
|
|
527
|
+
"@typescript-eslint/class-literal-property-style": "error",
|
|
528
|
+
"@typescript-eslint/consistent-generic-constructors": "error",
|
|
529
|
+
"@typescript-eslint/consistent-indexed-object-style": "error",
|
|
530
|
+
"@typescript-eslint/consistent-type-assertions": "error",
|
|
531
|
+
"@typescript-eslint/no-confusing-non-null-assertion": "error",
|
|
532
|
+
"no-empty-function": "off",
|
|
533
|
+
"@typescript-eslint/no-inferrable-types": "error",
|
|
534
|
+
"@typescript-eslint/prefer-for-of": "error",
|
|
535
|
+
"@typescript-eslint/prefer-function-type": "error",
|
|
536
|
+
"@typescript-eslint/consistent-type-definitions": "off",
|
|
537
|
+
"@typescript-eslint/no-empty-function": "off",
|
|
538
|
+
"@typescript-eslint/array-type": "off",
|
|
539
|
+
"@typescript-eslint/explicit-function-return-type": "error",
|
|
540
|
+
"@typescript-eslint/consistent-type-imports": ["error", {
|
|
541
|
+
prefer: "type-imports",
|
|
542
|
+
fixStyle: "separate-type-imports"
|
|
543
|
+
}],
|
|
544
|
+
"@typescript-eslint/no-unused-vars": ["error", {
|
|
545
|
+
argsIgnorePattern: "^_",
|
|
546
|
+
caughtErrorsIgnorePattern: "^_",
|
|
547
|
+
destructuredArrayIgnorePattern: "^_",
|
|
548
|
+
varsIgnorePattern: "^_"
|
|
549
|
+
}]
|
|
550
|
+
},
|
|
551
|
+
name: "@commencis/typescript"
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
//#endregion
|
|
555
|
+
//#region src/lib/configFactory.ts
|
|
556
|
+
function configFactory(options) {
|
|
557
|
+
const { typescript, react, reactCompiler, jsxA11y, nextjs } = options ?? {};
|
|
558
|
+
return [
|
|
559
|
+
baseRuleset,
|
|
560
|
+
javascriptRuleset,
|
|
561
|
+
importRuleset,
|
|
562
|
+
...typescript ? [typescriptRuleset] : [],
|
|
563
|
+
...react ? [reactRuleset({
|
|
564
|
+
reactCompiler,
|
|
565
|
+
jsxA11y
|
|
566
|
+
})] : [],
|
|
567
|
+
...nextjs ? [nextRuleset] : [],
|
|
568
|
+
prettierRuleset,
|
|
569
|
+
ignoresRuleset
|
|
570
|
+
];
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
//#endregion
|
|
574
|
+
export { configFactory as t };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { t as FlatConfig } from "../config.types-M1gOzpFJ.mjs";
|
|
2
|
+
import * as eslint_config0 from "eslint/config";
|
|
3
|
+
|
|
4
|
+
//#region src/configs/javascript.d.ts
|
|
5
|
+
declare const javascriptConfig: FlatConfig;
|
|
6
|
+
declare const _default: eslint_config0.Config[];
|
|
7
|
+
//#endregion
|
|
8
|
+
export { _default as default, javascriptConfig };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { t as configFactory } from "../configFactory-D_qKOxEp.mjs";
|
|
2
|
+
import { defineConfig } from "eslint/config";
|
|
3
|
+
|
|
4
|
+
//#region src/configs/javascript.ts
|
|
5
|
+
const javascriptConfig = configFactory();
|
|
6
|
+
var javascript_default = defineConfig(javascriptConfig);
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
export { javascript_default as default, javascriptConfig };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { t as FlatConfig } from "../config.types-M1gOzpFJ.mjs";
|
|
2
|
+
import * as eslint_config0 from "eslint/config";
|
|
3
|
+
|
|
4
|
+
//#region src/configs/native.d.ts
|
|
5
|
+
declare const reactNativeConfig: FlatConfig;
|
|
6
|
+
declare const _default: eslint_config0.Config[];
|
|
7
|
+
//#endregion
|
|
8
|
+
export { _default as default, reactNativeConfig };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { t as configFactory } from "../configFactory-D_qKOxEp.mjs";
|
|
2
|
+
import { defineConfig } from "eslint/config";
|
|
3
|
+
|
|
4
|
+
//#region src/configs/native.ts
|
|
5
|
+
const reactNativeConfig = configFactory({
|
|
6
|
+
typescript: true,
|
|
7
|
+
react: true
|
|
8
|
+
});
|
|
9
|
+
var native_default = defineConfig(reactNativeConfig);
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { native_default as default, reactNativeConfig };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { t as FlatConfig } from "../config.types-M1gOzpFJ.mjs";
|
|
2
|
+
import * as eslint_config1 from "eslint/config";
|
|
3
|
+
|
|
4
|
+
//#region src/configs/next.d.ts
|
|
5
|
+
declare const nextConfig: FlatConfig;
|
|
6
|
+
declare const _default: eslint_config1.Config[];
|
|
7
|
+
//#endregion
|
|
8
|
+
export { _default as default, nextConfig };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { t as configFactory } from "../configFactory-D_qKOxEp.mjs";
|
|
2
|
+
import { defineConfig } from "eslint/config";
|
|
3
|
+
|
|
4
|
+
//#region src/configs/next.ts
|
|
5
|
+
const nextConfig = configFactory({
|
|
6
|
+
typescript: true,
|
|
7
|
+
react: true,
|
|
8
|
+
nextjs: true
|
|
9
|
+
});
|
|
10
|
+
var next_default = defineConfig(nextConfig);
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { next_default as default, nextConfig };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { t as FlatConfig } from "../config.types-M1gOzpFJ.mjs";
|
|
2
|
+
import * as eslint_config2 from "eslint/config";
|
|
3
|
+
|
|
4
|
+
//#region src/configs/react.d.ts
|
|
5
|
+
declare const reactConfig: FlatConfig;
|
|
6
|
+
declare const _default: eslint_config2.Config[];
|
|
7
|
+
//#endregion
|
|
8
|
+
export { _default as default, reactConfig };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { t as configFactory } from "../configFactory-D_qKOxEp.mjs";
|
|
2
|
+
import { defineConfig } from "eslint/config";
|
|
3
|
+
|
|
4
|
+
//#region src/configs/react.ts
|
|
5
|
+
const reactConfig = configFactory({
|
|
6
|
+
typescript: true,
|
|
7
|
+
react: true
|
|
8
|
+
});
|
|
9
|
+
var react_default = defineConfig(reactConfig);
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { react_default as default, reactConfig };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { t as FlatConfig } from "../config.types-M1gOzpFJ.mjs";
|
|
2
|
+
import * as eslint_config3 from "eslint/config";
|
|
3
|
+
|
|
4
|
+
//#region src/configs/typescript.d.ts
|
|
5
|
+
declare const typescriptConfig: FlatConfig;
|
|
6
|
+
declare const _default: eslint_config3.Config[];
|
|
7
|
+
//#endregion
|
|
8
|
+
export { _default as default, typescriptConfig };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { t as configFactory } from "../configFactory-D_qKOxEp.mjs";
|
|
2
|
+
import { defineConfig } from "eslint/config";
|
|
3
|
+
|
|
4
|
+
//#region src/configs/typescript.ts
|
|
5
|
+
const typescriptConfig = configFactory({ typescript: true });
|
|
6
|
+
var typescript_default = defineConfig(typescriptConfig);
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
export { typescript_default as default, typescriptConfig };
|