@santi020k/eslint-config-santi020k 1.2.1 → 2.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/README.md +86 -111
- package/dist/configs/astro/index.config.d.ts +9 -0
- package/dist/configs/astro/rules.d.ts +6 -0
- package/dist/configs/expo/index.config.d.ts +9 -0
- package/dist/configs/expo/rules.d.ts +6 -0
- package/dist/configs/index.d.ts +6 -0
- package/dist/configs/js/index.config.d.ts +3 -0
- package/dist/configs/js/rules.d.ts +4 -0
- package/dist/configs/next/index.config.d.ts +9 -0
- package/dist/configs/next/rules.d.ts +6 -0
- package/dist/configs/react/index.config.d.ts +11 -0
- package/dist/configs/react/rules.d.ts +3 -0
- package/dist/configs/ts/index.config.d.ts +3 -0
- package/dist/configs/ts/rules.d.ts +25 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +453 -0
- package/dist/index.mjs +453 -0
- package/dist/optionals/cspell.d.ts +15 -0
- package/dist/optionals/i18next.d.ts +2 -0
- package/dist/optionals/index.d.ts +5 -0
- package/dist/optionals/mdx.d.ts +21 -0
- package/dist/optionals/tailwind.d.ts +2 -0
- package/dist/optionals/vitest.d.ts +16 -0
- package/dist/package.json +104 -0
- package/dist/utils/flatCompat.d.ts +6 -0
- package/package.json +40 -30
- package/dist/cjs/index.cjs +0 -441
- package/dist/esm/index.mjs +0 -432
package/dist/esm/index.mjs
DELETED
|
@@ -1,432 +0,0 @@
|
|
|
1
|
-
// @ts-self-types="./index.d.ts"
|
|
2
|
-
import eslint from '@eslint/js';
|
|
3
|
-
import pluginStylistic from '@stylistic/eslint-plugin';
|
|
4
|
-
import configStandard from 'eslint-config-standard';
|
|
5
|
-
import pluginImport from 'eslint-plugin-import';
|
|
6
|
-
import pluginJsxA11y from 'eslint-plugin-jsx-a11y';
|
|
7
|
-
import pluginN from 'eslint-plugin-n';
|
|
8
|
-
import pluginPromise from 'eslint-plugin-promise';
|
|
9
|
-
import pluginSimpleImport from 'eslint-plugin-simple-import-sort';
|
|
10
|
-
import pluginSonarJs from 'eslint-plugin-sonarjs';
|
|
11
|
-
import pluginUnusedImport from 'eslint-plugin-unused-imports';
|
|
12
|
-
import globals from 'globals';
|
|
13
|
-
import { fixupConfigRules } from '@eslint/compat';
|
|
14
|
-
import pluginReactConfig from 'eslint-plugin-react/configs/recommended.js';
|
|
15
|
-
import pluginReactHooks from 'eslint-plugin-react-hooks';
|
|
16
|
-
import { FlatCompat } from '@eslint/eslintrc';
|
|
17
|
-
import path from 'path';
|
|
18
|
-
import { fileURLToPath } from 'url';
|
|
19
|
-
import tseslint from 'typescript-eslint';
|
|
20
|
-
|
|
21
|
-
const groups = [
|
|
22
|
-
// Internal packages.
|
|
23
|
-
["^(store)(/.*|$)"],
|
|
24
|
-
["^(api)(/.*|$)"],
|
|
25
|
-
["^(components)(/.*|$)"],
|
|
26
|
-
["^(contexts)(/.*|$)"],
|
|
27
|
-
["^(hooks)(/.*|$)"],
|
|
28
|
-
["^(lib)(/.*|$)"],
|
|
29
|
-
["^(services)(/.*|$)"],
|
|
30
|
-
["^(models)(/.*|$)"],
|
|
31
|
-
["^(utils)(/.*|$)"],
|
|
32
|
-
["^(ws)(/.*|$)"],
|
|
33
|
-
// Side effect imports.
|
|
34
|
-
["^\\u0000"],
|
|
35
|
-
// Parent imports. Put `..` last.
|
|
36
|
-
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
|
|
37
|
-
// Other relative imports. Put same-folder imports and `.` last.
|
|
38
|
-
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
|
|
39
|
-
// Style imports.
|
|
40
|
-
["^.+\\.?(css)$"]
|
|
41
|
-
];
|
|
42
|
-
const rules$5 = {
|
|
43
|
-
"unused-imports/no-unused-imports": "warn",
|
|
44
|
-
"@stylistic/indent": ["warn", 2],
|
|
45
|
-
"@stylistic/quote-props": ["warn", "as-needed"],
|
|
46
|
-
quotes: "off",
|
|
47
|
-
"@stylistic/quotes": ["warn", "single"],
|
|
48
|
-
"@stylistic/semi": ["warn", "never"],
|
|
49
|
-
"@stylistic/comma-dangle": ["warn", "never"],
|
|
50
|
-
"@stylistic/object-curly-spacing": ["warn", "always"],
|
|
51
|
-
"@stylistic/padded-blocks": ["warn", "never"],
|
|
52
|
-
"@stylistic/arrow-parens": ["warn", "as-needed"],
|
|
53
|
-
"@stylistic/dot-location": ["warn", "property"],
|
|
54
|
-
"@stylistic/function-call-argument-newline": ["warn", "never"],
|
|
55
|
-
"@stylistic/object-property-newline": [
|
|
56
|
-
"warn",
|
|
57
|
-
{ allowAllPropertiesOnSameLine: true }
|
|
58
|
-
],
|
|
59
|
-
"@stylistic/multiline-ternary": ["warn", "always-multiline"],
|
|
60
|
-
"@stylistic/member-delimiter-style": ["error", {
|
|
61
|
-
multiline: {
|
|
62
|
-
delimiter: "none",
|
|
63
|
-
requireLast: false
|
|
64
|
-
},
|
|
65
|
-
singleline: {
|
|
66
|
-
delimiter: "comma",
|
|
67
|
-
requireLast: false
|
|
68
|
-
},
|
|
69
|
-
overrides: {
|
|
70
|
-
interface: {
|
|
71
|
-
multiline: {
|
|
72
|
-
delimiter: "none",
|
|
73
|
-
requireLast: false
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}],
|
|
78
|
-
"@stylistic/no-extra-parens": "off",
|
|
79
|
-
"@stylistic/max-len": [
|
|
80
|
-
"warn",
|
|
81
|
-
{
|
|
82
|
-
code: 120,
|
|
83
|
-
tabWidth: 2,
|
|
84
|
-
comments: 200,
|
|
85
|
-
ignoreStrings: true
|
|
86
|
-
}
|
|
87
|
-
],
|
|
88
|
-
"@stylistic/max-statements-per-line": ["warn", { max: 1 }],
|
|
89
|
-
"@stylistic/array-element-newline": ["warn", "consistent"],
|
|
90
|
-
"@stylistic/no-extra-semi": "off",
|
|
91
|
-
"@stylistic/no-multi-spaces": "off",
|
|
92
|
-
"@stylistic/padding-line-between-statements": [
|
|
93
|
-
"warn",
|
|
94
|
-
{ blankLine: "always", prev: "*", next: "*" },
|
|
95
|
-
{ blankLine: "any", prev: "import", next: "import" },
|
|
96
|
-
{
|
|
97
|
-
blankLine: "always",
|
|
98
|
-
prev: ["const", "let", "var"],
|
|
99
|
-
next: ["const", "let", "var"]
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
blankLine: "never",
|
|
103
|
-
prev: ["singleline-const", "singleline-let", "singleline-var"],
|
|
104
|
-
next: ["singleline-const", "singleline-let", "singleline-var"]
|
|
105
|
-
},
|
|
106
|
-
{ blankLine: "always", prev: "block-like", next: "const" },
|
|
107
|
-
{ blankLine: "always", prev: "const", next: "block-like" }
|
|
108
|
-
],
|
|
109
|
-
"@stylistic/function-paren-newline": ["warn", "consistent"],
|
|
110
|
-
"arrow-body-style": ["warn", "as-needed"],
|
|
111
|
-
"prefer-arrow-callback": ["warn", { allowNamedFunctions: true }],
|
|
112
|
-
"func-style": ["warn", "expression", { allowArrowFunctions: true }],
|
|
113
|
-
"simple-import-sort/imports": [
|
|
114
|
-
"warn",
|
|
115
|
-
{
|
|
116
|
-
groups
|
|
117
|
-
}
|
|
118
|
-
],
|
|
119
|
-
"jsx-a11y/alt-text": "warn",
|
|
120
|
-
"no-empty": "warn",
|
|
121
|
-
"no-nested-ternary": "warn",
|
|
122
|
-
"no-undef": "warn",
|
|
123
|
-
"unused-imports/no-unused-vars": [
|
|
124
|
-
"warn",
|
|
125
|
-
{
|
|
126
|
-
vars: "all",
|
|
127
|
-
varsIgnorePattern: "^_",
|
|
128
|
-
args: "after-used",
|
|
129
|
-
argsIgnorePattern: "^_",
|
|
130
|
-
destructuredArrayIgnorePattern: "^_",
|
|
131
|
-
ignoreRestSiblings: true
|
|
132
|
-
}
|
|
133
|
-
],
|
|
134
|
-
"no-void": "warn",
|
|
135
|
-
camelcase: "warn",
|
|
136
|
-
"array-callback-return": "warn",
|
|
137
|
-
"no-fallthrough": "warn",
|
|
138
|
-
eqeqeq: "warn",
|
|
139
|
-
"no-constant-binary-expression": "warn",
|
|
140
|
-
"@stylistic/lines-around-comment": "warn",
|
|
141
|
-
"import/no-duplicates": "warn",
|
|
142
|
-
"valid-typeof": "warn",
|
|
143
|
-
"no-constant-condition": "warn",
|
|
144
|
-
"no-use-before-define": "warn",
|
|
145
|
-
"@stylistic/implicit-arrow-linebreak": "warn",
|
|
146
|
-
"import/export": "warn",
|
|
147
|
-
"no-useless-escape": "warn",
|
|
148
|
-
"@stylistic/brace-style": "warn",
|
|
149
|
-
"no-useless-return": "warn",
|
|
150
|
-
"prefer-promise-reject-errors": "warn",
|
|
151
|
-
"no-useless-constructor": "warn",
|
|
152
|
-
"no-new": "warn",
|
|
153
|
-
"prefer-regex-literals": "warn",
|
|
154
|
-
"@stylistic/multiline-comment-style": "off",
|
|
155
|
-
"space-before-function-paren": "off"
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
const languageOptions$1 = {
|
|
159
|
-
ecmaVersion: "latest",
|
|
160
|
-
sourceType: "module",
|
|
161
|
-
globals: {
|
|
162
|
-
...globals.browser,
|
|
163
|
-
...globals.node
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
const jsConfig = [
|
|
167
|
-
{
|
|
168
|
-
name: "eslint-config",
|
|
169
|
-
...eslint.configs.recommended
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
name: "plugins",
|
|
173
|
-
plugins: {
|
|
174
|
-
n: pluginN,
|
|
175
|
-
promise: pluginPromise,
|
|
176
|
-
import: { rules: pluginImport.rules },
|
|
177
|
-
"simple-import-sort": pluginSimpleImport,
|
|
178
|
-
"jsx-a11y": pluginJsxA11y,
|
|
179
|
-
"unused-imports": pluginUnusedImport,
|
|
180
|
-
sonarjs: pluginSonarJs
|
|
181
|
-
},
|
|
182
|
-
languageOptions: languageOptions$1,
|
|
183
|
-
rules: {
|
|
184
|
-
...configStandard.rules,
|
|
185
|
-
...pluginSonarJs.configs.recommended.rules,
|
|
186
|
-
"import/first": "off"
|
|
187
|
-
}
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
name: "stylistic",
|
|
191
|
-
...pluginStylistic.configs["recommended-flat"]
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
name: "custom",
|
|
195
|
-
languageOptions: languageOptions$1,
|
|
196
|
-
files: ["**/*.{js,jsx,mjs,cjs}"],
|
|
197
|
-
rules: rules$5
|
|
198
|
-
}
|
|
199
|
-
];
|
|
200
|
-
|
|
201
|
-
const rules$4 = {
|
|
202
|
-
...rules$5,
|
|
203
|
-
"react/react-in-jsx-scope": "off",
|
|
204
|
-
"react/jsx-max-depth": ["warn", { max: 7 }],
|
|
205
|
-
"react/prop-types": "off",
|
|
206
|
-
"react-hooks/exhaustive-deps": "off",
|
|
207
|
-
"react/button-has-type": "warn",
|
|
208
|
-
"react/display-name": "warn",
|
|
209
|
-
"react/no-children-prop": "warn",
|
|
210
|
-
"react/no-danger-with-children": "warn",
|
|
211
|
-
"react/no-unstable-nested-components": "warn",
|
|
212
|
-
"react/self-closing-comp": ["warn", { component: true, html: true }],
|
|
213
|
-
"react/jsx-curly-brace-presence": [
|
|
214
|
-
"warn",
|
|
215
|
-
{ props: "never", children: "never" }
|
|
216
|
-
],
|
|
217
|
-
"react/jsx-curly-newline": "warn",
|
|
218
|
-
"react/destructuring-assignment": "warn",
|
|
219
|
-
"react/jsx-pascal-case": "warn",
|
|
220
|
-
"react/boolean-prop-naming": "warn",
|
|
221
|
-
"react/hook-use-state": "warn",
|
|
222
|
-
"react/jsx-boolean-value": "warn",
|
|
223
|
-
"react/jsx-closing-tag-location": "warn",
|
|
224
|
-
"react/jsx-closing-bracket-location": "warn",
|
|
225
|
-
"react/jsx-wrap-multilines": "warn",
|
|
226
|
-
"react/jsx-no-target-blank": "warn",
|
|
227
|
-
"react/jsx-no-leaked-render": "warn",
|
|
228
|
-
"react/jsx-handler-names": "warn",
|
|
229
|
-
"react/jsx-fragments": "warn",
|
|
230
|
-
"react/no-deprecated": "warn",
|
|
231
|
-
"react/no-multi-comp": "warn",
|
|
232
|
-
"react/no-unescaped-entities": "warn",
|
|
233
|
-
"react/jsx-no-undef": "warn",
|
|
234
|
-
"react/no-unknown-property": "warn",
|
|
235
|
-
"simple-import-sort/imports": [
|
|
236
|
-
"warn",
|
|
237
|
-
{
|
|
238
|
-
groups: [
|
|
239
|
-
// Packages `react` related packages come first.
|
|
240
|
-
["^react"],
|
|
241
|
-
...groups
|
|
242
|
-
]
|
|
243
|
-
}
|
|
244
|
-
]
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
const languageOptions = {
|
|
248
|
-
ecmaVersion: "latest",
|
|
249
|
-
sourceType: "module",
|
|
250
|
-
...pluginReactConfig.languageOptions,
|
|
251
|
-
globals: {
|
|
252
|
-
...globals.browser,
|
|
253
|
-
...globals.node
|
|
254
|
-
}
|
|
255
|
-
};
|
|
256
|
-
const reactConfig = [
|
|
257
|
-
...jsConfig,
|
|
258
|
-
...fixupConfigRules(pluginReactConfig).map((react) => ({
|
|
259
|
-
...react,
|
|
260
|
-
name: "react",
|
|
261
|
-
languageOptions,
|
|
262
|
-
settings: {
|
|
263
|
-
react: {
|
|
264
|
-
version: "detect"
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
})),
|
|
268
|
-
{
|
|
269
|
-
name: "custom-react",
|
|
270
|
-
plugins: {
|
|
271
|
-
"react-hooks": pluginReactHooks
|
|
272
|
-
},
|
|
273
|
-
languageOptions,
|
|
274
|
-
files: ["**/*.{js,jsx,mjs,cjs}"],
|
|
275
|
-
rules: {
|
|
276
|
-
...configStandard.rules,
|
|
277
|
-
...pluginSonarJs.configs.recommended.rules,
|
|
278
|
-
...pluginReactHooks.configs.recommended.rules,
|
|
279
|
-
...rules$4
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
];
|
|
283
|
-
|
|
284
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
285
|
-
const __dirname = path.dirname(__filename);
|
|
286
|
-
const flatCompat = new FlatCompat({
|
|
287
|
-
baseDirectory: __dirname,
|
|
288
|
-
recommendedConfig: {}
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
const astroConfig = [
|
|
292
|
-
...reactConfig,
|
|
293
|
-
...fixupConfigRules(flatCompat.config({
|
|
294
|
-
overrides: [
|
|
295
|
-
{
|
|
296
|
-
files: ["*.astro"],
|
|
297
|
-
parser: "astro-eslint-parser"
|
|
298
|
-
},
|
|
299
|
-
{
|
|
300
|
-
files: ["*.md", "*.mdx"],
|
|
301
|
-
extends: ["plugin:mdx/recommended"],
|
|
302
|
-
settings: {
|
|
303
|
-
"mdx/code-blocks": true,
|
|
304
|
-
"mdx/language-mapper": {}
|
|
305
|
-
},
|
|
306
|
-
rules: {
|
|
307
|
-
"max-len": "off",
|
|
308
|
-
"react/react-in-jsx-scope": "off"
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
]
|
|
312
|
-
}))
|
|
313
|
-
];
|
|
314
|
-
|
|
315
|
-
const rules$3 = {
|
|
316
|
-
...rules$5,
|
|
317
|
-
semi: "off",
|
|
318
|
-
"no-unused-vars": "off",
|
|
319
|
-
"@typescript-eslint/indent": "off",
|
|
320
|
-
"@typescript-eslint/no-unused-vars": [
|
|
321
|
-
"warn",
|
|
322
|
-
{
|
|
323
|
-
vars: "all",
|
|
324
|
-
varsIgnorePattern: "^_",
|
|
325
|
-
args: "after-used",
|
|
326
|
-
argsIgnorePattern: "^_",
|
|
327
|
-
destructuredArrayIgnorePattern: "^_",
|
|
328
|
-
ignoreRestSiblings: true
|
|
329
|
-
}
|
|
330
|
-
],
|
|
331
|
-
"@typescript-eslint/no-explicit-any": "warn",
|
|
332
|
-
"@typescript-eslint/no-empty-function": "warn",
|
|
333
|
-
"@typescript-eslint/ban-types": "warn",
|
|
334
|
-
"@typescript-eslint/no-var-requires": "warn",
|
|
335
|
-
"@typescript-eslint/ban-ts-comment": "warn",
|
|
336
|
-
"@typescript-eslint/no-non-null-assertion": "warn",
|
|
337
|
-
"@typescript-eslint/no-invalid-void-type": "warn",
|
|
338
|
-
"@typescript-eslint/no-dynamic-delete": "warn",
|
|
339
|
-
"@typescript-eslint/no-useless-constructor": "warn",
|
|
340
|
-
"@typescript-eslint/prefer-for-of": "warn",
|
|
341
|
-
"@typescript-eslint/no-duplicate-enum-values": "warn"
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
const tsConfig = [
|
|
345
|
-
...jsConfig,
|
|
346
|
-
...tseslint.configs.strict,
|
|
347
|
-
...tseslint.configs.stylistic,
|
|
348
|
-
{
|
|
349
|
-
name: "custom-ts",
|
|
350
|
-
files: ["**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}"],
|
|
351
|
-
rules: rules$3
|
|
352
|
-
}
|
|
353
|
-
];
|
|
354
|
-
|
|
355
|
-
const rules$2 = {
|
|
356
|
-
...rules$4,
|
|
357
|
-
...rules$3
|
|
358
|
-
};
|
|
359
|
-
|
|
360
|
-
const reactTsConfig = [
|
|
361
|
-
...reactConfig,
|
|
362
|
-
...tsConfig,
|
|
363
|
-
{
|
|
364
|
-
name: "custom-react-ts",
|
|
365
|
-
rules: rules$2
|
|
366
|
-
}
|
|
367
|
-
];
|
|
368
|
-
|
|
369
|
-
const astroTsConfig = [
|
|
370
|
-
...reactTsConfig,
|
|
371
|
-
...astroConfig,
|
|
372
|
-
...fixupConfigRules(flatCompat.config({
|
|
373
|
-
overrides: [{
|
|
374
|
-
files: ["*.astro"],
|
|
375
|
-
parser: "astro-eslint-parser",
|
|
376
|
-
plugins: ["@typescript-eslint"],
|
|
377
|
-
rules: {
|
|
378
|
-
"@typescript-eslint/strict-boolean-expressions": "off"
|
|
379
|
-
}
|
|
380
|
-
}]
|
|
381
|
-
}))
|
|
382
|
-
];
|
|
383
|
-
|
|
384
|
-
const rules$1 = {
|
|
385
|
-
...rules$4,
|
|
386
|
-
"simple-import-sort/imports": [
|
|
387
|
-
"warn",
|
|
388
|
-
{
|
|
389
|
-
groups: [
|
|
390
|
-
// Packages `react` related packages come first.
|
|
391
|
-
["^react"],
|
|
392
|
-
["^next"],
|
|
393
|
-
...groups
|
|
394
|
-
]
|
|
395
|
-
}
|
|
396
|
-
]
|
|
397
|
-
};
|
|
398
|
-
|
|
399
|
-
const nextConfig = [
|
|
400
|
-
...reactConfig,
|
|
401
|
-
...fixupConfigRules(flatCompat.extends("plugin:@next/next/core-web-vitals")),
|
|
402
|
-
{
|
|
403
|
-
name: "custom-next",
|
|
404
|
-
rules: rules$1
|
|
405
|
-
}
|
|
406
|
-
];
|
|
407
|
-
|
|
408
|
-
const rules = {
|
|
409
|
-
...rules$4,
|
|
410
|
-
"simple-import-sort/imports": [
|
|
411
|
-
"warn",
|
|
412
|
-
{
|
|
413
|
-
groups: [
|
|
414
|
-
// Packages `react` related packages come first.
|
|
415
|
-
["^react"],
|
|
416
|
-
["^next"],
|
|
417
|
-
...groups
|
|
418
|
-
]
|
|
419
|
-
}
|
|
420
|
-
]
|
|
421
|
-
};
|
|
422
|
-
|
|
423
|
-
const nextTsConfig = [
|
|
424
|
-
...nextConfig,
|
|
425
|
-
...reactTsConfig,
|
|
426
|
-
{
|
|
427
|
-
name: "custom-next-ts",
|
|
428
|
-
rules
|
|
429
|
-
}
|
|
430
|
-
];
|
|
431
|
-
|
|
432
|
-
export { astroConfig as astroEslint, astroTsConfig as astroTsEslint, jsConfig as jsEslint, nextConfig as nextEslint, nextTsConfig as nextTsEslint, reactConfig as reactEslint, reactTsConfig as reactTsEslint, tsConfig as tsEslint };
|