@shayanthenerd/eslint-config 0.11.2 → 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.
- package/dist/configs/base.mjs +13 -14
- package/dist/configs/css.mjs +2 -2
- package/dist/configs/cypress.mjs +2 -1
- package/dist/configs/html.mjs +3 -1
- package/dist/configs/importX.mjs +8 -5
- package/dist/configs/oxlintOverrides.mjs +8 -8
- package/dist/configs/perfectionist.mjs +1 -1
- package/dist/configs/playwright.mjs +2 -1
- package/dist/configs/storybook.mjs +1 -2
- package/dist/configs/stylistic.mjs +3 -3
- package/dist/configs/tailwind.mjs +15 -12
- package/dist/configs/typescript.mjs +13 -10
- package/dist/configs/vitest.mjs +1 -1
- package/dist/configs/vue.mjs +20 -8
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +23 -22
- package/dist/oxlint.config.jsonc +1 -0
- package/dist/rules/css.mjs +12 -3
- package/dist/rules/cypress.mjs +7 -3
- package/dist/rules/html.mjs +45 -23
- package/dist/rules/importX.mjs +23 -21
- package/dist/rules/javascript.mjs +167 -115
- package/dist/rules/playwright.mjs +40 -12
- package/dist/rules/storybook.mjs +13 -2
- package/dist/rules/stylistic.mjs +104 -55
- package/dist/rules/tailwind.mjs +13 -12
- package/dist/rules/typescript.mjs +117 -7
- package/dist/rules/vitest.mjs +57 -28
- package/dist/rules/vue.mjs +271 -96
- package/dist/rules/vueAccessibility.mjs +21 -7
- package/dist/types/eslint-schema.d.mts +24 -33
- package/package.json +23 -24
package/dist/configs/base.mjs
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { globs } from "../utils/globs.mjs";
|
|
2
|
+
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
2
3
|
import { getJavaScriptRules } from "../rules/javascript.mjs";
|
|
3
4
|
import { mergeConfigs } from "eslint-flat-config-utils";
|
|
4
|
-
import
|
|
5
|
+
import { parser } from "typescript-eslint";
|
|
5
6
|
import globals from "globals";
|
|
6
|
-
import javascriptESLint from "@eslint/js";
|
|
7
7
|
|
|
8
8
|
//#region src/configs/base.ts
|
|
9
9
|
function getBaseConfig(options) {
|
|
10
10
|
const { configs: { vue, test: { vitest }, base: { overrides } }, global: { globals: { node, worker, browser, commonjs, webextension, serviceworker, custom: userGlobals } } } = options;
|
|
11
11
|
return mergeConfigs({
|
|
12
12
|
name: "shayanthenerd/base",
|
|
13
|
-
files: [globs.src,
|
|
14
|
-
extends: [javascriptESLint.configs.recommended],
|
|
13
|
+
files: isEnabled(vue) ? [globs.src, globs.vue] : [globs.src],
|
|
15
14
|
languageOptions: {
|
|
16
|
-
parser
|
|
15
|
+
parser,
|
|
17
16
|
parserOptions: {
|
|
18
17
|
ecmaVersion: "latest",
|
|
19
18
|
ecmaFeatures: {
|
|
@@ -24,15 +23,15 @@ function getBaseConfig(options) {
|
|
|
24
23
|
globals: {
|
|
25
24
|
...globals.builtin,
|
|
26
25
|
...globals.es2026,
|
|
27
|
-
...commonjs
|
|
28
|
-
...node
|
|
29
|
-
...node
|
|
30
|
-
...browser
|
|
31
|
-
...worker
|
|
32
|
-
...serviceworker
|
|
33
|
-
...webextension
|
|
34
|
-
...vue
|
|
35
|
-
...vitest
|
|
26
|
+
...commonjs && globals.commonjs,
|
|
27
|
+
...node && globals.node,
|
|
28
|
+
...node && globals.nodeBuiltin,
|
|
29
|
+
...browser && globals.browser,
|
|
30
|
+
...worker && globals.worker,
|
|
31
|
+
...serviceworker && globals.serviceworker,
|
|
32
|
+
...webextension && globals.webextensions,
|
|
33
|
+
...isEnabled(vue) && globals.vue,
|
|
34
|
+
...isEnabled(vitest) && globals.vitest,
|
|
36
35
|
...userGlobals
|
|
37
36
|
}
|
|
38
37
|
},
|
package/dist/configs/css.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { globs } from "../utils/globs.mjs";
|
|
|
2
2
|
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
3
3
|
import { defaultOptions } from "../utils/options/defaultOptions.mjs";
|
|
4
4
|
import { getCSSRules } from "../rules/css.mjs";
|
|
5
|
-
import
|
|
5
|
+
import eslintPluginCSS from "@eslint/css";
|
|
6
6
|
import { mergeConfigs } from "eslint-flat-config-utils";
|
|
7
7
|
import { tailwind3, tailwind4 } from "tailwind-csstree";
|
|
8
8
|
|
|
@@ -14,7 +14,7 @@ function getCSSConfig(options) {
|
|
|
14
14
|
return mergeConfigs({
|
|
15
15
|
name: "shayanthenerd/css",
|
|
16
16
|
files: [globs.css],
|
|
17
|
-
|
|
17
|
+
plugins: { css: eslintPluginCSS },
|
|
18
18
|
language: "css/css",
|
|
19
19
|
languageOptions: {
|
|
20
20
|
tolerant: true,
|
package/dist/configs/cypress.mjs
CHANGED
|
@@ -12,7 +12,8 @@ function getCypressConfig(options) {
|
|
|
12
12
|
return mergeConfigs({
|
|
13
13
|
name: "shayanthenerd/cypress",
|
|
14
14
|
files: [globs.test],
|
|
15
|
-
|
|
15
|
+
plugins: { cypress: eslintPluginCypress },
|
|
16
|
+
languageOptions: { globals: eslintPluginCypress.configs.recommended.languageOptions?.globals },
|
|
16
17
|
rules: getCypressRules()
|
|
17
18
|
}, overrides);
|
|
18
19
|
}
|
package/dist/configs/html.mjs
CHANGED
|
@@ -6,14 +6,16 @@ import { mergeConfigs } from "eslint-flat-config-utils";
|
|
|
6
6
|
import eslintPluginHTML from "@html-eslint/eslint-plugin";
|
|
7
7
|
|
|
8
8
|
//#region src/configs/html.ts
|
|
9
|
+
const eslintParserHTML = (eslintPluginHTML.configs?.["flat/recommended"])?.languageOptions?.parser;
|
|
9
10
|
function getHTMLConfig(options) {
|
|
10
11
|
const { html } = options.configs;
|
|
11
12
|
const { overrides } = isEnabled(html) ? html : defaultOptions.configs.html;
|
|
12
13
|
return mergeConfigs({
|
|
13
14
|
name: "shayanthenerd/html",
|
|
14
15
|
files: [globs.html],
|
|
15
|
-
|
|
16
|
+
plugins: { "@html-eslint": eslintPluginHTML },
|
|
16
17
|
language: "html/html",
|
|
18
|
+
languageOptions: { parser: eslintParserHTML },
|
|
17
19
|
rules: getHTMLRules(options)
|
|
18
20
|
}, overrides);
|
|
19
21
|
}
|
package/dist/configs/importX.mjs
CHANGED
|
@@ -9,12 +9,15 @@ import eslintPluginUnusedImports from "eslint-plugin-unused-imports";
|
|
|
9
9
|
//#region src/configs/importX.ts
|
|
10
10
|
function getImportXConfig(options) {
|
|
11
11
|
const { vue, importX, typescript } = options.configs;
|
|
12
|
-
const { overrides } = isEnabled(importX) ? importX : defaultOptions.configs.importX;
|
|
12
|
+
const { overrides, removeUnusedImports } = isEnabled(importX) ? importX : defaultOptions.configs.importX;
|
|
13
13
|
return mergeConfigs({
|
|
14
|
-
name: "shayanthenerd/
|
|
15
|
-
files: [globs.src,
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
name: "shayanthenerd/imports",
|
|
15
|
+
files: isEnabled(vue) ? [globs.src, globs.vue] : [globs.src],
|
|
16
|
+
plugins: {
|
|
17
|
+
"import-x": eslintPluginImportX,
|
|
18
|
+
...removeUnusedImports && { "unused-imports": eslintPluginUnusedImports }
|
|
19
|
+
},
|
|
20
|
+
settings: isEnabled(typescript) ? eslintPluginImportX.flatConfigs.typescript.settings : void 0,
|
|
18
21
|
rules: getImportXRules(options)
|
|
19
22
|
}, overrides);
|
|
20
23
|
}
|
|
@@ -11,7 +11,7 @@ import eslintPluginPlaywright from "eslint-plugin-playwright";
|
|
|
11
11
|
|
|
12
12
|
//#region src/configs/oxlintOverrides.ts
|
|
13
13
|
function getOXLintOverridesConfig(options) {
|
|
14
|
-
const { vue, typescript, test: { vitest, playwright } } = options.configs;
|
|
14
|
+
const { vue, importX, typescript, test: { vitest, playwright } } = options.configs;
|
|
15
15
|
const vitestRules = getVitestRules(options);
|
|
16
16
|
const javascriptRules = getJavaScriptRules(options);
|
|
17
17
|
const typescriptRules = getTypeScriptRules(options);
|
|
@@ -20,14 +20,14 @@ function getOXLintOverridesConfig(options) {
|
|
|
20
20
|
name: "shayanthenerd/oxlint/overrides",
|
|
21
21
|
files: [
|
|
22
22
|
globs.src,
|
|
23
|
-
vue ? globs.vue : "",
|
|
24
|
-
vitest || playwright ? globs.test : ""
|
|
25
|
-
],
|
|
23
|
+
isEnabled(vue) ? globs.vue : "",
|
|
24
|
+
isEnabled(vitest) || isEnabled(playwright) ? globs.test : ""
|
|
25
|
+
].filter(Boolean),
|
|
26
26
|
plugins: {
|
|
27
|
-
|
|
28
|
-
"import-x": eslintPluginImportX,
|
|
29
|
-
|
|
30
|
-
"@typescript-eslint": typescriptESLint.plugin
|
|
27
|
+
...isEnabled(vitest) && { vitest: eslintPluginVitest },
|
|
28
|
+
...isEnabled(importX) && { "import-x": eslintPluginImportX },
|
|
29
|
+
...isEnabled(playwright) && { playwright: eslintPluginPlaywright },
|
|
30
|
+
...isEnabled(typescript) && { "@typescript-eslint": typescriptESLint.plugin }
|
|
31
31
|
},
|
|
32
32
|
rules: {
|
|
33
33
|
"max-depth": javascriptRules["max-depth"],
|
|
@@ -11,7 +11,7 @@ function getPerfectionistConfig(options) {
|
|
|
11
11
|
const { sortType, overrides } = isEnabled(perfectionist) ? perfectionist : defaultOptions.configs.perfectionist;
|
|
12
12
|
return mergeConfigs({
|
|
13
13
|
name: "shayanthenerd/perfectionist",
|
|
14
|
-
files: [globs.src,
|
|
14
|
+
files: isEnabled(vue) ? [globs.src, globs.vue] : [globs.src],
|
|
15
15
|
plugins: { perfectionist: eslintPluginPerfectionist },
|
|
16
16
|
settings: { perfectionist: { type: sortType } },
|
|
17
17
|
rules: getPerfectionistRules(options)
|
|
@@ -12,7 +12,8 @@ function getPlaywrightConfig(options) {
|
|
|
12
12
|
return mergeConfigs({
|
|
13
13
|
name: "shayanthenerd/playwright",
|
|
14
14
|
files: [globs.test],
|
|
15
|
-
|
|
15
|
+
plugins: { playwright: eslintPluginPlaywright },
|
|
16
|
+
languageOptions: { globals: eslintPluginPlaywright.configs["flat/recommended"].languageOptions?.globals },
|
|
16
17
|
rules: getPlaywrightRules(options)
|
|
17
18
|
}, overrides);
|
|
18
19
|
}
|
|
@@ -6,14 +6,13 @@ import { mergeConfigs } from "eslint-flat-config-utils";
|
|
|
6
6
|
import eslintPluginStorybook from "eslint-plugin-storybook";
|
|
7
7
|
|
|
8
8
|
//#region src/configs/storybook.ts
|
|
9
|
-
const eslintConfigStorybook = eslintPluginStorybook.configs["flat/recommended"];
|
|
10
9
|
function getStorybookConfig(options) {
|
|
11
10
|
const { storybook } = options.configs.test;
|
|
12
11
|
const { overrides } = isEnabled(storybook) ? storybook : defaultOptions.configs.test.storybook;
|
|
13
12
|
return mergeConfigs({
|
|
14
13
|
name: "shayanthenerd/storybook",
|
|
15
14
|
files: [globs.storybook],
|
|
16
|
-
|
|
15
|
+
plugins: { storybook: eslintPluginStorybook },
|
|
17
16
|
rules: getStorybookRules(options)
|
|
18
17
|
}, overrides);
|
|
19
18
|
}
|
|
@@ -7,12 +7,12 @@ import eslintPluginStylistic from "@stylistic/eslint-plugin";
|
|
|
7
7
|
|
|
8
8
|
//#region src/configs/stylistic.ts
|
|
9
9
|
function getStylisticConfig(options) {
|
|
10
|
-
const { stylistic } = options.configs;
|
|
10
|
+
const { vue, stylistic } = options.configs;
|
|
11
11
|
const { overrides } = isEnabled(stylistic) ? stylistic : defaultOptions.configs.stylistic;
|
|
12
12
|
return mergeConfigs({
|
|
13
13
|
name: "shayanthenerd/stylistic",
|
|
14
|
-
files: [globs.src,
|
|
15
|
-
|
|
14
|
+
files: isEnabled(vue) ? [globs.src, globs.vue] : [globs.src],
|
|
15
|
+
plugins: { "@stylistic": eslintPluginStylistic },
|
|
16
16
|
rules: getStylisticRules(options)
|
|
17
17
|
}, overrides);
|
|
18
18
|
}
|
|
@@ -9,8 +9,15 @@ import eslintPluginHTML from "@html-eslint/eslint-plugin";
|
|
|
9
9
|
import eslintPluginTailwind from "eslint-plugin-better-tailwindcss";
|
|
10
10
|
|
|
11
11
|
//#region src/configs/tailwind.ts
|
|
12
|
-
const eslintParserHTML = eslintPluginHTML.configs["flat/recommended"]
|
|
13
|
-
const eslintParserVue = eslintPluginVue.configs["flat/recommended"].find((config) =>
|
|
12
|
+
const eslintParserHTML = (eslintPluginHTML.configs?.["flat/recommended"])?.languageOptions?.parser;
|
|
13
|
+
const eslintParserVue = eslintPluginVue.configs["flat/recommended"].find((config) => {
|
|
14
|
+
return config.name === "vue/base/setup-for-vue";
|
|
15
|
+
})?.languageOptions?.parser;
|
|
16
|
+
const vueAttributes = [["^v-bind:ui$", [{ match: "objectValues" }]], ["^(?:v-bind:)?(class|activeClass|inactiveClass)$", [
|
|
17
|
+
{ match: "strings" },
|
|
18
|
+
{ match: "objectKeys" },
|
|
19
|
+
{ match: "objectValues" }
|
|
20
|
+
]]];
|
|
14
21
|
function getTailwindConfig(options) {
|
|
15
22
|
const { tsConfig, configs: { vue, html, tailwind } } = options;
|
|
16
23
|
const { config, entryPoint, overrides } = isEnabled(tailwind) ? tailwind : defaultOptions.configs.tailwind;
|
|
@@ -20,18 +27,14 @@ function getTailwindConfig(options) {
|
|
|
20
27
|
globs.src,
|
|
21
28
|
html ? globs.html : "",
|
|
22
29
|
vue ? globs.vue : ""
|
|
23
|
-
],
|
|
30
|
+
].filter(Boolean),
|
|
24
31
|
plugins: { "better-tailwindcss": eslintPluginTailwind },
|
|
25
|
-
languageOptions: { parserOptions: { parser: html ? eslintParserHTML : eslintParserVue } },
|
|
32
|
+
languageOptions: { parserOptions: { parser: isEnabled(html) ? eslintParserHTML : eslintParserVue } },
|
|
26
33
|
settings: { "better-tailwindcss": {
|
|
27
|
-
entryPoint,
|
|
28
|
-
tailwindConfig: config,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
{ match: "strings" },
|
|
32
|
-
{ match: "objectKeys" },
|
|
33
|
-
{ match: "objectValues" }
|
|
34
|
-
]]]
|
|
34
|
+
entryPoint: entryPoint || void 0,
|
|
35
|
+
tailwindConfig: config || void 0,
|
|
36
|
+
attributes: isEnabled(vue) ? vueAttributes : void 0,
|
|
37
|
+
tsconfig: tsConfig ? path.resolve(tsConfig.rootDir, tsConfig.filename) : void 0
|
|
35
38
|
} },
|
|
36
39
|
rules: getTailwindRules(options)
|
|
37
40
|
}, overrides);
|
|
@@ -4,7 +4,7 @@ import { defaultOptions } from "../utils/options/defaultOptions.mjs";
|
|
|
4
4
|
import { getTypeScriptRules } from "../rules/typescript.mjs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { mergeConfigs } from "eslint-flat-config-utils";
|
|
7
|
-
import
|
|
7
|
+
import { parser, plugin } from "typescript-eslint";
|
|
8
8
|
|
|
9
9
|
//#region src/configs/typescript.ts
|
|
10
10
|
function getTypeScriptConfig(options) {
|
|
@@ -13,16 +13,19 @@ function getTypeScriptConfig(options) {
|
|
|
13
13
|
const { overrides } = isEnabled(typescript) ? typescript : defaultOptions.configs.typescript;
|
|
14
14
|
return mergeConfigs({
|
|
15
15
|
name: "shayanthenerd/typescript",
|
|
16
|
-
files: [globs.ts,
|
|
17
|
-
|
|
18
|
-
languageOptions: {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
files: isEnabled(vue) ? [globs.ts, globs.vue] : [globs.ts],
|
|
17
|
+
plugins: { "@typescript-eslint": plugin },
|
|
18
|
+
languageOptions: {
|
|
19
|
+
parser,
|
|
20
|
+
parserOptions: {
|
|
21
|
+
warnOnUnsupportedTypeScriptVersion: false,
|
|
22
|
+
tsconfigRootDir: tsConfig ? path.resolve(tsConfig.rootDir) : void 0,
|
|
23
|
+
projectService: {
|
|
24
|
+
defaultProject: tsConfig ? tsConfig.filename : void 0,
|
|
25
|
+
allowDefaultProject: ["{prettier,eslint}.config.?([mc])ts", ...allowedDefaultProjects]
|
|
26
|
+
}
|
|
24
27
|
}
|
|
25
|
-
}
|
|
28
|
+
},
|
|
26
29
|
rules: getTypeScriptRules(options)
|
|
27
30
|
}, overrides);
|
|
28
31
|
}
|
package/dist/configs/vitest.mjs
CHANGED
|
@@ -12,7 +12,7 @@ function getVitestConfig(options) {
|
|
|
12
12
|
return mergeConfigs({
|
|
13
13
|
name: "shayanthenerd/vitest",
|
|
14
14
|
files: [globs.test],
|
|
15
|
-
|
|
15
|
+
plugins: { vitest: eslintPluginVitest },
|
|
16
16
|
rules: getVitestRules(options)
|
|
17
17
|
}, overrides);
|
|
18
18
|
}
|
package/dist/configs/vue.mjs
CHANGED
|
@@ -5,10 +5,14 @@ import { getVueRules } from "../rules/vue.mjs";
|
|
|
5
5
|
import { getVueAccessibilityRules } from "../rules/vueAccessibility.mjs";
|
|
6
6
|
import { mergeConfigs } from "eslint-flat-config-utils";
|
|
7
7
|
import eslintPluginVue from "eslint-plugin-vue";
|
|
8
|
-
import
|
|
8
|
+
import { parser } from "typescript-eslint";
|
|
9
9
|
import eslintPluginVueAccessibility from "eslint-plugin-vuejs-accessibility";
|
|
10
10
|
|
|
11
11
|
//#region src/configs/vue.ts
|
|
12
|
+
const vueSetupConfig = eslintPluginVue.configs["flat/recommended"].find((config) => {
|
|
13
|
+
return config.name === "vue/base/setup-for-vue";
|
|
14
|
+
});
|
|
15
|
+
vueSetupConfig.name = "setup";
|
|
12
16
|
function getVueConfig(options) {
|
|
13
17
|
const { vue } = options.configs;
|
|
14
18
|
const accessibility = isEnabled(vue) && isEnabled(vue.accessibility);
|
|
@@ -16,15 +20,23 @@ function getVueConfig(options) {
|
|
|
16
20
|
return mergeConfigs({
|
|
17
21
|
name: "shayanthenerd/vue",
|
|
18
22
|
files: [globs.vue],
|
|
19
|
-
extends: [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
extends: [vueSetupConfig],
|
|
24
|
+
plugins: {
|
|
25
|
+
vue: eslintPluginVue,
|
|
26
|
+
...accessibility && { "vuejs-accessibility": eslintPluginVueAccessibility }
|
|
27
|
+
},
|
|
28
|
+
languageOptions: {
|
|
29
|
+
globals: eslintPluginVueAccessibility.configs["flat/recommended"][0]?.languageOptions.globals,
|
|
30
|
+
parser: vueSetupConfig.languageOptions?.parser,
|
|
31
|
+
parserOptions: {
|
|
32
|
+
parser,
|
|
33
|
+
extraFileExtensions: [".vue"],
|
|
34
|
+
vueFeatures: { filter: false }
|
|
35
|
+
}
|
|
36
|
+
},
|
|
25
37
|
rules: {
|
|
26
38
|
...getVueRules(options),
|
|
27
|
-
...accessibility
|
|
39
|
+
...accessibility && getVueAccessibilityRules(options)
|
|
28
40
|
}
|
|
29
41
|
}, overrides);
|
|
30
42
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -4,10 +4,10 @@ import { Linter } from "eslint";
|
|
|
4
4
|
//#region src/index.d.ts
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Define
|
|
7
|
+
* Define ESLint configuration based on the provided options and any number of Flat Config Objects.
|
|
8
8
|
*
|
|
9
9
|
* @param {Options} options - Options to configure and customize the config
|
|
10
|
-
* @param {...ConfigObject} configs - Additional Flat Config
|
|
10
|
+
* @param {...ConfigObject} configs - Additional Flat Config Objects to extend the default config
|
|
11
11
|
*
|
|
12
12
|
* @returns {Linter.Config[]} The merged ESLint configuration array
|
|
13
13
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -25,10 +25,10 @@ import path from "node:path";
|
|
|
25
25
|
|
|
26
26
|
//#region src/index.ts
|
|
27
27
|
/**
|
|
28
|
-
* Define
|
|
28
|
+
* Define ESLint configuration based on the provided options and any number of Flat Config Objects.
|
|
29
29
|
*
|
|
30
30
|
* @param {Options} options - Options to configure and customize the config
|
|
31
|
-
* @param {...ConfigObject} configs - Additional Flat Config
|
|
31
|
+
* @param {...ConfigObject} configs - Additional Flat Config Objects to extend the default config
|
|
32
32
|
*
|
|
33
33
|
* @returns {Linter.Config[]} The merged ESLint configuration array
|
|
34
34
|
*/
|
|
@@ -39,33 +39,34 @@ function defineConfig(options = {}, ...configs) {
|
|
|
39
39
|
gitignore,
|
|
40
40
|
patterns: ignores
|
|
41
41
|
});
|
|
42
|
-
const oxlintConfigPath = path.resolve(oxlint || defaultOptions.configs.oxlint);
|
|
43
|
-
|
|
42
|
+
const oxlintConfigPath = oxlint ? path.resolve(oxlint || defaultOptions.configs.oxlint) : "";
|
|
43
|
+
const oxlintOverrides = oxlint ? eslintPluginOXLint.buildFromOxlintConfigFile(oxlintConfigPath).filter((config) => config.name !== "oxlint/vue-svelte-exceptions") : [];
|
|
44
|
+
return defineConfig$1([
|
|
45
|
+
globalIgnores(ignorePatterns, "shayanthenerd/ignores"),
|
|
44
46
|
{
|
|
45
47
|
name: "shayanthenerd/global",
|
|
46
48
|
linterOptions,
|
|
47
49
|
settings,
|
|
48
50
|
rules
|
|
49
51
|
},
|
|
50
|
-
globalIgnores(ignorePatterns, "shayanthenerd/ignores"),
|
|
51
52
|
getBaseConfig(mergedOptions),
|
|
52
|
-
|
|
53
|
-
isEnabled(
|
|
54
|
-
isEnabled(
|
|
55
|
-
isEnabled(
|
|
56
|
-
|
|
57
|
-
isEnabled(
|
|
58
|
-
isEnabled(
|
|
59
|
-
isEnabled(tailwind)
|
|
60
|
-
isEnabled(vue)
|
|
61
|
-
isEnabled(vue)
|
|
62
|
-
isEnabled(vue) && isEnabled(nuxt)
|
|
63
|
-
isEnabled(storybook)
|
|
64
|
-
isEnabled(vitest)
|
|
65
|
-
isEnabled(
|
|
66
|
-
isEnabled(
|
|
67
|
-
...
|
|
68
|
-
oxlint
|
|
53
|
+
isEnabled(typescript) && getTypeScriptConfig(mergedOptions),
|
|
54
|
+
isEnabled(html) && getHTMLConfig(mergedOptions),
|
|
55
|
+
isEnabled(css) && getCSSConfig(mergedOptions),
|
|
56
|
+
isEnabled(importX) && getImportXConfig(mergedOptions),
|
|
57
|
+
preferNamedExports && getRestrictedExports(),
|
|
58
|
+
isEnabled(stylistic) && getStylisticConfig(mergedOptions),
|
|
59
|
+
isEnabled(perfectionist) && getPerfectionistConfig(mergedOptions),
|
|
60
|
+
isEnabled(tailwind) && getTailwindConfig(mergedOptions),
|
|
61
|
+
isEnabled(vue) && getVueConfig(mergedOptions),
|
|
62
|
+
isEnabled(vue) && getVueComponentNamesConfig(),
|
|
63
|
+
isEnabled(vue) && isEnabled(nuxt) && getVueServerComponentsConfig(),
|
|
64
|
+
isEnabled(storybook) && getStorybookConfig(mergedOptions),
|
|
65
|
+
isEnabled(vitest) && getVitestConfig(mergedOptions),
|
|
66
|
+
isEnabled(cypress) && getCypressConfig(mergedOptions),
|
|
67
|
+
isEnabled(playwright) && getPlaywrightConfig(mergedOptions),
|
|
68
|
+
...oxlintOverrides,
|
|
69
|
+
oxlint && getOXLintOverridesConfig(mergedOptions),
|
|
69
70
|
...configs
|
|
70
71
|
].filter(Boolean));
|
|
71
72
|
}
|
package/dist/oxlint.config.jsonc
CHANGED
package/dist/rules/css.mjs
CHANGED
|
@@ -50,13 +50,22 @@ function getCSSRules(options) {
|
|
|
50
50
|
const { css } = options.configs;
|
|
51
51
|
const { useBaseline, allowedRelativeFontUnits } = isEnabled(css) ? css : defaultOptions.configs.css;
|
|
52
52
|
return {
|
|
53
|
+
"css/font-family-fallbacks": "warn",
|
|
54
|
+
"css/no-duplicate-imports": "error",
|
|
55
|
+
"css/no-duplicate-keyframe-selectors": "error",
|
|
56
|
+
"css/no-empty-blocks": "error",
|
|
57
|
+
"css/no-important": "warn",
|
|
58
|
+
"css/no-invalid-at-rule-placement": "error",
|
|
59
|
+
"css/no-invalid-at-rules": "error",
|
|
60
|
+
"css/no-invalid-named-grid-areas": "error",
|
|
53
61
|
"css/no-invalid-properties": ["error", { allowUnknownVariables: true }],
|
|
54
|
-
"css/
|
|
55
|
-
"css/use-baseline": useBaseline ? ["warn", { available: useBaseline }] : "off",
|
|
62
|
+
"css/no-unmatchable-selectors": "error",
|
|
56
63
|
"css/prefer-logical-properties": ["error", {
|
|
57
64
|
allowUnits: allowedPhysicalUnits,
|
|
58
65
|
allowProperties: allowedPhysicalProperties
|
|
59
|
-
}]
|
|
66
|
+
}],
|
|
67
|
+
"css/relative-font-units": ["warn", { allowUnits: allowedRelativeFontUnits }],
|
|
68
|
+
"css/use-baseline": useBaseline ? ["warn", { available: useBaseline }] : "off"
|
|
60
69
|
};
|
|
61
70
|
}
|
|
62
71
|
|
package/dist/rules/cypress.mjs
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
//#region src/rules/cypress.ts
|
|
2
2
|
function getCypressRules() {
|
|
3
3
|
return {
|
|
4
|
+
"cypress/no-assigning-return-values": "error",
|
|
5
|
+
"cypress/no-async-before": "warn",
|
|
6
|
+
"cypress/no-async-tests": "error",
|
|
7
|
+
"cypress/no-chained-get": "error",
|
|
8
|
+
"cypress/no-debug": "error",
|
|
4
9
|
"cypress/no-force": "error",
|
|
5
10
|
"cypress/no-pause": "error",
|
|
11
|
+
"cypress/no-unnecessary-waiting": "error",
|
|
6
12
|
"cypress/no-xpath": "error",
|
|
7
|
-
"cypress/
|
|
8
|
-
"cypress/no-chained-get": "error",
|
|
9
|
-
"cypress/assertion-before-screenshot": "error"
|
|
13
|
+
"cypress/unsafe-to-chain-command": "error"
|
|
10
14
|
};
|
|
11
15
|
}
|
|
12
16
|
|
package/dist/rules/html.mjs
CHANGED
|
@@ -3,50 +3,72 @@ import { defaultOptions } from "../utils/options/defaultOptions.mjs";
|
|
|
3
3
|
|
|
4
4
|
//#region src/rules/html.ts
|
|
5
5
|
function getHTMLRules(options) {
|
|
6
|
-
const { html, stylistic } = options.configs;
|
|
6
|
+
const { html, tailwind, stylistic } = options.configs;
|
|
7
7
|
const { useBaseline, idNamingConvention } = isEnabled(html) ? html : defaultOptions.configs.html;
|
|
8
8
|
const { indent, useTabs, maxAttributesPerLine, maxConsecutiveEmptyLines, selfCloseVoidHTMLElements } = isEnabled(stylistic) ? stylistic : defaultOptions.configs.stylistic;
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
"@html-eslint/no-target-blank": "error",
|
|
9
|
+
const htmlRules = {
|
|
10
|
+
"@html-eslint/no-duplicate-attrs": "error",
|
|
12
11
|
"@html-eslint/no-duplicate-class": "warn",
|
|
12
|
+
"@html-eslint/no-duplicate-id": "error",
|
|
13
|
+
"@html-eslint/no-duplicate-in-head": "error",
|
|
14
|
+
"@html-eslint/no-ineffective-attrs": "warn",
|
|
15
|
+
"@html-eslint/no-invalid-entity": "error",
|
|
16
|
+
"@html-eslint/no-nested-interactive": "error",
|
|
17
|
+
"@html-eslint/no-obsolete-tags": "error",
|
|
18
|
+
"@html-eslint/no-script-style-type": "warn",
|
|
19
|
+
"@html-eslint/no-target-blank": "warn",
|
|
20
|
+
"@html-eslint/prefer-https": "warn",
|
|
13
21
|
"@html-eslint/require-button-type": "error",
|
|
14
|
-
"@html-eslint/
|
|
15
|
-
"@html-eslint/no-script-style-type": "error",
|
|
16
|
-
"@html-eslint/require-meta-charset": "error",
|
|
17
|
-
"@html-eslint/quotes": [
|
|
18
|
-
"warn",
|
|
19
|
-
"double",
|
|
20
|
-
{ enforceTemplatedAttrValue: true }
|
|
21
|
-
],
|
|
22
|
-
"@html-eslint/use-baseline": useBaseline ? ["warn", { available: useBaseline }] : "off",
|
|
23
|
-
"@html-eslint/require-closing-tags": ["error", {
|
|
22
|
+
"@html-eslint/require-closing-tags": ["warn", {
|
|
24
23
|
selfClosingCustomPatterns: ["-"],
|
|
25
24
|
selfClosing: selfCloseVoidHTMLElements
|
|
26
25
|
}],
|
|
26
|
+
"@html-eslint/require-doctype": "error",
|
|
27
|
+
"@html-eslint/require-explicit-size": "warn",
|
|
28
|
+
"@html-eslint/require-li-container": "error",
|
|
29
|
+
"@html-eslint/require-meta-charset": "error",
|
|
30
|
+
"@html-eslint/use-baseline": useBaseline ? ["warn", { available: useBaseline }] : "off",
|
|
31
|
+
"@html-eslint/no-multiple-h1": "error",
|
|
32
|
+
"@html-eslint/require-lang": "error",
|
|
27
33
|
"@html-eslint/require-meta-description": "error",
|
|
28
34
|
"@html-eslint/require-open-graph-protocol": "error",
|
|
35
|
+
"@html-eslint/require-title": "error",
|
|
29
36
|
"@html-eslint/no-abstract-roles": "error",
|
|
30
37
|
"@html-eslint/no-accesskey-attrs": "error",
|
|
31
|
-
"@html-eslint/require-frame-title": "error",
|
|
32
38
|
"@html-eslint/no-aria-hidden-body": "error",
|
|
39
|
+
"@html-eslint/no-aria-hidden-on-focusable": "error",
|
|
40
|
+
"@html-eslint/no-empty-headings": "error",
|
|
41
|
+
"@html-eslint/no-heading-inside-button": "error",
|
|
42
|
+
"@html-eslint/no-invalid-role": "error",
|
|
43
|
+
"@html-eslint/no-non-scalable-viewport": "error",
|
|
33
44
|
"@html-eslint/no-positive-tabindex": "error",
|
|
34
|
-
"@html-eslint/require-meta-viewport": "error",
|
|
35
45
|
"@html-eslint/no-skip-heading-levels": "error",
|
|
36
|
-
"@html-eslint/
|
|
37
|
-
"@html-eslint/
|
|
38
|
-
"@html-eslint/
|
|
39
|
-
"@html-eslint/
|
|
40
|
-
"@html-eslint/element-newline": ["warn", { inline: ["$inline"] }],
|
|
46
|
+
"@html-eslint/require-frame-title": "error",
|
|
47
|
+
"@html-eslint/require-img-alt": "error",
|
|
48
|
+
"@html-eslint/require-input-label": "error",
|
|
49
|
+
"@html-eslint/require-meta-viewport": "error",
|
|
41
50
|
"@html-eslint/attrs-newline": ["warn", { ifAttrsMoreThan: maxAttributesPerLine }],
|
|
42
|
-
"@html-eslint/
|
|
51
|
+
"@html-eslint/element-newline": ["warn", { inline: ["$inline"] }],
|
|
52
|
+
"@html-eslint/id-naming-convention": ["warn", idNamingConvention],
|
|
53
|
+
"@html-eslint/indent": ["warn", useTabs ? "tab" : indent],
|
|
54
|
+
"@html-eslint/lowercase": "warn",
|
|
43
55
|
"@html-eslint/no-extra-spacing-attrs": ["warn", {
|
|
44
56
|
disallowTabs: true,
|
|
45
57
|
disallowMissing: true,
|
|
46
58
|
disallowInAssignment: true,
|
|
47
59
|
enforceBeforeSelfClose: true
|
|
48
|
-
}]
|
|
60
|
+
}],
|
|
61
|
+
"@html-eslint/no-extra-spacing-text": ["warn", { skip: ["pre"] }],
|
|
62
|
+
"@html-eslint/no-multiple-empty-lines": ["warn", { max: maxConsecutiveEmptyLines }],
|
|
63
|
+
"@html-eslint/no-trailing-spaces": "warn",
|
|
64
|
+
"@html-eslint/quotes": [
|
|
65
|
+
"warn",
|
|
66
|
+
"double",
|
|
67
|
+
{ enforceTemplatedAttrValue: true }
|
|
68
|
+
]
|
|
49
69
|
};
|
|
70
|
+
if (isEnabled(tailwind)) htmlRules["better-tailwindcss/no-duplicate-classes"] = "off";
|
|
71
|
+
return htmlRules;
|
|
50
72
|
}
|
|
51
73
|
|
|
52
74
|
//#endregion
|