@shayanthenerd/eslint-config 0.4.3 → 0.4.5

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 (65) hide show
  1. package/package.json +1 -2
  2. package/dist/configs/base.js +0 -43
  3. package/dist/configs/commons.js +0 -26
  4. package/dist/configs/css.js +0 -28
  5. package/dist/configs/cypress.js +0 -22
  6. package/dist/configs/html.js +0 -22
  7. package/dist/configs/importX.js +0 -45
  8. package/dist/configs/nuxtMultiRootTemplate.js +0 -14
  9. package/dist/configs/oxlintOverrides.js +0 -50
  10. package/dist/configs/perfectionist.js +0 -23
  11. package/dist/configs/playwright.js +0 -22
  12. package/dist/configs/storybook.js +0 -23
  13. package/dist/configs/stylistic.js +0 -22
  14. package/dist/configs/tailwind.js +0 -42
  15. package/dist/configs/typescript.js +0 -30
  16. package/dist/configs/vitest.js +0 -22
  17. package/dist/configs/vue.js +0 -34
  18. package/dist/configs/vueComponentNames.js +0 -19
  19. package/dist/index.d.ts +0 -16
  20. package/dist/index.js +0 -54
  21. package/dist/oxlint.config.jsonc +0 -192
  22. package/dist/prettier.config.d.ts +0 -6
  23. package/dist/prettier.config.js +0 -38
  24. package/dist/rules/css.js +0 -65
  25. package/dist/rules/cypress.js +0 -15
  26. package/dist/rules/html.js +0 -53
  27. package/dist/rules/importX.js +0 -50
  28. package/dist/rules/javascript.js +0 -163
  29. package/dist/rules/perfectionist.js +0 -73
  30. package/dist/rules/playwright.js +0 -27
  31. package/dist/rules/storybook.js +0 -15
  32. package/dist/rules/stylistic.js +0 -160
  33. package/dist/rules/tailwind.js +0 -36
  34. package/dist/rules/typescript.js +0 -62
  35. package/dist/rules/vitest.js +0 -46
  36. package/dist/rules/vue.js +0 -171
  37. package/dist/rules/vueAccessibility.js +0 -23
  38. package/dist/types/configOptions/base.d.ts +0 -47
  39. package/dist/types/configOptions/css.d.ts +0 -27
  40. package/dist/types/configOptions/html.d.ts +0 -27
  41. package/dist/types/configOptions/importX.d.ts +0 -29
  42. package/dist/types/configOptions/nuxt.d.ts +0 -42
  43. package/dist/types/configOptions/perfectionist.d.ts +0 -16
  44. package/dist/types/configOptions/stylistic.d.ts +0 -145
  45. package/dist/types/configOptions/tailwind.d.ts +0 -46
  46. package/dist/types/configOptions/test.d.ts +0 -55
  47. package/dist/types/configOptions/typescript.d.ts +0 -36
  48. package/dist/types/configOptions/vue.d.ts +0 -211
  49. package/dist/types/configOptions/vueAccessibility.d.ts +0 -34
  50. package/dist/types/eslint-schema.d.ts +0 -13732
  51. package/dist/types/eslintRules.d.ts +0 -12
  52. package/dist/types/helpers.d.ts +0 -5
  53. package/dist/types/index.d.ts +0 -360
  54. package/dist/utils/globs.js +0 -31
  55. package/dist/utils/ignores/defaultIgnorePatterns.js +0 -57
  56. package/dist/utils/ignores/getIgnorePatterns.js +0 -16
  57. package/dist/utils/ignores/resolveGitignorePatterns.js +0 -26
  58. package/dist/utils/isEmptyString.js +0 -7
  59. package/dist/utils/isEnabled.js +0 -7
  60. package/dist/utils/isPackageDetected.js +0 -20
  61. package/dist/utils/options/defaultOptions.js +0 -168
  62. package/dist/utils/options/enableDetectedConfigs.js +0 -40
  63. package/dist/utils/options/mergeWithDefaults.js +0 -21
  64. package/dist/utils/vue/getRestrictedVueElements.js +0 -27
  65. package/dist/utils/vue/getRestrictedVueInputs.js +0 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shayanthenerd/eslint-config",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
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": [
@@ -55,7 +55,6 @@
55
55
  "packageManager": "bun@1.2.19",
56
56
  "scripts": {
57
57
  "prepare": "bun set:gitmessage && bunx simple-git-hooks && bun generate:types",
58
- "prepublishOnly": "bun ci:validate",
59
58
  "set:gitmessage": "git config --local commit.template \".gitmessage\"",
60
59
  "inspect": "bunx @eslint/config-inspector",
61
60
  "build:package": "tsdown --no-report",
@@ -1,43 +0,0 @@
1
- import { globs } from "../utils/globs.js";
2
- import { getJavaScriptRules } from "../rules/javascript.js";
3
- import typescriptESLint from "typescript-eslint";
4
- import { mergeConfigs } from "eslint-flat-config-utils";
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, base: { overrides } }, global: { globals: { node, worker, browser, commonjs, webextension, serviceworker, custom: userGlobals } } } = options;
11
- const baseConfig = {
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
- ...userGlobals
35
- }
36
- },
37
- rules: getJavaScriptRules(options)
38
- };
39
- return mergeConfigs(baseConfig, overrides);
40
- }
41
-
42
- //#endregion
43
- export { getBaseConfig };
@@ -1,26 +0,0 @@
1
- import { globs } from "../utils/globs.js";
2
- import typescriptESLint from "typescript-eslint";
3
-
4
- //#region src/configs/commons.ts
5
- function getCommonsConfig(options) {
6
- const { typescript, base: { preferNamedExports } } = options.configs;
7
- const commonsConfig = {
8
- name: "shayanthenerd/commons",
9
- files: [globs.commons],
10
- ignores: [globs.commonsIgnore],
11
- plugins: { "@typescript-eslint": typescriptESLint.plugin },
12
- rules: {
13
- "@typescript-eslint/explicit-function-return-type": typescript ? "error" : "off",
14
- "no-restricted-exports": [preferNamedExports ? "error" : "off", { restrictDefaultExports: {
15
- named: true,
16
- direct: true,
17
- namedFrom: true,
18
- namespaceFrom: true
19
- } }]
20
- }
21
- };
22
- return commonsConfig;
23
- }
24
-
25
- //#endregion
26
- export { getCommonsConfig };
@@ -1,28 +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 { getCSSRules } from "../rules/css.js";
5
- import eslintCSS from "@eslint/css";
6
- import { tailwind4 } from "tailwind-csstree";
7
- import { mergeConfigs } from "eslint-flat-config-utils";
8
-
9
- //#region src/configs/css.ts
10
- function getCSSConfig(options) {
11
- const { css } = options.configs;
12
- const { overrides } = isEnabled(css) ? css : defaultOptions.configs.css;
13
- const cssConfig = {
14
- name: "shayanthenerd/css",
15
- files: [globs.css],
16
- extends: [eslintCSS.configs.recommended],
17
- language: "css/css",
18
- languageOptions: {
19
- tolerant: true,
20
- customSyntax: options.configs.tailwind ? tailwind4 : void 0
21
- },
22
- rules: getCSSRules(options)
23
- };
24
- return mergeConfigs(cssConfig, overrides);
25
- }
26
-
27
- //#endregion
28
- export { getCSSConfig };
@@ -1,22 +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 { getCypressRules } from "../rules/cypress.js";
5
- import { mergeConfigs } from "eslint-flat-config-utils";
6
- import eslintPluginCypress from "eslint-plugin-cypress";
7
-
8
- //#region src/configs/cypress.ts
9
- function getCypressConfig(options) {
10
- const { cypress } = options.configs.test;
11
- const { overrides } = isEnabled(cypress) ? cypress : defaultOptions.configs.test.cypress;
12
- const cypressConfig = {
13
- name: "shayanthenerd/cypress",
14
- files: [globs.test],
15
- extends: [eslintPluginCypress.configs.recommended],
16
- rules: getCypressRules()
17
- };
18
- return mergeConfigs(cypressConfig, overrides);
19
- }
20
-
21
- //#endregion
22
- export { getCypressConfig };
@@ -1,22 +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 { getHTMLRules } from "../rules/html.js";
5
- import { mergeConfigs } from "eslint-flat-config-utils";
6
- import eslintPluginHTML from "@html-eslint/eslint-plugin";
7
-
8
- //#region src/configs/html.ts
9
- function getHTMLConfig(options) {
10
- const { html } = options.configs;
11
- const { overrides } = isEnabled(html) ? html : defaultOptions.configs.html;
12
- const htmlConfig = {
13
- name: "shayanthenerd/html",
14
- files: [globs.html],
15
- extends: [eslintPluginHTML.configs["flat/recommended"]],
16
- rules: getHTMLRules(options)
17
- };
18
- return mergeConfigs(htmlConfig, overrides);
19
- }
20
-
21
- //#endregion
22
- export { getHTMLConfig };
@@ -1,45 +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 eslintPluginImport from "eslint-plugin-import";
7
- import eslintPluginImportX from "eslint-plugin-import-x";
8
- import eslintPluginUnusedImports from "eslint-plugin-unused-imports";
9
-
10
- //#region src/configs/importX.ts
11
- eslintPluginImport.flatConfigs.recommended.rules = {};
12
- function getImportXConfig(options) {
13
- const { vue, importX, typescript } = options.configs;
14
- const { overrides } = isEnabled(importX) ? importX : defaultOptions.configs.importX;
15
- const importXConfig = {
16
- name: "shayanthenerd/import-x",
17
- files: [globs.src, vue ? globs.vue : ""],
18
- extends: [
19
- eslintPluginImport.flatConfigs.recommended,
20
- eslintPluginImportX.flatConfigs.recommended,
21
- typescript ? eslintPluginImport.flatConfigs.typescript : {},
22
- typescript ? eslintPluginImportX.flatConfigs.typescript : {}
23
- ],
24
- plugins: { "unused-imports": eslintPluginUnusedImports },
25
- settings: {
26
- "import/resolver": { typescript: true },
27
- "import/extensions": [
28
- ".js",
29
- ".cjs",
30
- ".mjs",
31
- ".jsx",
32
- ".ts",
33
- ".cts",
34
- ".mts",
35
- ".tsx",
36
- ".vue"
37
- ]
38
- },
39
- rules: getImportXRules(options)
40
- };
41
- return mergeConfigs(importXConfig, overrides);
42
- }
43
-
44
- //#endregion
45
- export { getImportXConfig };
@@ -1,14 +0,0 @@
1
- import { globs } from "../utils/globs.js";
2
-
3
- //#region src/configs/nuxtMultiRootTemplate.ts
4
- function getNuxtMultiRootTemplateConfig() {
5
- const nuxtMultiRootTemplateConfig = {
6
- name: "shayanthenerd/nuxt/allow-multiple-template-root",
7
- files: [globs.vueMultiRootTemplate],
8
- rules: { "vue/no-multiple-template-root": "off" }
9
- };
10
- return nuxtMultiRootTemplateConfig;
11
- }
12
-
13
- //#endregion
14
- export { getNuxtMultiRootTemplateConfig };
@@ -1,50 +0,0 @@
1
- import { globs } from "../utils/globs.js";
2
- import { isEnabled } from "../utils/isEnabled.js";
3
- import { getJavaScriptRules } from "../rules/javascript.js";
4
- import { getVitestRules } from "../rules/vitest.js";
5
- import { getImportXRules } from "../rules/importX.js";
6
- import { getPlaywrightRules } from "../rules/playwright.js";
7
- import { getTypeScriptRules } from "../rules/typescript.js";
8
- import typescriptESLint from "typescript-eslint";
9
- import eslintPluginVitest from "@vitest/eslint-plugin";
10
- import eslintPluginImportX from "eslint-plugin-import-x";
11
- import eslintPluginPlaywright from "eslint-plugin-playwright";
12
-
13
- //#region src/configs/oxlintOverrides.ts
14
- function getOXLintOverridesConfig(options) {
15
- const { vue, importX, typescript, test: { vitest, playwright } } = options.configs;
16
- const vitestRules = getVitestRules(options);
17
- const importXRules = getImportXRules(options);
18
- const javascriptRules = getJavaScriptRules(options);
19
- const typescriptRules = getTypeScriptRules(options);
20
- const playwrightRules = getPlaywrightRules(options);
21
- const oxlintOverridesConfig = {
22
- name: "shayanthenerd/oxlint/overrides",
23
- files: [
24
- globs.src,
25
- globs.commons,
26
- vue ? globs.vue : "",
27
- vitest || playwright ? globs.test : ""
28
- ],
29
- plugins: {
30
- "vitest": eslintPluginVitest,
31
- "import-x": eslintPluginImportX,
32
- "playwright": eslintPluginPlaywright,
33
- "@typescript-eslint": typescriptESLint.plugin
34
- },
35
- rules: {
36
- "max-depth": javascriptRules["max-depth"],
37
- "func-style": javascriptRules["func-style"],
38
- "max-nested-callbacks": javascriptRules["max-nested-callbacks"],
39
- "@typescript-eslint/consistent-type-definitions": isEnabled(typescript) ? typescriptRules["@typescript-eslint/consistent-type-definitions"] : "off",
40
- "import-x/extensions": isEnabled(importX) ? importXRules["import-x/extensions"] : "off",
41
- "playwright/max-nested-describe": isEnabled(playwright) ? playwrightRules["playwright/max-nested-describe"] : "off",
42
- "vitest/consistent-test-it": isEnabled(vitest) ? vitestRules["vitest/consistent-test-it"] : "off",
43
- "vitest/max-nested-describe": isEnabled(vitest) ? vitestRules["vitest/max-nested-describe"] : "off"
44
- }
45
- };
46
- return oxlintOverridesConfig;
47
- }
48
-
49
- //#endregion
50
- export { getOXLintOverridesConfig };
@@ -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 { getPerfectionistRules } from "../rules/perfectionist.js";
5
- import { mergeConfigs } from "eslint-flat-config-utils";
6
- import eslintPluginPerfectionist from "eslint-plugin-perfectionist";
7
-
8
- //#region src/configs/perfectionist.ts
9
- function getPerfectionistConfig(options) {
10
- const { vue, perfectionist } = options.configs;
11
- const { sortType, overrides } = isEnabled(perfectionist) ? perfectionist : defaultOptions.configs.perfectionist;
12
- const perfectionistConfig = {
13
- name: "shayanthenerd/perfectionist",
14
- files: [globs.src, vue ? globs.vue : ""],
15
- plugins: { perfectionist: eslintPluginPerfectionist },
16
- settings: { perfectionist: { type: sortType } },
17
- rules: getPerfectionistRules(options)
18
- };
19
- return mergeConfigs(perfectionistConfig, overrides);
20
- }
21
-
22
- //#endregion
23
- export { getPerfectionistConfig };
@@ -1,22 +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 { getPlaywrightRules } from "../rules/playwright.js";
5
- import { mergeConfigs } from "eslint-flat-config-utils";
6
- import eslintPluginPlaywright from "eslint-plugin-playwright";
7
-
8
- //#region src/configs/playwright.ts
9
- function getPlaywrightConfig(options) {
10
- const { playwright } = options.configs.test;
11
- const { overrides } = isEnabled(playwright) ? playwright : defaultOptions.configs.test.playwright;
12
- const playwrightConfig = {
13
- name: "shayanthenerd/playwright",
14
- files: [globs.test],
15
- extends: [eslintPluginPlaywright.configs["flat/recommended"]],
16
- rules: getPlaywrightRules(options)
17
- };
18
- return mergeConfigs(playwrightConfig, overrides);
19
- }
20
-
21
- //#endregion
22
- export { getPlaywrightConfig };
@@ -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 { getStorybookRules } from "../rules/storybook.js";
5
- import { mergeConfigs } from "eslint-flat-config-utils";
6
- import eslintPluginStorybook from "eslint-plugin-storybook";
7
-
8
- //#region src/configs/storybook.ts
9
- const eslintConfigStorybook = eslintPluginStorybook.configs["flat/recommended"];
10
- function getStorybookConfig(options) {
11
- const { storybook } = options.configs.test;
12
- const { overrides } = isEnabled(storybook) ? storybook : defaultOptions.configs.test.storybook;
13
- const storybookConfig = {
14
- name: "shayanthenerd/storybook",
15
- files: [globs.storybook],
16
- extends: [eslintConfigStorybook],
17
- rules: getStorybookRules(options)
18
- };
19
- return mergeConfigs(storybookConfig, overrides);
20
- }
21
-
22
- //#endregion
23
- export { getStorybookConfig };
@@ -1,22 +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 { getStylisticRules } from "../rules/stylistic.js";
5
- import { mergeConfigs } from "eslint-flat-config-utils";
6
- import eslintPluginStylistic from "@stylistic/eslint-plugin";
7
-
8
- //#region src/configs/stylistic.ts
9
- function getStylisticConfig(options) {
10
- const { stylistic } = options.configs;
11
- const { overrides } = isEnabled(stylistic) ? stylistic : defaultOptions.configs.stylistic;
12
- const stylisticConfig = {
13
- name: "shayanthenerd/stylistic",
14
- files: [globs.src, options.configs.vue ? globs.vue : ""],
15
- extends: [eslintPluginStylistic.configs.recommended],
16
- rules: getStylisticRules(options)
17
- };
18
- return mergeConfigs(stylisticConfig, overrides);
19
- }
20
-
21
- //#endregion
22
- export { getStylisticConfig };
@@ -1,42 +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 { getTailwindRules } from "../rules/tailwind.js";
5
- import path from "node:path";
6
- import { mergeConfigs } from "eslint-flat-config-utils";
7
- import eslintPluginVue from "eslint-plugin-vue";
8
- import eslintPluginHTML from "@html-eslint/eslint-plugin";
9
- import eslintPluginTailwind from "eslint-plugin-better-tailwindcss";
10
-
11
- //#region src/configs/tailwind.ts
12
- const eslintParserHTML = eslintPluginHTML.configs["flat/recommended"].languageOptions.parser;
13
- const eslintParserVue = eslintPluginVue.configs["flat/recommended"].find((config) => config.name === "vue/base/setup-for-vue")?.languageOptions?.parser;
14
- function getTailwindConfig(options) {
15
- const { tsConfig, configs: { vue, html, tailwind } } = options;
16
- const { config, entryPoint, overrides } = isEnabled(tailwind) ? tailwind : defaultOptions.configs.tailwind;
17
- const tailwindConfig = {
18
- name: "shayanthenerd/tailwind",
19
- files: [
20
- globs.src,
21
- html ? globs.html : "",
22
- vue ? globs.vue : ""
23
- ],
24
- plugins: { "better-tailwindcss": eslintPluginTailwind },
25
- languageOptions: { parserOptions: { parser: html ? eslintParserHTML : eslintParserVue } },
26
- settings: { "better-tailwindcss": {
27
- entryPoint,
28
- tailwindConfig: config,
29
- tsconfig: tsConfig ? path.resolve(tsConfig.rootDir, tsConfig.filename) : void 0,
30
- attributes: [["^v-bind:ui$", [{ match: "objectValues" }]], ["^(?:v-bind:)?(class|activeClass|inactiveClass)$", [
31
- { match: "strings" },
32
- { match: "objectKeys" },
33
- { match: "objectValues" }
34
- ]]]
35
- } },
36
- rules: getTailwindRules(options)
37
- };
38
- return mergeConfigs(tailwindConfig, overrides);
39
- }
40
-
41
- //#endregion
42
- export { getTailwindConfig };
@@ -1,30 +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 typescriptESLint from "typescript-eslint";
6
- import { mergeConfigs } from "eslint-flat-config-utils";
7
-
8
- //#region src/configs/typescript.ts
9
- function getTypeScriptConfig(options) {
10
- const { tsConfig, configs: { vue, typescript } } = options;
11
- const { allowedDefaultProjects } = isEnabled(typescript) ? typescript : defaultOptions.configs.typescript;
12
- const { overrides } = isEnabled(typescript) ? typescript : defaultOptions.configs.typescript;
13
- const typescriptConfig = {
14
- name: "shayanthenerd/typescript",
15
- files: [globs.ts, vue ? globs.vue : ""],
16
- extends: [typescriptESLint.configs.strictTypeChecked, typescriptESLint.configs.stylisticTypeChecked],
17
- languageOptions: { parserOptions: {
18
- tsconfigRootDir: tsConfig ? tsConfig.rootDir : void 0,
19
- projectService: {
20
- allowDefaultProject: allowedDefaultProjects,
21
- defaultProject: tsConfig ? tsConfig.filename : void 0
22
- }
23
- } },
24
- rules: getTypeScriptRules(options)
25
- };
26
- return mergeConfigs(typescriptConfig, overrides);
27
- }
28
-
29
- //#endregion
30
- export { getTypeScriptConfig };
@@ -1,22 +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 { getVitestRules } from "../rules/vitest.js";
5
- import { mergeConfigs } from "eslint-flat-config-utils";
6
- import eslintPluginVitest from "@vitest/eslint-plugin";
7
-
8
- //#region src/configs/vitest.ts
9
- function getVitestConfig(options) {
10
- const { vitest } = options.configs.test;
11
- const { overrides } = isEnabled(vitest) ? vitest : defaultOptions.configs.test.vitest;
12
- const vitestConfig = {
13
- name: "shayanthenerd/vitest",
14
- files: [globs.test],
15
- extends: [eslintPluginVitest.configs.recommended],
16
- rules: getVitestRules(options)
17
- };
18
- return mergeConfigs(vitestConfig, overrides);
19
- }
20
-
21
- //#endregion
22
- export { getVitestConfig };
@@ -1,34 +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 typescriptESLint from "typescript-eslint";
7
- import { mergeConfigs } from "eslint-flat-config-utils";
8
- import eslintPluginVue from "eslint-plugin-vue";
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
- const vueConfig = {
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
- };
30
- return mergeConfigs(vueConfig, overrides);
31
- }
32
-
33
- //#endregion
34
- export { getVueConfig };
@@ -1,19 +0,0 @@
1
- import { globs } from "../utils/globs.js";
2
-
3
- //#region src/configs/vueComponentNames.ts
4
- function getVueComponentNamesConfig() {
5
- const vueComponentNamesConfig = {
6
- name: "shayanthenerd/vue/multi-word-component-names",
7
- files: [globs.vueComponentNames],
8
- ignores: [globs.vueComponentNamesIgnore],
9
- rules: {
10
- "vue/match-component-file-name": "off",
11
- "vue/multi-word-component-names": "off",
12
- "vue/component-definition-name-casing": "off"
13
- }
14
- };
15
- return vueComponentNamesConfig;
16
- }
17
-
18
- //#endregion
19
- export { getVueComponentNamesConfig };
package/dist/index.d.ts DELETED
@@ -1,16 +0,0 @@
1
- import { ConfigObject, Options } from "./types/index.js";
2
- import { Linter } from "eslint";
3
-
4
- //#region src/index.d.ts
5
-
6
- /**
7
- * Define the ESLint configuration based on the provided options and any number of Flat Config objects.
8
- *
9
- * @param {Options} options - Options to configure and customize the config
10
- * @param {...ConfigObject} configs - Additional Flat Config objects to extend the config
11
- *
12
- * @returns {Linter.Config[]} The merged ESLint configuration array
13
- */
14
- declare function defineConfig(options?: Options, ...configs: ConfigObject[]): Linter.Config[];
15
- //#endregion
16
- export { defineConfig };
package/dist/index.js DELETED
@@ -1,54 +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 { getCommonsConfig } from "./configs/commons.js";
9
- import { getCypressConfig } from "./configs/cypress.js";
10
- import { getImportXConfig } from "./configs/importX.js";
11
- import { getTailwindConfig } from "./configs/tailwind.js";
12
- import { getStorybookConfig } from "./configs/storybook.js";
13
- import { getStylisticConfig } from "./configs/stylistic.js";
14
- import { getPlaywrightConfig } from "./configs/playwright.js";
15
- import { getTypeScriptConfig } from "./configs/typescript.js";
16
- import { getPerfectionistConfig } from "./configs/perfectionist.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 { getNuxtMultiRootTemplateConfig } from "./configs/nuxtMultiRootTemplate.js";
22
- import { globalIgnores } from "eslint/config";
23
- import eslintPluginOXLint from "eslint-plugin-oxlint";
24
- import { config } from "typescript-eslint";
25
- import path from "node:path";
26
-
27
- //#region src/index.ts
28
- /**
29
- * Define the ESLint configuration based on the provided options and any number of Flat Config objects.
30
- *
31
- * @param {Options} options - Options to configure and customize the config
32
- * @param {...ConfigObject} configs - Additional Flat Config objects to extend the config
33
- *
34
- * @returns {Linter.Config[]} The merged ESLint configuration array
35
- */
36
- function defineConfig(options = {}, ...configs) {
37
- const mergedOptions = mergeWithDefaults(options);
38
- const { gitignore, global: { rules, ignores, settings, linterOptions }, configs: { vue, css, nuxt, html, oxlint, importX, tailwind, stylistic, typescript, perfectionist, test: { vitest, cypress, storybook, playwright } } } = mergedOptions;
39
- const ignorePatterns = getIgnorePatterns({
40
- gitignore,
41
- patterns: ignores
42
- });
43
- const oxlintConfigPath = path.resolve(oxlint || defaultOptions.configs.oxlint);
44
- const eslintConfig = config({
45
- name: "shayanthenerd/global",
46
- linterOptions,
47
- settings,
48
- rules
49
- }, globalIgnores(ignorePatterns, "shayanthenerd/ignores"), getBaseConfig(mergedOptions), getCommonsConfig(mergedOptions), isEnabled(importX) ? getImportXConfig(mergedOptions) : {}, isEnabled(stylistic) ? getStylisticConfig(mergedOptions) : {}, isEnabled(perfectionist) ? getPerfectionistConfig(mergedOptions) : {}, isEnabled(typescript) ? getTypeScriptConfig(mergedOptions) : {}, isEnabled(html) ? getHTMLConfig(mergedOptions) : {}, isEnabled(css) ? getCSSConfig(mergedOptions) : {}, isEnabled(tailwind) ? getTailwindConfig(mergedOptions) : {}, isEnabled(vue) ? getVueConfig(mergedOptions) : {}, isEnabled(vue) ? getVueComponentNamesConfig() : {}, isEnabled(vue) && isEnabled(nuxt) ? getNuxtMultiRootTemplateConfig() : {}, isEnabled(storybook) ? getStorybookConfig(mergedOptions) : {}, isEnabled(vitest) ? getVitestConfig(mergedOptions) : {}, isEnabled(playwright) ? getPlaywrightConfig(mergedOptions) : {}, isEnabled(cypress) ? getCypressConfig(mergedOptions) : {}, ...oxlint ? eslintPluginOXLint.buildFromOxlintConfigFile(oxlintConfigPath) : [], oxlint ? getOXLintOverridesConfig(mergedOptions) : {}, ...configs);
50
- return eslintConfig;
51
- }
52
-
53
- //#endregion
54
- export { defineConfig };