@shayanthenerd/eslint-config 0.14.0 → 0.16.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 +209 -190
  3. package/dist/configs/astro.mjs +34 -0
  4. package/dist/configs/base.mjs +19 -10
  5. package/dist/configs/css.mjs +2 -2
  6. package/dist/configs/cypress.mjs +2 -2
  7. package/dist/configs/html.mjs +2 -3
  8. package/dist/configs/importX.mjs +8 -4
  9. package/dist/configs/oxlintOverrides.mjs +20 -14
  10. package/dist/configs/perfectionist.mjs +8 -4
  11. package/dist/configs/playwright.mjs +2 -2
  12. package/dist/configs/restrictedExports.mjs +1 -1
  13. package/dist/configs/storybook.mjs +2 -2
  14. package/dist/configs/stylistic.mjs +8 -4
  15. package/dist/configs/tailwind.mjs +14 -14
  16. package/dist/configs/typescript.mjs +8 -4
  17. package/dist/configs/vitest.mjs +2 -2
  18. package/dist/configs/vue.mjs +2 -2
  19. package/dist/configs/vueComponentNames.mjs +1 -1
  20. package/dist/configs/vueServerComponents.mjs +1 -1
  21. package/dist/configs/zod.mjs +8 -4
  22. package/dist/{utils → helpers}/globs.mjs +2 -1
  23. package/dist/{utils → helpers}/ignores/defaultIgnorePatterns.mjs +3 -1
  24. package/dist/{utils → helpers}/ignores/getIgnorePatterns.mjs +1 -1
  25. package/dist/{utils → helpers}/ignores/resolveGitignorePatterns.mjs +1 -1
  26. package/dist/{utils → helpers}/isPackageDetected.mjs +1 -1
  27. package/dist/{utils → helpers}/options/defaultOptions.mjs +15 -7
  28. package/dist/{utils → helpers}/options/enableDetectedConfigs.mjs +2 -3
  29. package/dist/{utils → helpers}/options/mergeWithDefaults.mjs +4 -5
  30. package/dist/{utils → helpers}/vue/getRestrictedVueElements.mjs +1 -1
  31. package/dist/{utils → helpers}/vue/getRestrictedVueInputs.mjs +1 -1
  32. package/dist/index.mjs +6 -4
  33. package/dist/oxlint.config.jsonc +120 -206
  34. package/dist/prettier.config.mjs +1 -1
  35. package/dist/rules/astro.mjs +61 -0
  36. package/dist/rules/css.mjs +1 -1
  37. package/dist/rules/html.mjs +3 -3
  38. package/dist/rules/importX.mjs +1 -1
  39. package/dist/rules/javascript.mjs +1 -2
  40. package/dist/rules/perfectionist.mjs +2 -2
  41. package/dist/rules/stylistic.mjs +10 -7
  42. package/dist/rules/tailwind.mjs +4 -4
  43. package/dist/rules/typescript.mjs +2 -2
  44. package/dist/rules/vue.mjs +6 -6
  45. package/dist/rules/vueAccessibility.mjs +1 -1
  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 +1031 -237
  52. package/dist/types/index.d.mts +46 -20
  53. package/package.json +142 -124
@@ -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,40 @@ 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
199
+ * astro: false, // `true` if `configs.astro` is enabled
189
200
  * custom: {},
190
201
  * }
191
202
  *
192
- * @see [Language Options: Specifying Globals: Using Configuration Files](https://eslint.org/docs/latest/use/configure/language-options#using-configuration-files)
203
+ * @see [Language Options: Specifying Globals](https://eslint.org/docs/latest/use/configure/language-options#using-configuration-files)
193
204
  */
194
205
  globals?: {
195
- node?: boolean;
206
+ worker?: boolean;
196
207
  commonjs?: boolean;
208
+ bun?: boolean;
209
+ deno?: boolean;
210
+ node?: boolean;
211
+ nodeBuiltin?: boolean;
197
212
  browser?: boolean;
198
- worker?: boolean;
199
213
  serviceworker?: boolean;
214
+ sharedWorker?: boolean;
200
215
  webextension?: boolean;
216
+ audioWorklet?: boolean;
217
+ vitest?: boolean;
218
+ vue?: boolean;
219
+ astro?: boolean;
201
220
  custom?: Linter.LanguageOptions['globals'];
202
221
  };
203
222
 
@@ -262,11 +281,11 @@ interface Options {
262
281
  *
263
282
  * Provide the path to your OXLint configuration file (relative to the current working directory) or set to `false` to disable it.
264
283
  *
265
- * Enabling this improves performance and feedback loops when using OXLint.
284
+ * Enabling OXLint improves performance and feedback loops.
266
285
  *
267
286
  * It will fall back to the default value if set to an empty string (`''`).
268
287
  *
269
- * @default false // `'.oxlintrc.json'` if "oxlint" is detected in the package.json file when `autoDetectDeps` is enabled
288
+ * @default '.oxlintrc.json'
270
289
  */
271
290
  oxlint?: false | string;
272
291
 
@@ -314,7 +333,7 @@ interface Options {
314
333
  * - [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
334
  * - [eslint-plugin-vue](https://eslint.vuejs.org) to enforce TypeScript-specific rules in the `<script setup lang="ts">` of Vue SFCs.
316
335
  *
317
- * @default false // `true` if "typescript" is detected in the package.json file when `autoDetectDeps` is enabled
336
+ * @default false // `true` if "typescript" is detected in the dependencies when `autoDetectDeps` is enabled
318
337
  */
319
338
  typescript?: boolean | TypeScriptOptions;
320
339
 
@@ -335,14 +354,14 @@ interface Options {
335
354
  /**
336
355
  * Use [eslint-plugin-zod-x](https://github.com/marcalexiei/eslint-plugin-zod-x) to enforce Zod best practices.
337
356
  *
338
- * @default false // `true` if "zod" is detected in the package.json file when `autoDetectDeps` is enabled
357
+ * @default false // `true` if "zod" is detected in the dependencies when `autoDetectDeps` is enabled
339
358
  */
340
359
  zod?: boolean | ConfigWithOverrides;
341
360
 
342
361
  /**
343
362
  * Use [eslint-plugin-vue](https://eslint.vuejs.org) to enforce Vue best practices, accessibility guidelines, stylistic rules, and identify mistakes.
344
363
  *
345
- * @default false // `true` if "vue" is detected in the package.json file when `autoDetectDeps` is enabled
364
+ * @default false // `true` if "vue" is detected in the dependencies when `autoDetectDeps` is enabled
346
365
  */
347
366
  vue?: boolean | VueOptions;
348
367
 
@@ -353,10 +372,17 @@ interface Options {
353
372
  *
354
373
  * **This configuration requires `configs.vue` to be enabled.**
355
374
  *
356
- * @default false // `true` if "nuxt" is detected in the package.json file when `autoDetectDeps` is enabled
375
+ * @default false // `true` if "nuxt" is detected in the dependencies when `autoDetectDeps` is enabled
357
376
  */
358
377
  nuxt?: boolean | NuxtOptions;
359
378
 
379
+ /**
380
+ * Use [eslint-plugin-astro](https://ota-meshi.github.io/eslint-plugin-astro) to enforce Astro best practices and accessibility guidelines.
381
+ *
382
+ * @default false // `true` if "astro" is detected in the dependencies when `autoDetectDeps` is enabled
383
+ */
384
+ astro?: boolean | ConfigWithOverrides;
385
+
360
386
  /**
361
387
  * Configuration options for the testing tools.
362
388
  */
package/package.json CHANGED
@@ -1,126 +1,144 @@
1
1
  {
2
- "name": "@shayanthenerd/eslint-config",
3
- "version": "0.14.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
- "#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.26.2",
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.52.0",
88
- "@stylistic/eslint-plugin": "5.6.1",
89
- "@vitest/eslint-plugin": "1.6.4",
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.36.0",
98
- "eslint-plugin-perfectionist": "5.1.0",
99
- "eslint-plugin-playwright": "2.4.0",
100
- "eslint-plugin-storybook": "10.1.11",
101
- "eslint-plugin-unused-imports": "4.3.0",
102
- "eslint-plugin-vue": "10.6.2",
103
- "eslint-plugin-vuejs-accessibility": "2.4.1",
104
- "eslint-plugin-zod-x": "2.0.0",
105
- "globals": "16.5.0",
106
- "local-pkg": "1.1.2",
107
- "oxlint": "1.36.0",
108
- "tailwind-csstree": "0.1.4",
109
- "typescript-eslint": "8.51.0"
110
- },
111
- "devDependencies": {
112
- "@arethetypeswrong/cli": "0.18.2",
113
- "@eslint/config-inspector": "1.4.2",
114
- "@types/node": "25.0.3",
115
- "actions-up": "1.8.0",
116
- "eslint-typegen": "2.3.0",
117
- "nano-staged": "0.9.0",
118
- "prettier": "3.7.4",
119
- "publint": "0.3.16",
120
- "serve": "14.2.5",
121
- "simple-git-hooks": "2.13.1",
122
- "tsdown": "0.18.3",
123
- "typescript": "5.9.3",
124
- "unplugin-unused": "0.5.6"
125
- }
2
+ "name": "@shayanthenerd/eslint-config",
3
+ "version": "0.16.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
+ "astro-eslint-parser": "1.2.2",
94
+ "defu": "6.1.4",
95
+ "eslint": "9.39.2",
96
+ "eslint-flat-config-utils": "2.1.4",
97
+ "eslint-import-resolver-typescript": "4.4.4",
98
+ "eslint-plugin-astro": "1.5.0",
99
+ "eslint-plugin-better-tailwindcss": "3.8.0",
100
+ "eslint-plugin-cypress": "5.2.1",
101
+ "eslint-plugin-import-x": "4.16.1",
102
+ "eslint-plugin-jsx-a11y": "6.10.2",
103
+ "eslint-plugin-oxlint": "1.38.0",
104
+ "eslint-plugin-perfectionist": "5.3.0",
105
+ "eslint-plugin-playwright": "2.4.0",
106
+ "eslint-plugin-storybook": "10.1.11",
107
+ "eslint-plugin-unused-imports": "4.3.0",
108
+ "eslint-plugin-vue": "10.6.2",
109
+ "eslint-plugin-vuejs-accessibility": "2.4.1",
110
+ "eslint-plugin-zod-x": "2.0.0",
111
+ "globals": "17.0.0",
112
+ "local-pkg": "1.1.2",
113
+ "oxlint": "1.38.0",
114
+ "tailwind-csstree": "0.1.4",
115
+ "typescript-eslint": "8.52.0"
116
+ },
117
+ "devDependencies": {
118
+ "@arethetypeswrong/cli": "0.18.2",
119
+ "@eslint/config-inspector": "1.4.2",
120
+ "@types/node": "25.0.3",
121
+ "actions-up": "1.8.0",
122
+ "eslint-typegen": "2.3.0",
123
+ "nano-staged": "0.9.0",
124
+ "prettier": "3.7.4",
125
+ "publint": "0.3.16",
126
+ "serve": "14.2.5",
127
+ "simple-git-hooks": "2.13.1",
128
+ "tsdown": "0.18.3",
129
+ "typescript": "5.9.3",
130
+ "unplugin-unused": "0.5.6"
131
+ },
132
+ "peerDependencies": {
133
+ "eslint": "^9.28.0",
134
+ "oxlint": "^1.37.0"
135
+ },
136
+ "peerDependenciesMeta": {
137
+ "eslint": {
138
+ "optional": true
139
+ },
140
+ "oxlint": {
141
+ "optional": true
142
+ }
143
+ }
126
144
  }