@shayanthenerd/eslint-config 0.4.6 → 0.6.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/README.md +0 -1
- package/dist/configs/html.js +1 -0
- package/dist/configs/importX.js +1 -22
- package/dist/configs/oxlintOverrides.js +2 -5
- package/dist/configs/restrictedExports.js +19 -0
- package/dist/configs/typescript.js +5 -3
- package/dist/configs/vueComponentNames.js +1 -2
- package/dist/configs/vueServerComponents.js +14 -0
- package/dist/index.js +4 -4
- package/dist/oxlint.config.jsonc +9 -9
- package/dist/rules/html.js +1 -0
- package/dist/rules/importX.js +8 -13
- package/dist/rules/javascript.js +5 -2
- package/dist/rules/tailwind.js +1 -1
- package/dist/rules/typescript.js +1 -0
- package/dist/rules/vue.js +26 -10
- package/dist/types/configOptions/base.d.ts +9 -1
- package/dist/types/configOptions/importX.d.ts +0 -14
- package/dist/types/configOptions/vue.d.ts +11 -10
- package/dist/types/configOptions/vueAccessibility.d.ts +7 -1
- package/dist/types/eslint-schema.d.ts +72 -498
- package/dist/utils/globs.js +4 -7
- package/dist/utils/isPackageDetected.js +1 -0
- package/dist/utils/options/defaultOptions.js +3 -4
- package/dist/utils/options/mergeWithDefaults.js +11 -0
- package/dist/utils/vue/getRestrictedVueElements.js +1 -1
- package/dist/utils/vue/getRestrictedVueInputs.js +1 -1
- package/package.json +32 -33
- package/dist/configs/commons.js +0 -26
- package/dist/configs/nuxtMultiRootTemplate.js +0 -14
package/README.md
CHANGED
package/dist/configs/html.js
CHANGED
package/dist/configs/importX.js
CHANGED
|
@@ -3,39 +3,18 @@ import { isEnabled } from "../utils/isEnabled.js";
|
|
|
3
3
|
import { defaultOptions } from "../utils/options/defaultOptions.js";
|
|
4
4
|
import { getImportXRules } from "../rules/importX.js";
|
|
5
5
|
import { mergeConfigs } from "eslint-flat-config-utils";
|
|
6
|
-
import eslintPluginImport from "eslint-plugin-import";
|
|
7
6
|
import eslintPluginImportX from "eslint-plugin-import-x";
|
|
8
7
|
import eslintPluginUnusedImports from "eslint-plugin-unused-imports";
|
|
9
8
|
|
|
10
9
|
//#region src/configs/importX.ts
|
|
11
|
-
eslintPluginImport.flatConfigs.recommended.rules = {};
|
|
12
10
|
function getImportXConfig(options) {
|
|
13
11
|
const { vue, importX, typescript } = options.configs;
|
|
14
12
|
const { overrides } = isEnabled(importX) ? importX : defaultOptions.configs.importX;
|
|
15
13
|
const importXConfig = {
|
|
16
14
|
name: "shayanthenerd/import-x",
|
|
17
15
|
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
|
-
],
|
|
16
|
+
extends: [eslintPluginImportX.flatConfigs.recommended, typescript ? eslintPluginImportX.flatConfigs.typescript : {}],
|
|
24
17
|
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
18
|
rules: getImportXRules(options)
|
|
40
19
|
};
|
|
41
20
|
return mergeConfigs(importXConfig, overrides);
|
|
@@ -2,7 +2,6 @@ import { globs } from "../utils/globs.js";
|
|
|
2
2
|
import { isEnabled } from "../utils/isEnabled.js";
|
|
3
3
|
import { getJavaScriptRules } from "../rules/javascript.js";
|
|
4
4
|
import { getVitestRules } from "../rules/vitest.js";
|
|
5
|
-
import { getImportXRules } from "../rules/importX.js";
|
|
6
5
|
import { getPlaywrightRules } from "../rules/playwright.js";
|
|
7
6
|
import { getTypeScriptRules } from "../rules/typescript.js";
|
|
8
7
|
import typescriptESLint from "typescript-eslint";
|
|
@@ -12,9 +11,8 @@ import eslintPluginPlaywright from "eslint-plugin-playwright";
|
|
|
12
11
|
|
|
13
12
|
//#region src/configs/oxlintOverrides.ts
|
|
14
13
|
function getOXLintOverridesConfig(options) {
|
|
15
|
-
const { vue,
|
|
14
|
+
const { vue, typescript, test: { vitest, playwright } } = options.configs;
|
|
16
15
|
const vitestRules = getVitestRules(options);
|
|
17
|
-
const importXRules = getImportXRules(options);
|
|
18
16
|
const javascriptRules = getJavaScriptRules(options);
|
|
19
17
|
const typescriptRules = getTypeScriptRules(options);
|
|
20
18
|
const playwrightRules = getPlaywrightRules(options);
|
|
@@ -22,7 +20,6 @@ function getOXLintOverridesConfig(options) {
|
|
|
22
20
|
name: "shayanthenerd/oxlint/overrides",
|
|
23
21
|
files: [
|
|
24
22
|
globs.src,
|
|
25
|
-
globs.commons,
|
|
26
23
|
vue ? globs.vue : "",
|
|
27
24
|
vitest || playwright ? globs.test : ""
|
|
28
25
|
],
|
|
@@ -36,8 +33,8 @@ function getOXLintOverridesConfig(options) {
|
|
|
36
33
|
"max-depth": javascriptRules["max-depth"],
|
|
37
34
|
"func-style": javascriptRules["func-style"],
|
|
38
35
|
"max-nested-callbacks": javascriptRules["max-nested-callbacks"],
|
|
36
|
+
"@typescript-eslint/explicit-module-boundary-types": typescriptRules["@typescript-eslint/explicit-module-boundary-types"],
|
|
39
37
|
"@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
38
|
"playwright/max-nested-describe": isEnabled(playwright) ? playwrightRules["playwright/max-nested-describe"] : "off",
|
|
42
39
|
"vitest/consistent-test-it": isEnabled(vitest) ? vitestRules["vitest/consistent-test-it"] : "off",
|
|
43
40
|
"vitest/max-nested-describe": isEnabled(vitest) ? vitestRules["vitest/max-nested-describe"] : "off"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { globs } from "../utils/globs.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/restrictedExports.ts
|
|
4
|
+
function getRestrictedExports() {
|
|
5
|
+
const restrictedExportsConfig = {
|
|
6
|
+
name: "shayanthenerd/restricted-exports",
|
|
7
|
+
files: [globs.restrictedExports],
|
|
8
|
+
rules: { "no-restricted-exports": ["error", { restrictDefaultExports: {
|
|
9
|
+
named: true,
|
|
10
|
+
direct: true,
|
|
11
|
+
namedFrom: true,
|
|
12
|
+
namespaceFrom: true
|
|
13
|
+
} }] }
|
|
14
|
+
};
|
|
15
|
+
return restrictedExportsConfig;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { getRestrictedExports };
|
|
@@ -3,6 +3,7 @@ import { isEnabled } from "../utils/isEnabled.js";
|
|
|
3
3
|
import { defaultOptions } from "../utils/options/defaultOptions.js";
|
|
4
4
|
import { getTypeScriptRules } from "../rules/typescript.js";
|
|
5
5
|
import typescriptESLint from "typescript-eslint";
|
|
6
|
+
import path from "node:path";
|
|
6
7
|
import { mergeConfigs } from "eslint-flat-config-utils";
|
|
7
8
|
|
|
8
9
|
//#region src/configs/typescript.ts
|
|
@@ -15,10 +16,11 @@ function getTypeScriptConfig(options) {
|
|
|
15
16
|
files: [globs.ts, vue ? globs.vue : ""],
|
|
16
17
|
extends: [typescriptESLint.configs.strictTypeChecked, typescriptESLint.configs.stylisticTypeChecked],
|
|
17
18
|
languageOptions: { parserOptions: {
|
|
18
|
-
|
|
19
|
+
warnOnUnsupportedTypeScriptVersion: false,
|
|
20
|
+
tsconfigRootDir: tsConfig ? path.resolve(tsConfig.rootDir) : void 0,
|
|
19
21
|
projectService: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
defaultProject: tsConfig ? tsConfig.filename : void 0,
|
|
23
|
+
allowDefaultProject: allowedDefaultProjects
|
|
22
24
|
}
|
|
23
25
|
} },
|
|
24
26
|
rules: getTypeScriptRules(options)
|
|
@@ -4,8 +4,7 @@ import { globs } from "../utils/globs.js";
|
|
|
4
4
|
function getVueComponentNamesConfig() {
|
|
5
5
|
const vueComponentNamesConfig = {
|
|
6
6
|
name: "shayanthenerd/vue/multi-word-component-names",
|
|
7
|
-
files: [globs.
|
|
8
|
-
ignores: [globs.vueComponentNamesIgnore],
|
|
7
|
+
files: [globs.vueAppErrorLayoutsPages],
|
|
9
8
|
rules: {
|
|
10
9
|
"vue/match-component-file-name": "off",
|
|
11
10
|
"vue/multi-word-component-names": "off",
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { globs } from "../utils/globs.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/vueServerComponents.ts
|
|
4
|
+
function getVueServerComponentsConfig() {
|
|
5
|
+
const vueServerComponentsConfig = {
|
|
6
|
+
name: "shayanthenerd/vue/server-components",
|
|
7
|
+
files: [globs.vueServerComponents],
|
|
8
|
+
rules: { "vue/no-multiple-template-root": "error" }
|
|
9
|
+
};
|
|
10
|
+
return vueServerComponentsConfig;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { getVueServerComponentsConfig };
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,6 @@ import { getVueConfig } from "./configs/vue.js";
|
|
|
5
5
|
import { getBaseConfig } from "./configs/base.js";
|
|
6
6
|
import { getHTMLConfig } from "./configs/html.js";
|
|
7
7
|
import { getVitestConfig } from "./configs/vitest.js";
|
|
8
|
-
import { getCommonsConfig } from "./configs/commons.js";
|
|
9
8
|
import { getCypressConfig } from "./configs/cypress.js";
|
|
10
9
|
import { getImportXConfig } from "./configs/importX.js";
|
|
11
10
|
import { getTailwindConfig } from "./configs/tailwind.js";
|
|
@@ -14,11 +13,12 @@ import { getStylisticConfig } from "./configs/stylistic.js";
|
|
|
14
13
|
import { getPlaywrightConfig } from "./configs/playwright.js";
|
|
15
14
|
import { getTypeScriptConfig } from "./configs/typescript.js";
|
|
16
15
|
import { getPerfectionistConfig } from "./configs/perfectionist.js";
|
|
16
|
+
import { getRestrictedExports } from "./configs/restrictedExports.js";
|
|
17
17
|
import { getOXLintOverridesConfig } from "./configs/oxlintOverrides.js";
|
|
18
18
|
import { getIgnorePatterns } from "./utils/ignores/getIgnorePatterns.js";
|
|
19
19
|
import { mergeWithDefaults } from "./utils/options/mergeWithDefaults.js";
|
|
20
20
|
import { getVueComponentNamesConfig } from "./configs/vueComponentNames.js";
|
|
21
|
-
import {
|
|
21
|
+
import { getVueServerComponentsConfig } from "./configs/vueServerComponents.js";
|
|
22
22
|
import { globalIgnores } from "eslint/config";
|
|
23
23
|
import eslintPluginOXLint from "eslint-plugin-oxlint";
|
|
24
24
|
import { config } from "typescript-eslint";
|
|
@@ -35,7 +35,7 @@ import path from "node:path";
|
|
|
35
35
|
*/
|
|
36
36
|
function defineConfig(options = {}, ...configs) {
|
|
37
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;
|
|
38
|
+
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;
|
|
39
39
|
const ignorePatterns = getIgnorePatterns({
|
|
40
40
|
gitignore,
|
|
41
41
|
patterns: ignores
|
|
@@ -46,7 +46,7 @@ function defineConfig(options = {}, ...configs) {
|
|
|
46
46
|
linterOptions,
|
|
47
47
|
settings,
|
|
48
48
|
rules
|
|
49
|
-
}, globalIgnores(ignorePatterns, "shayanthenerd/ignores"), getBaseConfig(mergedOptions),
|
|
49
|
+
}, globalIgnores(ignorePatterns, "shayanthenerd/ignores"), getBaseConfig(mergedOptions), preferNamedExports ? getRestrictedExports() : {}, 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) ? getVueServerComponentsConfig() : {}, 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
50
|
return eslintConfig;
|
|
51
51
|
}
|
|
52
52
|
|
package/dist/oxlint.config.jsonc
CHANGED
|
@@ -66,9 +66,11 @@
|
|
|
66
66
|
/*** TypeScript ***/
|
|
67
67
|
"typescript/triple-slash-reference": "off",
|
|
68
68
|
"typescript/explicit-function-return-type": "off",
|
|
69
|
+
"typescript/explicit-module-boundary-types": "off",
|
|
69
70
|
"typescript/consistent-indexed-object-style": ["warn", "record"],
|
|
70
71
|
|
|
71
72
|
/*** Import ***/
|
|
73
|
+
"import/extensions": "off",
|
|
72
74
|
"import/unambiguous": "off",
|
|
73
75
|
"import/no-namespace": "off",
|
|
74
76
|
"import/exports-last": "off",
|
|
@@ -79,11 +81,13 @@
|
|
|
79
81
|
"import/no-anonymous-default-export": "off",
|
|
80
82
|
|
|
81
83
|
/*** Unicorn ***/
|
|
84
|
+
"unicorn/no-null": "off",
|
|
82
85
|
"unicorn/filename-case": "off",
|
|
83
86
|
"unicorn/prefer-set-has": "off",
|
|
84
87
|
"unicorn/no-array-reduce": "off",
|
|
85
88
|
"unicorn/prefer-string-raw": "off",
|
|
86
89
|
"unicorn/no-array-for-each": "off",
|
|
90
|
+
"unicorn/prefer-global-this": "off",
|
|
87
91
|
"unicorn/no-useless-undefined": "off",
|
|
88
92
|
"unicorn/prefer-prototype-methods": "off",
|
|
89
93
|
"unicorn/no-await-expression-member": "off",
|
|
@@ -93,13 +97,17 @@
|
|
|
93
97
|
"jest/prefer-lowercase-title": "warn",
|
|
94
98
|
"jest/require-top-level-describe": "off",
|
|
95
99
|
|
|
100
|
+
/*** JSDoc ***/
|
|
101
|
+
"jsdoc/require-param": "off",
|
|
102
|
+
"jsdoc/require-returns": "off",
|
|
103
|
+
"jsdoc/require-property": "off",
|
|
104
|
+
|
|
96
105
|
/*** Customizable Overrides ***/
|
|
97
106
|
/* These rules are customizable in the ESLint config, but OXLint doesn't respect them. */
|
|
98
107
|
"eslint/max-depth": "off",
|
|
99
108
|
"eslint/func-style": "off",
|
|
100
109
|
"eslint/max-nested-callbacks": "off",
|
|
101
110
|
"typescript/consistent-type-definitions": "off",
|
|
102
|
-
"import/extensions": "off",
|
|
103
111
|
"vitest/consistent-test-it": "off",
|
|
104
112
|
"jest/max-nested-describe": "off"
|
|
105
113
|
},
|
|
@@ -110,14 +118,6 @@
|
|
|
110
118
|
"rules": {
|
|
111
119
|
"eslint/no-undef": "off"
|
|
112
120
|
}
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
"files": [
|
|
116
|
-
"**/{shared,dto,dtos,model,models,helper,helpers,module,modules,@type,@types,types,util,utils,utilities,composable,composables,repo,repos,repository,repositories}/**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}"
|
|
117
|
-
],
|
|
118
|
-
"rules": {
|
|
119
|
-
"typescript/explicit-function-return-type": "error"
|
|
120
|
-
}
|
|
121
121
|
}
|
|
122
122
|
],
|
|
123
123
|
|
package/dist/rules/html.js
CHANGED
|
@@ -11,6 +11,7 @@ function getHTMLRules(options) {
|
|
|
11
11
|
"@html-eslint/no-target-blank": "error",
|
|
12
12
|
"@html-eslint/no-duplicate-class": "warn",
|
|
13
13
|
"@html-eslint/require-button-type": "error",
|
|
14
|
+
"@html-eslint/no-ineffective-attrs": "error",
|
|
14
15
|
"@html-eslint/no-script-style-type": "error",
|
|
15
16
|
"@html-eslint/require-meta-charset": "error",
|
|
16
17
|
"@html-eslint/quotes": [
|
package/dist/rules/importX.js
CHANGED
|
@@ -4,22 +4,13 @@ import path from "node:path";
|
|
|
4
4
|
|
|
5
5
|
//#region src/rules/importX.ts
|
|
6
6
|
function getImportXRules(options) {
|
|
7
|
-
const { packageDir, configs: { importX } } = options;
|
|
8
|
-
const { removeUnusedImports
|
|
7
|
+
const { packageDir, configs: { importX, typescript } } = options;
|
|
8
|
+
const { removeUnusedImports } = isEnabled(importX) ? importX : defaultOptions.configs.importX;
|
|
9
9
|
const importXRules = {
|
|
10
10
|
"unused-imports/no-unused-imports": removeUnusedImports ? "warn" : "off",
|
|
11
|
-
"import-x/extensions": "off",
|
|
12
|
-
"import/extensions": [
|
|
13
|
-
requireFileExtension ? "warn" : "off",
|
|
14
|
-
"always",
|
|
15
|
-
{
|
|
16
|
-
ignorePackages: true,
|
|
17
|
-
checkTypeImports: true
|
|
18
|
-
}
|
|
19
|
-
],
|
|
20
11
|
"import-x/no-amd": "error",
|
|
21
|
-
"import-x/exports-last": "warn",
|
|
22
12
|
"import-x/no-commonjs": "error",
|
|
13
|
+
"import-x/exports-last": "warn",
|
|
23
14
|
"import-x/no-deprecated": "warn",
|
|
24
15
|
"import-x/group-exports": "warn",
|
|
25
16
|
"import-x/no-self-import": "error",
|
|
@@ -27,11 +18,15 @@ function getImportXRules(options) {
|
|
|
27
18
|
"import-x/no-named-default": "error",
|
|
28
19
|
"import-x/no-mutable-exports": "error",
|
|
29
20
|
"import-x/no-empty-named-blocks": "error",
|
|
30
|
-
"import-x/no-named-as-default-member": "off",
|
|
31
21
|
"import-x/no-import-module-exports": "error",
|
|
32
22
|
"import-x/no-useless-path-segments": "error",
|
|
23
|
+
"import-x/no-named-as-default-member": "off",
|
|
24
|
+
"import-x/named": typescript ? "off" : "error",
|
|
25
|
+
"import-x/export": typescript ? "off" : "error",
|
|
26
|
+
"import-x/default": typescript ? "off" : "error",
|
|
33
27
|
"import-x/consistent-type-specifier-style": "warn",
|
|
34
28
|
"import-x/first": ["warn", "disable-absolute-first"],
|
|
29
|
+
"import-x/no-unresolved": typescript ? "off" : "error",
|
|
35
30
|
"import-x/namespace": ["error", { allowComputed: true }],
|
|
36
31
|
"import-x/no-duplicates": ["error", { considerQueryString: true }],
|
|
37
32
|
"import-x/no-cycle": ["error", {
|
package/dist/rules/javascript.js
CHANGED
|
@@ -37,7 +37,6 @@ function getJavaScriptRules(options) {
|
|
|
37
37
|
"no-void": "error",
|
|
38
38
|
"no-proto": "warn",
|
|
39
39
|
"no-empty": "warn",
|
|
40
|
-
"camelcase": "warn",
|
|
41
40
|
"no-caller": "error",
|
|
42
41
|
"no-eq-null": "warn",
|
|
43
42
|
"complexity": "warn",
|
|
@@ -90,7 +89,6 @@ function getJavaScriptRules(options) {
|
|
|
90
89
|
"prefer-destructuring": "warn",
|
|
91
90
|
"no-implicit-coercion": "error",
|
|
92
91
|
"no-array-constructor": "error",
|
|
93
|
-
"no-underscore-dangle": "error",
|
|
94
92
|
"prefer-object-spread": "error",
|
|
95
93
|
"radix": ["error", "as-needed"],
|
|
96
94
|
"curly": ["warn", "multi-line"],
|
|
@@ -121,6 +119,11 @@ function getJavaScriptRules(options) {
|
|
|
121
119
|
"prefer-promise-reject-errors": ["error", { allowEmptyReject: true }],
|
|
122
120
|
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
123
121
|
"no-extra-boolean-cast": ["error", { enforceForInnerExpressions: true }],
|
|
122
|
+
"camelcase": ["warn", {
|
|
123
|
+
properties: "never",
|
|
124
|
+
ignoreImports: true,
|
|
125
|
+
ignoreDestructuring: true
|
|
126
|
+
}],
|
|
124
127
|
"no-console": ["warn", { allow: [
|
|
125
128
|
"info",
|
|
126
129
|
"warn",
|
package/dist/rules/tailwind.js
CHANGED
|
@@ -8,9 +8,9 @@ function getTailwindRules(options) {
|
|
|
8
8
|
const { indent, useTabs, maxLineLength } = isEnabled(stylistic) ? stylistic : defaultOptions.configs.stylistic;
|
|
9
9
|
const isTailwindV4 = isEnabled(tailwind) && tailwind.entryPoint;
|
|
10
10
|
const tailwindRules = {
|
|
11
|
-
"vue/max-len": "off",
|
|
12
11
|
"@stylistic/max-len": "off",
|
|
13
12
|
"css/no-duplicate-imports": "off",
|
|
13
|
+
"vue/first-attribute-linebreak": "off",
|
|
14
14
|
"better-tailwindcss/no-duplicate-classes": "error",
|
|
15
15
|
"better-tailwindcss/no-deprecated-classes": "error",
|
|
16
16
|
"better-tailwindcss/no-conflicting-classes": "error",
|
package/dist/rules/typescript.js
CHANGED
|
@@ -22,6 +22,7 @@ function getTypeScriptRules(options) {
|
|
|
22
22
|
"@typescript-eslint/prefer-enum-initializers": "error",
|
|
23
23
|
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
|
24
24
|
"@typescript-eslint/switch-exhaustiveness-check": "warn",
|
|
25
|
+
"@typescript-eslint/explicit-module-boundary-types": "warn",
|
|
25
26
|
"@typescript-eslint/no-unnecessary-parameter-property-assignment": "warn",
|
|
26
27
|
"@typescript-eslint/method-signature-style": ["error", methodSignatureStyle],
|
|
27
28
|
"@typescript-eslint/consistent-type-definitions": ["warn", typeDefinitionStyle],
|
package/dist/rules/vue.js
CHANGED
|
@@ -5,19 +5,22 @@ import { getRestrictedVueElements } from "../utils/vue/getRestrictedVueElements.
|
|
|
5
5
|
|
|
6
6
|
//#region src/rules/vue.ts
|
|
7
7
|
function getVueRules(options) {
|
|
8
|
-
const { typescript, stylistic, vue, nuxt } = options.configs;
|
|
8
|
+
const { typescript, stylistic, tailwind, vue, nuxt } = options.configs;
|
|
9
9
|
const { indent, useTabs, trailingComma, maxLineLength, maxAttributesPerLine, maxConsecutiveEmptyLines, selfCloseVoidHTMLElements } = isEnabled(stylistic) ? stylistic : defaultOptions.configs.stylistic;
|
|
10
|
-
const { blockLang, blocksOrder, macrosOrder, attributesOrder,
|
|
10
|
+
const { blockLang, blocksOrder, macrosOrder, attributesOrder, destructureProps, vForDelimiterStyle, attributeHyphenation, allowedStyleAttributes, preferVBindTrueShorthand, componentNameCaseInTemplate, preferVBindSameNameShorthand, restrictedElements: userRestrictedElements, ignoredUndefinedComponents: userIgnoredUndefinedComponents, restrictedStaticAttributes: userRestrictedStaticAttributes } = isEnabled(vue) ? vue : defaultOptions.configs.vue;
|
|
11
11
|
const nuxtImage = isEnabled(nuxt) ? nuxt.image : void 0;
|
|
12
12
|
const nuxtUI = isEnabled(nuxt) ? nuxt.ui : void 0;
|
|
13
|
-
const nuxtUIPrefix = isEnabled(nuxt) && isEnabled(nuxt.ui) ? nuxt.ui.prefix :
|
|
13
|
+
const nuxtUIPrefix = isEnabled(nuxt) && isEnabled(nuxt.ui) ? nuxt.ui.prefix : defaultOptions.configs.nuxt.ui.prefix;
|
|
14
14
|
const isScriptLangTS = blockLang.script === "ts";
|
|
15
15
|
const isStyleLangImplicit = blockLang.style === "implicit";
|
|
16
16
|
const vueRules = {
|
|
17
17
|
"no-undef": "off",
|
|
18
18
|
"no-useless-assignment": "off",
|
|
19
19
|
"import-x/default": "off",
|
|
20
|
+
"import-x/no-unresolved": "off",
|
|
21
|
+
"vue/no-multiple-template-root": "off",
|
|
20
22
|
"vue/comment-directive": ["error", { reportUnusedDisableDirectives: true }],
|
|
23
|
+
"vue/require-default-prop": "off",
|
|
21
24
|
"vue/html-closing-bracket-newline": "warn",
|
|
22
25
|
"vue/singleline-html-element-content-newline": "off",
|
|
23
26
|
"vue/html-indent": ["warn", useTabs ? "tab" : indent],
|
|
@@ -56,6 +59,7 @@ function getVueRules(options) {
|
|
|
56
59
|
"vue/custom-event-name-casing": "warn",
|
|
57
60
|
"vue/no-use-v-else-with-v-for": "error",
|
|
58
61
|
"vue/no-empty-component-block": "error",
|
|
62
|
+
"vue/no-negated-v-if-condition": "warn",
|
|
59
63
|
"vue/no-import-compiler-macros": "error",
|
|
60
64
|
"vue/require-typed-object-prop": "error",
|
|
61
65
|
"vue/require-macro-variable-name": "warn",
|
|
@@ -73,7 +77,6 @@ function getVueRules(options) {
|
|
|
73
77
|
"vue/prefer-prop-type-boolean-first": "warn",
|
|
74
78
|
"vue/no-setup-props-reactivity-loss": "error",
|
|
75
79
|
"vue/block-order": ["warn", { order: blocksOrder }],
|
|
76
|
-
"vue/v-on-handler-style": ["error", vOnHandlerStyle],
|
|
77
80
|
"vue/v-for-delimiter-style": ["warn", vForDelimiterStyle],
|
|
78
81
|
"vue/require-typed-ref": isScriptLangTS ? "error" : "off",
|
|
79
82
|
"vue/define-macros-order": ["warn", { order: macrosOrder }],
|
|
@@ -86,7 +89,7 @@ function getVueRules(options) {
|
|
|
86
89
|
"vue/define-props-destructuring": ["warn", { destructure: destructureProps }],
|
|
87
90
|
"vue/define-emits-declaration": ["warn", isScriptLangTS ? "type-based" : "runtime"],
|
|
88
91
|
"vue/define-props-declaration": ["error", isScriptLangTS ? "type-based" : "runtime"],
|
|
89
|
-
"vue/max-len": ["warn", {
|
|
92
|
+
"vue/max-len": [tailwind ? "off" : "warn", {
|
|
90
93
|
tabWidth: indent,
|
|
91
94
|
code: maxLineLength,
|
|
92
95
|
template: Infinity,
|
|
@@ -130,18 +133,28 @@ function getVueRules(options) {
|
|
|
130
133
|
"RouterLink",
|
|
131
134
|
"NuxtLink"
|
|
132
135
|
] : "",
|
|
133
|
-
message: nuxtUI
|
|
136
|
+
message: nuxtUI ? `Use \`<${nuxtUIPrefix}Link>\`.` : void 0
|
|
134
137
|
},
|
|
135
138
|
{
|
|
136
139
|
element: ["a", nuxt ? "RouterLink" : ""],
|
|
137
|
-
message: `Use
|
|
140
|
+
message: `Use \`<${nuxt ? "NuxtLink" : "RouterLink"}>\`.`
|
|
138
141
|
},
|
|
139
|
-
...nuxtUI
|
|
142
|
+
...nuxtUI ? getRestrictedVueElements(nuxtUIPrefix) : [],
|
|
140
143
|
...userRestrictedElements
|
|
141
144
|
],
|
|
142
145
|
"vue/no-restricted-static-attribute": [
|
|
143
146
|
"error",
|
|
144
|
-
...nuxtUI
|
|
147
|
+
...nuxtUI ? getRestrictedVueInputs(nuxtUIPrefix) : [],
|
|
148
|
+
nuxtUI ? {
|
|
149
|
+
key: "href",
|
|
150
|
+
element: `${nuxtUIPrefix}Link`,
|
|
151
|
+
message: "Use `v-bind:to=\"\"`."
|
|
152
|
+
} : { key: "" },
|
|
153
|
+
nuxtUI ? {
|
|
154
|
+
key: "href",
|
|
155
|
+
element: `${nuxtUIPrefix}Button`,
|
|
156
|
+
message: "Use `v-bind:to=\"\"`."
|
|
157
|
+
} : { key: " " },
|
|
145
158
|
...userRestrictedStaticAttributes
|
|
146
159
|
],
|
|
147
160
|
"vue/no-undef-components": ["error", { ignorePatterns: [
|
|
@@ -161,7 +174,10 @@ function getVueRules(options) {
|
|
|
161
174
|
"vue/component-name-in-template-casing": [
|
|
162
175
|
"warn",
|
|
163
176
|
componentNameCaseInTemplate,
|
|
164
|
-
{
|
|
177
|
+
{
|
|
178
|
+
ignores: ["/^\\w+(\\.\\w+)+$/"],
|
|
179
|
+
registeredComponentsOnly: false
|
|
180
|
+
}
|
|
165
181
|
]
|
|
166
182
|
};
|
|
167
183
|
return vueRules;
|
|
@@ -17,7 +17,15 @@ interface BaseOptions extends ConfigWithOverrides {
|
|
|
17
17
|
functionStyle?: RuleOptions<'func-style'>;
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Enforce named exports in the following directories:
|
|
21
|
+
* - 'shared'
|
|
22
|
+
* - 'dto', 'dtos'
|
|
23
|
+
* - 'model', 'models'
|
|
24
|
+
* - 'helper', 'helpers'
|
|
25
|
+
* - 'module', 'modules'
|
|
26
|
+
* - 'util', 'utils', 'utilities'
|
|
27
|
+
* - 'composable', 'composables'
|
|
28
|
+
* - 'repo', 'repos', 'repository', 'repositories'
|
|
21
29
|
*
|
|
22
30
|
* @default true
|
|
23
31
|
*
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ConfigWithOverrides } from "../index.js";
|
|
2
2
|
|
|
3
3
|
//#region src/types/configOptions/importX.d.ts
|
|
4
|
-
|
|
5
4
|
interface ImportXOptions extends ConfigWithOverrides {
|
|
6
5
|
/**
|
|
7
6
|
* Automatically remove unused imports.
|
|
@@ -11,19 +10,6 @@ interface ImportXOptions extends ConfigWithOverrides {
|
|
|
11
10
|
* @see [unused-imports/no-unused-imports](https://github.com/sweepline/eslint-plugin-unused-imports/blob/master/docs/rules/no-unused-imports.md)
|
|
12
11
|
*/
|
|
13
12
|
removeUnusedImports?: boolean;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Require file extensions within the import path.
|
|
17
|
-
*
|
|
18
|
-
* Imports from third-party packages are ignored.
|
|
19
|
-
*
|
|
20
|
-
* `import-x/extensions` rule is currently broken, so `import/extensions` is used as a temporary replacement.
|
|
21
|
-
*
|
|
22
|
-
* @default true
|
|
23
|
-
*
|
|
24
|
-
* @see [import/extensions](https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/extensions.md)
|
|
25
|
-
*/
|
|
26
|
-
requireFileExtension?: boolean;
|
|
27
13
|
}
|
|
28
14
|
//#endregion
|
|
29
15
|
export { type ImportXOptions };
|
|
@@ -144,6 +144,8 @@ interface VueOptions extends ConfigWithOverrides {
|
|
|
144
144
|
/**
|
|
145
145
|
* Enforce consistent casing for component names in `<template>` blocks.
|
|
146
146
|
*
|
|
147
|
+
* Compound components (e.g., `<motion.div>`) are ignored by default.
|
|
148
|
+
*
|
|
147
149
|
* @default 'PascalCase'
|
|
148
150
|
*
|
|
149
151
|
* @see [vue/component-name-in-template-casing](https://eslint.vuejs.org/rules/component-name-in-template-casing)
|
|
@@ -159,22 +161,21 @@ interface VueOptions extends ConfigWithOverrides {
|
|
|
159
161
|
*/
|
|
160
162
|
vForDelimiterStyle?: RuleOptions<'vue/v-for-delimiter-style'>;
|
|
161
163
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
164
|
+
/* https://github.com/vuejs/eslint-plugin-vue/issues/2571 */
|
|
165
|
+
// /**
|
|
166
|
+
// * Enforce a consistent handler style in `v-on` directives.
|
|
167
|
+
// *
|
|
168
|
+
// * @default ['method', 'inline-function']
|
|
169
|
+
// *
|
|
170
|
+
// * @see [vue/v-on-handler-style](https://eslint.vuejs.org/rules/v-on-handler-style)
|
|
171
|
+
// */
|
|
172
|
+
// vOnHandlerStyle?: RuleOptions<'vue/v-on-handler-style'>,
|
|
170
173
|
|
|
171
174
|
/**
|
|
172
175
|
* Disallow certain elements and components.
|
|
173
176
|
*
|
|
174
177
|
* When NuxtUI or NuxtImage are enabled, certain HTML elements (e.g., `<img>`, `<a>`, `<form>`, `<input>`) are disallowed in favor of their alternative components.
|
|
175
178
|
*
|
|
176
|
-
* New items extend the defaults, they don't override it.
|
|
177
|
-
*
|
|
178
179
|
* @default []
|
|
179
180
|
*
|
|
180
181
|
* @see [vue/no-restricted-html-elements](https://eslint.vuejs.org/rules/no-restricted-html-elements)
|
|
@@ -6,6 +6,8 @@ interface VueAccessibilityOptions {
|
|
|
6
6
|
/**
|
|
7
7
|
* Names of components that render an `<a>` element.
|
|
8
8
|
*
|
|
9
|
+
* New items extend the defaults, they don't override it.
|
|
10
|
+
*
|
|
9
11
|
* @default ['RouterLink', 'NuxtLink', 'ULink']
|
|
10
12
|
*
|
|
11
13
|
* @see [vuejs-accessibility/anchor-has-content: `components` option](https://vue-a11y.github.io/eslint-plugin-vuejs-accessibility/rules/anchor-has-content#%F0%9F%94%A7-options)
|
|
@@ -15,6 +17,8 @@ interface VueAccessibilityOptions {
|
|
|
15
17
|
/**
|
|
16
18
|
* Names of components that render an `<img>` element.
|
|
17
19
|
*
|
|
20
|
+
* New items extend the defaults, they don't override it.
|
|
21
|
+
*
|
|
18
22
|
* @default ['NuxtImg']
|
|
19
23
|
*
|
|
20
24
|
* @see [vuejs-accessibility/alt-text: `img` option](https://vue-a11y.github.io/eslint-plugin-vuejs-accessibility/rules/alt-text#%F0%9F%94%A7-options)
|
|
@@ -24,7 +28,9 @@ interface VueAccessibilityOptions {
|
|
|
24
28
|
/**
|
|
25
29
|
* Names of components that should be considered accessible child elements.
|
|
26
30
|
*
|
|
27
|
-
*
|
|
31
|
+
* New items extend the defaults, they don't override it.
|
|
32
|
+
*
|
|
33
|
+
* @default ['img', 'picture', 'NuxtImg', 'NuxtPicture', 'UBadge']
|
|
28
34
|
*
|
|
29
35
|
* @see [vuejs-accessibility/anchor-has-content: `accessibleChildren` option](https://vue-a11y.github.io/eslint-plugin-vuejs-accessibility/rules/anchor-has-content#%F0%9F%94%A7-options)
|
|
30
36
|
*/
|