@icebreakers/eslint-config 5.0.4 → 7.0.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 +6 -3
- package/README.zh.md +6 -3
- package/dist/{dist-B7ddKLda.cjs → dist-BL_Srtot.cjs} +1505 -1393
- package/dist/{dist-Bhh5YMxq.js → dist-CfNAWugK.js} +906 -794
- package/dist/index.cjs +80 -77
- package/dist/index.d.cts +41 -8
- package/dist/index.d.ts +41 -8
- package/dist/index.js +74 -35
- package/dist/{jiti-CwIriPCr.js → jiti-BQvCzdOI.js} +5 -5
- package/dist/{jiti-BOkVoEUx.cjs → jiti-DmQZ8B-l.cjs} +8 -8
- package/dist/{lib-R7AmzwP-.cjs → lib-ADc7sTOW.cjs} +1576 -1075
- package/dist/{lib-Mwx9Doks.js → lib-BiNYUSxy.js} +1111 -610
- package/dist/{lib-H3OzP-X_.cjs → lib-ByHGIggZ.cjs} +152 -152
- package/dist/{lib-Dc92-WCU.js → lib-CLPiq1xv.js} +1 -1
- package/dist/{modern-DRyO5loa.cjs → modern-Dnpu3mfI.cjs} +98 -23
- package/dist/{modern-Dr_fOGoK.js → modern-RpY8mk7x.js} +98 -23
- package/dist/{chunk-yCSr5jVb.js → rolldown-runtime-C8SNSOcs.js} +9 -2
- package/dist/rolldown-runtime-DzWaZAza.cjs +71 -0
- package/dist/{src-C34Mcqt3.cjs → src-Ccb5vGgU.cjs} +10 -10
- package/dist/{src-DPttw6yg.js → src-zsLgvLJM.js} +2 -2
- package/index.d.ts +6 -2
- package/package.json +18 -14
package/dist/index.cjs
CHANGED
|
@@ -1,49 +1,16 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
10
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
11
|
-
var __exportAll = (all, no_symbols) => {
|
|
12
|
-
let target = {};
|
|
13
|
-
for (var name in all) __defProp(target, name, {
|
|
14
|
-
get: all[name],
|
|
15
|
-
enumerable: true
|
|
16
|
-
});
|
|
17
|
-
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __copyProps = (to, from, except, desc) => {
|
|
21
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
22
|
-
key = keys[i];
|
|
23
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
24
|
-
get: ((k) => from[k]).bind(null, key),
|
|
25
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
return to;
|
|
29
|
-
};
|
|
30
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
31
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
32
|
-
value: mod,
|
|
33
|
-
enumerable: true
|
|
34
|
-
}) : target, mod));
|
|
35
|
-
//#endregion
|
|
2
|
+
const require_rolldown_runtime = require("./rolldown-runtime-DzWaZAza.cjs");
|
|
3
|
+
let node_module = require("node:module");
|
|
36
4
|
let node_path = require("node:path");
|
|
37
|
-
node_path = __toESM(node_path, 1);
|
|
38
|
-
let node_process = require("node:process");
|
|
39
|
-
node_process = __toESM(node_process, 1);
|
|
5
|
+
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
40
6
|
let node_fs = require("node:fs");
|
|
41
|
-
node_fs = __toESM(node_fs, 1);
|
|
42
|
-
let
|
|
7
|
+
node_fs = require_rolldown_runtime.__toESM(node_fs, 1);
|
|
8
|
+
let node_process = require("node:process");
|
|
9
|
+
node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
43
10
|
let node_url = require("node:url");
|
|
44
11
|
//#region src/antfu.ts
|
|
45
|
-
var antfu_exports = /* @__PURE__ */ __exportAll({});
|
|
46
|
-
__reExport(antfu_exports, require("@antfu/eslint-config"));
|
|
12
|
+
var antfu_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({});
|
|
13
|
+
require_rolldown_runtime.__reExport(antfu_exports, require("@antfu/eslint-config"));
|
|
47
14
|
//#endregion
|
|
48
15
|
//#region src/defaults.ts
|
|
49
16
|
const nestjsTypeScriptRules = {
|
|
@@ -132,14 +99,14 @@ function getDefaultTypescriptOptions(opts) {
|
|
|
132
99
|
}
|
|
133
100
|
//#endregion
|
|
134
101
|
//#region src/utils.ts
|
|
135
|
-
const require$
|
|
102
|
+
const require$3 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
136
103
|
const PACKAGE_DIR = node_path.default.dirname((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
137
104
|
function isObject(o) {
|
|
138
105
|
return Object.prototype.toString.call(o) === "[object Object]";
|
|
139
106
|
}
|
|
140
107
|
function isPackageAvailable$1(name, searchPaths = [node_process.default.cwd(), PACKAGE_DIR]) {
|
|
141
108
|
try {
|
|
142
|
-
require$
|
|
109
|
+
require$3.resolve(name, { paths: searchPaths });
|
|
143
110
|
return true;
|
|
144
111
|
} catch {
|
|
145
112
|
const packageSegments = name.split("/");
|
|
@@ -161,13 +128,14 @@ function hasAllPackages(names, searchPaths) {
|
|
|
161
128
|
//#endregion
|
|
162
129
|
//#region src/features.ts
|
|
163
130
|
const BETTER_TAILWIND_PACKAGES = ["eslint-plugin-better-tailwindcss"];
|
|
164
|
-
const TAILWIND_PACKAGES = ["eslint-plugin-tailwindcss"];
|
|
131
|
+
const TAILWIND_PACKAGES = ["eslint-plugin-tailwindcss", "tailwindcss"];
|
|
165
132
|
const STYLELINT_BRIDGE_PACKAGES = ["eslint-plugin-better-stylelint"];
|
|
166
133
|
const MDX_PACKAGES = ["eslint-plugin-mdx"];
|
|
167
134
|
const VUE_A11Y_PACKAGES = ["eslint-plugin-vuejs-accessibility"];
|
|
168
135
|
const REACT_A11Y_PACKAGES = ["eslint-plugin-jsx-a11y"];
|
|
169
136
|
const QUERY_PACKAGES = ["@tanstack/eslint-plugin-query"];
|
|
170
|
-
const
|
|
137
|
+
const BETTER_TAILWIND_EXTENSIONS = "js,mjs,cjs,ts,mts,cts,jsx,tsx,vue,html,md,mdx,astro,svelte";
|
|
138
|
+
const BETTER_TAILWIND_FILES = [`**/*.{${BETTER_TAILWIND_EXTENSIONS}}`];
|
|
171
139
|
const BETTER_TAILWIND_IGNORES = [
|
|
172
140
|
"**/*.json",
|
|
173
141
|
"**/*.json5",
|
|
@@ -185,37 +153,66 @@ const BETTER_TAILWIND_IGNORES = [
|
|
|
185
153
|
"**/Gemfile.lock",
|
|
186
154
|
"**/go.sum"
|
|
187
155
|
];
|
|
156
|
+
const BETTER_TAILWIND_SYNTAX_RULES = {
|
|
157
|
+
"better-tailwindcss/no-duplicate-classes": "warn",
|
|
158
|
+
"better-tailwindcss/no-unnecessary-whitespace": "warn"
|
|
159
|
+
};
|
|
160
|
+
const require$2 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
188
161
|
function resolveStylelintConfigLoader(moduleUrl = require("url").pathToFileURL(__filename).href) {
|
|
189
162
|
return moduleUrl.endsWith(".ts") ? new URL("./stylelint.ts", moduleUrl).href : new URL("./stylelint.js", moduleUrl).href;
|
|
190
163
|
}
|
|
164
|
+
function resolveDefaultTailwindCssConfigPath() {
|
|
165
|
+
try {
|
|
166
|
+
return require$2.resolve("tailwindcss/index.css");
|
|
167
|
+
} catch {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function normalizeGlobPath(filePath) {
|
|
172
|
+
return filePath.replaceAll(node_path.default.sep, "/").replace(/^\.\//, "");
|
|
173
|
+
}
|
|
174
|
+
function resolveBetterTailwindFiles(option) {
|
|
175
|
+
if (option.files?.length) return option.files;
|
|
176
|
+
if (!option.entryPoint || node_path.default.isAbsolute(option.entryPoint)) return BETTER_TAILWIND_FILES;
|
|
177
|
+
const sourceDir = normalizeGlobPath(node_path.default.dirname(option.entryPoint));
|
|
178
|
+
if (!sourceDir || sourceDir === ".") return BETTER_TAILWIND_FILES;
|
|
179
|
+
return [`${sourceDir}/**/*.{${BETTER_TAILWIND_EXTENSIONS}}`];
|
|
180
|
+
}
|
|
181
|
+
function resolveBetterTailwindRules(plugin, option) {
|
|
182
|
+
if (option.rules === "recommended") return plugin.configs.recommended?.rules ?? {};
|
|
183
|
+
return BETTER_TAILWIND_SYNTAX_RULES;
|
|
184
|
+
}
|
|
185
|
+
function resolveBetterTailwindPresets(option) {
|
|
186
|
+
if (!option) return [];
|
|
187
|
+
if (!hasAllPackages(BETTER_TAILWIND_PACKAGES)) return [];
|
|
188
|
+
const betterTailwindcssOption = typeof option === "object" ? option : {};
|
|
189
|
+
return [(0, antfu_exports.interopDefault)(import("eslint-plugin-better-tailwindcss")).then((eslintPluginBetterTailwindcss) => {
|
|
190
|
+
const betterTailwindcssRules = resolveBetterTailwindRules(eslintPluginBetterTailwindcss, betterTailwindcssOption);
|
|
191
|
+
return {
|
|
192
|
+
name: "icebreaker/better-tailwindcss",
|
|
193
|
+
files: resolveBetterTailwindFiles(betterTailwindcssOption),
|
|
194
|
+
ignores: BETTER_TAILWIND_IGNORES,
|
|
195
|
+
plugins: { "better-tailwindcss": eslintPluginBetterTailwindcss },
|
|
196
|
+
rules: betterTailwindcssRules,
|
|
197
|
+
settings: { "better-tailwindcss": {
|
|
198
|
+
cwd: betterTailwindcssOption.cwd,
|
|
199
|
+
entryPoint: betterTailwindcssOption.entryPoint,
|
|
200
|
+
tailwindConfig: betterTailwindcssOption.tailwindConfig
|
|
201
|
+
} }
|
|
202
|
+
};
|
|
203
|
+
})];
|
|
204
|
+
}
|
|
191
205
|
function resolveTailwindPresets(option) {
|
|
192
206
|
if (!option) return [];
|
|
193
|
-
if (typeof option === "object") {
|
|
194
|
-
if (!hasAllPackages(BETTER_TAILWIND_PACKAGES)) return [];
|
|
195
|
-
return [(0, antfu_exports.interopDefault)(import("eslint-plugin-better-tailwindcss")).then((eslintPluginBetterTailwindcss) => {
|
|
196
|
-
const cwd = option.cwd ?? (option.entryPoint ? node_path.default.dirname(option.entryPoint) : void 0) ?? node_process.default.cwd();
|
|
197
|
-
const betterTailwindcssRules = {
|
|
198
|
-
...eslintPluginBetterTailwindcss.configs["recommended-warn"].rules,
|
|
199
|
-
...eslintPluginBetterTailwindcss.configs["recommended-error"].rules
|
|
200
|
-
};
|
|
201
|
-
return {
|
|
202
|
-
name: "icebreaker/better-tailwindcss",
|
|
203
|
-
files: BETTER_TAILWIND_FILES,
|
|
204
|
-
ignores: BETTER_TAILWIND_IGNORES,
|
|
205
|
-
plugins: { "better-tailwindcss": eslintPluginBetterTailwindcss },
|
|
206
|
-
rules: betterTailwindcssRules,
|
|
207
|
-
settings: { "better-tailwindcss": {
|
|
208
|
-
cwd,
|
|
209
|
-
entryPoint: option.entryPoint,
|
|
210
|
-
tailwindConfig: option.tailwindConfig
|
|
211
|
-
} }
|
|
212
|
-
};
|
|
213
|
-
})];
|
|
214
|
-
}
|
|
215
207
|
if (!hasAllPackages(TAILWIND_PACKAGES)) return [];
|
|
208
|
+
const cssConfigPath = resolveDefaultTailwindCssConfigPath();
|
|
216
209
|
return [(0, antfu_exports.interopDefault)(import("eslint-plugin-tailwindcss")).then((tailwind) => {
|
|
217
|
-
|
|
218
|
-
|
|
210
|
+
const tailwindPlugin = tailwind;
|
|
211
|
+
return tailwindPlugin.configs["flat/recommended"] ?? tailwindPlugin.configs.recommended ?? [];
|
|
212
|
+
}), {
|
|
213
|
+
...cssConfigPath ? { settings: { tailwindcss: { cssConfigPath } } } : {},
|
|
214
|
+
rules: { "tailwindcss/no-custom-classname": "off" }
|
|
215
|
+
}];
|
|
219
216
|
}
|
|
220
217
|
function resolveStylelintBridgeOptions(option) {
|
|
221
218
|
const { cwd, ...stylelintConfigOptions } = typeof option === "object" ? option : {};
|
|
@@ -273,10 +270,10 @@ function resolveMdxPresets(isEnabled) {
|
|
|
273
270
|
function resolveAccessibilityPresets(isEnabled, vueOption, reactOption) {
|
|
274
271
|
if (!isEnabled) return [];
|
|
275
272
|
const presets = [];
|
|
276
|
-
if (vueOption && hasAllPackages(VUE_A11Y_PACKAGES)) presets.push((0, antfu_exports.interopDefault)(Promise.resolve().then(() => /* @__PURE__ */ __toESM(require("./dist-
|
|
273
|
+
if (vueOption && hasAllPackages(VUE_A11Y_PACKAGES)) presets.push((0, antfu_exports.interopDefault)(Promise.resolve().then(() => /* @__PURE__ */ require_rolldown_runtime.__toESM(require("./dist-BL_Srtot.cjs").default, 1))).then((pluginVueA11y) => {
|
|
277
274
|
return pluginVueA11y.configs["flat/recommended"];
|
|
278
275
|
}));
|
|
279
|
-
if (reactOption && hasAllPackages(REACT_A11Y_PACKAGES)) presets.push((0, antfu_exports.interopDefault)(Promise.resolve().then(() => /* @__PURE__ */ __toESM(require("./lib-
|
|
276
|
+
if (reactOption && hasAllPackages(REACT_A11Y_PACKAGES)) presets.push((0, antfu_exports.interopDefault)(Promise.resolve().then(() => /* @__PURE__ */ require_rolldown_runtime.__toESM(require("./lib-ADc7sTOW.cjs").default, 1))).then((jsxA11y) => {
|
|
280
277
|
return jsxA11y.flatConfigs.recommended;
|
|
281
278
|
}));
|
|
282
279
|
return presets;
|
|
@@ -291,7 +288,7 @@ function resolveNestPresets(isEnabled) {
|
|
|
291
288
|
function resolveQueryPresets(isEnabled) {
|
|
292
289
|
if (!isEnabled) return [];
|
|
293
290
|
if (!hasAllPackages(QUERY_PACKAGES)) return [];
|
|
294
|
-
return [(0, antfu_exports.interopDefault)(Promise.resolve().then(() => require("./modern-
|
|
291
|
+
return [(0, antfu_exports.interopDefault)(Promise.resolve().then(() => require("./modern-Dnpu3mfI.cjs"))).then((pluginQuery) => pluginQuery.configs["flat/recommended"])];
|
|
295
292
|
}
|
|
296
293
|
//#endregion
|
|
297
294
|
//#region ../../node_modules/.pnpm/defu@6.1.7/node_modules/defu/dist/defu.mjs
|
|
@@ -347,7 +344,7 @@ const BASE_RULES = {
|
|
|
347
344
|
};
|
|
348
345
|
const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
349
346
|
const ANTFU_PACKAGE_DIR = node_path.default.dirname(require$1.resolve("@antfu/eslint-config/package.json"));
|
|
350
|
-
const GENERAL_EDITORCONFIG_SECTIONS = new Set([
|
|
347
|
+
const GENERAL_EDITORCONFIG_SECTIONS = /* @__PURE__ */ new Set([
|
|
351
348
|
"*",
|
|
352
349
|
"**",
|
|
353
350
|
"**/*",
|
|
@@ -488,6 +485,11 @@ function resolveUserOptions(options) {
|
|
|
488
485
|
resolved.miniProgram = true;
|
|
489
486
|
delete resolved.weapp;
|
|
490
487
|
}
|
|
488
|
+
const legacyTailwindcssOption = resolved.tailwindcss;
|
|
489
|
+
if (isObject(legacyTailwindcssOption)) {
|
|
490
|
+
resolved.betterTailwindcss ??= legacyTailwindcssOption;
|
|
491
|
+
delete resolved.tailwindcss;
|
|
492
|
+
}
|
|
491
493
|
const resolvedVue = mergeOptionWithDefaults(resolved.vue, getDefaultVueOptions(options), { postProcess: applyVueVersionSpecificRules });
|
|
492
494
|
if (resolvedVue === void 0) delete resolved.vue;
|
|
493
495
|
else resolved.vue = resolvedVue;
|
|
@@ -535,6 +537,10 @@ function getPresets(options, mode) {
|
|
|
535
537
|
{
|
|
536
538
|
files: ["**/*.{css,scss,sass,less,pcss,postcss,json,jsonc,json5}"],
|
|
537
539
|
rules: { "style/eol-last": "off" }
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
files: ["**/*.{json,jsonc,json5}"],
|
|
543
|
+
rules: { "unicorn/prefer-number-properties": "off" }
|
|
538
544
|
}
|
|
539
545
|
];
|
|
540
546
|
if (resolved.vue !== false && resolved.vue !== void 0) presets.push({
|
|
@@ -549,7 +555,7 @@ function getPresets(options, mode) {
|
|
|
549
555
|
languageOptions: { parser: antfu_exports.parserPlain },
|
|
550
556
|
rules: {}
|
|
551
557
|
});
|
|
552
|
-
presets.push(...resolveStylelintBridgePresets(resolved.stylelint), ...resolveTailwindPresets(resolved.tailwindcss), ...resolveMdxPresets(resolved.mdx), ...resolveNestPresets(resolved.nestjs), ...resolveQueryPresets(resolved.query), ...resolveAccessibilityPresets(resolved.a11y, resolved.vue, resolved.react));
|
|
558
|
+
presets.push(...resolveStylelintBridgePresets(resolved.stylelint), ...resolveTailwindPresets(resolved.tailwindcss), ...resolveBetterTailwindPresets(resolved.betterTailwindcss), ...resolveMdxPresets(resolved.mdx), ...resolveNestPresets(resolved.nestjs), ...resolveQueryPresets(resolved.query), ...resolveAccessibilityPresets(resolved.a11y, resolved.vue, resolved.react));
|
|
553
559
|
return [resolved, ...presets];
|
|
554
560
|
}
|
|
555
561
|
//#endregion
|
|
@@ -746,9 +752,6 @@ function icebreakerLegacy(options = {}, ...userConfigs) {
|
|
|
746
752
|
return applyOxfmtFormatterOverrides((0, antfu_exports.antfu)(toAntfuOptions(normalized), ...presets, ...userConfigs.map(normalizeUserConfig)), normalized.formatters);
|
|
747
753
|
}
|
|
748
754
|
//#endregion
|
|
749
|
-
exports.__commonJSMin = __commonJSMin;
|
|
750
|
-
exports.__esmMin = __esmMin;
|
|
751
|
-
exports.__toESM = __toESM;
|
|
752
755
|
exports.getPresets = getPresets;
|
|
753
756
|
exports.icebreaker = icebreaker;
|
|
754
757
|
exports.icebreakerLegacy = icebreakerLegacy;
|
package/dist/index.d.cts
CHANGED
|
@@ -1843,17 +1843,17 @@ interface Directive {
|
|
|
1843
1843
|
justification?: string;
|
|
1844
1844
|
}
|
|
1845
1845
|
//#endregion
|
|
1846
|
-
//#region ../../node_modules/.pnpm/@eslint+plugin-kit@0.7.
|
|
1846
|
+
//#region ../../node_modules/.pnpm/@eslint+plugin-kit@0.7.2/node_modules/@eslint/plugin-kit/dist/esm/types.d.ts
|
|
1847
1847
|
/**
|
|
1848
1848
|
* Adds matching `:exit` selector properties for each key of a `RuleVisitor`.
|
|
1849
1849
|
*/
|
|
1850
1850
|
type CustomRuleVisitorWithExit$1<RuleVisitorType extends RuleVisitor$1> = { [Key in keyof RuleVisitorType as Key | `${Key & string}:exit`]: RuleVisitorType[Key] };
|
|
1851
1851
|
//#endregion
|
|
1852
|
-
//#region ../../node_modules/.pnpm/@eslint+plugin-kit@0.7.
|
|
1852
|
+
//#region ../../node_modules/.pnpm/@eslint+plugin-kit@0.7.2/node_modules/@eslint/plugin-kit/dist/esm/index.d.ts
|
|
1853
1853
|
type RuleVisitor = RuleVisitor$1;
|
|
1854
1854
|
type CustomRuleVisitorWithExit<RuleVisitorType extends RuleVisitor> = CustomRuleVisitorWithExit$1<RuleVisitorType>;
|
|
1855
1855
|
//#endregion
|
|
1856
|
-
//#region ../../node_modules/.pnpm/eslint@10.
|
|
1856
|
+
//#region ../../node_modules/.pnpm/eslint@10.6.0_jiti@2.7.0/node_modules/eslint/lib/types/index.d.ts
|
|
1857
1857
|
//------------------------------------------------------------------------------
|
|
1858
1858
|
// Exports
|
|
1859
1859
|
//------------------------------------------------------------------------------
|
|
@@ -2201,6 +2201,15 @@ declare namespace Rule {
|
|
|
2201
2201
|
[key: string]: ((codePath: CodePath, node: Node) => void) | ((segment: CodePathSegment, node: Node) => void) | ((fromSegment: CodePathSegment, toSegment: CodePathSegment, node: Node) => void) | ((node: Node) => void) | NodeListener[keyof NodeListener] | undefined;
|
|
2202
2202
|
}
|
|
2203
2203
|
type CodePathOrigin = "program" | "function" | "class-field-initializer" | "class-static-block";
|
|
2204
|
+
interface CodePathSegmentTraversalController {
|
|
2205
|
+
skip(): void;
|
|
2206
|
+
break(): void;
|
|
2207
|
+
}
|
|
2208
|
+
type CodePathSegmentTraversalCallback = (this: CodePath, segment: CodePathSegment, controller: CodePathSegmentTraversalController) => void;
|
|
2209
|
+
interface CodePathTraversalOptions {
|
|
2210
|
+
first?: CodePathSegment | undefined;
|
|
2211
|
+
last?: CodePathSegment | undefined;
|
|
2212
|
+
}
|
|
2204
2213
|
interface CodePath {
|
|
2205
2214
|
id: string;
|
|
2206
2215
|
origin: CodePathOrigin;
|
|
@@ -2210,11 +2219,15 @@ declare namespace Rule {
|
|
|
2210
2219
|
thrownSegments: CodePathSegment[];
|
|
2211
2220
|
upper: CodePath | null;
|
|
2212
2221
|
childCodePaths: CodePath[];
|
|
2222
|
+
traverseSegments(callback: CodePathSegmentTraversalCallback): void;
|
|
2223
|
+
traverseSegments(options: CodePathTraversalOptions, callback: CodePathSegmentTraversalCallback): void;
|
|
2213
2224
|
}
|
|
2214
2225
|
interface CodePathSegment {
|
|
2215
2226
|
id: string;
|
|
2216
2227
|
nextSegments: CodePathSegment[];
|
|
2217
2228
|
prevSegments: CodePathSegment[];
|
|
2229
|
+
allNextSegments: CodePathSegment[];
|
|
2230
|
+
allPrevSegments: CodePathSegment[];
|
|
2218
2231
|
reachable: boolean;
|
|
2219
2232
|
}
|
|
2220
2233
|
type RuleMetaData = RulesMeta;
|
|
@@ -2695,14 +2708,28 @@ declare namespace ESLint {
|
|
|
2695
2708
|
}
|
|
2696
2709
|
//#endregion
|
|
2697
2710
|
//#region src/types.d.ts
|
|
2698
|
-
interface
|
|
2711
|
+
interface BetterTailwindcssOption {
|
|
2699
2712
|
/**
|
|
2700
2713
|
* Tailwind CSS v4 entry point, e.g. `src/global.css`.
|
|
2701
2714
|
*/
|
|
2702
2715
|
entryPoint?: string;
|
|
2716
|
+
/**
|
|
2717
|
+
* Files that should receive better-tailwindcss rules.
|
|
2718
|
+
* Defaults to the entry point directory for relative entry points, otherwise source-like files.
|
|
2719
|
+
*/
|
|
2720
|
+
files?: string[];
|
|
2721
|
+
/**
|
|
2722
|
+
* Rule preset for object mode.
|
|
2723
|
+
*
|
|
2724
|
+
* `syntax` keeps the fast rules that do not need Tailwind class analysis.
|
|
2725
|
+
* `recommended` enables the full eslint-plugin-better-tailwindcss recommended preset.
|
|
2726
|
+
*
|
|
2727
|
+
* @default 'syntax'
|
|
2728
|
+
*/
|
|
2729
|
+
rules?: 'syntax' | 'recommended';
|
|
2703
2730
|
/**
|
|
2704
2731
|
* Working directory passed to eslint-plugin-better-tailwindcss.
|
|
2705
|
-
* Defaults to
|
|
2732
|
+
* Defaults to ESLint's current working directory.
|
|
2706
2733
|
*/
|
|
2707
2734
|
cwd?: string;
|
|
2708
2735
|
/**
|
|
@@ -2710,7 +2737,8 @@ interface TailwindcssOption {
|
|
|
2710
2737
|
*/
|
|
2711
2738
|
tailwindConfig?: string;
|
|
2712
2739
|
}
|
|
2713
|
-
type
|
|
2740
|
+
type BetterTailwindcssConfig = boolean | BetterTailwindcssOption;
|
|
2741
|
+
type TailwindcssConfig = boolean;
|
|
2714
2742
|
interface UnocssOption {
|
|
2715
2743
|
/**
|
|
2716
2744
|
* UnoCSS config file path, e.g. `uno.config.ts`.
|
|
@@ -2771,10 +2799,15 @@ type UserDefinedOptions = Omit<OptionsConfig, 'formatters' | 'unocss'> & TypedFl
|
|
|
2771
2799
|
*/
|
|
2772
2800
|
miniProgram?: boolean;
|
|
2773
2801
|
/**
|
|
2774
|
-
* Enable
|
|
2802
|
+
* Enable eslint-plugin-tailwindcss support.
|
|
2775
2803
|
* @default false
|
|
2776
2804
|
*/
|
|
2777
2805
|
tailwindcss?: TailwindcssConfig;
|
|
2806
|
+
/**
|
|
2807
|
+
* Enable eslint-plugin-better-tailwindcss support.
|
|
2808
|
+
* @default false
|
|
2809
|
+
*/
|
|
2810
|
+
betterTailwindcss?: BetterTailwindcssConfig;
|
|
2778
2811
|
/**
|
|
2779
2812
|
* Enable UnoCSS support.
|
|
2780
2813
|
* @default false
|
|
@@ -2828,4 +2861,4 @@ type IcebreakerLegacyEslintConfig = ReturnType<typeof icebreakerLegacy>;
|
|
|
2828
2861
|
//#region src/preset.d.ts
|
|
2829
2862
|
declare function getPresets(options?: UserDefinedOptions, mode?: 'legacy'): [UserDefinedOptions, ...UserConfigItem[]];
|
|
2830
2863
|
type parserPlain = import__antfu_eslint_config.parserPlain;
|
|
2831
|
-
export { type ConfigNames, type FlatConfigComposer, IcebreakerEslintConfig, type IcebreakerFormatterOptions, IcebreakerLegacyEslintConfig, type StylelintBridgeConfig, type StylelintBridgeOption, type TailwindcssConfig, type
|
|
2864
|
+
export { type BetterTailwindcssConfig, type BetterTailwindcssOption, type ConfigNames, type FlatConfigComposer, IcebreakerEslintConfig, type IcebreakerFormatterOptions, IcebreakerLegacyEslintConfig, type StylelintBridgeConfig, type StylelintBridgeOption, type TailwindcssConfig, type TypedFlatConfigItem, type UnocssConfig, type UnocssOption, type UserConfigItem, type UserDefinedOptions, getPresets, icebreaker, icebreakerLegacy, parserPlain };
|
package/dist/index.d.ts
CHANGED
|
@@ -1843,17 +1843,17 @@ interface Directive {
|
|
|
1843
1843
|
justification?: string;
|
|
1844
1844
|
}
|
|
1845
1845
|
//#endregion
|
|
1846
|
-
//#region ../../node_modules/.pnpm/@eslint+plugin-kit@0.7.
|
|
1846
|
+
//#region ../../node_modules/.pnpm/@eslint+plugin-kit@0.7.2/node_modules/@eslint/plugin-kit/dist/esm/types.d.ts
|
|
1847
1847
|
/**
|
|
1848
1848
|
* Adds matching `:exit` selector properties for each key of a `RuleVisitor`.
|
|
1849
1849
|
*/
|
|
1850
1850
|
type CustomRuleVisitorWithExit$1<RuleVisitorType extends RuleVisitor$1> = { [Key in keyof RuleVisitorType as Key | `${Key & string}:exit`]: RuleVisitorType[Key] };
|
|
1851
1851
|
//#endregion
|
|
1852
|
-
//#region ../../node_modules/.pnpm/@eslint+plugin-kit@0.7.
|
|
1852
|
+
//#region ../../node_modules/.pnpm/@eslint+plugin-kit@0.7.2/node_modules/@eslint/plugin-kit/dist/esm/index.d.ts
|
|
1853
1853
|
type RuleVisitor = RuleVisitor$1;
|
|
1854
1854
|
type CustomRuleVisitorWithExit<RuleVisitorType extends RuleVisitor> = CustomRuleVisitorWithExit$1<RuleVisitorType>;
|
|
1855
1855
|
//#endregion
|
|
1856
|
-
//#region ../../node_modules/.pnpm/eslint@10.
|
|
1856
|
+
//#region ../../node_modules/.pnpm/eslint@10.6.0_jiti@2.7.0/node_modules/eslint/lib/types/index.d.ts
|
|
1857
1857
|
//------------------------------------------------------------------------------
|
|
1858
1858
|
// Exports
|
|
1859
1859
|
//------------------------------------------------------------------------------
|
|
@@ -2201,6 +2201,15 @@ declare namespace Rule {
|
|
|
2201
2201
|
[key: string]: ((codePath: CodePath, node: Node) => void) | ((segment: CodePathSegment, node: Node) => void) | ((fromSegment: CodePathSegment, toSegment: CodePathSegment, node: Node) => void) | ((node: Node) => void) | NodeListener[keyof NodeListener] | undefined;
|
|
2202
2202
|
}
|
|
2203
2203
|
type CodePathOrigin = "program" | "function" | "class-field-initializer" | "class-static-block";
|
|
2204
|
+
interface CodePathSegmentTraversalController {
|
|
2205
|
+
skip(): void;
|
|
2206
|
+
break(): void;
|
|
2207
|
+
}
|
|
2208
|
+
type CodePathSegmentTraversalCallback = (this: CodePath, segment: CodePathSegment, controller: CodePathSegmentTraversalController) => void;
|
|
2209
|
+
interface CodePathTraversalOptions {
|
|
2210
|
+
first?: CodePathSegment | undefined;
|
|
2211
|
+
last?: CodePathSegment | undefined;
|
|
2212
|
+
}
|
|
2204
2213
|
interface CodePath {
|
|
2205
2214
|
id: string;
|
|
2206
2215
|
origin: CodePathOrigin;
|
|
@@ -2210,11 +2219,15 @@ declare namespace Rule {
|
|
|
2210
2219
|
thrownSegments: CodePathSegment[];
|
|
2211
2220
|
upper: CodePath | null;
|
|
2212
2221
|
childCodePaths: CodePath[];
|
|
2222
|
+
traverseSegments(callback: CodePathSegmentTraversalCallback): void;
|
|
2223
|
+
traverseSegments(options: CodePathTraversalOptions, callback: CodePathSegmentTraversalCallback): void;
|
|
2213
2224
|
}
|
|
2214
2225
|
interface CodePathSegment {
|
|
2215
2226
|
id: string;
|
|
2216
2227
|
nextSegments: CodePathSegment[];
|
|
2217
2228
|
prevSegments: CodePathSegment[];
|
|
2229
|
+
allNextSegments: CodePathSegment[];
|
|
2230
|
+
allPrevSegments: CodePathSegment[];
|
|
2218
2231
|
reachable: boolean;
|
|
2219
2232
|
}
|
|
2220
2233
|
type RuleMetaData = RulesMeta;
|
|
@@ -2695,14 +2708,28 @@ declare namespace ESLint {
|
|
|
2695
2708
|
}
|
|
2696
2709
|
//#endregion
|
|
2697
2710
|
//#region src/types.d.ts
|
|
2698
|
-
interface
|
|
2711
|
+
interface BetterTailwindcssOption {
|
|
2699
2712
|
/**
|
|
2700
2713
|
* Tailwind CSS v4 entry point, e.g. `src/global.css`.
|
|
2701
2714
|
*/
|
|
2702
2715
|
entryPoint?: string;
|
|
2716
|
+
/**
|
|
2717
|
+
* Files that should receive better-tailwindcss rules.
|
|
2718
|
+
* Defaults to the entry point directory for relative entry points, otherwise source-like files.
|
|
2719
|
+
*/
|
|
2720
|
+
files?: string[];
|
|
2721
|
+
/**
|
|
2722
|
+
* Rule preset for object mode.
|
|
2723
|
+
*
|
|
2724
|
+
* `syntax` keeps the fast rules that do not need Tailwind class analysis.
|
|
2725
|
+
* `recommended` enables the full eslint-plugin-better-tailwindcss recommended preset.
|
|
2726
|
+
*
|
|
2727
|
+
* @default 'syntax'
|
|
2728
|
+
*/
|
|
2729
|
+
rules?: 'syntax' | 'recommended';
|
|
2703
2730
|
/**
|
|
2704
2731
|
* Working directory passed to eslint-plugin-better-tailwindcss.
|
|
2705
|
-
* Defaults to
|
|
2732
|
+
* Defaults to ESLint's current working directory.
|
|
2706
2733
|
*/
|
|
2707
2734
|
cwd?: string;
|
|
2708
2735
|
/**
|
|
@@ -2710,7 +2737,8 @@ interface TailwindcssOption {
|
|
|
2710
2737
|
*/
|
|
2711
2738
|
tailwindConfig?: string;
|
|
2712
2739
|
}
|
|
2713
|
-
type
|
|
2740
|
+
type BetterTailwindcssConfig = boolean | BetterTailwindcssOption;
|
|
2741
|
+
type TailwindcssConfig = boolean;
|
|
2714
2742
|
interface UnocssOption {
|
|
2715
2743
|
/**
|
|
2716
2744
|
* UnoCSS config file path, e.g. `uno.config.ts`.
|
|
@@ -2771,10 +2799,15 @@ type UserDefinedOptions = Omit<OptionsConfig, 'formatters' | 'unocss'> & TypedFl
|
|
|
2771
2799
|
*/
|
|
2772
2800
|
miniProgram?: boolean;
|
|
2773
2801
|
/**
|
|
2774
|
-
* Enable
|
|
2802
|
+
* Enable eslint-plugin-tailwindcss support.
|
|
2775
2803
|
* @default false
|
|
2776
2804
|
*/
|
|
2777
2805
|
tailwindcss?: TailwindcssConfig;
|
|
2806
|
+
/**
|
|
2807
|
+
* Enable eslint-plugin-better-tailwindcss support.
|
|
2808
|
+
* @default false
|
|
2809
|
+
*/
|
|
2810
|
+
betterTailwindcss?: BetterTailwindcssConfig;
|
|
2778
2811
|
/**
|
|
2779
2812
|
* Enable UnoCSS support.
|
|
2780
2813
|
* @default false
|
|
@@ -2828,4 +2861,4 @@ type IcebreakerLegacyEslintConfig = ReturnType<typeof icebreakerLegacy>;
|
|
|
2828
2861
|
//#region src/preset.d.ts
|
|
2829
2862
|
declare function getPresets(options?: UserDefinedOptions, mode?: 'legacy'): [UserDefinedOptions, ...UserConfigItem[]];
|
|
2830
2863
|
type parserPlain = import__antfu_eslint_config.parserPlain;
|
|
2831
|
-
export { type ConfigNames, type FlatConfigComposer, IcebreakerEslintConfig, type IcebreakerFormatterOptions, IcebreakerLegacyEslintConfig, type StylelintBridgeConfig, type StylelintBridgeOption, type TailwindcssConfig, type
|
|
2864
|
+
export { type BetterTailwindcssConfig, type BetterTailwindcssOption, type ConfigNames, type FlatConfigComposer, IcebreakerEslintConfig, type IcebreakerFormatterOptions, IcebreakerLegacyEslintConfig, type StylelintBridgeConfig, type StylelintBridgeOption, type TailwindcssConfig, type TypedFlatConfigItem, type UnocssConfig, type UnocssOption, type UserConfigItem, type UserDefinedOptions, getPresets, icebreaker, icebreakerLegacy, parserPlain };
|