@maz-ui/eslint-config 4.7.3 → 4.7.10-beta.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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +22 -16
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -50,7 +50,7 @@ declare const sonarjsRules: {
|
|
|
50
50
|
readonly 'sonarjs/class-name': "off";
|
|
51
51
|
readonly 'sonarjs/no-nested-conditional': "off";
|
|
52
52
|
readonly 'sonarjs/sonar-no-unused-vars': "off";
|
|
53
|
-
readonly 'sonarjs/cognitive-complexity':
|
|
53
|
+
readonly 'sonarjs/cognitive-complexity': ["error", number];
|
|
54
54
|
readonly 'sonarjs/no-identical-functions': "error";
|
|
55
55
|
readonly 'sonarjs/no-collapsible-if': "error";
|
|
56
56
|
readonly 'sonarjs/prefer-immediate-return': "error";
|
package/dist/index.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ declare const sonarjsRules: {
|
|
|
50
50
|
readonly 'sonarjs/class-name': "off";
|
|
51
51
|
readonly 'sonarjs/no-nested-conditional': "off";
|
|
52
52
|
readonly 'sonarjs/sonar-no-unused-vars': "off";
|
|
53
|
-
readonly 'sonarjs/cognitive-complexity':
|
|
53
|
+
readonly 'sonarjs/cognitive-complexity': ["error", number];
|
|
54
54
|
readonly 'sonarjs/no-identical-functions': "error";
|
|
55
55
|
readonly 'sonarjs/no-collapsible-if': "error";
|
|
56
56
|
readonly 'sonarjs/prefer-immediate-return': "error";
|
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,27 +149,28 @@ 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({
|
|
169
|
+
...configs.recommended,
|
|
170
|
+
files: sonarjsFiles,
|
|
169
171
|
rules: {
|
|
170
|
-
...configs.recommended.rules
|
|
172
|
+
...configs.recommended.rules,
|
|
173
|
+
...sonarjsRules
|
|
171
174
|
}
|
|
172
175
|
});
|
|
173
176
|
additionalConfigs.push({
|
|
@@ -214,7 +217,10 @@ function defineConfig(options = {}, ...userConfigs) {
|
|
|
214
217
|
return antfu({
|
|
215
218
|
formatters: opts.formatters,
|
|
216
219
|
...opts,
|
|
217
|
-
rules:
|
|
220
|
+
rules: {
|
|
221
|
+
...baseRules(env === "production"),
|
|
222
|
+
...opts.rules
|
|
223
|
+
},
|
|
218
224
|
ignores: (() => {
|
|
219
225
|
return opts.ignores;
|
|
220
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.7.
|
|
4
|
+
"version": "4.7.10-beta.0",
|
|
5
5
|
"description": "ESLint configuration for JavaScript/TypeScript projects",
|
|
6
6
|
"author": "Louis Mazel <me@loicmazuel.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -42,9 +42,9 @@
|
|
|
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
|
-
"eslint-plugin-sonarjs": "^4.0.
|
|
47
|
+
"eslint-plugin-sonarjs": "^4.0.2",
|
|
48
48
|
"eslint-plugin-tailwindcss": "^3.18.2",
|
|
49
49
|
"eslint-plugin-vuejs-accessibility": "^2.5.0"
|
|
50
50
|
},
|