@fullstacksjs/eslint-config 14.8.1 → 15.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.
Files changed (55) hide show
  1. package/README.md +1 -20
  2. package/dist/index.mjs +1894 -0
  3. package/package.json +44 -46
  4. package/src/index.mjs +5 -5
  5. package/src/modules/base.mjs +10 -2
  6. package/src/modules/cypress.mjs +1 -0
  7. package/src/modules/imports.mjs +1 -0
  8. package/src/modules/jest.mjs +1 -0
  9. package/src/modules/next.mjs +1 -0
  10. package/src/modules/node.mjs +3 -0
  11. package/src/modules/perfectionist.mjs +1 -0
  12. package/src/modules/playwright.mjs +1 -0
  13. package/src/modules/prettier.mjs +1 -0
  14. package/src/modules/promise.mjs +1 -0
  15. package/src/modules/react.mjs +2 -0
  16. package/src/modules/regex.mjs +1 -0
  17. package/src/modules/storybook.mjs +1 -0
  18. package/src/modules/stylistic.mjs +1 -0
  19. package/src/modules/tailwind.mjs +1 -0
  20. package/src/modules/tests.mjs +4 -1
  21. package/src/modules/typescript.mjs +22 -4
  22. package/src/modules/vitest.mjs +1 -0
  23. package/src/utils/nextAllowExportNames.mjs +7 -0
  24. package/cjs/index.js +0 -137
  25. package/cjs/modules/base.js +0 -235
  26. package/cjs/modules/cypress.js +0 -39
  27. package/cjs/modules/ignore.js +0 -26
  28. package/cjs/modules/imports.js +0 -124
  29. package/cjs/modules/jest.js +0 -102
  30. package/cjs/modules/next.js +0 -48
  31. package/cjs/modules/node.js +0 -76
  32. package/cjs/modules/perfectionist.js +0 -54
  33. package/cjs/modules/playwright.js +0 -89
  34. package/cjs/modules/prettier.js +0 -97
  35. package/cjs/modules/promise.js +0 -45
  36. package/cjs/modules/react.js +0 -190
  37. package/cjs/modules/regex.js +0 -122
  38. package/cjs/modules/storybook.js +0 -49
  39. package/cjs/modules/stylistic.js +0 -94
  40. package/cjs/modules/tailwind.js +0 -56
  41. package/cjs/modules/tests.js +0 -52
  42. package/cjs/modules/typescript.js +0 -277
  43. package/cjs/modules/vitest.js +0 -116
  44. package/cjs/types/index.d.ts +0 -143
  45. package/cjs/types/modules/import.d.ts +0 -7
  46. package/cjs/types/modules/react.d.ts +0 -10
  47. package/cjs/types/modules/regex.d.ts +0 -5
  48. package/cjs/types/modules/tailwind.d.ts +0 -13
  49. package/cjs/types/modules/typescript.d.ts +0 -38
  50. package/cjs/utils/conditions.js +0 -25
  51. package/cjs/utils/getGitignorePatterns.js +0 -35
  52. package/cjs/utils/globs.js +0 -37
  53. package/cjs/utils/naming-convention.js +0 -63
  54. package/cjs/utils/nextAllowExportNames.js +0 -7
  55. package/cjs/utils/objectOrEmpty.js +0 -14
package/package.json CHANGED
@@ -1,66 +1,60 @@
1
1
  {
2
2
  "name": "@fullstacksjs/eslint-config",
3
- "version": "14.8.1",
3
+ "version": "15.0.0",
4
+ "description": "fullstacks eslint config",
4
5
  "license": "MIT",
5
6
  "author": "fullstacks <fullstacksjs@gmail.com>",
6
- "description": "fullstacks eslint config",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/fullstacksjs/eslint-config.git"
10
10
  },
11
+ "files": [
12
+ "src",
13
+ "dist"
14
+ ],
15
+ "exports": {
16
+ ".": "./dist/index.mjs",
17
+ "./package.json": "./package.json"
18
+ },
11
19
  "publishConfig": {
12
20
  "access": "public",
13
21
  "provenance": true
14
22
  },
15
- "files": [
16
- "src",
17
- "cjs"
18
- ],
19
- "packageManager": "npm@12.0.1",
20
23
  "scripts": {
21
- "lint": "eslint .",
22
24
  "spell": "cspell ./* --no-progress",
23
25
  "test": "echo 0",
24
- "build": "unbuild",
25
- "postbuild": "./postbuild",
26
+ "check": "vp check",
27
+ "lint": "eslint . --ext .js,.ts,.mjs,.cjs",
28
+ "build": "vp pack",
26
29
  "prepublishOnly": "pinst --disable",
27
30
  "postpublish": "pinst --enable",
28
- "check:rules": "node scripts/check-missing-rules.mjs",
29
- "pre-commit": "npm run test && lint-staged && npm run spell"
30
- },
31
- "main": "./cjs/index.js",
32
- "module": "./src/index.mjs",
33
- "exports": {
34
- ".": {
35
- "import": "./src/index.mjs",
36
- "require": "./cjs/index.js",
37
- "types": "./src/types/index.d.ts"
38
- }
31
+ "prepare": "vp config",
32
+ "check:rules": "node scripts/check-missing-rules.mjs"
39
33
  },
40
34
  "dependencies": {
41
- "@eslint-react/eslint-plugin": "5.17.2",
35
+ "@eslint-react/eslint-plugin": "5.18.3",
42
36
  "@eslint/compat": "2.1.0",
43
- "@next/eslint-plugin-next": "16.2.10",
37
+ "@next/eslint-plugin-next": "16.3.0",
44
38
  "@stylistic/eslint-plugin": "5.10.0",
45
- "@vitest/eslint-plugin": "1.6.23",
39
+ "@vitest/eslint-plugin": "1.6.27",
46
40
  "deepmerge": "4.3.1",
47
41
  "eslint-flat-config-utils": "3.2.0",
48
42
  "eslint-plugin-better-tailwindcss": "4.7.0",
49
- "eslint-plugin-cypress": "6.4.3",
43
+ "eslint-plugin-cypress": "7.0.0",
50
44
  "eslint-plugin-import-x": "4.17.1",
51
- "eslint-plugin-jest": "29.15.4",
45
+ "eslint-plugin-jest": "29.16.0",
52
46
  "eslint-plugin-jsx-a11y": "6.10.2",
53
- "eslint-plugin-n": "18.2.1",
54
- "eslint-plugin-perfectionist": "5.10.0",
55
- "eslint-plugin-playwright": "2.10.5",
47
+ "eslint-plugin-n": "18.3.0",
48
+ "eslint-plugin-perfectionist": "5.10.1",
49
+ "eslint-plugin-playwright": "2.11.0",
56
50
  "eslint-plugin-prettier": "5.5.6",
57
51
  "eslint-plugin-promise": "7.3.0",
58
- "eslint-plugin-react-refresh": "0.5.3",
52
+ "eslint-plugin-react-refresh": "0.5.4",
59
53
  "eslint-plugin-regexp": "3.1.1",
60
- "eslint-plugin-storybook": "10.5.2",
61
- "globals": "17.7.0",
54
+ "eslint-plugin-storybook": "10.5.7",
55
+ "globals": "17.10.0",
62
56
  "local-pkg": "1.2.1",
63
- "typescript-eslint": "8.65.0"
57
+ "typescript-eslint": "8.67.0"
64
58
  },
65
59
  "devDependencies": {
66
60
  "@eslint/eslintrc": "3.3.6",
@@ -70,22 +64,21 @@
70
64
  "@semantic-release/release-notes-generator": "14.1.1",
71
65
  "@types/eslint": "9.6.1",
72
66
  "cspell": "10.0.1",
73
- "eslint": "10.7.0",
74
- "husky": "9.1.7",
67
+ "eslint": "10.8.1",
75
68
  "jest": "30.4.2",
76
- "lint-staged": "17.1.0",
77
69
  "pinst": "3.0.0",
78
- "prettier": "3.9.5",
79
- "semantic-release": "25.0.8",
80
- "storybook": "10.5.2",
70
+ "prettier": "3.9.6",
71
+ "semantic-release": "25.0.9",
72
+ "storybook": "10.5.7",
81
73
  "typescript": "6.0.3",
82
- "unbuild": "3.6.1"
74
+ "vite-plus": "0.2.8",
75
+ "vitest": "4.1.10"
83
76
  },
84
77
  "peerDependencies": {
85
- "cypress": ">=8",
86
- "eslint": ">=9.38",
78
+ "cypress": ">=15",
79
+ "eslint": ">=10.3.0",
87
80
  "prettier": ">=3",
88
- "react": ">=18",
81
+ "react": ">=19",
89
82
  "tailwindcss": ">=3.3.0",
90
83
  "typescript": ">=5"
91
84
  },
@@ -106,7 +99,12 @@
106
99
  "optional": true
107
100
  }
108
101
  },
109
- "volta": {
110
- "node": "24.12.0"
111
- }
102
+ "devEngines": {
103
+ "runtime": {
104
+ "name": "node",
105
+ "version": "24.18.0",
106
+ "onFail": "download"
107
+ }
108
+ },
109
+ "packageManager": "npm@12.0.2"
112
110
  }
package/src/index.mjs CHANGED
@@ -83,10 +83,10 @@ export function defineConfig(initOptions = {}, ...extend) {
83
83
  stylistic: enableStylistic,
84
84
  sort: enableSort,
85
85
  cypress: enableCypress,
86
- disableExpensiveRules,
87
- esm: enableEsm,
88
- ignores: enableIgnores,
89
- gitignore,
86
+ disableExpensiveRules: _disableExpensiveRules,
87
+ esm: _enableEsm,
88
+ ignores: _enableIgnores,
89
+ gitignore: _gitignore,
90
90
  import: enableImport,
91
91
  jest: enableJest,
92
92
  next: enableNext,
@@ -95,7 +95,7 @@ export function defineConfig(initOptions = {}, ...extend) {
95
95
  prettier: enablePrettier,
96
96
  react: enableReact,
97
97
  storybook: enableStorybook,
98
- strict: enableStrict,
98
+ strict: _enableStrict,
99
99
  tailwind: enableTailwind,
100
100
  test: enableTest,
101
101
  typescript: enableTypescript,
@@ -11,6 +11,9 @@ import { objectOrEmpty } from '../utils/objectOrEmpty.mjs';
11
11
  function base(options = {}) {
12
12
  const overrides = objectOrEmpty(options.base.overrides);
13
13
 
14
+ /**
15
+ * @type { import('eslint/config').ConfigObject }
16
+ */
14
17
  const baseConfig = {
15
18
  name: 'base',
16
19
  languageOptions: {
@@ -85,7 +88,7 @@ function base(options = {}) {
85
88
  'no-extend-native': 'error',
86
89
  'no-extra-bind': 'error',
87
90
  'no-extra-label': 'error',
88
- 'no-fallthrough': ["error", { "allowEmptyCase": true }],
91
+ 'no-fallthrough': ['error', { allowEmptyCase: true }],
89
92
  'no-func-assign': 'error',
90
93
  'no-global-assign': 'error',
91
94
  'no-implicit-globals': 'error',
@@ -145,7 +148,12 @@ function base(options = {}) {
145
148
  'no-unused-private-class-members': 'warn',
146
149
  'no-unused-vars': [
147
150
  'error',
148
- { argsIgnorePattern: '^_', varsIgnorePattern: '^ignore(d)?', args: 'after-used', ignoreRestSiblings: true },
151
+ {
152
+ argsIgnorePattern: '^_',
153
+ varsIgnorePattern: '^ignore(d)?',
154
+ args: 'after-used',
155
+ ignoreRestSiblings: true,
156
+ },
149
157
  ],
150
158
  'no-use-before-define': ['error', 'nofunc'],
151
159
  'no-useless-assignment': 'warn',
@@ -11,6 +11,7 @@ import { objectOrEmpty } from '../utils/objectOrEmpty.mjs';
11
11
  function cypress(options = {}) {
12
12
  const overrides = objectOrEmpty(options.cypress.overrides);
13
13
 
14
+ /** @type { import('eslint/config').ConfigObject } */
14
15
  const cypressConfig = {
15
16
  name: 'cypress',
16
17
  files: globs.e2e,
@@ -16,6 +16,7 @@ function imports(options = {}) {
16
16
  const isObject = typeof options.import === 'object';
17
17
  const overrides = objectOrEmpty(options.import.overrides);
18
18
 
19
+ /** @type { import('eslint/config').ConfigObject } */
19
20
  const importsConfig = {
20
21
  name: 'imports',
21
22
  plugins: { import: plugin },
@@ -13,6 +13,7 @@ function jest(options = {}) {
13
13
  const projectService = options.typescript && options.typescript.tsconfigRootDir && options.typescript.projectService;
14
14
  const overrides = objectOrEmpty(options.jest.overrides);
15
15
 
16
+ /** @type { import('eslint/config').ConfigObject } */
16
17
  const jestConfig = {
17
18
  name: 'jest',
18
19
  files: globs.test,
@@ -10,6 +10,7 @@ import { objectOrEmpty } from '../utils/objectOrEmpty.mjs';
10
10
  function next(options = {}) {
11
11
  const overrides = objectOrEmpty(options.next.overrides);
12
12
 
13
+ /** @type { import('eslint/config').ConfigObject } */
13
14
  const nextConfig = {
14
15
  name: 'next',
15
16
  plugins: { next: plugin },
@@ -11,6 +11,7 @@ import { objectOrEmpty } from '../utils/objectOrEmpty.mjs';
11
11
  function node(options = {}) {
12
12
  const overrides = objectOrEmpty(options.node.overrides);
13
13
 
14
+ /** @type { import('eslint/config').ConfigObject } */
14
15
  const nodeConfig = {
15
16
  name: 'node',
16
17
  plugins: { n: plugin },
@@ -46,7 +47,9 @@ function node(options = {}) {
46
47
  'n/prefer-global/timers': 'warn',
47
48
  'n/prefer-global/url-search-params': 'warn',
48
49
  'n/prefer-global/url': 'warn',
50
+ '/prefer-import/assert-strict': 'warn',
49
51
  'n/prefer-node-protocol': 'warn',
52
+ 'n/prefer-process-get-builtin-module': 'warn',
50
53
  'n/prefer-promises/dns': 'warn',
51
54
  'n/prefer-promises/fs': 'warn',
52
55
  'n/process-exit-as-throw': 'error',
@@ -10,6 +10,7 @@ import { objectOrEmpty } from '../utils/objectOrEmpty.mjs';
10
10
  function perfectionist(options = {}) {
11
11
  const overrides = objectOrEmpty(options.sort.overrides);
12
12
 
13
+ /** @type { import('eslint/config').ConfigObject } */
13
14
  const perfectionistConfig = {
14
15
  name: 'perfectionist',
15
16
  plugins: { perfectionist: plugin },
@@ -11,6 +11,7 @@ import { objectOrEmpty } from '../utils/objectOrEmpty.mjs';
11
11
  function playwright(options = {}) {
12
12
  const overrides = objectOrEmpty(options.playwright.overrides);
13
13
 
14
+ /** @type { import('eslint/config').ConfigObject } */
14
15
  const playwrightConfig = {
15
16
  name: 'playwright',
16
17
  plugins: { playwright: plugin },
@@ -10,6 +10,7 @@ import { objectOrEmpty } from '../utils/objectOrEmpty.mjs';
10
10
  function prettier(options = {}) {
11
11
  const overrides = objectOrEmpty(options.prettier.overrides);
12
12
 
13
+ /** @type { import('eslint/config').ConfigObject } */
13
14
  const prettierConfig = {
14
15
  name: 'prettier',
15
16
  plugins: { prettier: plugin },
@@ -11,6 +11,7 @@ import { objectOrEmpty } from '../utils/objectOrEmpty.mjs';
11
11
  function promise(options = {}) {
12
12
  const overrides = objectOrEmpty(options.promise.overrides);
13
13
 
14
+ /** @type { import('eslint/config').ConfigObject } */
14
15
  const promiseConfig = {
15
16
  name: 'promise',
16
17
  plugins: { promise: plugin },
@@ -19,6 +19,7 @@ function react(options = {}) {
19
19
  const isObject = typeof options.react === 'object';
20
20
  const overrides = objectOrEmpty(options.react.overrides);
21
21
 
22
+ /** @type { import('eslint/config').ConfigObject } */
22
23
  const reactConfig = {
23
24
  name: 'react',
24
25
  files: [globs.js, globs.jsx, globs.ts, globs.tsx],
@@ -76,6 +77,7 @@ function react(options = {}) {
76
77
  '@eslint-react/jsx-no-children-prop': 'warn',
77
78
  '@eslint-react/jsx-no-children-prop-with-children': 'warn',
78
79
  '@eslint-react/jsx-no-key-after-spread': 'error',
80
+ '@eslint-react/no-leaked-dollar': 'error',
79
81
  '@eslint-react/jsx-no-useless-fragment': 'warn',
80
82
  '@eslint-react/jsx-no-namespace': 'error',
81
83
 
@@ -12,6 +12,7 @@ function regex(options = {}) {
12
12
  const isObject = typeof options.regex === 'object';
13
13
  const overrides = objectOrEmpty(options.regex.overrides);
14
14
 
15
+ /** @type { import('eslint/config').ConfigObject } */
15
16
  const regexConfig = {
16
17
  name: 'regex',
17
18
  plugins: { regexp: plugin },
@@ -11,6 +11,7 @@ import { objectOrEmpty } from '../utils/objectOrEmpty.mjs';
11
11
  function storybook(options = {}) {
12
12
  const overrides = objectOrEmpty(options.storybook.overrides);
13
13
 
14
+ /** @type { import('eslint/config').ConfigObject } */
14
15
  const storybookConfig = {
15
16
  name: 'storybook',
16
17
  files: globs.storybook,
@@ -10,6 +10,7 @@ import { objectOrEmpty } from '../utils/objectOrEmpty.mjs';
10
10
  function stylistic(options = {}) {
11
11
  const overrides = objectOrEmpty(options.stylistic.overrides);
12
12
 
13
+ /** @type { import('eslint/config').ConfigObject } */
13
14
  const stylisticConfig = {
14
15
  name: 'stylistic',
15
16
  plugins: { '@stylistic': stylisticPlugin },
@@ -12,6 +12,7 @@ async function tailwind(options = {}) {
12
12
  const isObject = typeof options.tailwind === 'object';
13
13
  const overrides = objectOrEmpty(options.tailwind.overrides);
14
14
 
15
+ /** @type { import('eslint/config').ConfigObject } */
15
16
  const tailwindConfig = {
16
17
  name: 'tailwind',
17
18
  plugins: { 'better-tailwindcss': plugin.default ?? plugin },
@@ -14,12 +14,15 @@ import { objectOrEmpty } from '../utils/objectOrEmpty.mjs';
14
14
  function tests(options = {}) {
15
15
  const overrides = objectOrEmpty(options.test.overrides);
16
16
 
17
+ /** @type { import('eslint/config').ConfigObject } */
17
18
  const testsConfug = {
18
19
  name: 'tests',
19
20
  files: [...globs.test, ...globs.e2e],
20
21
  plugins: { vitest: plugin },
21
22
  languageOptions: {
22
- globals: { ...globals['shared-node-browser'] },
23
+ globals: {
24
+ ...globals['shared-node-browser'],
25
+ },
23
26
  },
24
27
  rules: {
25
28
  'max-lines-per-function': 'off',
@@ -14,6 +14,7 @@ function typescript(options = {}) {
14
14
  const projectService = options.typescript && options.typescript.tsconfigRootDir && options.typescript.projectService;
15
15
  const overrides = objectOrEmpty(options.typescript.overrides);
16
16
 
17
+ /** @type { import('eslint/config').ConfigObject } */
17
18
  const typescriptConfig = {
18
19
  name: 'typescript',
19
20
  files: [globs.ts, globs.tsx],
@@ -46,7 +47,11 @@ function typescript(options = {}) {
46
47
  '@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
47
48
  '@typescript-eslint/consistent-type-imports': [
48
49
  'warn',
49
- { prefer: 'type-imports', disallowTypeAnnotations: false, fixStyle: 'separate-type-imports' },
50
+ {
51
+ prefer: 'type-imports',
52
+ disallowTypeAnnotations: false,
53
+ fixStyle: 'separate-type-imports',
54
+ },
50
55
  ],
51
56
  '@typescript-eslint/default-param-last': 'warn',
52
57
  '@typescript-eslint/explicit-function-return-type': 'off',
@@ -92,7 +97,9 @@ function typescript(options = {}) {
92
97
  '@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
93
98
  '@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
94
99
  '@typescript-eslint/no-non-null-assertion': 'off',
95
- ...predicate(options.strict, { '@typescript-eslint/no-non-null-assertion': 'warn' }),
100
+ ...predicate(options.strict, {
101
+ '@typescript-eslint/no-non-null-assertion': 'warn',
102
+ }),
96
103
  '@typescript-eslint/no-redeclare': ['off', { ignoreDeclarationMerge: true }], // useful in FP.
97
104
  '@typescript-eslint/no-require-imports': 'error',
98
105
  '@typescript-eslint/no-restricted-imports': 'off',
@@ -132,7 +139,11 @@ function typescript(options = {}) {
132
139
  '@typescript-eslint/prefer-namespace-keyword': 'error',
133
140
  '@typescript-eslint/prefer-readonly-parameter-types': [
134
141
  'off',
135
- { checkParameterProperties: true, ignoreInferredTypes: false, treatMethodsAsReadonly: true },
142
+ {
143
+ checkParameterProperties: true,
144
+ ignoreInferredTypes: false,
145
+ treatMethodsAsReadonly: true,
146
+ },
136
147
  ], // I'm not sure...
137
148
  '@typescript-eslint/prefer-readonly': 'off',
138
149
  '@typescript-eslint/prefer-readonlysemi': 'off', // Annoying with auto-fix on save.
@@ -204,7 +215,14 @@ function typescript(options = {}) {
204
215
  '@typescript-eslint/prefer-string-starts-ends-with': 'warn',
205
216
  '@typescript-eslint/restrict-template-expressions': [
206
217
  'warn',
207
- { allowNumber: true, allowBoolean: false, allowAny: false, allowNullish: false, allowRegExp: false, allowNever: false },
218
+ {
219
+ allowNumber: true,
220
+ allowBoolean: false,
221
+ allowAny: false,
222
+ allowNullish: false,
223
+ allowRegExp: false,
224
+ allowNever: false,
225
+ },
208
226
  ],
209
227
  '@typescript-eslint/related-getter-setter-pairs': 'error',
210
228
  '@typescript-eslint/require-array-sort-compare': ['error', { ignoreStringArrays: true }],
@@ -11,6 +11,7 @@ import { objectOrEmpty } from '../utils/objectOrEmpty.mjs';
11
11
  function vitest(options = {}) {
12
12
  const overrides = objectOrEmpty(options.vitest.overrides);
13
13
 
14
+ /** @type { import('eslint/config').ConfigObject } */
14
15
  const vitestConfig = {
15
16
  name: 'vitest',
16
17
  files: globs.test,
@@ -7,11 +7,18 @@ export const nextAllowExportNames = [
7
7
  'runtime',
8
8
  'preferredRegion',
9
9
  'maxDuration',
10
+ // https://nextjs.org/docs/app/api-reference/functions/generate-metadata
10
11
  'metadata',
11
12
  'generateMetadata',
13
+ // https://nextjs.org/docs/app/api-reference/functions/generate-viewport
12
14
  'viewport',
13
15
  'generateViewport',
16
+ // https://nextjs.org/docs/app/api-reference/functions/generate-image-metadata
14
17
  'generateImageMetadata',
18
+ // https://nextjs.org/docs/app/api-reference/functions/generate-sitemaps
15
19
  'generateSitemaps',
20
+ // https://nextjs.org/docs/app/api-reference/functions/generate-static-params
16
21
  'generateStaticParams',
22
+ // https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config/instant
23
+ 'instant',
17
24
  ];
package/cjs/index.js DELETED
@@ -1,137 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.defineConfig = defineConfig;
7
- var _deepmerge = _interopRequireDefault(require("deepmerge"));
8
- var _config = require("eslint/config");
9
- var _localPkg = require("local-pkg");
10
- var _base = _interopRequireDefault(require("./modules/base.js"));
11
- var _cypress = _interopRequireDefault(require("./modules/cypress.js"));
12
- var _ignore = _interopRequireDefault(require("./modules/ignore.js"));
13
- var _imports = _interopRequireDefault(require("./modules/imports.js"));
14
- var _jest = _interopRequireDefault(require("./modules/jest.js"));
15
- var _next = _interopRequireDefault(require("./modules/next.js"));
16
- var _node = _interopRequireDefault(require("./modules/node.js"));
17
- var _perfectionist = _interopRequireDefault(require("./modules/perfectionist.js"));
18
- var _playwright = _interopRequireDefault(require("./modules/playwright.js"));
19
- var _prettier = _interopRequireDefault(require("./modules/prettier.js"));
20
- var _promise = _interopRequireDefault(require("./modules/promise.js"));
21
- var _react = _interopRequireDefault(require("./modules/react.js"));
22
- var _regex = _interopRequireDefault(require("./modules/regex.js"));
23
- var _storybook = _interopRequireDefault(require("./modules/storybook.js"));
24
- var _stylistic = _interopRequireDefault(require("./modules/stylistic.js"));
25
- var _tailwind = _interopRequireDefault(require("./modules/tailwind.js"));
26
- var _tests = _interopRequireDefault(require("./modules/tests.js"));
27
- var _typescript = _interopRequireDefault(require("./modules/typescript.js"));
28
- var _vitest = _interopRequireDefault(require("./modules/vitest.js"));
29
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
30
- const testPackages = ['jest', 'vitest', 'cypress', '@playwright/test'];
31
-
32
- /**
33
- * @typedef {import('eslint').Linter.Config} Config
34
- * @typedef {import('./types').Options} Options
35
- * /
36
-
37
- /** @type {Options} */
38
- const defaultOptions = {
39
- base: true,
40
- promise: true,
41
- stylistic: true,
42
- cypress: (0, _localPkg.isPackageExists)('cypress'),
43
- disableExpensiveRules: false,
44
- esm: false,
45
- ignores: [],
46
- gitignore: './.gitignore',
47
- import: {},
48
- jest: (0, _localPkg.isPackageExists)('jest'),
49
- next: (0, _localPkg.isPackageExists)('next'),
50
- node: false,
51
- sort: true,
52
- playwright: (0, _localPkg.isPackageExists)('@playwright/test'),
53
- prettier: (0, _localPkg.isPackageExists)('prettier'),
54
- react: (0, _localPkg.isPackageExists)('react'),
55
- storybook: (0, _localPkg.isPackageExists)('storybook'),
56
- strict: false,
57
- tailwind: false,
58
- test: testPackages.some(p => (0, _localPkg.isPackageExists)(p)),
59
- typescript: (0, _localPkg.isPackageExists)('typescript') ? {
60
- projectService: true
61
- } : false,
62
- vitest: (0, _localPkg.isPackageExists)('vitest'),
63
- regex: {
64
- allowedCharacterRanges: ['all']
65
- }
66
- };
67
-
68
- /**
69
- * Initialize eslint config
70
- * @param {Options} initOptions
71
- * @param {...Config} extend
72
- * @returns {Config[]}
73
- */
74
- function defineConfig(initOptions = {}, ...extend) {
75
- const options = (0, _deepmerge.default)(defaultOptions, initOptions);
76
- if (options.import === true) {
77
- options.import = {};
78
- }
79
- if (options.regex === true) {
80
- options.regex = {
81
- allowedCharacterRanges: ['all']
82
- };
83
- }
84
- if (options.typescript === true) {
85
- options.typescript = {
86
- projectService: true
87
- };
88
- }
89
- const {
90
- base: enableBase,
91
- promise: enablePromise,
92
- stylistic: enableStylistic,
93
- sort: enableSort,
94
- cypress: enableCypress,
95
- disableExpensiveRules,
96
- esm: enableEsm,
97
- ignores: enableIgnores,
98
- gitignore,
99
- import: enableImport,
100
- jest: enableJest,
101
- next: enableNext,
102
- node: enableNode,
103
- playwright: enablePlaywright,
104
- prettier: enablePrettier,
105
- react: enableReact,
106
- storybook: enableStorybook,
107
- strict: enableStrict,
108
- tailwind: enableTailwind,
109
- test: enableTest,
110
- typescript: enableTypescript,
111
- vitest: enableVitest,
112
- regex: enableRegex,
113
- ...eslintOptions
114
- } = options;
115
- const rules = [(0, _ignore.default)(options)];
116
- if (enableBase) rules.push((0, _base.default)(options));
117
- if (enablePromise) rules.push((0, _promise.default)(options));
118
- if (enableStylistic) rules.push((0, _stylistic.default)(options));
119
- if (enableSort) rules.push((0, _perfectionist.default)(options));
120
- if (enableImport) rules.push((0, _imports.default)(options));
121
- if (enableTailwind) rules.push((0, _tailwind.default)(options));
122
- if (enableNode) rules.push((0, _node.default)(options));
123
- if (enableReact) rules.push((0, _react.default)(options));
124
- if (enableStorybook) rules.push((0, _storybook.default)(options));
125
- if (enableTypescript) rules.push((0, _typescript.default)(options));
126
- if (enableNext) rules.push((0, _next.default)(options));
127
- if (enablePrettier) rules.push((0, _prettier.default)(options));
128
- if (enableJest) rules.push((0, _jest.default)(options));
129
- if (enableVitest) rules.push((0, _vitest.default)(options));
130
- if (enableTest) rules.push((0, _tests.default)(options));
131
- if (enableCypress) rules.push((0, _cypress.default)(options));
132
- if (enablePlaywright) rules.push((0, _playwright.default)(options));
133
- if (enableRegex) rules.push((0, _regex.default)(options));
134
- if (Object.keys(eslintOptions).length > 0) rules.push(eslintOptions);
135
- if (extend) Array.prototype.push.apply(rules, extend);
136
- return (0, _config.defineConfig)(rules);
137
- }