@santi020k/eslint-config-santi020k 1.0.1 → 1.1.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 CHANGED
@@ -11,11 +11,14 @@ Welcome to @santi020k/eslint-config-santi020k, a comprehensive and opinionated E
11
11
 
12
12
  ## Links to Configurations
13
13
 
14
+ - [jsEslint](./src/js/README.md): For JavaScript projects.
15
+ - [tsEslint](./src/ts/README.md): For TypeScript projects.
14
16
  - [reactEslint](./src/react/README.md): For JavaScript and React projects.
15
17
  - [reactTsEslint](./src/react-ts/README.md): For TypeScript and React projects.
16
- - NextJS: Pending
17
- - Astro: Pending
18
- - NX: Pending
18
+ - [nextEslint](./src/next/README.md): For JavaScript and Next projects.
19
+ - [nextTsEslint](./src/next-ts/README.md): For TypeScript and Next projects.
20
+ - [astroEslint](./src/astro/README.md): For JavaScript and Astro projects. (Beta)
21
+ - [astroTsEslint](./src/astro-ts/README.md): For TypeScript and Astro projects. (Beta)
19
22
 
20
23
  ## Installation
21
24
 
@@ -33,6 +36,36 @@ Then, install the configuration package:
33
36
 
34
37
  ## Usage
35
38
 
39
+ ### For JavaScript Projects
40
+
41
+ Create an `eslint.config.js` file (or use your existing one) and extend `@santi020k/eslint-config-santi020k`:
42
+
43
+ ```js
44
+ import { jsEslint } from '@santi020k/eslint-config-santi020k'
45
+
46
+ export default [
47
+ ...jsEslint,
48
+ {
49
+ // Other rules or overrides
50
+ }
51
+ ]
52
+ ```
53
+
54
+ ### For TypeScript Projects
55
+
56
+ Create an `eslint.config.js` file (or use your existing one) and extend `@santi020k/eslint-config-santi020k` with TypeScript support:
57
+
58
+ ```js
59
+ import { tsConfig } from '@santi020k/eslint-config-santi020k'
60
+
61
+ export default [
62
+ ...tsConfig,
63
+ {
64
+ // Other rules or overrides
65
+ }
66
+ ]
67
+ ```
68
+
36
69
  ### For JavaScript and React Projects
37
70
 
38
71
  Create an `eslint.config.js` file (or use your existing one) and extend `@santi020k/eslint-config-santi020k`:
@@ -52,12 +85,75 @@ Create an `eslint.config.js` file (or use your existing one) and extend `@santi0
52
85
 
53
86
  Create an `eslint.config.js` file (or use your existing one) and extend `@santi020k/eslint-config-santi020k` with TypeScript support:
54
87
 
88
+ ```js
89
+ import { reactTsEslint } from '@santi020k/eslint-config-santi020k'
90
+
91
+ export default [
92
+ ...reactTsEslint,
93
+ {
94
+ // Other rules or overrides
95
+ }
96
+ ]
97
+ ```
98
+
99
+ ### For JavaScript and Next Projects
100
+
101
+ Create an `eslint.config.js` file (or use your existing one) and extend `@santi020k/eslint-config-santi020k`:
55
102
 
56
103
  ```js
57
- import { reactTsConfig } from '@santi020k/eslint-config-santi020k'
104
+ import { nextEslint } from '@santi020k/eslint-config-santi020k'
58
105
 
59
106
  export default [
60
- ...reactTsConfig,
107
+ ...nextEslint,
108
+ {
109
+ // Other rules or overrides
110
+ }
111
+ ]
112
+ ```
113
+
114
+ ### For TypeScript and Next Projects
115
+
116
+ Create an `eslint.config.js` file (or use your existing one) and extend `@santi020k/eslint-config-santi020k` with TypeScript support:
117
+
118
+ ```js
119
+ import { nextTsEslint } from '@santi020k/eslint-config-santi020k'
120
+
121
+ export default [
122
+ ...nextTsEslint,
123
+ {
124
+ // Other rules or overrides
125
+ }
126
+ ]
127
+ ```
128
+
129
+ ### For JavaScript and Astro Projects
130
+
131
+ (It is currently a beta implementation and only supports astro with react)
132
+
133
+ Create an `eslint.config.js` file (or use your existing one) and extend `@santi020k/eslint-config-santi020k`:
134
+
135
+ ```js
136
+ import { astroEslint } from '@santi020k/eslint-config-santi020k'
137
+
138
+ export default [
139
+ ...astroEslint,
140
+ {
141
+ // Other rules or overrides
142
+ }
143
+ ]
144
+ ```
145
+
146
+ ### For TypeScript and Astro Projects
147
+
148
+ (It is currently a beta implementation and only supports astro with react)
149
+
150
+ Create an `eslint.config.js` file (or use your existing one) and extend `@santi020k/eslint-config-santi020k` with TypeScript support:
151
+
152
+ ```js
153
+ import { astroTsEslint } from '@santi020k/eslint-config-santi020k'
154
+
155
+ export default [
156
+ ...astroTsEslint,
61
157
  {
62
158
  // Other rules or overrides
63
159
  }
@@ -94,6 +190,12 @@ Here are some useful scripts you can add to your `package.json`:
94
190
 
95
191
  4. Adjust as Necessary: Review the linting rules and adjust them based on your project's needs. Since this configuration is opinionated, some rules might be too strict or not applicable to your project. Feel free to disable or modify them.
96
192
 
193
+ ## Future
194
+
195
+ [ ] Unit testing
196
+ [ ] Better documentation
197
+ [ ] Additional Frameworks support
198
+
97
199
  ## Contributing
98
200
 
99
201
  If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the [GitHub repository](https://github.com/santi020k/eslint-config-santi020k).
@@ -114,6 +216,7 @@ I would like to express my gratitude to the developers and maintainers of the fo
114
216
  - `eslint-plugin-unused-imports`
115
217
  - `@stylistic/eslint-plugin`
116
218
  - `@typescript-eslint`
219
+ - etc...
117
220
 
118
221
  These tools have significantly contributed to the JavaScript and TypeScript ecosystem, and their continued development helps maintain the high standards of code quality that we all strive for.
119
222
 
@@ -0,0 +1,410 @@
1
+ 'use strict';
2
+
3
+ var eslint = require('@eslint/js');
4
+ var pluginStylistic = require('@stylistic/eslint-plugin');
5
+ var configStandard = require('eslint-config-standard');
6
+ var pluginImport = require('eslint-plugin-import');
7
+ var pluginJsxA11y = require('eslint-plugin-jsx-a11y');
8
+ var pluginN = require('eslint-plugin-n');
9
+ var pluginPromise = require('eslint-plugin-promise');
10
+ var pluginSimpleImport = require('eslint-plugin-simple-import-sort');
11
+ var pluginSonarJs = require('eslint-plugin-sonarjs');
12
+ var pluginUnusedImport = require('eslint-plugin-unused-imports');
13
+ var globals = require('globals');
14
+ var compat = require('@eslint/compat');
15
+ var pluginReactConfig = require('eslint-plugin-react/configs/recommended.js');
16
+ var pluginReactHooks = require('eslint-plugin-react-hooks');
17
+ var eslintrc = require('@eslint/eslintrc');
18
+ var path = require('path');
19
+ var url = require('url');
20
+ var tseslint = require('typescript-eslint');
21
+
22
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
23
+ const groups = [
24
+ // Internal packages.
25
+ ["^(store)(/.*|$)"],
26
+ ["^(api)(/.*|$)"],
27
+ ["^(components)(/.*|$)"],
28
+ ["^(contexts)(/.*|$)"],
29
+ ["^(hooks)(/.*|$)"],
30
+ ["^(lib)(/.*|$)"],
31
+ ["^(services)(/.*|$)"],
32
+ ["^(models)(/.*|$)"],
33
+ ["^(utils)(/.*|$)"],
34
+ ["^(ws)(/.*|$)"],
35
+ // Side effect imports.
36
+ ["^\\u0000"],
37
+ // Parent imports. Put `..` last.
38
+ ["^\\.\\.(?!/?$)", "^\\.\\./?$"],
39
+ // Other relative imports. Put same-folder imports and `.` last.
40
+ ["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
41
+ // Style imports.
42
+ ["^.+\\.?(css)$"]
43
+ ];
44
+ const rules$3 = {
45
+ "unused-imports/no-unused-imports": "warn",
46
+ "@stylistic/indent": ["warn", 2],
47
+ "@stylistic/quote-props": ["warn", "as-needed"],
48
+ quotes: "off",
49
+ "@stylistic/quotes": ["warn", "single"],
50
+ "@stylistic/semi": ["warn", "never"],
51
+ "@stylistic/comma-dangle": ["warn", "never"],
52
+ "@stylistic/object-curly-spacing": ["warn", "always"],
53
+ "@stylistic/padded-blocks": ["warn", "never"],
54
+ "@stylistic/arrow-parens": ["warn", "as-needed"],
55
+ "@stylistic/dot-location": ["warn", "property"],
56
+ "@stylistic/function-call-argument-newline": ["warn", "never"],
57
+ "@stylistic/object-property-newline": [
58
+ "warn",
59
+ { allowAllPropertiesOnSameLine: true }
60
+ ],
61
+ "@stylistic/multiline-ternary": ["warn", "always-multiline"],
62
+ "@stylistic/member-delimiter-style": ["error", {
63
+ multiline: {
64
+ delimiter: "none",
65
+ requireLast: false
66
+ },
67
+ singleline: {
68
+ delimiter: "comma",
69
+ requireLast: false
70
+ },
71
+ overrides: {
72
+ interface: {
73
+ multiline: {
74
+ delimiter: "none",
75
+ requireLast: false
76
+ }
77
+ }
78
+ }
79
+ }],
80
+ "@stylistic/no-extra-parens": "off",
81
+ "@stylistic/max-len": [
82
+ "warn",
83
+ {
84
+ code: 120,
85
+ tabWidth: 2,
86
+ comments: 200,
87
+ ignoreStrings: true
88
+ }
89
+ ],
90
+ "@stylistic/max-statements-per-line": ["warn", { max: 1 }],
91
+ "@stylistic/array-element-newline": ["warn", "consistent"],
92
+ "@stylistic/no-extra-semi": "off",
93
+ "@stylistic/no-multi-spaces": "off",
94
+ "@stylistic/padding-line-between-statements": [
95
+ "warn",
96
+ { blankLine: "always", prev: "*", next: "*" },
97
+ { blankLine: "any", prev: "import", next: "import" },
98
+ {
99
+ blankLine: "always",
100
+ prev: ["const", "let", "var"],
101
+ next: ["const", "let", "var"]
102
+ },
103
+ {
104
+ blankLine: "never",
105
+ prev: ["singleline-const", "singleline-let", "singleline-var"],
106
+ next: ["singleline-const", "singleline-let", "singleline-var"]
107
+ },
108
+ { blankLine: "always", prev: "block-like", next: "const" },
109
+ { blankLine: "always", prev: "const", next: "block-like" }
110
+ ],
111
+ "@stylistic/function-paren-newline": ["warn", "consistent"],
112
+ "arrow-body-style": ["warn", "as-needed"],
113
+ "prefer-arrow-callback": ["warn", { allowNamedFunctions: true }],
114
+ "func-style": ["warn", "expression", { allowArrowFunctions: true }],
115
+ "simple-import-sort/imports": [
116
+ "warn",
117
+ {
118
+ groups
119
+ }
120
+ ],
121
+ "jsx-a11y/alt-text": "warn",
122
+ "no-empty": "warn",
123
+ "no-nested-ternary": "warn",
124
+ "no-undef": "warn",
125
+ "unused-imports/no-unused-vars": [
126
+ "warn",
127
+ {
128
+ vars: "all",
129
+ varsIgnorePattern: "^_",
130
+ args: "after-used",
131
+ argsIgnorePattern: "^_",
132
+ destructuredArrayIgnorePattern: "^_",
133
+ ignoreRestSiblings: true
134
+ }
135
+ ],
136
+ "no-void": "warn",
137
+ camelcase: "warn",
138
+ "array-callback-return": "warn",
139
+ "no-fallthrough": "warn",
140
+ eqeqeq: "warn",
141
+ "no-constant-binary-expression": "warn",
142
+ "@stylistic/lines-around-comment": "warn",
143
+ "import/no-duplicates": "warn",
144
+ "valid-typeof": "warn",
145
+ "no-constant-condition": "warn",
146
+ "no-use-before-define": "warn",
147
+ "@stylistic/implicit-arrow-linebreak": "warn",
148
+ "import/export": "warn",
149
+ "no-useless-escape": "warn",
150
+ "@stylistic/brace-style": "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
+ };
158
+
159
+ const languageOptions$1 = {
160
+ ecmaVersion: "latest",
161
+ sourceType: "module",
162
+ globals: {
163
+ ...globals.browser,
164
+ ...globals.node
165
+ }
166
+ };
167
+ const jsConfig = [
168
+ {
169
+ name: "eslint-config",
170
+ ...eslint.configs.recommended
171
+ },
172
+ {
173
+ name: "plugins",
174
+ plugins: {
175
+ n: pluginN,
176
+ promise: pluginPromise,
177
+ import: { rules: pluginImport.rules },
178
+ "simple-import-sort": pluginSimpleImport,
179
+ "jsx-a11y": pluginJsxA11y,
180
+ "unused-imports": pluginUnusedImport,
181
+ sonarjs: pluginSonarJs
182
+ },
183
+ languageOptions: languageOptions$1,
184
+ rules: {
185
+ ...configStandard.rules,
186
+ ...pluginSonarJs.configs.recommended.rules,
187
+ "import/first": 0
188
+ }
189
+ },
190
+ {
191
+ name: "stylistic",
192
+ ...pluginStylistic.configs["recommended-flat"]
193
+ },
194
+ {
195
+ name: "custom",
196
+ languageOptions: languageOptions$1,
197
+ files: ["**/*.{js,jsx,mjs,cjs}"],
198
+ rules: rules$3
199
+ }
200
+ ];
201
+
202
+ const rules$2 = {
203
+ ...rules$3,
204
+ "react/react-in-jsx-scope": "off",
205
+ "react/jsx-max-depth": ["warn", { max: 7 }],
206
+ "react/prop-types": "off",
207
+ "react-hooks/exhaustive-deps": "off",
208
+ "react/button-has-type": "warn",
209
+ "react/display-name": "warn",
210
+ "react/no-children-prop": "warn",
211
+ "react/no-danger-with-children": "warn",
212
+ "react/no-unstable-nested-components": "warn",
213
+ "react/self-closing-comp": ["warn", { component: true, html: true }],
214
+ "react/jsx-curly-brace-presence": [
215
+ "warn",
216
+ { props: "never", children: "never" }
217
+ ],
218
+ "react/jsx-curly-newline": "warn",
219
+ "react/destructuring-assignment": "warn",
220
+ "react/jsx-pascal-case": "warn",
221
+ "react/boolean-prop-naming": "warn",
222
+ "react/hook-use-state": "warn",
223
+ "react/jsx-boolean-value": "warn",
224
+ "react/jsx-closing-tag-location": "warn",
225
+ "react/jsx-closing-bracket-location": "warn",
226
+ "react/jsx-wrap-multilines": "warn",
227
+ "react/jsx-no-target-blank": "warn",
228
+ "react/jsx-no-leaked-render": "warn",
229
+ "react/jsx-handler-names": "warn",
230
+ "react/jsx-fragments": "warn",
231
+ "react/no-deprecated": "warn",
232
+ "react/no-multi-comp": "warn",
233
+ "react/no-unescaped-entities": "warn",
234
+ "react/jsx-no-undef": "warn",
235
+ "react/no-unknown-property": "warn",
236
+ "simple-import-sort/imports": [
237
+ "warn",
238
+ {
239
+ groups: [
240
+ // Packages `react` related packages come first.
241
+ ["^react"],
242
+ ...groups
243
+ ]
244
+ }
245
+ ]
246
+ };
247
+
248
+ const languageOptions = {
249
+ ecmaVersion: "latest",
250
+ sourceType: "module",
251
+ ...pluginReactConfig.languageOptions,
252
+ globals: {
253
+ ...globals.browser,
254
+ ...globals.node
255
+ }
256
+ };
257
+ const reactConfig = [
258
+ ...jsConfig,
259
+ ...compat.fixupConfigRules(pluginReactConfig).map((react) => ({
260
+ ...react,
261
+ name: "react",
262
+ languageOptions,
263
+ settings: {
264
+ react: {
265
+ version: "detect"
266
+ }
267
+ }
268
+ })),
269
+ {
270
+ name: "custom-react",
271
+ plugins: {
272
+ "react-hooks": pluginReactHooks
273
+ },
274
+ languageOptions,
275
+ files: ["**/*.{js,jsx,mjs,cjs}"],
276
+ rules: {
277
+ ...configStandard.rules,
278
+ ...pluginSonarJs.configs.recommended.rules,
279
+ ...pluginReactHooks.configs.recommended.rules,
280
+ ...rules$2
281
+ }
282
+ }
283
+ ];
284
+
285
+ const __filename$1 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
286
+ const __dirname$1 = path.dirname(__filename$1);
287
+ const flatCompat = new eslintrc.FlatCompat({
288
+ baseDirectory: __dirname$1,
289
+ recommendedConfig: {}
290
+ });
291
+
292
+ const astroConfig = [
293
+ ...reactConfig,
294
+ ...compat.fixupConfigRules(flatCompat.config({
295
+ overrides: [
296
+ {
297
+ files: ["*.astro"],
298
+ parser: "astro-eslint-parser"
299
+ },
300
+ {
301
+ files: ["*.md", "*.mdx"],
302
+ extends: ["plugin:mdx/recommended"],
303
+ settings: {
304
+ "mdx/code-blocks": true,
305
+ "mdx/language-mapper": {}
306
+ },
307
+ rules: {
308
+ "max-len": 0,
309
+ "react/react-in-jsx-scope": 0
310
+ }
311
+ }
312
+ ]
313
+ }))
314
+ ];
315
+
316
+ const rules$1 = {
317
+ ...rules$3,
318
+ "@typescript-eslint/indent": 0,
319
+ "@typescript-eslint/no-unused-vars": [
320
+ "warn",
321
+ {
322
+ vars: "all",
323
+ varsIgnorePattern: "^_",
324
+ args: "after-used",
325
+ argsIgnorePattern: "^_",
326
+ destructuredArrayIgnorePattern: "^_",
327
+ ignoreRestSiblings: true
328
+ }
329
+ ],
330
+ "@typescript-eslint/no-explicit-any": "warn",
331
+ "@typescript-eslint/no-empty-function": "warn",
332
+ "@typescript-eslint/ban-types": "warn",
333
+ "@typescript-eslint/no-var-requires": "warn",
334
+ "@typescript-eslint/ban-ts-comment": "warn",
335
+ "@typescript-eslint/no-non-null-assertion": "warn",
336
+ "@typescript-eslint/no-invalid-void-type": "warn",
337
+ "@typescript-eslint/no-dynamic-delete": "warn",
338
+ "@typescript-eslint/no-useless-constructor": "warn",
339
+ "@typescript-eslint/prefer-for-of": "warn",
340
+ "@typescript-eslint/no-duplicate-enum-values": "warn",
341
+ semi: "off"
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$1
352
+ }
353
+ ];
354
+
355
+ const reactTsConfig = [
356
+ ...reactConfig,
357
+ ...tsConfig
358
+ ];
359
+
360
+ const astroTsConfig = [
361
+ ...reactTsConfig,
362
+ ...astroConfig,
363
+ ...compat.fixupConfigRules(flatCompat.config({
364
+ overrides: [{
365
+ files: ["*.astro"],
366
+ parser: "astro-eslint-parser",
367
+ plugins: ["@typescript-eslint"],
368
+ rules: {
369
+ "@typescript-eslint/strict-boolean-expressions": 0
370
+ }
371
+ }]
372
+ }))
373
+ ];
374
+
375
+ const rules = {
376
+ "simple-import-sort/imports": [
377
+ "warn",
378
+ {
379
+ groups: [
380
+ // Packages `react` related packages come first.
381
+ ["^react"],
382
+ ["^next"],
383
+ ...groups
384
+ ]
385
+ }
386
+ ]
387
+ };
388
+
389
+ const nextConfig = [
390
+ ...compat.fixupConfigRules(flatCompat.extends("plugin:@next/next/core-web-vitals")),
391
+ ...reactConfig,
392
+ {
393
+ name: "custom-next",
394
+ rules
395
+ }
396
+ ];
397
+
398
+ const nextTsConfig = [
399
+ ...nextConfig,
400
+ ...reactTsConfig
401
+ ];
402
+
403
+ exports.astroEslint = astroConfig;
404
+ exports.astroTsEslint = astroTsConfig;
405
+ exports.jsEslint = jsConfig;
406
+ exports.nextEslint = nextConfig;
407
+ exports.nextTsEslint = nextTsConfig;
408
+ exports.reactEslint = reactConfig;
409
+ exports.reactTsEslint = reactTsConfig;
410
+ exports.tsEslint = tsConfig;
@@ -0,0 +1,401 @@
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$3 = {
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
+ };
156
+
157
+ const languageOptions$1 = {
158
+ ecmaVersion: "latest",
159
+ sourceType: "module",
160
+ globals: {
161
+ ...globals.browser,
162
+ ...globals.node
163
+ }
164
+ };
165
+ const jsConfig = [
166
+ {
167
+ name: "eslint-config",
168
+ ...eslint.configs.recommended
169
+ },
170
+ {
171
+ name: "plugins",
172
+ plugins: {
173
+ n: pluginN,
174
+ promise: pluginPromise,
175
+ import: { rules: pluginImport.rules },
176
+ "simple-import-sort": pluginSimpleImport,
177
+ "jsx-a11y": pluginJsxA11y,
178
+ "unused-imports": pluginUnusedImport,
179
+ sonarjs: pluginSonarJs
180
+ },
181
+ languageOptions: languageOptions$1,
182
+ rules: {
183
+ ...configStandard.rules,
184
+ ...pluginSonarJs.configs.recommended.rules,
185
+ "import/first": 0
186
+ }
187
+ },
188
+ {
189
+ name: "stylistic",
190
+ ...pluginStylistic.configs["recommended-flat"]
191
+ },
192
+ {
193
+ name: "custom",
194
+ languageOptions: languageOptions$1,
195
+ files: ["**/*.{js,jsx,mjs,cjs}"],
196
+ rules: rules$3
197
+ }
198
+ ];
199
+
200
+ const rules$2 = {
201
+ ...rules$3,
202
+ "react/react-in-jsx-scope": "off",
203
+ "react/jsx-max-depth": ["warn", { max: 7 }],
204
+ "react/prop-types": "off",
205
+ "react-hooks/exhaustive-deps": "off",
206
+ "react/button-has-type": "warn",
207
+ "react/display-name": "warn",
208
+ "react/no-children-prop": "warn",
209
+ "react/no-danger-with-children": "warn",
210
+ "react/no-unstable-nested-components": "warn",
211
+ "react/self-closing-comp": ["warn", { component: true, html: true }],
212
+ "react/jsx-curly-brace-presence": [
213
+ "warn",
214
+ { props: "never", children: "never" }
215
+ ],
216
+ "react/jsx-curly-newline": "warn",
217
+ "react/destructuring-assignment": "warn",
218
+ "react/jsx-pascal-case": "warn",
219
+ "react/boolean-prop-naming": "warn",
220
+ "react/hook-use-state": "warn",
221
+ "react/jsx-boolean-value": "warn",
222
+ "react/jsx-closing-tag-location": "warn",
223
+ "react/jsx-closing-bracket-location": "warn",
224
+ "react/jsx-wrap-multilines": "warn",
225
+ "react/jsx-no-target-blank": "warn",
226
+ "react/jsx-no-leaked-render": "warn",
227
+ "react/jsx-handler-names": "warn",
228
+ "react/jsx-fragments": "warn",
229
+ "react/no-deprecated": "warn",
230
+ "react/no-multi-comp": "warn",
231
+ "react/no-unescaped-entities": "warn",
232
+ "react/jsx-no-undef": "warn",
233
+ "react/no-unknown-property": "warn",
234
+ "simple-import-sort/imports": [
235
+ "warn",
236
+ {
237
+ groups: [
238
+ // Packages `react` related packages come first.
239
+ ["^react"],
240
+ ...groups
241
+ ]
242
+ }
243
+ ]
244
+ };
245
+
246
+ const languageOptions = {
247
+ ecmaVersion: "latest",
248
+ sourceType: "module",
249
+ ...pluginReactConfig.languageOptions,
250
+ globals: {
251
+ ...globals.browser,
252
+ ...globals.node
253
+ }
254
+ };
255
+ const reactConfig = [
256
+ ...jsConfig,
257
+ ...fixupConfigRules(pluginReactConfig).map((react) => ({
258
+ ...react,
259
+ name: "react",
260
+ languageOptions,
261
+ settings: {
262
+ react: {
263
+ version: "detect"
264
+ }
265
+ }
266
+ })),
267
+ {
268
+ name: "custom-react",
269
+ plugins: {
270
+ "react-hooks": pluginReactHooks
271
+ },
272
+ languageOptions,
273
+ files: ["**/*.{js,jsx,mjs,cjs}"],
274
+ rules: {
275
+ ...configStandard.rules,
276
+ ...pluginSonarJs.configs.recommended.rules,
277
+ ...pluginReactHooks.configs.recommended.rules,
278
+ ...rules$2
279
+ }
280
+ }
281
+ ];
282
+
283
+ const __filename = fileURLToPath(import.meta.url);
284
+ const __dirname = path.dirname(__filename);
285
+ const flatCompat = new FlatCompat({
286
+ baseDirectory: __dirname,
287
+ recommendedConfig: {}
288
+ });
289
+
290
+ const astroConfig = [
291
+ ...reactConfig,
292
+ ...fixupConfigRules(flatCompat.config({
293
+ overrides: [
294
+ {
295
+ files: ["*.astro"],
296
+ parser: "astro-eslint-parser"
297
+ },
298
+ {
299
+ files: ["*.md", "*.mdx"],
300
+ extends: ["plugin:mdx/recommended"],
301
+ settings: {
302
+ "mdx/code-blocks": true,
303
+ "mdx/language-mapper": {}
304
+ },
305
+ rules: {
306
+ "max-len": 0,
307
+ "react/react-in-jsx-scope": 0
308
+ }
309
+ }
310
+ ]
311
+ }))
312
+ ];
313
+
314
+ const rules$1 = {
315
+ ...rules$3,
316
+ "@typescript-eslint/indent": 0,
317
+ "@typescript-eslint/no-unused-vars": [
318
+ "warn",
319
+ {
320
+ vars: "all",
321
+ varsIgnorePattern: "^_",
322
+ args: "after-used",
323
+ argsIgnorePattern: "^_",
324
+ destructuredArrayIgnorePattern: "^_",
325
+ ignoreRestSiblings: true
326
+ }
327
+ ],
328
+ "@typescript-eslint/no-explicit-any": "warn",
329
+ "@typescript-eslint/no-empty-function": "warn",
330
+ "@typescript-eslint/ban-types": "warn",
331
+ "@typescript-eslint/no-var-requires": "warn",
332
+ "@typescript-eslint/ban-ts-comment": "warn",
333
+ "@typescript-eslint/no-non-null-assertion": "warn",
334
+ "@typescript-eslint/no-invalid-void-type": "warn",
335
+ "@typescript-eslint/no-dynamic-delete": "warn",
336
+ "@typescript-eslint/no-useless-constructor": "warn",
337
+ "@typescript-eslint/prefer-for-of": "warn",
338
+ "@typescript-eslint/no-duplicate-enum-values": "warn",
339
+ semi: "off"
340
+ };
341
+
342
+ const tsConfig = [
343
+ ...jsConfig,
344
+ ...tseslint.configs.strict,
345
+ ...tseslint.configs.stylistic,
346
+ {
347
+ name: "custom-ts",
348
+ files: ["**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}"],
349
+ rules: rules$1
350
+ }
351
+ ];
352
+
353
+ const reactTsConfig = [
354
+ ...reactConfig,
355
+ ...tsConfig
356
+ ];
357
+
358
+ const astroTsConfig = [
359
+ ...reactTsConfig,
360
+ ...astroConfig,
361
+ ...fixupConfigRules(flatCompat.config({
362
+ overrides: [{
363
+ files: ["*.astro"],
364
+ parser: "astro-eslint-parser",
365
+ plugins: ["@typescript-eslint"],
366
+ rules: {
367
+ "@typescript-eslint/strict-boolean-expressions": 0
368
+ }
369
+ }]
370
+ }))
371
+ ];
372
+
373
+ const rules = {
374
+ "simple-import-sort/imports": [
375
+ "warn",
376
+ {
377
+ groups: [
378
+ // Packages `react` related packages come first.
379
+ ["^react"],
380
+ ["^next"],
381
+ ...groups
382
+ ]
383
+ }
384
+ ]
385
+ };
386
+
387
+ const nextConfig = [
388
+ ...fixupConfigRules(flatCompat.extends("plugin:@next/next/core-web-vitals")),
389
+ ...reactConfig,
390
+ {
391
+ name: "custom-next",
392
+ rules
393
+ }
394
+ ];
395
+
396
+ const nextTsConfig = [
397
+ ...nextConfig,
398
+ ...reactTsConfig
399
+ ];
400
+
401
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@santi020k/eslint-config-santi020k",
3
- "version": "1.0.1",
3
+ "version": "1.1.2",
4
4
  "description": "A comprehensive ESLint configuration package for JavaScript, TypeScript, and React projects, including popular plugins and custom rules for consistent coding style.",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.cjs",
@@ -24,7 +24,7 @@
24
24
  "lint": "eslint . --report-unused-disable-directives",
25
25
  "lint:fix": "npm run lint -- --fix --max-warnings=0",
26
26
  "pre-commit": "lint-staged",
27
- "pre-push": "npm run lint:fix && npm run build",
27
+ "pre-push": "npm run build && npm run lint:fix",
28
28
  "prepare": "husky config/.husky",
29
29
  "test": "not yet"
30
30
  },
@@ -74,13 +74,16 @@
74
74
  "dependencies": {
75
75
  "@eslint/compat": "^1.0.3",
76
76
  "@eslint/js": "^9.4.0",
77
+ "@next/eslint-plugin-next": "^14.2.3",
77
78
  "@stylistic/eslint-plugin": "^2.1.0",
78
79
  "@types/eslint__js": "^8.42.3",
79
80
  "@typescript-eslint/eslint-plugin": "^7.11.0",
80
81
  "@typescript-eslint/type-utils": "^7.11.0",
81
82
  "eslint-config-standard": "^17.1.0",
83
+ "eslint-plugin-astro": "^1.2.0",
82
84
  "eslint-plugin-import": "^2.29.1",
83
85
  "eslint-plugin-jsx-a11y": "^6.8.0",
86
+ "eslint-plugin-mdx": "^3.1.5",
84
87
  "eslint-plugin-n": "^17.7.0",
85
88
  "eslint-plugin-promise": "^6.2.0",
86
89
  "eslint-plugin-react": "^7.34.2",