@icebreakers/eslint-config 2.0.0 → 2.0.2
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 +26 -8
- package/README.zh.md +16 -7
- package/dist/index.cjs +22 -10
- package/dist/index.d.cts +42 -5
- package/dist/index.d.ts +42 -5
- package/dist/index.js +21 -10
- package/dist/stylelint.cjs +9 -0
- package/dist/stylelint.d.cts +6 -0
- package/dist/stylelint.d.ts +6 -0
- package/dist/stylelint.js +7 -0
- package/index.d.ts +11 -0
- package/package.json +12 -7
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
- Node.js 18 or newer
|
|
12
12
|
- ESLint 9 with flat config support
|
|
13
|
-
- Install optional peer plugins when you turn on Tailwind (`eslint-plugin-tailwindcss` or `eslint-plugin-better-tailwindcss`), MDX (`eslint-plugin-mdx`),
|
|
13
|
+
- Install optional peer plugins when you turn on Tailwind (`eslint-plugin-tailwindcss` or `eslint-plugin-better-tailwindcss`), MDX (`eslint-plugin-mdx`), or UnoCSS (`@unocss/eslint-plugin`)
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
@@ -74,24 +74,42 @@ export default icebreaker({
|
|
|
74
74
|
|
|
75
75
|
### Stylelint Bridge
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
`@icebreakers/eslint-config` bundles the Stylelint bridge and uses
|
|
78
|
+
`@icebreakers/stylelint-config` as the default Stylelint preset when you opt in.
|
|
79
|
+
The bridge is still disabled by default. Turn it on with `stylelint: true` to
|
|
80
|
+
lint `*.css`, `*.scss`, and `.vue` style blocks through ESLint:
|
|
79
81
|
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
+
```ts
|
|
83
|
+
import { icebreaker } from '@icebreakers/eslint-config'
|
|
84
|
+
|
|
85
|
+
export default icebreaker({
|
|
86
|
+
vue: true,
|
|
87
|
+
stylelint: true,
|
|
88
|
+
})
|
|
82
89
|
```
|
|
83
90
|
|
|
91
|
+
You can also inline Stylelint preset options directly in `eslint.config.ts`:
|
|
92
|
+
|
|
84
93
|
```ts
|
|
85
94
|
import { icebreaker } from '@icebreakers/eslint-config'
|
|
86
95
|
|
|
87
96
|
export default icebreaker({
|
|
88
97
|
vue: true,
|
|
89
|
-
stylelint:
|
|
98
|
+
stylelint: {
|
|
99
|
+
cwd: process.cwd(),
|
|
100
|
+
presets: {
|
|
101
|
+
order: false,
|
|
102
|
+
},
|
|
103
|
+
rules: {
|
|
104
|
+
'color-named': 'never',
|
|
105
|
+
},
|
|
106
|
+
},
|
|
90
107
|
})
|
|
91
108
|
```
|
|
92
109
|
|
|
93
|
-
|
|
94
|
-
|
|
110
|
+
`stylelint.cwd` changes the resolution root, and the remaining fields follow
|
|
111
|
+
the `@icebreakers/stylelint-config` options (`presets`, `tailwindcssPreset`,
|
|
112
|
+
`ignores`, `extends`, `overrides`, `rules`).
|
|
95
113
|
|
|
96
114
|
### NestJS Projects
|
|
97
115
|
|
package/README.zh.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
- Node.js 18 或更高版本
|
|
10
10
|
- 支持 Flat Config 的 ESLint 9
|
|
11
|
-
- 如需启用 Tailwind、MDX、
|
|
11
|
+
- 如需启用 Tailwind、MDX、UnoCSS 等,可安装对应的可选依赖:`eslint-plugin-tailwindcss` / `eslint-plugin-better-tailwindcss`、`eslint-plugin-mdx`、`@unocss/eslint-plugin`
|
|
12
12
|
|
|
13
13
|
## 安装
|
|
14
14
|
|
|
@@ -72,16 +72,14 @@ export default icebreaker({
|
|
|
72
72
|
|
|
73
73
|
### Stylelint 桥接
|
|
74
74
|
|
|
75
|
+
`@icebreakers/eslint-config` 已内置 Stylelint bridge,并在启用时默认使用
|
|
76
|
+
`@icebreakers/stylelint-config` 作为 Stylelint 预设;但 bridge 默认仍是关闭的。
|
|
75
77
|
设置 `stylelint: true` 后,会把 Stylelint 诊断桥接到 ESLint,用于:
|
|
76
78
|
|
|
77
79
|
- `*.css`
|
|
78
80
|
- `*.scss`
|
|
79
81
|
- `.vue` 文件里的 `<style>` 块
|
|
80
82
|
|
|
81
|
-
```bash
|
|
82
|
-
pnpm add -D eslint-plugin-better-stylelint
|
|
83
|
-
```
|
|
84
|
-
|
|
85
83
|
```ts
|
|
86
84
|
import { icebreaker } from '@icebreakers/eslint-config'
|
|
87
85
|
|
|
@@ -91,18 +89,29 @@ export default icebreaker({
|
|
|
91
89
|
})
|
|
92
90
|
```
|
|
93
91
|
|
|
94
|
-
|
|
92
|
+
也可以直接把 Stylelint 预设配置写进 `eslint.config.ts`:
|
|
95
93
|
|
|
96
94
|
```ts
|
|
97
95
|
import { icebreaker } from '@icebreakers/eslint-config'
|
|
98
96
|
|
|
99
97
|
export default icebreaker({
|
|
98
|
+
vue: true,
|
|
100
99
|
stylelint: {
|
|
101
|
-
cwd:
|
|
100
|
+
cwd: process.cwd(),
|
|
101
|
+
presets: {
|
|
102
|
+
order: false,
|
|
103
|
+
},
|
|
104
|
+
rules: {
|
|
105
|
+
'color-named': 'never',
|
|
106
|
+
},
|
|
102
107
|
},
|
|
103
108
|
})
|
|
104
109
|
```
|
|
105
110
|
|
|
111
|
+
其中 `stylelint.cwd` 用来指定配置解析根目录,其余字段沿用
|
|
112
|
+
`@icebreakers/stylelint-config` 的选项结构,例如 `presets`、
|
|
113
|
+
`tailwindcssPreset`、`ignores`、`extends`、`overrides`、`rules`。
|
|
114
|
+
|
|
106
115
|
### NestJS 项目
|
|
107
116
|
|
|
108
117
|
建议在 Nest 项目中同时开启 `typescript` 与 `nestjs`,以便应用以下定制:
|
package/dist/index.cjs
CHANGED
|
@@ -149,6 +149,9 @@ function getDefaultTypescriptOptions(opts) {
|
|
|
149
149
|
}
|
|
150
150
|
//#endregion
|
|
151
151
|
//#region src/features.ts
|
|
152
|
+
function resolveStylelintConfigLoader() {
|
|
153
|
+
return require("url").pathToFileURL(__filename).href.endsWith(".ts") ? new URL("./stylelint.ts", require("url").pathToFileURL(__filename).href).href : new URL("./stylelint.js", require("url").pathToFileURL(__filename).href).href;
|
|
154
|
+
}
|
|
152
155
|
function resolveTailwindPresets(option) {
|
|
153
156
|
if (!option) return [];
|
|
154
157
|
if (typeof option === "object") return [(0, antfu_exports.interopDefault)(import("eslint-plugin-better-tailwindcss")).then((eslintPluginBetterTailwindcss) => {
|
|
@@ -170,29 +173,37 @@ function resolveTailwindPresets(option) {
|
|
|
170
173
|
return tailwind.configs["flat/recommended"];
|
|
171
174
|
}), { rules: { "tailwindcss/no-custom-classname": "off" } }];
|
|
172
175
|
}
|
|
176
|
+
function resolveStylelintBridgeOptions(option) {
|
|
177
|
+
const { cwd, ...stylelintConfigOptions } = typeof option === "object" ? option : {};
|
|
178
|
+
return {
|
|
179
|
+
...cwd ? { cwd } : {},
|
|
180
|
+
configLoader: resolveStylelintConfigLoader(),
|
|
181
|
+
configOptions: stylelintConfigOptions
|
|
182
|
+
};
|
|
183
|
+
}
|
|
173
184
|
function resolveStylelintBridgePresets(option) {
|
|
174
185
|
if (!option) return [];
|
|
175
|
-
const
|
|
176
|
-
const
|
|
186
|
+
const pluginModulePromise = import("eslint-plugin-better-stylelint");
|
|
187
|
+
const stylelintOptions = resolveStylelintBridgeOptions(option);
|
|
177
188
|
return [
|
|
178
|
-
|
|
189
|
+
pluginModulePromise.then((pluginModule) => {
|
|
179
190
|
return {
|
|
180
191
|
files: ["**/*.{css,pcss,postcss}"],
|
|
181
|
-
plugins: { stylelint:
|
|
182
|
-
processor:
|
|
192
|
+
plugins: { stylelint: pluginModule.default },
|
|
193
|
+
processor: pluginModule.createStylelintProcessor(stylelintOptions)
|
|
183
194
|
};
|
|
184
195
|
}),
|
|
185
|
-
|
|
196
|
+
pluginModulePromise.then((pluginModule) => {
|
|
186
197
|
return {
|
|
187
198
|
files: ["**/*.{scss,sass}"],
|
|
188
|
-
plugins: { stylelint:
|
|
189
|
-
processor:
|
|
199
|
+
plugins: { stylelint: pluginModule.default },
|
|
200
|
+
processor: pluginModule.createStylelintProcessor(stylelintOptions)
|
|
190
201
|
};
|
|
191
202
|
}),
|
|
192
|
-
|
|
203
|
+
pluginModulePromise.then((pluginModule) => {
|
|
193
204
|
return {
|
|
194
205
|
files: ["**/*.vue"],
|
|
195
|
-
plugins: { stylelint:
|
|
206
|
+
plugins: { stylelint: pluginModule.default },
|
|
196
207
|
rules: { "stylelint/stylelint": ["error", stylelintOptions] }
|
|
197
208
|
};
|
|
198
209
|
})
|
|
@@ -475,6 +486,7 @@ function icebreakerLegacy(options = {}, ...userConfigs) {
|
|
|
475
486
|
return (0, antfu_exports.antfu)(...getPresets(options, "legacy"), ...userConfigs);
|
|
476
487
|
}
|
|
477
488
|
//#endregion
|
|
489
|
+
exports.__toESM = __toESM;
|
|
478
490
|
exports.getPresets = getPresets;
|
|
479
491
|
exports.icebreaker = icebreaker;
|
|
480
492
|
exports.icebreakerLegacy = icebreakerLegacy;
|
package/dist/index.d.cts
CHANGED
|
@@ -1862,7 +1862,7 @@ type CustomRuleVisitorWithExit$1<RuleVisitorType extends RuleVisitor$1> = { [Key
|
|
|
1862
1862
|
type RuleVisitor = RuleVisitor$1;
|
|
1863
1863
|
type CustomRuleVisitorWithExit<RuleVisitorType extends RuleVisitor> = CustomRuleVisitorWithExit$1<RuleVisitorType>;
|
|
1864
1864
|
//#endregion
|
|
1865
|
-
//#region ../../node_modules/.pnpm/eslint@10.
|
|
1865
|
+
//#region ../../node_modules/.pnpm/eslint@10.1.0_jiti@2.6.1/node_modules/eslint/lib/types/index.d.ts
|
|
1866
1866
|
//------------------------------------------------------------------------------
|
|
1867
1867
|
// Exports
|
|
1868
1868
|
//------------------------------------------------------------------------------
|
|
@@ -2538,31 +2538,65 @@ declare namespace ESLint {
|
|
|
2538
2538
|
type Plugin = Plugin$1;
|
|
2539
2539
|
type FixType = "directive" | "problem" | "suggestion" | "layout";
|
|
2540
2540
|
type CacheStrategy = "content" | "metadata";
|
|
2541
|
+
/** The options with which to configure the ESLint instance. */
|
|
2541
2542
|
interface Options {
|
|
2542
2543
|
// File enumeration
|
|
2544
|
+
/** The value to use for the current working directory. */
|
|
2543
2545
|
cwd?: string | undefined;
|
|
2546
|
+
/** If `false` then `ESLint#lintFiles()` doesn't throw even if no target files found. Defaults to `true`. */
|
|
2544
2547
|
errorOnUnmatchedPattern?: boolean | undefined;
|
|
2548
|
+
/**
|
|
2549
|
+
* Set to false to skip glob resolution of input file paths to lint (default: true).
|
|
2550
|
+
* If false, each input file path is assumed to be a non-glob path to an existing file.
|
|
2551
|
+
*/
|
|
2545
2552
|
globInputPaths?: boolean | undefined;
|
|
2553
|
+
/** False disables all ignore patterns except for the default ones. */
|
|
2546
2554
|
ignore?: boolean | undefined;
|
|
2555
|
+
/** Ignore file patterns to use in addition to config ignores. These patterns are relative to `cwd`. */
|
|
2547
2556
|
ignorePatterns?: string[] | null | undefined;
|
|
2557
|
+
/** When set to true, missing patterns cause the linting operation to short circuit and not report any failures. */
|
|
2548
2558
|
passOnNoPatterns?: boolean | undefined;
|
|
2559
|
+
/** Show warnings when the file list includes ignored files. */
|
|
2549
2560
|
warnIgnored?: boolean | undefined; // Linting
|
|
2561
|
+
/** Enable or disable inline configuration comments. */
|
|
2550
2562
|
allowInlineConfig?: boolean | undefined;
|
|
2563
|
+
/** Base config, extended by all configs used with this instance. */
|
|
2551
2564
|
baseConfig?: Linter.Config | Linter.Config[] | null | undefined;
|
|
2565
|
+
/** Override config, overrides all configs used with this instance. */
|
|
2552
2566
|
overrideConfig?: Linter.Config | Linter.Config[] | null | undefined;
|
|
2567
|
+
/**
|
|
2568
|
+
* Searches for default config file when falsy; doesn't do any config file lookup when `true`; considered to be a config filename when a string.
|
|
2569
|
+
*/
|
|
2553
2570
|
overrideConfigFile?: string | true | null | undefined;
|
|
2571
|
+
/** An array of plugin implementations. */
|
|
2554
2572
|
plugins?: Record<string, Plugin> | null | undefined;
|
|
2573
|
+
/**
|
|
2574
|
+
* Default is `() => true`. A predicate function that filters rules to be run.
|
|
2575
|
+
* This function is called with an object containing `ruleId` and `severity`, and returns `true` if the rule should be run.
|
|
2576
|
+
*/
|
|
2555
2577
|
ruleFilter?: ((arg: {
|
|
2556
2578
|
ruleId: string;
|
|
2557
2579
|
severity: Exclude<Linter.Severity, 0>;
|
|
2558
2580
|
}) => boolean) | undefined;
|
|
2581
|
+
/** True enables added statistics on lint results. */
|
|
2559
2582
|
stats?: boolean | undefined; // Autofix
|
|
2583
|
+
/** Execute in autofix mode. If a function, should return a boolean. */
|
|
2560
2584
|
fix?: boolean | ((message: Linter.LintMessage) => boolean) | undefined;
|
|
2585
|
+
/** Array of rule types to apply fixes for. */
|
|
2561
2586
|
fixTypes?: FixType[] | null | undefined; // Cache-related
|
|
2587
|
+
/** Enable result caching. */
|
|
2562
2588
|
cache?: boolean | undefined;
|
|
2589
|
+
/** The cache file to use instead of .eslintcache. */
|
|
2563
2590
|
cacheLocation?: string | undefined;
|
|
2564
|
-
|
|
2591
|
+
/** The strategy used to detect changed files. */
|
|
2592
|
+
cacheStrategy?: CacheStrategy | undefined;
|
|
2593
|
+
/** If true, apply suppressions automatically. Defaults to false. */
|
|
2594
|
+
applySuppressions?: boolean | undefined;
|
|
2595
|
+
/** Path to suppressions file. Relative to cwd. Defaults to eslint-suppressions.json in cwd. */
|
|
2596
|
+
suppressionsLocation?: string | undefined; // Other Options
|
|
2597
|
+
/** Maximum number of linting threads, "auto" to choose automatically, "off" for no multithreading. */
|
|
2565
2598
|
concurrency?: number | "auto" | "off" | undefined;
|
|
2599
|
+
/** Array of feature flags to enable. */
|
|
2566
2600
|
flags?: string[] | undefined;
|
|
2567
2601
|
}
|
|
2568
2602
|
/** A linting result. */
|
|
@@ -2922,9 +2956,10 @@ interface TailwindcssOption {
|
|
|
2922
2956
|
tailwindConfig?: string;
|
|
2923
2957
|
}
|
|
2924
2958
|
type TailwindcssConfig = boolean | TailwindcssOption;
|
|
2925
|
-
|
|
2959
|
+
interface StylelintBridgeOption {
|
|
2926
2960
|
cwd?: string;
|
|
2927
|
-
}
|
|
2961
|
+
}
|
|
2962
|
+
type StylelintBridgeConfig = boolean | StylelintBridgeOption;
|
|
2928
2963
|
type UserDefinedOptions = OptionsConfig & TypedFlatConfigItem$1 & {
|
|
2929
2964
|
/**
|
|
2930
2965
|
* Enable TailwindCSS support
|
|
@@ -2971,9 +3006,11 @@ type UserConfigItem = Awaitable<TypedFlatConfigItem$1 | TypedFlatConfigItem$1[]
|
|
|
2971
3006
|
//#endregion
|
|
2972
3007
|
//#region src/factory.d.ts
|
|
2973
3008
|
declare function icebreaker(options?: UserDefinedOptions, ...userConfigs: UserConfigItem[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
|
|
3009
|
+
type IcebreakerEslintConfig = ReturnType<typeof icebreaker>;
|
|
2974
3010
|
declare function icebreakerLegacy(options?: UserDefinedOptions, ...userConfigs: UserConfigItem[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
|
|
3011
|
+
type IcebreakerLegacyEslintConfig = ReturnType<typeof icebreakerLegacy>;
|
|
2975
3012
|
//#endregion
|
|
2976
3013
|
//#region src/preset.d.ts
|
|
2977
3014
|
declare function getPresets(options?: UserDefinedOptions, mode?: 'legacy'): [UserDefinedOptions, ...UserConfigItem[]];
|
|
2978
3015
|
//#endregion
|
|
2979
|
-
export { type ConfigNames, type FlatConfigComposer, type TailwindcssConfig, type TailwindcssOption, type TypedFlatConfigItem, type UserConfigItem, type UserDefinedOptions, getPresets, icebreaker, icebreakerLegacy };
|
|
3016
|
+
export { type ConfigNames, type FlatConfigComposer, IcebreakerEslintConfig, IcebreakerLegacyEslintConfig, type StylelintBridgeConfig, type StylelintBridgeOption, type TailwindcssConfig, type TailwindcssOption, type TypedFlatConfigItem, type UserConfigItem, type UserDefinedOptions, getPresets, icebreaker, icebreakerLegacy };
|
package/dist/index.d.ts
CHANGED
|
@@ -1862,7 +1862,7 @@ type CustomRuleVisitorWithExit$1<RuleVisitorType extends RuleVisitor$1> = { [Key
|
|
|
1862
1862
|
type RuleVisitor = RuleVisitor$1;
|
|
1863
1863
|
type CustomRuleVisitorWithExit<RuleVisitorType extends RuleVisitor> = CustomRuleVisitorWithExit$1<RuleVisitorType>;
|
|
1864
1864
|
//#endregion
|
|
1865
|
-
//#region ../../node_modules/.pnpm/eslint@10.
|
|
1865
|
+
//#region ../../node_modules/.pnpm/eslint@10.1.0_jiti@2.6.1/node_modules/eslint/lib/types/index.d.ts
|
|
1866
1866
|
//------------------------------------------------------------------------------
|
|
1867
1867
|
// Exports
|
|
1868
1868
|
//------------------------------------------------------------------------------
|
|
@@ -2538,31 +2538,65 @@ declare namespace ESLint {
|
|
|
2538
2538
|
type Plugin = Plugin$1;
|
|
2539
2539
|
type FixType = "directive" | "problem" | "suggestion" | "layout";
|
|
2540
2540
|
type CacheStrategy = "content" | "metadata";
|
|
2541
|
+
/** The options with which to configure the ESLint instance. */
|
|
2541
2542
|
interface Options {
|
|
2542
2543
|
// File enumeration
|
|
2544
|
+
/** The value to use for the current working directory. */
|
|
2543
2545
|
cwd?: string | undefined;
|
|
2546
|
+
/** If `false` then `ESLint#lintFiles()` doesn't throw even if no target files found. Defaults to `true`. */
|
|
2544
2547
|
errorOnUnmatchedPattern?: boolean | undefined;
|
|
2548
|
+
/**
|
|
2549
|
+
* Set to false to skip glob resolution of input file paths to lint (default: true).
|
|
2550
|
+
* If false, each input file path is assumed to be a non-glob path to an existing file.
|
|
2551
|
+
*/
|
|
2545
2552
|
globInputPaths?: boolean | undefined;
|
|
2553
|
+
/** False disables all ignore patterns except for the default ones. */
|
|
2546
2554
|
ignore?: boolean | undefined;
|
|
2555
|
+
/** Ignore file patterns to use in addition to config ignores. These patterns are relative to `cwd`. */
|
|
2547
2556
|
ignorePatterns?: string[] | null | undefined;
|
|
2557
|
+
/** When set to true, missing patterns cause the linting operation to short circuit and not report any failures. */
|
|
2548
2558
|
passOnNoPatterns?: boolean | undefined;
|
|
2559
|
+
/** Show warnings when the file list includes ignored files. */
|
|
2549
2560
|
warnIgnored?: boolean | undefined; // Linting
|
|
2561
|
+
/** Enable or disable inline configuration comments. */
|
|
2550
2562
|
allowInlineConfig?: boolean | undefined;
|
|
2563
|
+
/** Base config, extended by all configs used with this instance. */
|
|
2551
2564
|
baseConfig?: Linter.Config | Linter.Config[] | null | undefined;
|
|
2565
|
+
/** Override config, overrides all configs used with this instance. */
|
|
2552
2566
|
overrideConfig?: Linter.Config | Linter.Config[] | null | undefined;
|
|
2567
|
+
/**
|
|
2568
|
+
* Searches for default config file when falsy; doesn't do any config file lookup when `true`; considered to be a config filename when a string.
|
|
2569
|
+
*/
|
|
2553
2570
|
overrideConfigFile?: string | true | null | undefined;
|
|
2571
|
+
/** An array of plugin implementations. */
|
|
2554
2572
|
plugins?: Record<string, Plugin> | null | undefined;
|
|
2573
|
+
/**
|
|
2574
|
+
* Default is `() => true`. A predicate function that filters rules to be run.
|
|
2575
|
+
* This function is called with an object containing `ruleId` and `severity`, and returns `true` if the rule should be run.
|
|
2576
|
+
*/
|
|
2555
2577
|
ruleFilter?: ((arg: {
|
|
2556
2578
|
ruleId: string;
|
|
2557
2579
|
severity: Exclude<Linter.Severity, 0>;
|
|
2558
2580
|
}) => boolean) | undefined;
|
|
2581
|
+
/** True enables added statistics on lint results. */
|
|
2559
2582
|
stats?: boolean | undefined; // Autofix
|
|
2583
|
+
/** Execute in autofix mode. If a function, should return a boolean. */
|
|
2560
2584
|
fix?: boolean | ((message: Linter.LintMessage) => boolean) | undefined;
|
|
2585
|
+
/** Array of rule types to apply fixes for. */
|
|
2561
2586
|
fixTypes?: FixType[] | null | undefined; // Cache-related
|
|
2587
|
+
/** Enable result caching. */
|
|
2562
2588
|
cache?: boolean | undefined;
|
|
2589
|
+
/** The cache file to use instead of .eslintcache. */
|
|
2563
2590
|
cacheLocation?: string | undefined;
|
|
2564
|
-
|
|
2591
|
+
/** The strategy used to detect changed files. */
|
|
2592
|
+
cacheStrategy?: CacheStrategy | undefined;
|
|
2593
|
+
/** If true, apply suppressions automatically. Defaults to false. */
|
|
2594
|
+
applySuppressions?: boolean | undefined;
|
|
2595
|
+
/** Path to suppressions file. Relative to cwd. Defaults to eslint-suppressions.json in cwd. */
|
|
2596
|
+
suppressionsLocation?: string | undefined; // Other Options
|
|
2597
|
+
/** Maximum number of linting threads, "auto" to choose automatically, "off" for no multithreading. */
|
|
2565
2598
|
concurrency?: number | "auto" | "off" | undefined;
|
|
2599
|
+
/** Array of feature flags to enable. */
|
|
2566
2600
|
flags?: string[] | undefined;
|
|
2567
2601
|
}
|
|
2568
2602
|
/** A linting result. */
|
|
@@ -2922,9 +2956,10 @@ interface TailwindcssOption {
|
|
|
2922
2956
|
tailwindConfig?: string;
|
|
2923
2957
|
}
|
|
2924
2958
|
type TailwindcssConfig = boolean | TailwindcssOption;
|
|
2925
|
-
|
|
2959
|
+
interface StylelintBridgeOption {
|
|
2926
2960
|
cwd?: string;
|
|
2927
|
-
}
|
|
2961
|
+
}
|
|
2962
|
+
type StylelintBridgeConfig = boolean | StylelintBridgeOption;
|
|
2928
2963
|
type UserDefinedOptions = OptionsConfig & TypedFlatConfigItem$1 & {
|
|
2929
2964
|
/**
|
|
2930
2965
|
* Enable TailwindCSS support
|
|
@@ -2971,9 +3006,11 @@ type UserConfigItem = Awaitable<TypedFlatConfigItem$1 | TypedFlatConfigItem$1[]
|
|
|
2971
3006
|
//#endregion
|
|
2972
3007
|
//#region src/factory.d.ts
|
|
2973
3008
|
declare function icebreaker(options?: UserDefinedOptions, ...userConfigs: UserConfigItem[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
|
|
3009
|
+
type IcebreakerEslintConfig = ReturnType<typeof icebreaker>;
|
|
2974
3010
|
declare function icebreakerLegacy(options?: UserDefinedOptions, ...userConfigs: UserConfigItem[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
|
|
3011
|
+
type IcebreakerLegacyEslintConfig = ReturnType<typeof icebreakerLegacy>;
|
|
2975
3012
|
//#endregion
|
|
2976
3013
|
//#region src/preset.d.ts
|
|
2977
3014
|
declare function getPresets(options?: UserDefinedOptions, mode?: 'legacy'): [UserDefinedOptions, ...UserConfigItem[]];
|
|
2978
3015
|
//#endregion
|
|
2979
|
-
export { type ConfigNames, type FlatConfigComposer, type TailwindcssConfig, type TailwindcssOption, type TypedFlatConfigItem, type UserConfigItem, type UserDefinedOptions, getPresets, icebreaker, icebreakerLegacy };
|
|
3016
|
+
export { type ConfigNames, type FlatConfigComposer, IcebreakerEslintConfig, IcebreakerLegacyEslintConfig, type StylelintBridgeConfig, type StylelintBridgeOption, type TailwindcssConfig, type TailwindcssOption, type TypedFlatConfigItem, type UserConfigItem, type UserDefinedOptions, getPresets, icebreaker, icebreakerLegacy };
|
package/dist/index.js
CHANGED
|
@@ -140,6 +140,9 @@ function getDefaultTypescriptOptions(opts) {
|
|
|
140
140
|
}
|
|
141
141
|
//#endregion
|
|
142
142
|
//#region src/features.ts
|
|
143
|
+
function resolveStylelintConfigLoader() {
|
|
144
|
+
return import.meta.url.endsWith(".ts") ? new URL("./stylelint.ts", import.meta.url).href : new URL("./stylelint.js", import.meta.url).href;
|
|
145
|
+
}
|
|
143
146
|
function resolveTailwindPresets(option) {
|
|
144
147
|
if (!option) return [];
|
|
145
148
|
if (typeof option === "object") return [(0, antfu_exports.interopDefault)(import("eslint-plugin-better-tailwindcss")).then((eslintPluginBetterTailwindcss) => {
|
|
@@ -161,29 +164,37 @@ function resolveTailwindPresets(option) {
|
|
|
161
164
|
return tailwind.configs["flat/recommended"];
|
|
162
165
|
}), { rules: { "tailwindcss/no-custom-classname": "off" } }];
|
|
163
166
|
}
|
|
167
|
+
function resolveStylelintBridgeOptions(option) {
|
|
168
|
+
const { cwd, ...stylelintConfigOptions } = typeof option === "object" ? option : {};
|
|
169
|
+
return {
|
|
170
|
+
...cwd ? { cwd } : {},
|
|
171
|
+
configLoader: resolveStylelintConfigLoader(),
|
|
172
|
+
configOptions: stylelintConfigOptions
|
|
173
|
+
};
|
|
174
|
+
}
|
|
164
175
|
function resolveStylelintBridgePresets(option) {
|
|
165
176
|
if (!option) return [];
|
|
166
|
-
const
|
|
167
|
-
const
|
|
177
|
+
const pluginModulePromise = import("eslint-plugin-better-stylelint");
|
|
178
|
+
const stylelintOptions = resolveStylelintBridgeOptions(option);
|
|
168
179
|
return [
|
|
169
|
-
|
|
180
|
+
pluginModulePromise.then((pluginModule) => {
|
|
170
181
|
return {
|
|
171
182
|
files: ["**/*.{css,pcss,postcss}"],
|
|
172
|
-
plugins: { stylelint:
|
|
173
|
-
processor:
|
|
183
|
+
plugins: { stylelint: pluginModule.default },
|
|
184
|
+
processor: pluginModule.createStylelintProcessor(stylelintOptions)
|
|
174
185
|
};
|
|
175
186
|
}),
|
|
176
|
-
|
|
187
|
+
pluginModulePromise.then((pluginModule) => {
|
|
177
188
|
return {
|
|
178
189
|
files: ["**/*.{scss,sass}"],
|
|
179
|
-
plugins: { stylelint:
|
|
180
|
-
processor:
|
|
190
|
+
plugins: { stylelint: pluginModule.default },
|
|
191
|
+
processor: pluginModule.createStylelintProcessor(stylelintOptions)
|
|
181
192
|
};
|
|
182
193
|
}),
|
|
183
|
-
|
|
194
|
+
pluginModulePromise.then((pluginModule) => {
|
|
184
195
|
return {
|
|
185
196
|
files: ["**/*.vue"],
|
|
186
|
-
plugins: { stylelint:
|
|
197
|
+
plugins: { stylelint: pluginModule.default },
|
|
187
198
|
rules: { "stylelint/stylelint": ["error", stylelintOptions] }
|
|
188
199
|
};
|
|
189
200
|
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("./index.cjs");
|
|
3
|
+
let _icebreakers_stylelint_config = require("@icebreakers/stylelint-config");
|
|
4
|
+
//#region src/stylelint.ts
|
|
5
|
+
function resolveStylelintConfig(options = {}) {
|
|
6
|
+
return (0, _icebreakers_stylelint_config.createStylelintConfig)(options);
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
exports.resolveStylelintConfig = resolveStylelintConfig;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IcebreakerStylelintOptions, IcebreakerStylelintOptions as IcebreakerStylelintOptions$1, createStylelintConfig } from "@icebreakers/stylelint-config";
|
|
2
|
+
|
|
3
|
+
//#region src/stylelint.d.ts
|
|
4
|
+
declare function resolveStylelintConfig(options?: IcebreakerStylelintOptions$1): ReturnType<typeof createStylelintConfig>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { type IcebreakerStylelintOptions, resolveStylelintConfig };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IcebreakerStylelintOptions, IcebreakerStylelintOptions as IcebreakerStylelintOptions$1, createStylelintConfig } from "@icebreakers/stylelint-config";
|
|
2
|
+
|
|
3
|
+
//#region src/stylelint.d.ts
|
|
4
|
+
declare function resolveStylelintConfig(options?: IcebreakerStylelintOptions$1): ReturnType<typeof createStylelintConfig>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { type IcebreakerStylelintOptions, resolveStylelintConfig };
|
package/index.d.ts
CHANGED
|
@@ -13,9 +13,14 @@ export interface TailwindcssOption {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export type TailwindcssConfig = boolean | TailwindcssOption
|
|
16
|
+
export interface StylelintBridgeOption {
|
|
17
|
+
cwd?: string
|
|
18
|
+
}
|
|
19
|
+
export type StylelintBridgeConfig = boolean | StylelintBridgeOption
|
|
16
20
|
|
|
17
21
|
export type UserDefinedOptions = OptionsConfig & TypedFlatConfigItem & {
|
|
18
22
|
tailwindcss?: TailwindcssConfig
|
|
23
|
+
stylelint?: StylelintBridgeConfig
|
|
19
24
|
mdx?: boolean
|
|
20
25
|
a11y?: boolean
|
|
21
26
|
nestjs?: boolean
|
|
@@ -41,11 +46,17 @@ export declare function icebreaker(
|
|
|
41
46
|
...userConfigs: UserConfigItem[]
|
|
42
47
|
): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>
|
|
43
48
|
|
|
49
|
+
export type IcebreakerEslintConfig = ReturnType<typeof icebreaker>
|
|
50
|
+
|
|
44
51
|
export declare function icebreakerLegacy(
|
|
45
52
|
options?: UserDefinedOptions,
|
|
46
53
|
...userConfigs: UserConfigItem[]
|
|
47
54
|
): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>
|
|
48
55
|
|
|
56
|
+
export type IcebreakerLegacyEslintConfig = ReturnType<
|
|
57
|
+
typeof icebreakerLegacy
|
|
58
|
+
>
|
|
59
|
+
|
|
49
60
|
export type {
|
|
50
61
|
ConfigNames,
|
|
51
62
|
FlatConfigComposer,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icebreakers/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.2",
|
|
5
5
|
"description": "ESLint preset from Icebreaker's dev-configs",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -24,6 +24,11 @@
|
|
|
24
24
|
"import": "./dist/index.js",
|
|
25
25
|
"require": "./dist/index.cjs"
|
|
26
26
|
},
|
|
27
|
+
"./stylelint": {
|
|
28
|
+
"types": "./dist/stylelint.d.ts",
|
|
29
|
+
"import": "./dist/stylelint.js",
|
|
30
|
+
"require": "./dist/stylelint.cjs"
|
|
31
|
+
},
|
|
27
32
|
"./*": "./*"
|
|
28
33
|
},
|
|
29
34
|
"main": "./dist/index.cjs",
|
|
@@ -34,13 +39,9 @@
|
|
|
34
39
|
"index.d.ts"
|
|
35
40
|
],
|
|
36
41
|
"peerDependencies": {
|
|
37
|
-
"eslint-plugin-pnpm": "^1.4.3"
|
|
38
|
-
"eslint-plugin-better-stylelint": "0.1.0"
|
|
42
|
+
"eslint-plugin-pnpm": "^1.4.3"
|
|
39
43
|
},
|
|
40
44
|
"peerDependenciesMeta": {
|
|
41
|
-
"eslint-plugin-better-stylelint": {
|
|
42
|
-
"optional": true
|
|
43
|
-
},
|
|
44
45
|
"eslint-plugin-pnpm": {
|
|
45
46
|
"optional": true
|
|
46
47
|
}
|
|
@@ -56,7 +57,9 @@
|
|
|
56
57
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
57
58
|
"eslint-plugin-react-refresh": "^0.5.2",
|
|
58
59
|
"eslint-plugin-tailwindcss": "3.18.2",
|
|
59
|
-
"eslint-plugin-vuejs-accessibility": "^2.5.0"
|
|
60
|
+
"eslint-plugin-vuejs-accessibility": "^2.5.0",
|
|
61
|
+
"eslint-plugin-better-stylelint": "0.1.1",
|
|
62
|
+
"@icebreakers/stylelint-config": "2.1.1"
|
|
60
63
|
},
|
|
61
64
|
"optionalDependencies": {
|
|
62
65
|
"@unocss/eslint-plugin": "66.6.7",
|
|
@@ -69,6 +72,8 @@
|
|
|
69
72
|
"tsd": {
|
|
70
73
|
"directory": "test-d",
|
|
71
74
|
"compilerOptions": {
|
|
75
|
+
"module": "esnext",
|
|
76
|
+
"moduleResolution": "bundler",
|
|
72
77
|
"skipLibCheck": true
|
|
73
78
|
}
|
|
74
79
|
},
|