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