@shayanthenerd/eslint-config 0.13.1 → 0.15.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 (53) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +192 -183
  3. package/dist/configs/base.mjs +13 -9
  4. package/dist/configs/css.mjs +2 -2
  5. package/dist/configs/cypress.mjs +2 -2
  6. package/dist/configs/html.mjs +2 -2
  7. package/dist/configs/importX.mjs +2 -2
  8. package/dist/configs/oxlintOverrides.mjs +16 -11
  9. package/dist/configs/perfectionist.mjs +2 -2
  10. package/dist/configs/playwright.mjs +2 -2
  11. package/dist/configs/restrictedExports.mjs +1 -1
  12. package/dist/configs/storybook.mjs +2 -2
  13. package/dist/configs/stylistic.mjs +2 -2
  14. package/dist/configs/tailwind.mjs +4 -4
  15. package/dist/configs/typescript.mjs +2 -2
  16. package/dist/configs/vitest.mjs +2 -2
  17. package/dist/configs/vue.mjs +2 -2
  18. package/dist/configs/vueComponentNames.mjs +1 -1
  19. package/dist/configs/vueServerComponents.mjs +1 -1
  20. package/dist/configs/zod.mjs +21 -0
  21. package/dist/{utils → helpers}/globs.mjs +1 -1
  22. package/dist/{utils → helpers}/ignores/defaultIgnorePatterns.mjs +1 -1
  23. package/dist/{utils → helpers}/ignores/getIgnorePatterns.mjs +1 -1
  24. package/dist/{utils → helpers}/ignores/resolveGitignorePatterns.mjs +1 -1
  25. package/dist/{utils → helpers}/isPackageDetected.mjs +5 -3
  26. package/dist/{utils → helpers}/options/defaultOptions.mjs +14 -7
  27. package/dist/{utils → helpers}/options/enableDetectedConfigs.mjs +2 -3
  28. package/dist/{utils → helpers}/options/mergeWithDefaults.mjs +4 -5
  29. package/dist/{utils → helpers}/vue/getRestrictedVueElements.mjs +1 -1
  30. package/dist/{utils → helpers}/vue/getRestrictedVueInputs.mjs +1 -1
  31. package/dist/index.mjs +6 -4
  32. package/dist/oxlint.config.jsonc +209 -201
  33. package/dist/prettier.config.mjs +1 -1
  34. package/dist/rules/css.mjs +1 -1
  35. package/dist/rules/html.mjs +3 -3
  36. package/dist/rules/importX.mjs +1 -1
  37. package/dist/rules/javascript.mjs +1 -2
  38. package/dist/rules/perfectionist.mjs +2 -2
  39. package/dist/rules/stylistic.mjs +22 -10
  40. package/dist/rules/tailwind.mjs +4 -4
  41. package/dist/rules/typescript.mjs +6 -3
  42. package/dist/rules/vitest.mjs +4 -0
  43. package/dist/rules/vue.mjs +6 -6
  44. package/dist/rules/vueAccessibility.mjs +1 -1
  45. package/dist/rules/zod.mjs +20 -0
  46. package/dist/types/configOptions/base.d.mts +8 -8
  47. package/dist/types/configOptions/nuxt.d.mts +3 -3
  48. package/dist/types/configOptions/stylistic.d.mts +0 -15
  49. package/dist/types/configOptions/test.d.mts +4 -4
  50. package/dist/types/configOptions/vue.d.mts +1 -1
  51. package/dist/types/eslint-schema.d.mts +769 -270
  52. package/dist/types/index.d.mts +43 -19
  53. package/package.json +139 -123
@@ -81,12 +81,15 @@ interface Options {
81
81
  * Specify the runtime environment to correctly resolve its built-in modules
82
82
  *
83
83
  * This is used by
84
- * [perfectionist/sort-imports: `env` option](https://perfectionist.dev/rules/sort-imports#environment)
85
- * to recognize the environment’s built-in modules when sorting the imports.
84
+ *
85
+ * - [ESLint: Specifying Globals](https://eslint.org/docs/latest/use/configure/language-options#using-configuration-files)
86
+ * - [perfectionist/sort-imports: `env` option](https://perfectionist.dev/rules/sort-imports#environment)
87
+ *
88
+ * to recognize the environment’s built-in modules.
86
89
  *
87
90
  * @default 'node'
88
91
  */
89
- env?: 'bun' | 'node';
92
+ env?: 'bun' | 'deno' | 'node' | 'browser';
90
93
 
91
94
  /**
92
95
  * The path and the name of the root TypeScript config file.
@@ -97,16 +100,16 @@ interface Options {
97
100
  * - [better-tailwindcss: `tsconfig` option](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/settings/settings.md#tsconfig)
98
101
  * - [perfectionist/sort-imports: `tsconfig` option](https://perfectionist.dev/rules/sort-imports#tsconfig)
99
102
  *
100
- * @default undefined // `{ rootDir: '.', filename: 'tsconfig.json' }` if "typescript" is detected in the package.json file when `autoDetectDeps` is enabled
103
+ * @default undefined // `{ rootDir: '.', filename: 'tsconfig.json' }` if "typescript" is detected in the dependencies when `autoDetectDeps` is enabled
101
104
  */
102
105
  tsConfig?: false | {
103
106
  /**
104
107
  * The directory of the root TypeScript config file.
105
108
  *
106
- * If you don't use TypeScript, provide the directory of the root JavaScript config file.
109
+ * If you don't use TypeScript, provide the directory of the root JavaScript config file.
107
110
  *
108
111
  * It will fall back to the default value if set to an empty string (`''`).
109
- *
112
+ *
110
113
  * @default '.'
111
114
  */
112
115
  rootDir: string;
@@ -180,24 +183,38 @@ interface Options {
180
183
  *
181
184
  * @default
182
185
  * {
183
- * node: true,
184
- * commonjs: false,
185
- * browser: true,
186
186
  * worker: true,
187
- * serviceworker: false,
188
- * webextension: false,
187
+ * commonjs: false,
188
+ * bun: false, // `true` if `env` is set to `bun`
189
+ * deno: false, // `true` if `env` is set to `deno`
190
+ * node: true,
191
+ * nodeBuiltin: false, // `true` if `env` is set to `node`
192
+ * browser: true, // `true` if `env` is set to `browser`
193
+ * serviceworker: false, // `true` if `env` is set to `browser`
194
+ * sharedWorker: false, // `true` if `env` is set to `browser`
195
+ * webextension: false, // `true` if `env` is set to `browser`
196
+ * audioWorklet: false, // `true` if `env` is set to `browser`
197
+ * vitest: false,
198
+ * vue: false, // `true` if `configs.vue` is enabled
189
199
  * custom: {},
190
200
  * }
191
201
  *
192
202
  * @see [Language Options: Specifying Globals: Using Configuration Files](https://eslint.org/docs/latest/use/configure/language-options#using-configuration-files)
193
203
  */
194
204
  globals?: {
195
- node?: boolean;
205
+ worker?: boolean;
196
206
  commonjs?: boolean;
207
+ bun?: boolean;
208
+ deno?: boolean;
209
+ node?: boolean;
210
+ nodeBuiltin?: boolean;
197
211
  browser?: boolean;
198
- worker?: boolean;
199
212
  serviceworker?: boolean;
213
+ sharedWorker?: boolean;
200
214
  webextension?: boolean;
215
+ audioWorklet?: boolean;
216
+ vitest?: boolean;
217
+ vue?: boolean;
201
218
  custom?: Linter.LanguageOptions['globals'];
202
219
  };
203
220
 
@@ -262,11 +279,11 @@ interface Options {
262
279
  *
263
280
  * Provide the path to your OXLint configuration file (relative to the current working directory) or set to `false` to disable it.
264
281
  *
265
- * Enabling this improves performance and feedback loops when using OXLint.
282
+ * Enabling OXLint improves performance and feedback loops.
266
283
  *
267
284
  * It will fall back to the default value if set to an empty string (`''`).
268
285
  *
269
- * @default false // `'.oxlintrc.json'` if "oxlint" is detected in the package.json file when `autoDetectDeps` is enabled
286
+ * @default '.oxlintrc.json'
270
287
  */
271
288
  oxlint?: false | string;
272
289
 
@@ -314,12 +331,12 @@ interface Options {
314
331
  * - [eslint-plugin-import-x](https://github.com/un-ts/eslint-plugin-import-x) to better understand imports from TypeScript files such as ".ts", ".tsx", etc.
315
332
  * - [eslint-plugin-vue](https://eslint.vuejs.org) to enforce TypeScript-specific rules in the `<script setup lang="ts">` of Vue SFCs.
316
333
  *
317
- * @default false // `true` if "typescript" is detected in the package.json file when `autoDetectDeps` is enabled
334
+ * @default false // `true` if "typescript" is detected in the dependencies when `autoDetectDeps` is enabled
318
335
  */
319
336
  typescript?: boolean | TypeScriptOptions;
320
337
 
321
338
  /**
322
- * Use [eslint-plugin-import-x](https://github.com/un-ts/eslint-plugin-import-x) to organize imports and exports, and detect related issues.
339
+ * Use [eslint-plugin-import-x](https://github.com/un-ts/eslint-plugin-import-x) and [eslint-plugin-unused-imports](https://github.com/sweepline/eslint-plugin-unused-imports) to organize imports and exports, and detect related issues.
323
340
  *
324
341
  * @default true
325
342
  */
@@ -332,10 +349,17 @@ interface Options {
332
349
  */
333
350
  perfectionist?: boolean | PerfectionistOptions;
334
351
 
352
+ /**
353
+ * Use [eslint-plugin-zod-x](https://github.com/marcalexiei/eslint-plugin-zod-x) to enforce Zod best practices.
354
+ *
355
+ * @default false // `true` if "zod" is detected in the dependencies when `autoDetectDeps` is enabled
356
+ */
357
+ zod?: boolean | ConfigWithOverrides;
358
+
335
359
  /**
336
360
  * Use [eslint-plugin-vue](https://eslint.vuejs.org) to enforce Vue best practices, accessibility guidelines, stylistic rules, and identify mistakes.
337
361
  *
338
- * @default false // `true` if "vue" is detected in the package.json file when `autoDetectDeps` is enabled
362
+ * @default false // `true` if "vue" is detected in the dependencies when `autoDetectDeps` is enabled
339
363
  */
340
364
  vue?: boolean | VueOptions;
341
365
 
@@ -346,7 +370,7 @@ interface Options {
346
370
  *
347
371
  * **This configuration requires `configs.vue` to be enabled.**
348
372
  *
349
- * @default false // `true` if "nuxt" is detected in the package.json file when `autoDetectDeps` is enabled
373
+ * @default false // `true` if "nuxt" is detected in the dependencies when `autoDetectDeps` is enabled
350
374
  */
351
375
  nuxt?: boolean | NuxtOptions;
352
376
 
package/package.json CHANGED
@@ -1,125 +1,141 @@
1
1
  {
2
- "name": "@shayanthenerd/eslint-config",
3
- "version": "0.13.1",
4
- "license": "MIT",
5
- "description": "A modern, flexible ESLint configuration for enforcing best practices and maintaining a consistent coding style",
6
- "keywords": [
7
- "eslint",
8
- "eslint-config",
9
- "eslint-flat-config",
10
- "eslint-config-vue",
11
- "eslint-config-typescript",
12
- "oxlint",
13
- "oxlint-config"
14
- ],
15
- "homepage": "https://eslint-config.shayan-zamani.me",
16
- "repository": {
17
- "type": "git",
18
- "url": "git+https://github.com/ShayanTheNerd/eslint-config.git"
19
- },
20
- "bugs": {
21
- "url": "https://github.com/ShayanTheNerd/eslint-config/issues/new?template=bug_report.md"
22
- },
23
- "author": {
24
- "name": "Shayan Zamani",
25
- "email": "dev.shayan.zamani@gmail.com",
26
- "url": "https://github.com/ShayanTheNerd"
27
- },
28
- "funding": "https://buymeacoffee.com/shayanthenerd",
29
- "files": [
30
- "./dist"
31
- ],
32
- "main": "./dist/index.mjs",
33
- "module": "./dist/index.mjs",
34
- "types": "./dist/index.d.mts",
35
- "exports": {
36
- ".": "./dist/index.mjs",
37
- "./package.json": "./package.json",
38
- "./types/*": "./dist/types/*",
39
- "./oxlint": "./dist/oxlint.config.jsonc",
40
- "./prettier": "./dist/prettier.config.mjs"
41
- },
42
- "publishConfig": {
43
- "access": "public"
44
- },
45
- "imports": {
46
- "#utils/*": "./src/utils/*",
47
- "#types/*": "./src/types/*",
48
- "#rules/*": "./src/rules/*",
49
- "#configs/*": "./src/configs/*"
50
- },
51
- "type": "module",
52
- "engines": {
53
- "name": "node",
54
- "version": "^22.12.0",
55
- "onfail": "download"
56
- },
57
- "packageManager": "pnpm@10.25.0",
58
- "scripts": {
59
- "prepare": "pnpm git:gitmessage && simple-git-hooks && pnpm generate:types",
60
- "prepublishOnly": "pnpm build:package",
61
- "git:gitmessage": "git config --local commit.template \".gitmessage\"",
62
- "inspect": "eslint-config-inspector",
63
- "build:package": "tsdown --no-report",
64
- "build:inspector": "eslint-config-inspector build --config=./scripts/defaultESLintConfigReference.ts",
65
- "preview:inspector": "serve .eslint-config-inspector",
66
- "generate:types": "node ./scripts/generateESLintTypes.ts",
67
- "update:actions": "actions-up --yes",
68
- "format": "prettier --write '**/*.{json,jsonc,yaml,yml,lock}' --cache",
69
- "lint:oxlint": "oxlint --fix",
70
- "lint:eslint": "eslint --fix --cache --cache-location=./node_modules/.cache/.eslintcache",
71
- "lint": "pnpm lint:oxlint && pnpm lint:eslint",
72
- "check:types": "tsc",
73
- "check:exports": "attw --pack --profile=esm-only --exclude-entrypoints=./oxlint",
74
- "check:spell": "pnpx cspell . --gitignore --exclude='pnpm-lock.yaml' --cache --cache-location='./node_modules/.cache/.cspellcache'",
75
- "ci:validate": "pnpm generate:types && pnpm format && pnpm lint && pnpm check:types && pnpm build:inspector && pnpm build:package && pnpm check:exports"
76
- },
77
- "simple-git-hooks": {
78
- "pre-commit": "./node_modules/.bin/nano-staged"
79
- },
80
- "nano-staged": {
81
- "**/*.{js,ts}": "pnpm lint",
82
- "**/*.{json,jsonc,yaml,yml,lock}": "pnpm format"
83
- },
84
- "dependencies": {
85
- "@eslint/compat": "2.0.0",
86
- "@eslint/css": "0.14.1",
87
- "@html-eslint/eslint-plugin": "0.51.0",
88
- "@stylistic/eslint-plugin": "5.6.1",
89
- "@vitest/eslint-plugin": "1.5.2",
90
- "defu": "6.1.4",
91
- "eslint": "9.39.2",
92
- "eslint-flat-config-utils": "2.1.4",
93
- "eslint-import-resolver-typescript": "4.4.4",
94
- "eslint-plugin-better-tailwindcss": "3.8.0",
95
- "eslint-plugin-cypress": "5.2.0",
96
- "eslint-plugin-import-x": "4.16.1",
97
- "eslint-plugin-oxlint": "1.33.0",
98
- "eslint-plugin-perfectionist": "5.0.0",
99
- "eslint-plugin-playwright": "2.4.0",
100
- "eslint-plugin-storybook": "10.1.10",
101
- "eslint-plugin-unused-imports": "4.3.0",
102
- "eslint-plugin-vue": "10.6.2",
103
- "eslint-plugin-vuejs-accessibility": "2.4.1",
104
- "globals": "16.5.0",
105
- "local-pkg": "1.1.2",
106
- "oxlint": "1.33.0",
107
- "tailwind-csstree": "0.1.4",
108
- "typescript-eslint": "8.50.0"
109
- },
110
- "devDependencies": {
111
- "@arethetypeswrong/cli": "0.18.2",
112
- "@eslint/config-inspector": "1.4.2",
113
- "@types/node": "25.0.3",
114
- "actions-up": "1.7.0",
115
- "eslint-typegen": "2.3.0",
116
- "nano-staged": "0.9.0",
117
- "prettier": "3.7.4",
118
- "publint": "0.3.16",
119
- "serve": "14.2.5",
120
- "simple-git-hooks": "2.13.1",
121
- "tsdown": "0.18.1",
122
- "typescript": "5.9.3",
123
- "unplugin-unused": "0.5.6"
124
- }
2
+ "name": "@shayanthenerd/eslint-config",
3
+ "version": "0.15.0",
4
+ "license": "MIT",
5
+ "description": "A modern, flexible ESLint configuration for enforcing best practices and maintaining a consistent coding style",
6
+ "keywords": [
7
+ "eslint",
8
+ "eslint-config",
9
+ "eslint-flat-config",
10
+ "eslint-config-vue",
11
+ "eslint-config-typescript",
12
+ "oxlint",
13
+ "oxlint-config"
14
+ ],
15
+ "homepage": "https://eslint-config.shayan-zamani.me",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/ShayanTheNerd/eslint-config.git"
19
+ },
20
+ "bugs": {
21
+ "url": "https://github.com/ShayanTheNerd/eslint-config/issues/new?template=bug_report.md"
22
+ },
23
+ "author": {
24
+ "name": "Shayan Zamani",
25
+ "email": "dev.shayan.zamani@gmail.com",
26
+ "url": "https://github.com/ShayanTheNerd"
27
+ },
28
+ "funding": "https://buymeacoffee.com/shayanthenerd",
29
+ "files": [
30
+ "./dist"
31
+ ],
32
+ "main": "./dist/index.mjs",
33
+ "module": "./dist/index.mjs",
34
+ "types": "./dist/index.d.mts",
35
+ "exports": {
36
+ ".": "./dist/index.mjs",
37
+ "./package.json": "./package.json",
38
+ "./types/*": "./dist/types/*",
39
+ "./oxlint": "./dist/oxlint.config.jsonc",
40
+ "./prettier": "./dist/prettier.config.mjs"
41
+ },
42
+ "publishConfig": {
43
+ "access": "public"
44
+ },
45
+ "imports": {
46
+ "#configs/*": "./src/configs/*",
47
+ "#helpers/*": "./src/helpers/*",
48
+ "#rules/*": "./src/rules/*",
49
+ "#types/*": "./src/types/*",
50
+ "#utils/*": "./src/utils/*"
51
+ },
52
+ "type": "module",
53
+ "engines": {
54
+ "name": "node",
55
+ "version": "^22.18.0",
56
+ "onfail": "download"
57
+ },
58
+ "packageManager": "pnpm@10.27.0",
59
+ "scripts": {
60
+ "prepare": "pnpm git:gitmessage && simple-git-hooks && pnpm generate:types",
61
+ "prepublishOnly": "pnpm build:package",
62
+ "git:gitmessage": "git config --local commit.template \".gitmessage\"",
63
+ "inspect": "eslint-config-inspector",
64
+ "build:package": "tsdown --no-report",
65
+ "build:inspector": "eslint-config-inspector build --config=./scripts/defaultESLintConfigReference.ts",
66
+ "preview:inspector": "serve .eslint-config-inspector",
67
+ "generate:types": "node ./scripts/generateESLintTypes.ts",
68
+ "update:actions": "actions-up --yes",
69
+ "format": "prettier --write '**/*.{json,jsonc,yaml,yml,lock}' --cache",
70
+ "lint:oxlint": "oxlint --fix",
71
+ "lint:eslint": "eslint --fix --cache --cache-location=./node_modules/.cache/.eslintcache",
72
+ "lint": "pnpm lint:oxlint && pnpm lint:eslint",
73
+ "check:types": "tsc",
74
+ "check:exports": "attw --pack --profile=esm-only --exclude-entrypoints=./oxlint",
75
+ "check:spell": "pnpx cspell . --gitignore --exclude='pnpm-lock.yaml' --cache --cache-location='./node_modules/.cache/.cspellcache'",
76
+ "ci:validate": "pnpm generate:types && pnpm format && pnpm lint && pnpm check:types && pnpm build:inspector && pnpm build:package && pnpm check:exports"
77
+ },
78
+ "simple-git-hooks": {
79
+ "pre-commit": "./node_modules/.bin/nano-staged"
80
+ },
81
+ "nano-staged": {
82
+ "eslint.config.ts": "pnpm lint",
83
+ "prettier.config.ts": "pnpm format",
84
+ "**/*.{js,ts}": "pnpm lint",
85
+ "**/*.{json,jsonc,yaml,yml,lock}": "pnpm format"
86
+ },
87
+ "dependencies": {
88
+ "@eslint/compat": "2.0.0",
89
+ "@eslint/css": "0.14.1",
90
+ "@html-eslint/eslint-plugin": "0.52.1",
91
+ "@stylistic/eslint-plugin": "5.6.1",
92
+ "@vitest/eslint-plugin": "1.6.5",
93
+ "defu": "6.1.4",
94
+ "eslint": "9.39.2",
95
+ "eslint-flat-config-utils": "2.1.4",
96
+ "eslint-import-resolver-typescript": "4.4.4",
97
+ "eslint-plugin-better-tailwindcss": "3.8.0",
98
+ "eslint-plugin-cypress": "5.2.1",
99
+ "eslint-plugin-import-x": "4.16.1",
100
+ "eslint-plugin-oxlint": "1.38.0",
101
+ "eslint-plugin-perfectionist": "5.3.0",
102
+ "eslint-plugin-playwright": "2.4.0",
103
+ "eslint-plugin-storybook": "10.1.11",
104
+ "eslint-plugin-unused-imports": "4.3.0",
105
+ "eslint-plugin-vue": "10.6.2",
106
+ "eslint-plugin-vuejs-accessibility": "2.4.1",
107
+ "eslint-plugin-zod-x": "2.0.0",
108
+ "globals": "17.0.0",
109
+ "local-pkg": "1.1.2",
110
+ "oxlint": "1.38.0",
111
+ "tailwind-csstree": "0.1.4",
112
+ "typescript-eslint": "8.52.0"
113
+ },
114
+ "devDependencies": {
115
+ "@arethetypeswrong/cli": "0.18.2",
116
+ "@eslint/config-inspector": "1.4.2",
117
+ "@types/node": "25.0.3",
118
+ "actions-up": "1.8.0",
119
+ "eslint-typegen": "2.3.0",
120
+ "nano-staged": "0.9.0",
121
+ "prettier": "3.7.4",
122
+ "publint": "0.3.16",
123
+ "serve": "14.2.5",
124
+ "simple-git-hooks": "2.13.1",
125
+ "tsdown": "0.18.3",
126
+ "typescript": "5.9.3",
127
+ "unplugin-unused": "0.5.6"
128
+ },
129
+ "peerDependencies": {
130
+ "eslint": "^9.28.0",
131
+ "oxlint": "^1.37.0"
132
+ },
133
+ "peerDependenciesMeta": {
134
+ "eslint": {
135
+ "optional": true
136
+ },
137
+ "oxlint": {
138
+ "optional": true
139
+ }
140
+ }
125
141
  }