@maz-ui/eslint-config 4.7.7 → 4.8.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/index.mjs +17 -14
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -33,7 +33,9 @@ function baseRules(isProduction) {
|
|
|
33
33
|
// Unicorn
|
|
34
34
|
"unicorn/prefer-global-this": "error",
|
|
35
35
|
// Test
|
|
36
|
-
"test/prefer-lowercase-title": "off"
|
|
36
|
+
"test/prefer-lowercase-title": "off",
|
|
37
|
+
// e18e
|
|
38
|
+
"e18e/prefer-static-regex": "off"
|
|
37
39
|
};
|
|
38
40
|
}
|
|
39
41
|
|
|
@@ -147,22 +149,20 @@ function getEslintMajorVersion() {
|
|
|
147
149
|
return 0;
|
|
148
150
|
}
|
|
149
151
|
}
|
|
152
|
+
function isVueOrNuxtProject() {
|
|
153
|
+
const packageJson = getPackageJson();
|
|
154
|
+
return packageJson?.dependencies?.vue || packageJson?.devDependencies?.vue || packageJson?.peerDependencies?.vue || packageJson?.dependencies?.nuxt || packageJson?.devDependencies?.nuxt || packageJson?.peerDependencies?.nuxt;
|
|
155
|
+
}
|
|
150
156
|
function defineConfig(options = {}, ...userConfigs) {
|
|
151
157
|
const opts = { ...defaultOptions, ...options, ignores: [...GLOBAL_IGNORES, ...options.ignores || []] };
|
|
152
158
|
const env = opts.env || process.env.NODE_ENV || "production";
|
|
153
|
-
let allRules = {
|
|
154
|
-
...baseRules(env === "production"),
|
|
155
|
-
...opts.rules
|
|
156
|
-
};
|
|
157
|
-
const packageJson = getPackageJson();
|
|
158
|
-
const vueDetected = packageJson?.dependencies?.vue || packageJson?.devDependencies?.vue || packageJson?.peerDependencies?.vue;
|
|
159
|
-
if (opts.vue || vueDetected) {
|
|
160
|
-
allRules = {
|
|
161
|
-
...allRules,
|
|
162
|
-
...vueRules
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
159
|
const additionalConfigs = [];
|
|
160
|
+
if (opts.vue || isVueOrNuxtProject()) {
|
|
161
|
+
additionalConfigs.push({
|
|
162
|
+
files: ["**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx,vue}"],
|
|
163
|
+
rules: vueRules
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
166
|
if (opts.sonarjs) {
|
|
167
167
|
const sonarjsFiles = ["**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx,vue}"];
|
|
168
168
|
additionalConfigs.push({
|
|
@@ -217,7 +217,10 @@ function defineConfig(options = {}, ...userConfigs) {
|
|
|
217
217
|
return antfu({
|
|
218
218
|
formatters: opts.formatters,
|
|
219
219
|
...opts,
|
|
220
|
-
rules:
|
|
220
|
+
rules: {
|
|
221
|
+
...baseRules(env === "production"),
|
|
222
|
+
...opts.rules
|
|
223
|
+
},
|
|
221
224
|
ignores: (() => {
|
|
222
225
|
return opts.ignores;
|
|
223
226
|
})
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maz-ui/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.8.0",
|
|
5
5
|
"description": "ESLint configuration for JavaScript/TypeScript projects",
|
|
6
6
|
"author": "Louis Mazel <me@loicmazuel.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"eslint": ">=9.0.0 <11.0.0"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@antfu/eslint-config": "^7.
|
|
45
|
+
"@antfu/eslint-config": "^7.7.2",
|
|
46
46
|
"eslint-plugin-format": "^2.0.1",
|
|
47
47
|
"eslint-plugin-sonarjs": "^4.0.2",
|
|
48
48
|
"eslint-plugin-tailwindcss": "^3.18.2",
|