@maz-ui/eslint-config 4.8.0 → 5.0.0-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 +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.mjs +21 -6
- package/package.json +13 -6
package/dist/index.d.mts
CHANGED
|
@@ -68,7 +68,12 @@ declare const sonarjsTestRules: {
|
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
|
-
* Tailwind CSS ESLint rules configuration
|
|
71
|
+
* Tailwind CSS ESLint rules configuration.
|
|
72
|
+
*
|
|
73
|
+
* These rules only activate when the user opts in via
|
|
74
|
+
* `defineMazEslintConfig({ tailwindcss: true })` AND is on ESLint 9 +
|
|
75
|
+
* Tailwind v3. The plugin itself does not yet support ESLint 10+ or
|
|
76
|
+
* Tailwind v4 (upstream — uses the removed context.getSourceCode API).
|
|
72
77
|
*/
|
|
73
78
|
declare const tailwindcssRules: {
|
|
74
79
|
readonly 'tailwindcss/no-custom-classname': "off";
|
package/dist/index.d.ts
CHANGED
|
@@ -68,7 +68,12 @@ declare const sonarjsTestRules: {
|
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
|
-
* Tailwind CSS ESLint rules configuration
|
|
71
|
+
* Tailwind CSS ESLint rules configuration.
|
|
72
|
+
*
|
|
73
|
+
* These rules only activate when the user opts in via
|
|
74
|
+
* `defineMazEslintConfig({ tailwindcss: true })` AND is on ESLint 9 +
|
|
75
|
+
* Tailwind v3. The plugin itself does not yet support ESLint 10+ or
|
|
76
|
+
* Tailwind v4 (upstream — uses the removed context.getSourceCode API).
|
|
72
77
|
*/
|
|
73
78
|
declare const tailwindcssRules: {
|
|
74
79
|
readonly 'tailwindcss/no-custom-classname': "off";
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,6 @@ import { createRequire } from 'node:module';
|
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import antfu from '@antfu/eslint-config';
|
|
5
5
|
import { configs } from 'eslint-plugin-sonarjs';
|
|
6
|
-
import tailwind from 'eslint-plugin-tailwindcss';
|
|
7
6
|
import vueA11y from 'eslint-plugin-vuejs-accessibility';
|
|
8
7
|
|
|
9
8
|
function baseRules(isProduction) {
|
|
@@ -149,6 +148,15 @@ function getEslintMajorVersion() {
|
|
|
149
148
|
return 0;
|
|
150
149
|
}
|
|
151
150
|
}
|
|
151
|
+
function tryLoadTailwindPlugin() {
|
|
152
|
+
try {
|
|
153
|
+
const _require = createRequire(import.meta.url);
|
|
154
|
+
const mod = _require("eslint-plugin-tailwindcss");
|
|
155
|
+
return mod?.default ?? mod;
|
|
156
|
+
} catch {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
152
160
|
function isVueOrNuxtProject() {
|
|
153
161
|
const packageJson = getPackageJson();
|
|
154
162
|
return packageJson?.dependencies?.vue || packageJson?.devDependencies?.vue || packageJson?.peerDependencies?.vue || packageJson?.dependencies?.nuxt || packageJson?.devDependencies?.nuxt || packageJson?.peerDependencies?.nuxt;
|
|
@@ -201,13 +209,20 @@ function defineConfig(options = {}, ...userConfigs) {
|
|
|
201
209
|
additionalConfigs.push(...fixedConfigs);
|
|
202
210
|
}
|
|
203
211
|
if (opts.tailwindcss) {
|
|
204
|
-
|
|
212
|
+
const eslintMajor = getEslintMajorVersion();
|
|
213
|
+
if (eslintMajor >= 10) {
|
|
205
214
|
console.warn("[maz-eslint-config] eslint-plugin-tailwindcss is not compatible with ESLint 10+ (uses removed context.getSourceCode API). Tailwind CSS rules are disabled.");
|
|
206
215
|
} else {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
rules
|
|
210
|
-
}
|
|
216
|
+
const tailwindPlugin = tryLoadTailwindPlugin();
|
|
217
|
+
if (!tailwindPlugin) {
|
|
218
|
+
console.warn("[maz-eslint-config] opts.tailwindcss is true but eslint-plugin-tailwindcss is not installed. Add it to your devDependencies to enable the Tailwind CSS lint rules.");
|
|
219
|
+
} else {
|
|
220
|
+
const tailwindConfigs = tailwindPlugin.configs?.["flat/recommended"];
|
|
221
|
+
if (Array.isArray(tailwindConfigs)) {
|
|
222
|
+
additionalConfigs.push(...tailwindConfigs);
|
|
223
|
+
}
|
|
224
|
+
additionalConfigs.push({ rules: tailwindcssRules });
|
|
225
|
+
}
|
|
211
226
|
}
|
|
212
227
|
}
|
|
213
228
|
additionalConfigs.push({
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maz-ui/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "5.0.0-beta.0",
|
|
5
5
|
"description": "ESLint configuration for JavaScript/TypeScript projects",
|
|
6
6
|
"author": "Louis Mazel <me@loicmazuel.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -39,18 +39,24 @@
|
|
|
39
39
|
"node": ">=20.19.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"eslint": ">=9.0.0 <11.0.0"
|
|
42
|
+
"eslint": ">=9.0.0 <11.0.0",
|
|
43
|
+
"eslint-plugin-tailwindcss": "^3.18.0"
|
|
44
|
+
},
|
|
45
|
+
"peerDependenciesMeta": {
|
|
46
|
+
"eslint-plugin-tailwindcss": {
|
|
47
|
+
"optional": true
|
|
48
|
+
}
|
|
43
49
|
},
|
|
44
50
|
"dependencies": {
|
|
45
|
-
"@antfu/eslint-config": "^
|
|
51
|
+
"@antfu/eslint-config": "^8.2.0",
|
|
46
52
|
"eslint-plugin-format": "^2.0.1",
|
|
47
|
-
"eslint-plugin-sonarjs": "^4.0.
|
|
48
|
-
"eslint-plugin-tailwindcss": "^3.18.2",
|
|
53
|
+
"eslint-plugin-sonarjs": "^4.0.3",
|
|
49
54
|
"eslint-plugin-vuejs-accessibility": "^2.5.0"
|
|
50
55
|
},
|
|
51
56
|
"devDependencies": {
|
|
52
57
|
"@types/eslint-plugin-tailwindcss": "^3.17.0",
|
|
53
|
-
"eslint": "^10.0
|
|
58
|
+
"eslint": "^10.3.0",
|
|
59
|
+
"eslint-plugin-tailwindcss": "^3.18.3",
|
|
54
60
|
"unbuild": "^3.6.1"
|
|
55
61
|
},
|
|
56
62
|
"lint-staged": {
|
|
@@ -59,6 +65,7 @@
|
|
|
59
65
|
]
|
|
60
66
|
},
|
|
61
67
|
"scripts": {
|
|
68
|
+
"codegen": "nx build",
|
|
62
69
|
"build": "unbuild",
|
|
63
70
|
"dev": "unbuild --stub",
|
|
64
71
|
"typecheck": "tsc --noEmit --skipLibCheck",
|