@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/dist/utils/globs.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
//#region src/utils/globs.ts
|
|
2
2
|
const srcExtensions = "?([mc])[jt]s?(x)";
|
|
3
3
|
const vueExtensions = `{vue,${srcExtensions}}`;
|
|
4
|
-
const
|
|
4
|
+
const restrictedExportsFolders = [
|
|
5
5
|
"shared",
|
|
6
6
|
"dto?(s)",
|
|
7
7
|
"model?(s)",
|
|
8
8
|
"helper?(s)",
|
|
9
9
|
"module?(s)",
|
|
10
|
-
"?(@)type?(s)",
|
|
11
10
|
"util?(s|ities)",
|
|
12
11
|
"composable?(s)",
|
|
13
12
|
"repo?(s|sitory|sitories)"
|
|
@@ -17,12 +16,10 @@ const globs = {
|
|
|
17
16
|
html: "**/*.html",
|
|
18
17
|
ts: "**/*.?([mc])ts?(x)",
|
|
19
18
|
src: `**/*.${srcExtensions}`,
|
|
20
|
-
|
|
21
|
-
commonsIgnore: `**/lint-staged.config.${srcExtensions}`,
|
|
19
|
+
restrictedExports: `**/{${restrictedExportsFolders.join(",")}}/**/*.${srcExtensions}`,
|
|
22
20
|
vue: `**/*.${vueExtensions}`,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
vueComponentNamesIgnore: `**/{layouts,pages}/**/(_|-)components/**/*.${vueExtensions}`,
|
|
21
|
+
vueServerComponents: `**/*.server.${vueExtensions}`,
|
|
22
|
+
vueAppErrorLayoutsPages: `**/{{app,error},{layouts,pages}/**/*}.${vueExtensions}`,
|
|
26
23
|
storybook: `**/*.(story|stories).${srcExtensions}`,
|
|
27
24
|
test: `**/{__tests__/*,*.{test,spec,cy,bench?(mark)}.${srcExtensions}`
|
|
28
25
|
};
|
|
@@ -13,6 +13,7 @@ function isPackageDetected(packageName, options = defaultOptions) {
|
|
|
13
13
|
if (!autoDetectDeps) return false;
|
|
14
14
|
const isPackageInstalled = isPackageExists(packageName, { paths: [path.resolve(packageDir)] });
|
|
15
15
|
if (isPackageInstalled) detectedPackages.push(packageName);
|
|
16
|
+
detectedPackages.sort();
|
|
16
17
|
return isPackageInstalled;
|
|
17
18
|
}
|
|
18
19
|
|
|
@@ -74,7 +74,6 @@ const defaultOptions = {
|
|
|
74
74
|
},
|
|
75
75
|
importX: {
|
|
76
76
|
removeUnusedImports: true,
|
|
77
|
-
requireFileExtension: true,
|
|
78
77
|
overrides: {}
|
|
79
78
|
},
|
|
80
79
|
perfectionist: {
|
|
@@ -93,7 +92,8 @@ const defaultOptions = {
|
|
|
93
92
|
"img",
|
|
94
93
|
"picture",
|
|
95
94
|
"NuxtImg",
|
|
96
|
-
"NuxtPicture"
|
|
95
|
+
"NuxtPicture",
|
|
96
|
+
"UBadge"
|
|
97
97
|
]
|
|
98
98
|
},
|
|
99
99
|
blocksOrder: [
|
|
@@ -123,8 +123,8 @@ const defaultOptions = {
|
|
|
123
123
|
"LIST_RENDERING",
|
|
124
124
|
"UNIQUE",
|
|
125
125
|
"GLOBAL",
|
|
126
|
-
"TWO_WAY_BINDING",
|
|
127
126
|
"SLOT",
|
|
127
|
+
"TWO_WAY_BINDING",
|
|
128
128
|
"CONTENT",
|
|
129
129
|
"OTHER_DIRECTIVES",
|
|
130
130
|
"EVENTS",
|
|
@@ -143,7 +143,6 @@ const defaultOptions = {
|
|
|
143
143
|
destructureProps: "always",
|
|
144
144
|
componentNameCaseInTemplate: "PascalCase",
|
|
145
145
|
vForDelimiterStyle: "in",
|
|
146
|
-
vOnHandlerStyle: ["method", "inline-function"],
|
|
147
146
|
restrictedElements: [],
|
|
148
147
|
restrictedStaticAttributes: [],
|
|
149
148
|
ignoredUndefinedComponents: [],
|
|
@@ -5,6 +5,17 @@ import { createDefu } from "defu";
|
|
|
5
5
|
|
|
6
6
|
//#region src/utils/options/mergeWithDefaults.ts
|
|
7
7
|
const mergeOptions = createDefu((object, key, value) => {
|
|
8
|
+
const stringKey = key.toString();
|
|
9
|
+
const uniqueArrayOptions = [
|
|
10
|
+
"allowedRelativeFontUnits",
|
|
11
|
+
"macrosOrder",
|
|
12
|
+
"blocksOrder",
|
|
13
|
+
"attributesOrder"
|
|
14
|
+
];
|
|
15
|
+
if (uniqueArrayOptions.includes(stringKey)) {
|
|
16
|
+
object[key] = value;
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
8
19
|
const isValueTrue = value === true;
|
|
9
20
|
const isDefaultValueFalse = object[key] === false;
|
|
10
21
|
const isValueEmptyString = isEmptyString(value);
|
|
@@ -18,7 +18,7 @@ function getRestrictedVueElements(prefix) {
|
|
|
18
18
|
const restrictedElements = [];
|
|
19
19
|
for (const [element, component] of alternativeComponentPairs) restrictedElements.push({
|
|
20
20
|
element,
|
|
21
|
-
message: `Use
|
|
21
|
+
message: `Use \`<${prefix}${component}>\`.`
|
|
22
22
|
});
|
|
23
23
|
return restrictedElements;
|
|
24
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shayanthenerd/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.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": [
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"#configs/*": "./src/configs/*"
|
|
53
53
|
},
|
|
54
54
|
"type": "module",
|
|
55
|
-
"packageManager": "bun@1.2.
|
|
55
|
+
"packageManager": "bun@1.2.21",
|
|
56
56
|
"scripts": {
|
|
57
|
-
"prepare": "bun
|
|
57
|
+
"prepare": "bun git:gitmessage && bunx simple-git-hooks && bun generate:types",
|
|
58
58
|
"prepublishOnly": "bun build:package",
|
|
59
|
-
"
|
|
59
|
+
"git:gitmessage": "git config --local commit.template \".gitmessage\"",
|
|
60
60
|
"inspect": "bunx @eslint/config-inspector",
|
|
61
61
|
"build:package": "tsdown --no-report",
|
|
62
62
|
"build:inspector": "bunx @eslint/config-inspector build --config=./scripts/defaultESLintConfigReference.ts",
|
|
@@ -75,49 +75,48 @@
|
|
|
75
75
|
"pre-commit": "./node_modules/.bin/nano-staged"
|
|
76
76
|
},
|
|
77
77
|
"nano-staged": {
|
|
78
|
-
"**/*.{
|
|
79
|
-
"**/*.{
|
|
80
|
-
"oxlint --fix",
|
|
81
|
-
"eslint --fix --cache --cache-location=./node_modules/.cache/.eslintcache"
|
|
82
|
-
]
|
|
78
|
+
"**/*.{js,ts}": "bun lint",
|
|
79
|
+
"**/*.{json,jsonc,yaml,yml,lock}": "bun format"
|
|
83
80
|
},
|
|
84
81
|
"dependencies": {
|
|
85
|
-
"@eslint/compat": "1.3.
|
|
82
|
+
"@eslint/compat": "1.3.2",
|
|
86
83
|
"@eslint/css": "0.10.0",
|
|
87
|
-
"@eslint/js": "9.
|
|
88
|
-
"@html-eslint/eslint-plugin": "0.
|
|
89
|
-
"@stylistic/eslint-plugin": "5.2.
|
|
84
|
+
"@eslint/js": "9.34.0",
|
|
85
|
+
"@html-eslint/eslint-plugin": "0.46.1",
|
|
86
|
+
"@stylistic/eslint-plugin": "5.2.3",
|
|
90
87
|
"@vitest/eslint-plugin": "1.3.4",
|
|
91
88
|
"defu": "6.1.4",
|
|
92
|
-
"eslint": "9.
|
|
93
|
-
"eslint-flat-config-utils": "2.1.
|
|
89
|
+
"eslint": "9.34.0",
|
|
90
|
+
"eslint-flat-config-utils": "2.1.1",
|
|
94
91
|
"eslint-import-resolver-typescript": "4.4.4",
|
|
95
|
-
"eslint-plugin-better-tailwindcss": "3.7.
|
|
96
|
-
"eslint-plugin-cypress": "5.1.
|
|
97
|
-
"eslint-plugin-import": "2.32.0",
|
|
92
|
+
"eslint-plugin-better-tailwindcss": "3.7.5",
|
|
93
|
+
"eslint-plugin-cypress": "5.1.1",
|
|
98
94
|
"eslint-plugin-import-x": "4.16.1",
|
|
99
|
-
"eslint-plugin-oxlint": "1.
|
|
95
|
+
"eslint-plugin-oxlint": "1.13.0",
|
|
100
96
|
"eslint-plugin-perfectionist": "4.15.0",
|
|
101
|
-
"eslint-plugin-playwright": "2.2.
|
|
102
|
-
"eslint-plugin-storybook": "9.
|
|
103
|
-
"eslint-plugin-unused-imports": "4.
|
|
104
|
-
"eslint-plugin-vue": "10.
|
|
97
|
+
"eslint-plugin-playwright": "2.2.2",
|
|
98
|
+
"eslint-plugin-storybook": "9.1.3",
|
|
99
|
+
"eslint-plugin-unused-imports": "4.2.0",
|
|
100
|
+
"eslint-plugin-vue": "10.4.0",
|
|
105
101
|
"eslint-plugin-vuejs-accessibility": "2.4.1",
|
|
106
102
|
"globals": "16.3.0",
|
|
107
|
-
"local-pkg": "1.1.
|
|
108
|
-
"oxlint": "1.
|
|
109
|
-
"tailwind-csstree": "0.1.
|
|
110
|
-
"typescript-eslint": "8.
|
|
103
|
+
"local-pkg": "1.1.2",
|
|
104
|
+
"oxlint": "1.13.0",
|
|
105
|
+
"tailwind-csstree": "0.1.3",
|
|
106
|
+
"typescript-eslint": "8.41.0"
|
|
111
107
|
},
|
|
112
108
|
"devDependencies": {
|
|
113
|
-
"@types/node": "24.
|
|
109
|
+
"@types/node": "24.3.0",
|
|
114
110
|
"eslint-typegen": "2.3.0",
|
|
115
|
-
"lint-staged": "16.1.2",
|
|
116
111
|
"nano-staged": "0.8.0",
|
|
117
112
|
"prettier": "3.6.2",
|
|
118
113
|
"publint": "0.3.12",
|
|
119
|
-
"tsdown": "0.
|
|
120
|
-
"typescript": "5.
|
|
121
|
-
"unplugin-unused": "0.5.
|
|
122
|
-
}
|
|
114
|
+
"tsdown": "0.14.2",
|
|
115
|
+
"typescript": "5.9.2",
|
|
116
|
+
"unplugin-unused": "0.5.2"
|
|
117
|
+
},
|
|
118
|
+
"trustedDependencies": [
|
|
119
|
+
"esbuild",
|
|
120
|
+
"unrs-resolver"
|
|
121
|
+
]
|
|
123
122
|
}
|
package/dist/configs/commons.js
DELETED
|
@@ -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,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 };
|