@shayanthenerd/eslint-config 0.11.1 → 0.12.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 (75) hide show
  1. package/dist/configs/base.mjs +43 -0
  2. package/dist/configs/{css.js → css.mjs} +6 -6
  3. package/dist/configs/{cypress.js → cypress.mjs} +6 -5
  4. package/dist/configs/{html.js → html.mjs} +7 -5
  5. package/dist/configs/importX.mjs +26 -0
  6. package/dist/configs/{oxlintOverrides.js → oxlintOverrides.mjs} +14 -14
  7. package/dist/configs/{perfectionist.js → perfectionist.mjs} +5 -5
  8. package/dist/configs/{playwright.js → playwright.mjs} +6 -5
  9. package/dist/configs/{restrictedExports.js → restrictedExports.mjs} +1 -1
  10. package/dist/configs/{storybook.js → storybook.mjs} +5 -6
  11. package/dist/configs/{stylistic.js → stylistic.mjs} +7 -7
  12. package/dist/configs/{tailwind.js → tailwind.mjs} +19 -16
  13. package/dist/configs/typescript.mjs +34 -0
  14. package/dist/configs/{vitest.js → vitest.mjs} +5 -5
  15. package/dist/configs/vue.mjs +45 -0
  16. package/dist/configs/{vueComponentNames.js → vueComponentNames.mjs} +1 -1
  17. package/dist/configs/{vueServerComponents.js → vueServerComponents.mjs} +1 -1
  18. package/dist/{index.d.ts → index.d.mts} +3 -3
  19. package/dist/index.mjs +75 -0
  20. package/dist/oxlint.config.jsonc +1 -0
  21. package/dist/rules/{css.js → css.mjs} +14 -5
  22. package/dist/rules/cypress.mjs +18 -0
  23. package/dist/rules/{html.js → html.mjs} +47 -25
  24. package/dist/rules/{importX.js → importX.mjs} +25 -23
  25. package/dist/rules/{javascript.js → javascript.mjs} +167 -115
  26. package/dist/rules/{perfectionist.js → perfectionist.mjs} +2 -2
  27. package/dist/rules/playwright.mjs +54 -0
  28. package/dist/rules/storybook.mjs +25 -0
  29. package/dist/rules/{stylistic.js → stylistic.mjs} +106 -57
  30. package/dist/rules/{tailwind.js → tailwind.mjs} +15 -14
  31. package/dist/rules/typescript.mjs +173 -0
  32. package/dist/rules/{vitest.js → vitest.mjs} +57 -28
  33. package/dist/rules/vue.mjs +361 -0
  34. package/dist/rules/{vueAccessibility.js → vueAccessibility.mjs} +23 -9
  35. package/dist/types/configOptions/{base.d.ts → base.d.mts} +2 -2
  36. package/dist/types/configOptions/{css.d.ts → css.d.mts} +2 -2
  37. package/dist/types/configOptions/{html.d.ts → html.d.mts} +2 -2
  38. package/dist/types/configOptions/{importX.d.ts → importX.d.mts} +1 -1
  39. package/dist/types/configOptions/{perfectionist.d.ts → perfectionist.d.mts} +2 -2
  40. package/dist/types/configOptions/{stylistic.d.ts → stylistic.d.mts} +2 -2
  41. package/dist/types/configOptions/{tailwind.d.ts → tailwind.d.mts} +2 -2
  42. package/dist/types/configOptions/{test.d.ts → test.d.mts} +2 -2
  43. package/dist/types/configOptions/{typescript.d.ts → typescript.d.mts} +2 -2
  44. package/dist/types/configOptions/{vue.d.ts → vue.d.mts} +3 -3
  45. package/dist/types/configOptions/{vueAccessibility.d.ts → vueAccessibility.d.mts} +1 -1
  46. package/dist/types/{eslint-schema.d.ts → eslint-schema.d.mts} +24 -33
  47. package/dist/types/{eslintRules.d.ts → eslintRules.d.mts} +2 -2
  48. package/dist/types/{index.d.ts → index.d.mts} +12 -12
  49. package/dist/utils/ignores/{getIgnorePatterns.js → getIgnorePatterns.mjs} +2 -2
  50. package/dist/utils/{isPackageDetected.js → isPackageDetected.mjs} +1 -1
  51. package/dist/utils/options/{enableDetectedConfigs.js → enableDetectedConfigs.mjs} +2 -2
  52. package/dist/utils/options/{mergeWithDefaults.js → mergeWithDefaults.mjs} +3 -3
  53. package/package.json +30 -31
  54. package/dist/configs/base.js +0 -44
  55. package/dist/configs/importX.js +0 -23
  56. package/dist/configs/typescript.js +0 -31
  57. package/dist/configs/vue.js +0 -33
  58. package/dist/index.js +0 -74
  59. package/dist/rules/cypress.js +0 -14
  60. package/dist/rules/playwright.js +0 -26
  61. package/dist/rules/storybook.js +0 -14
  62. package/dist/rules/typescript.js +0 -63
  63. package/dist/rules/vue.js +0 -186
  64. /package/dist/{prettier.config.d.ts → prettier.config.d.mts} +0 -0
  65. /package/dist/{prettier.config.js → prettier.config.mjs} +0 -0
  66. /package/dist/types/configOptions/{nuxt.d.ts → nuxt.d.mts} +0 -0
  67. /package/dist/types/{helpers.d.ts → helpers.d.mts} +0 -0
  68. /package/dist/utils/{globs.js → globs.mjs} +0 -0
  69. /package/dist/utils/ignores/{defaultIgnorePatterns.js → defaultIgnorePatterns.mjs} +0 -0
  70. /package/dist/utils/ignores/{resolveGitignorePatterns.js → resolveGitignorePatterns.mjs} +0 -0
  71. /package/dist/utils/{isEmptyString.js → isEmptyString.mjs} +0 -0
  72. /package/dist/utils/{isEnabled.js → isEnabled.mjs} +0 -0
  73. /package/dist/utils/options/{defaultOptions.js → defaultOptions.mjs} +0 -0
  74. /package/dist/utils/vue/{getRestrictedVueElements.js → getRestrictedVueElements.mjs} +0 -0
  75. /package/dist/utils/vue/{getRestrictedVueInputs.js → getRestrictedVueInputs.mjs} +0 -0
@@ -1,15 +1,15 @@
1
- import { DeepNonNullable } from "./helpers.js";
2
- import { CSSOptions } from "./configOptions/css.js";
3
- import { VueOptions } from "./configOptions/vue.js";
4
- import { BaseOptions } from "./configOptions/base.js";
5
- import { HTMLOptions } from "./configOptions/html.js";
6
- import { NuxtOptions } from "./configOptions/nuxt.js";
7
- import { TestOptions } from "./configOptions/test.js";
8
- import { ImportXOptions } from "./configOptions/importX.js";
9
- import { TailwindOptions } from "./configOptions/tailwind.js";
10
- import { StylisticOptions } from "./configOptions/stylistic.js";
11
- import { TypeScriptOptions } from "./configOptions/typescript.js";
12
- import { PerfectionistOptions } from "./configOptions/perfectionist.js";
1
+ import { DeepNonNullable } from "./helpers.mjs";
2
+ import { CSSOptions } from "./configOptions/css.mjs";
3
+ import { VueOptions } from "./configOptions/vue.mjs";
4
+ import { BaseOptions } from "./configOptions/base.mjs";
5
+ import { HTMLOptions } from "./configOptions/html.mjs";
6
+ import { NuxtOptions } from "./configOptions/nuxt.mjs";
7
+ import { TestOptions } from "./configOptions/test.mjs";
8
+ import { ImportXOptions } from "./configOptions/importX.mjs";
9
+ import { TailwindOptions } from "./configOptions/tailwind.mjs";
10
+ import { StylisticOptions } from "./configOptions/stylistic.mjs";
11
+ import { TypeScriptOptions } from "./configOptions/typescript.mjs";
12
+ import { PerfectionistOptions } from "./configOptions/perfectionist.mjs";
13
13
  import { ConfigWithExtends } from "typescript-eslint";
14
14
  import { Linter } from "eslint";
15
15
 
@@ -1,5 +1,5 @@
1
- import { defaultIgnorePatterns } from "./defaultIgnorePatterns.js";
2
- import { resolveGitignorePatterns } from "./resolveGitignorePatterns.js";
1
+ import { defaultIgnorePatterns } from "./defaultIgnorePatterns.mjs";
2
+ import { resolveGitignorePatterns } from "./resolveGitignorePatterns.mjs";
3
3
 
4
4
  //#region src/utils/ignores/getIgnorePatterns.ts
5
5
  function getIgnorePatterns({ patterns, gitignore }) {
@@ -1,4 +1,4 @@
1
- import { defaultOptions } from "./options/defaultOptions.js";
1
+ import { defaultOptions } from "./options/defaultOptions.mjs";
2
2
  import path from "node:path";
3
3
  import { styleText } from "node:util";
4
4
  import { isPackageExists } from "local-pkg";
@@ -1,5 +1,5 @@
1
- import { defaultOptions } from "./defaultOptions.js";
2
- import { isPackageDetected, logDetectedPackages } from "../isPackageDetected.js";
1
+ import { defaultOptions } from "./defaultOptions.mjs";
2
+ import { isPackageDetected, logDetectedPackages } from "../isPackageDetected.mjs";
3
3
 
4
4
  //#region src/utils/options/enableDetectedConfigs.ts
5
5
  function enableDetectedConfigs(options) {
@@ -1,6 +1,6 @@
1
- import { defaultOptions } from "./defaultOptions.js";
2
- import { isEmptyString } from "../isEmptyString.js";
3
- import { enableDetectedConfigs } from "./enableDetectedConfigs.js";
1
+ import { defaultOptions } from "./defaultOptions.mjs";
2
+ import { isEmptyString } from "../isEmptyString.mjs";
3
+ import { enableDetectedConfigs } from "./enableDetectedConfigs.mjs";
4
4
  import { createDefu } from "defu";
5
5
 
6
6
  //#region src/utils/options/mergeWithDefaults.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shayanthenerd/eslint-config",
3
- "version": "0.11.1",
3
+ "version": "0.12.0",
4
4
  "license": "MIT",
5
5
  "description": "A modern, flexible ESLint configuration for enforcing best practices and maintaining a consistent coding style",
6
6
  "keywords": [
@@ -29,15 +29,15 @@
29
29
  "files": [
30
30
  "./dist"
31
31
  ],
32
- "main": "./dist/index.js",
33
- "module": "./dist/index.js",
34
- "types": "./dist/index.d.ts",
32
+ "main": "./dist/index.mjs",
33
+ "module": "./dist/index.mjs",
34
+ "types": "./dist/index.d.mts",
35
35
  "exports": {
36
- ".": "./dist/index.js",
36
+ ".": "./dist/index.mjs",
37
37
  "./package.json": "./package.json",
38
38
  "./types/*": "./dist/types/*",
39
39
  "./oxlint": "./dist/oxlint.config.jsonc",
40
- "./prettier": "./dist/prettier.config.js"
40
+ "./prettier": "./dist/prettier.config.mjs"
41
41
  },
42
42
  "publishConfig": {
43
43
  "access": "public"
@@ -52,24 +52,24 @@
52
52
  "engines": {
53
53
  "node": ">=20.12.0"
54
54
  },
55
- "packageManager": "pnpm@10.20.0",
55
+ "packageManager": "pnpm@10.23.0",
56
56
  "scripts": {
57
- "prepare": "pnpm git:gitmessage && pnpm simple-git-hooks && pnpm generate:types",
57
+ "prepare": "pnpm git:gitmessage && simple-git-hooks && pnpm generate:types",
58
58
  "prepublishOnly": "pnpm build:package",
59
59
  "git:gitmessage": "git config --local commit.template \".gitmessage\"",
60
- "inspect": "pnpm eslint-config-inspector",
60
+ "inspect": "eslint-config-inspector",
61
61
  "build:package": "tsdown --no-report",
62
- "build:inspector": "pnpm eslint-config-inspector build --config=./scripts/defaultESLintConfigReference.ts",
63
- "preview:inspector": "pnpm serve .eslint-config-inspector",
62
+ "build:inspector": "eslint-config-inspector build --config=./scripts/defaultESLintConfigReference.ts",
63
+ "preview:inspector": "serve .eslint-config-inspector",
64
64
  "generate:types": "node ./scripts/generateESLintTypes.ts",
65
- "update:actions": "pnpm actions-up --yes",
65
+ "update:actions": "actions-up --yes",
66
66
  "format": "prettier --write '**/*.{json,jsonc,yaml,yml,lock}' --cache",
67
67
  "lint:oxlint": "oxlint --fix",
68
68
  "lint:eslint": "eslint --fix --cache --cache-location=./node_modules/.cache/.eslintcache",
69
69
  "lint": "pnpm lint:oxlint && pnpm lint:eslint",
70
70
  "check:types": "tsc",
71
- "check:exports": "pnpm attw --pack --profile=esm-only --exclude-entrypoints=./oxlint",
72
- "check:spell": "pnpm dlx cspell . --gitignore --exclude='pnpm-lock.yaml' --cache --cache-location='./node_modules/.cache/.cspellcache'",
71
+ "check:exports": "attw --pack --profile=esm-only --exclude-entrypoints=./oxlint",
72
+ "check:spell": "pnpx cspell . --gitignore --exclude='pnpm-lock.yaml' --cache --cache-location='./node_modules/.cache/.cspellcache'",
73
73
  "ci:validate": "pnpm generate:types && pnpm format && pnpm lint && pnpm check:types && pnpm build:inspector && pnpm build:package && pnpm check:exports"
74
74
  },
75
75
  "simple-git-hooks": {
@@ -80,45 +80,44 @@
80
80
  "**/*.{json,jsonc,yaml,yml,lock}": "pnpm format"
81
81
  },
82
82
  "dependencies": {
83
- "@eslint/compat": "1.4.1",
84
- "@eslint/css": "0.14.0",
85
- "@eslint/js": "9.39.0",
86
- "@html-eslint/eslint-plugin": "0.47.0",
87
- "@stylistic/eslint-plugin": "5.5.0",
88
- "@vitest/eslint-plugin": "1.4.0",
83
+ "@eslint/compat": "2.0.0",
84
+ "@eslint/css": "0.14.1",
85
+ "@html-eslint/eslint-plugin": "0.49.0",
86
+ "@stylistic/eslint-plugin": "5.6.1",
87
+ "@vitest/eslint-plugin": "1.4.3",
89
88
  "defu": "6.1.4",
90
- "eslint": "9.38.0",
89
+ "eslint": "9.39.1",
91
90
  "eslint-flat-config-utils": "2.1.4",
92
91
  "eslint-import-resolver-typescript": "4.4.4",
93
- "eslint-plugin-better-tailwindcss": "3.7.10",
92
+ "eslint-plugin-better-tailwindcss": "3.7.11",
94
93
  "eslint-plugin-cypress": "5.2.0",
95
94
  "eslint-plugin-import-x": "4.16.1",
96
- "eslint-plugin-oxlint": "1.25.0",
95
+ "eslint-plugin-oxlint": "1.29.0",
97
96
  "eslint-plugin-perfectionist": "4.15.1",
98
97
  "eslint-plugin-playwright": "2.3.0",
99
- "eslint-plugin-storybook": "10.0.3",
98
+ "eslint-plugin-storybook": "10.0.8",
100
99
  "eslint-plugin-unused-imports": "4.3.0",
101
- "eslint-plugin-vue": "10.5.1",
100
+ "eslint-plugin-vue": "10.6.0",
102
101
  "eslint-plugin-vuejs-accessibility": "2.4.1",
103
102
  "globals": "16.5.0",
104
103
  "local-pkg": "1.1.2",
105
- "oxlint": "1.25.0",
104
+ "oxlint": "1.29.0",
106
105
  "tailwind-csstree": "0.1.4",
107
- "typescript-eslint": "8.46.3"
106
+ "typescript-eslint": "8.47.0"
108
107
  },
109
108
  "devDependencies": {
110
109
  "@arethetypeswrong/cli": "0.18.2",
111
110
  "@eslint/config-inspector": "1.3.0",
112
- "@types/node": "24.10.0",
111
+ "@types/node": "24.10.1",
113
112
  "actions-up": "1.5.0",
114
113
  "eslint-typegen": "2.3.0",
115
- "nano-staged": "0.8.0",
114
+ "nano-staged": "0.9.0",
116
115
  "prettier": "3.6.2",
117
116
  "publint": "0.3.15",
118
117
  "serve": "14.2.5",
119
118
  "simple-git-hooks": "2.13.1",
120
- "tsdown": "0.15.12",
119
+ "tsdown": "0.16.6",
121
120
  "typescript": "5.9.3",
122
- "unplugin-unused": "0.5.5"
121
+ "unplugin-unused": "0.5.6"
123
122
  }
124
123
  }
@@ -1,44 +0,0 @@
1
- import { globs } from "../utils/globs.js";
2
- import { getJavaScriptRules } from "../rules/javascript.js";
3
- import { mergeConfigs } from "eslint-flat-config-utils";
4
- import typescriptESLint from "typescript-eslint";
5
- import globals from "globals";
6
- import javascriptESLint from "@eslint/js";
7
-
8
- //#region src/configs/base.ts
9
- function getBaseConfig(options) {
10
- const { configs: { vue, test: { vitest }, base: { overrides } }, global: { globals: { node, worker, browser, commonjs, webextension, serviceworker, custom: userGlobals } } } = options;
11
- return mergeConfigs({
12
- name: "shayanthenerd/base",
13
- files: [globs.src, vue ? globs.vue : ""],
14
- extends: [javascriptESLint.configs.recommended],
15
- languageOptions: {
16
- parser: typescriptESLint.parser,
17
- parserOptions: {
18
- ecmaVersion: "latest",
19
- ecmaFeatures: {
20
- jsx: true,
21
- impliedStrict: true
22
- }
23
- },
24
- globals: {
25
- ...globals.builtin,
26
- ...globals.es2026,
27
- ...commonjs ? globals.commonjs : {},
28
- ...node ? globals.node : {},
29
- ...node ? globals.nodeBuiltin : {},
30
- ...browser ? globals.browser : {},
31
- ...worker ? globals.worker : {},
32
- ...serviceworker ? globals.serviceworker : {},
33
- ...webextension ? globals.webextensions : {},
34
- ...vue ? globals.vue : {},
35
- ...vitest ? globals.vitest : {},
36
- ...userGlobals
37
- }
38
- },
39
- rules: getJavaScriptRules(options)
40
- }, overrides);
41
- }
42
-
43
- //#endregion
44
- export { getBaseConfig };
@@ -1,23 +0,0 @@
1
- import { globs } from "../utils/globs.js";
2
- import { isEnabled } from "../utils/isEnabled.js";
3
- import { defaultOptions } from "../utils/options/defaultOptions.js";
4
- import { getImportXRules } from "../rules/importX.js";
5
- import { mergeConfigs } from "eslint-flat-config-utils";
6
- import eslintPluginImportX from "eslint-plugin-import-x";
7
- import eslintPluginUnusedImports from "eslint-plugin-unused-imports";
8
-
9
- //#region src/configs/importX.ts
10
- function getImportXConfig(options) {
11
- const { vue, importX, typescript } = options.configs;
12
- const { overrides } = isEnabled(importX) ? importX : defaultOptions.configs.importX;
13
- return mergeConfigs({
14
- name: "shayanthenerd/import-x",
15
- files: [globs.src, vue ? globs.vue : ""],
16
- extends: [eslintPluginImportX.flatConfigs.recommended, typescript ? eslintPluginImportX.flatConfigs.typescript : {}],
17
- plugins: { "unused-imports": eslintPluginUnusedImports },
18
- rules: getImportXRules(options)
19
- }, overrides);
20
- }
21
-
22
- //#endregion
23
- export { getImportXConfig };
@@ -1,31 +0,0 @@
1
- import { globs } from "../utils/globs.js";
2
- import { isEnabled } from "../utils/isEnabled.js";
3
- import { defaultOptions } from "../utils/options/defaultOptions.js";
4
- import { getTypeScriptRules } from "../rules/typescript.js";
5
- import path from "node:path";
6
- import { mergeConfigs } from "eslint-flat-config-utils";
7
- import typescriptESLint from "typescript-eslint";
8
-
9
- //#region src/configs/typescript.ts
10
- function getTypeScriptConfig(options) {
11
- const { tsConfig, configs: { vue, typescript } } = options;
12
- const { allowedDefaultProjects } = isEnabled(typescript) ? typescript : defaultOptions.configs.typescript;
13
- const { overrides } = isEnabled(typescript) ? typescript : defaultOptions.configs.typescript;
14
- return mergeConfigs({
15
- name: "shayanthenerd/typescript",
16
- files: [globs.ts, vue ? globs.vue : ""],
17
- extends: [typescriptESLint.configs.strictTypeChecked, typescriptESLint.configs.stylisticTypeChecked],
18
- languageOptions: { parserOptions: {
19
- warnOnUnsupportedTypeScriptVersion: false,
20
- tsconfigRootDir: tsConfig ? path.resolve(tsConfig.rootDir) : void 0,
21
- projectService: {
22
- defaultProject: tsConfig ? tsConfig.filename : void 0,
23
- allowDefaultProject: ["{prettier,eslint}.config.?([mc])ts", ...allowedDefaultProjects]
24
- }
25
- } },
26
- rules: getTypeScriptRules(options)
27
- }, overrides);
28
- }
29
-
30
- //#endregion
31
- export { getTypeScriptConfig };
@@ -1,33 +0,0 @@
1
- import { globs } from "../utils/globs.js";
2
- import { isEnabled } from "../utils/isEnabled.js";
3
- import { defaultOptions } from "../utils/options/defaultOptions.js";
4
- import { getVueRules } from "../rules/vue.js";
5
- import { getVueAccessibilityRules } from "../rules/vueAccessibility.js";
6
- import { mergeConfigs } from "eslint-flat-config-utils";
7
- import eslintPluginVue from "eslint-plugin-vue";
8
- import typescriptESLint from "typescript-eslint";
9
- import eslintPluginVueAccessibility from "eslint-plugin-vuejs-accessibility";
10
-
11
- //#region src/configs/vue.ts
12
- function getVueConfig(options) {
13
- const { vue } = options.configs;
14
- const accessibility = isEnabled(vue) && isEnabled(vue.accessibility);
15
- const { overrides } = isEnabled(vue) ? vue : defaultOptions.configs.vue;
16
- return mergeConfigs({
17
- name: "shayanthenerd/vue",
18
- files: [globs.vue],
19
- extends: [eslintPluginVue.configs["flat/recommended"], accessibility ? eslintPluginVueAccessibility.configs["flat/recommended"] : {}],
20
- languageOptions: { parserOptions: {
21
- parser: typescriptESLint.parser,
22
- extraFileExtensions: [".vue"],
23
- vueFeatures: { filter: false }
24
- } },
25
- rules: {
26
- ...getVueRules(options),
27
- ...accessibility ? getVueAccessibilityRules(options) : {}
28
- }
29
- }, overrides);
30
- }
31
-
32
- //#endregion
33
- export { getVueConfig };
package/dist/index.js DELETED
@@ -1,74 +0,0 @@
1
- import { isEnabled } from "./utils/isEnabled.js";
2
- import { defaultOptions } from "./utils/options/defaultOptions.js";
3
- import { getCSSConfig } from "./configs/css.js";
4
- import { getVueConfig } from "./configs/vue.js";
5
- import { getBaseConfig } from "./configs/base.js";
6
- import { getHTMLConfig } from "./configs/html.js";
7
- import { getVitestConfig } from "./configs/vitest.js";
8
- import { getCypressConfig } from "./configs/cypress.js";
9
- import { getImportXConfig } from "./configs/importX.js";
10
- import { getTailwindConfig } from "./configs/tailwind.js";
11
- import { getStorybookConfig } from "./configs/storybook.js";
12
- import { getStylisticConfig } from "./configs/stylistic.js";
13
- import { getPlaywrightConfig } from "./configs/playwright.js";
14
- import { getTypeScriptConfig } from "./configs/typescript.js";
15
- import { getPerfectionistConfig } from "./configs/perfectionist.js";
16
- import { getRestrictedExports } from "./configs/restrictedExports.js";
17
- import { getOXLintOverridesConfig } from "./configs/oxlintOverrides.js";
18
- import { getIgnorePatterns } from "./utils/ignores/getIgnorePatterns.js";
19
- import { mergeWithDefaults } from "./utils/options/mergeWithDefaults.js";
20
- import { getVueComponentNamesConfig } from "./configs/vueComponentNames.js";
21
- import { getVueServerComponentsConfig } from "./configs/vueServerComponents.js";
22
- import eslintPluginOXLint from "eslint-plugin-oxlint";
23
- import { defineConfig as defineConfig$1, globalIgnores } from "eslint/config";
24
- import path from "node:path";
25
-
26
- //#region src/index.ts
27
- /**
28
- * Define the ESLint configuration based on the provided options and any number of Flat Config objects.
29
- *
30
- * @param {Options} options - Options to configure and customize the config
31
- * @param {...ConfigObject} configs - Additional Flat Config objects to extend the config
32
- *
33
- * @returns {Linter.Config[]} The merged ESLint configuration array
34
- */
35
- function defineConfig(options = {}, ...configs) {
36
- const mergedOptions = mergeWithDefaults(options);
37
- const { gitignore, global: { rules, ignores, settings, linterOptions }, configs: { vue, css, nuxt, html, oxlint, importX, tailwind, stylistic, typescript, perfectionist, base: { preferNamedExports }, test: { vitest, cypress, storybook, playwright } } } = mergedOptions;
38
- const ignorePatterns = getIgnorePatterns({
39
- gitignore,
40
- patterns: ignores
41
- });
42
- const oxlintConfigPath = path.resolve(oxlint || defaultOptions.configs.oxlint);
43
- return defineConfig$1(...[
44
- {
45
- name: "shayanthenerd/global",
46
- linterOptions,
47
- settings,
48
- rules
49
- },
50
- globalIgnores(ignorePatterns, "shayanthenerd/ignores"),
51
- getBaseConfig(mergedOptions),
52
- preferNamedExports ? getRestrictedExports() : void 0,
53
- isEnabled(importX) ? getImportXConfig(mergedOptions) : void 0,
54
- isEnabled(stylistic) ? getStylisticConfig(mergedOptions) : void 0,
55
- isEnabled(perfectionist) ? getPerfectionistConfig(mergedOptions) : void 0,
56
- isEnabled(typescript) ? getTypeScriptConfig(mergedOptions) : void 0,
57
- isEnabled(html) ? getHTMLConfig(mergedOptions) : void 0,
58
- isEnabled(css) ? getCSSConfig(mergedOptions) : void 0,
59
- isEnabled(tailwind) ? getTailwindConfig(mergedOptions) : void 0,
60
- isEnabled(vue) ? getVueConfig(mergedOptions) : void 0,
61
- isEnabled(vue) ? getVueComponentNamesConfig() : void 0,
62
- isEnabled(vue) && isEnabled(nuxt) ? getVueServerComponentsConfig() : void 0,
63
- isEnabled(storybook) ? getStorybookConfig(mergedOptions) : void 0,
64
- isEnabled(vitest) ? getVitestConfig(mergedOptions) : void 0,
65
- isEnabled(playwright) ? getPlaywrightConfig(mergedOptions) : void 0,
66
- isEnabled(cypress) ? getCypressConfig(mergedOptions) : void 0,
67
- ...oxlint ? eslintPluginOXLint.buildFromOxlintConfigFile(oxlintConfigPath) : [],
68
- oxlint ? getOXLintOverridesConfig(mergedOptions) : void 0,
69
- ...configs
70
- ].filter(Boolean));
71
- }
72
-
73
- //#endregion
74
- export { defineConfig };
@@ -1,14 +0,0 @@
1
- //#region src/rules/cypress.ts
2
- function getCypressRules() {
3
- return {
4
- "cypress/no-force": "error",
5
- "cypress/no-pause": "error",
6
- "cypress/no-xpath": "error",
7
- "cypress/no-async-tests": "off",
8
- "cypress/no-chained-get": "error",
9
- "cypress/assertion-before-screenshot": "error"
10
- };
11
- }
12
-
13
- //#endregion
14
- export { getCypressRules };
@@ -1,26 +0,0 @@
1
- //#region src/rules/playwright.ts
2
- function getPlaywrightRules(options) {
3
- const { maxNestedDescribe } = options.configs.test;
4
- return {
5
- "playwright/max-expects": "off",
6
- "playwright/prefer-to-be": "warn",
7
- "playwright/no-get-by-title": "error",
8
- "playwright/prefer-to-contain": "warn",
9
- "playwright/no-wait-for-timeout": "off",
10
- "playwright/no-duplicate-hooks": "error",
11
- "playwright/prefer-strict-equal": "warn",
12
- "playwright/prefer-hooks-on-top": "warn",
13
- "playwright/prefer-to-have-count": "warn",
14
- "playwright/prefer-hooks-in-order": "warn",
15
- "playwright/prefer-to-have-length": "warn",
16
- "playwright/no-commented-out-tests": "error",
17
- "playwright/prefer-equality-matcher": "warn",
18
- "playwright/require-to-throw-message": "error",
19
- "playwright/prefer-comparison-matcher": "warn",
20
- "playwright/max-nested-describe": ["warn", { max: maxNestedDescribe }],
21
- "playwright/prefer-lowercase-title": ["warn", { ignoreTopLevelDescribe: true }]
22
- };
23
- }
24
-
25
- //#endregion
26
- export { getPlaywrightRules };
@@ -1,14 +0,0 @@
1
- import path from "node:path";
2
-
3
- //#region src/rules/storybook.ts
4
- function getStorybookRules(options) {
5
- return {
6
- "storybook/csf-component": "error",
7
- "storybook/no-stories-of": "error",
8
- "storybook/meta-satisfies-type": "warn",
9
- "storybook/no-uninstalled-addons": ["error", { packageJsonLocation: path.resolve(options.packageDir, "package.json") }]
10
- };
11
- }
12
-
13
- //#endregion
14
- export { getStorybookRules };
@@ -1,63 +0,0 @@
1
- import { isEnabled } from "../utils/isEnabled.js";
2
- import { defaultOptions } from "../utils/options/defaultOptions.js";
3
-
4
- //#region src/rules/typescript.ts
5
- function getTypeScriptRules(options) {
6
- const { typescript } = options.configs;
7
- const { typeDefinitionStyle, methodSignatureStyle } = isEnabled(typescript) ? typescript : defaultOptions.configs.typescript;
8
- return {
9
- "no-loop-func": "off",
10
- "no-unused-vars": "off",
11
- "default-param-last": "off",
12
- "prefer-destructuring": "off",
13
- "@typescript-eslint/no-loop-func": "error",
14
- "@typescript-eslint/unbound-method": "off",
15
- "@typescript-eslint/default-param-last": "warn",
16
- "@typescript-eslint/no-unsafe-assignment": "warn",
17
- "@typescript-eslint/prefer-destructuring": "warn",
18
- "@typescript-eslint/promise-function-async": "error",
19
- "@typescript-eslint/no-unsafe-member-access": "warn",
20
- "@typescript-eslint/consistent-type-imports": "warn",
21
- "@typescript-eslint/no-useless-empty-export": "error",
22
- "@typescript-eslint/no-unsafe-type-assertion": "warn",
23
- "@typescript-eslint/prefer-enum-initializers": "error",
24
- "@typescript-eslint/no-unnecessary-qualifier": "error",
25
- "@typescript-eslint/switch-exhaustiveness-check": "warn",
26
- "@typescript-eslint/explicit-module-boundary-types": "warn",
27
- "@typescript-eslint/no-unnecessary-parameter-property-assignment": "warn",
28
- "@typescript-eslint/method-signature-style": ["error", methodSignatureStyle],
29
- "@typescript-eslint/consistent-type-definitions": ["warn", typeDefinitionStyle],
30
- "@typescript-eslint/naming-convention": [
31
- "warn",
32
- {
33
- selector: "variable",
34
- format: [
35
- "camelCase",
36
- "PascalCase",
37
- "UPPER_CASE"
38
- ]
39
- },
40
- {
41
- selector: "memberLike",
42
- modifiers: ["private"],
43
- format: ["camelCase"],
44
- leadingUnderscore: "require"
45
- },
46
- {
47
- selector: "enumMember",
48
- format: ["PascalCase"]
49
- },
50
- {
51
- selector: "typeLike",
52
- format: ["PascalCase"],
53
- custom: {
54
- regex: "^(I|T(?!S))[A-Z]",
55
- match: false
56
- }
57
- }
58
- ]
59
- };
60
- }
61
-
62
- //#endregion
63
- export { getTypeScriptRules };