@icebreakers/eslint-config 4.0.4 → 4.0.6

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.cjs CHANGED
@@ -31,13 +31,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
31
31
  enumerable: true
32
32
  }) : target, mod));
33
33
  //#endregion
34
- let node_fs = require("node:fs");
35
- node_fs = __toESM(node_fs);
36
- let node_module = require("node:module");
37
34
  let node_path = require("node:path");
38
- node_path = __toESM(node_path);
35
+ node_path = __toESM(node_path, 1);
39
36
  let node_process = require("node:process");
40
- node_process = __toESM(node_process);
37
+ node_process = __toESM(node_process, 1);
38
+ let node_fs = require("node:fs");
39
+ node_fs = __toESM(node_fs, 1);
40
+ let node_module = require("node:module");
41
41
  let node_url = require("node:url");
42
42
  //#region src/antfu.ts
43
43
  var antfu_exports = /* @__PURE__ */ __exportAll({});
@@ -188,6 +188,24 @@ const MDX_PACKAGES = ["eslint-plugin-mdx"];
188
188
  const VUE_A11Y_PACKAGES = ["eslint-plugin-vuejs-accessibility"];
189
189
  const REACT_A11Y_PACKAGES = ["eslint-plugin-jsx-a11y"];
190
190
  const QUERY_PACKAGES = ["@tanstack/eslint-plugin-query"];
191
+ const BETTER_TAILWIND_FILES = ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx,vue,html,md,mdx,astro,svelte}"];
192
+ const BETTER_TAILWIND_IGNORES = [
193
+ "**/*.json",
194
+ "**/*.json5",
195
+ "**/*.yaml",
196
+ "**/*.yml",
197
+ "**/*.{lock,lockb}",
198
+ "**/package.json",
199
+ "**/package-lock.json",
200
+ "**/pnpm-lock.yaml",
201
+ "**/yarn.lock",
202
+ "**/bun.lock",
203
+ "**/bun.lockb",
204
+ "**/composer.lock",
205
+ "**/Cargo.lock",
206
+ "**/Gemfile.lock",
207
+ "**/go.sum"
208
+ ];
191
209
  function resolveStylelintConfigLoader(moduleUrl = require("url").pathToFileURL(__filename).href) {
192
210
  return moduleUrl.endsWith(".ts") ? new URL("./stylelint.ts", moduleUrl).href : new URL("./stylelint.js", moduleUrl).href;
193
211
  }
@@ -196,15 +214,19 @@ function resolveTailwindPresets(option) {
196
214
  if (typeof option === "object") {
197
215
  if (!hasAllPackages(BETTER_TAILWIND_PACKAGES)) return [];
198
216
  return [(0, antfu_exports.interopDefault)(import("eslint-plugin-better-tailwindcss")).then((eslintPluginBetterTailwindcss) => {
217
+ const cwd = option.cwd ?? (option.entryPoint ? node_path.default.dirname(option.entryPoint) : void 0) ?? node_process.default.cwd();
199
218
  const betterTailwindcssRules = {
200
219
  ...eslintPluginBetterTailwindcss.configs["recommended-warn"].rules,
201
220
  ...eslintPluginBetterTailwindcss.configs["recommended-error"].rules
202
221
  };
203
222
  return {
204
223
  name: "icebreaker/better-tailwindcss",
224
+ files: BETTER_TAILWIND_FILES,
225
+ ignores: BETTER_TAILWIND_IGNORES,
205
226
  plugins: { "better-tailwindcss": eslintPluginBetterTailwindcss },
206
227
  rules: betterTailwindcssRules,
207
228
  settings: { "better-tailwindcss": {
229
+ cwd,
208
230
  entryPoint: option.entryPoint,
209
231
  tailwindConfig: option.tailwindConfig
210
232
  } }
package/dist/index.d.cts CHANGED
@@ -1854,7 +1854,7 @@ interface AwaitExpression extends BaseExpression {
1854
1854
  argument: Expression;
1855
1855
  }
1856
1856
  //#endregion
1857
- //#region ../../node_modules/.pnpm/@eslint+core@1.2.0/node_modules/@eslint/core/dist/esm/types.d.ts
1857
+ //#region ../../node_modules/.pnpm/@eslint+core@1.2.1/node_modules/@eslint/core/dist/esm/types.d.ts
1858
1858
  /**
1859
1859
  * Represents an error inside of a file.
1860
1860
  */
@@ -2968,17 +2968,17 @@ interface Directive {
2968
2968
  justification?: string;
2969
2969
  }
2970
2970
  //#endregion
2971
- //#region ../../node_modules/.pnpm/@eslint+plugin-kit@0.7.0/node_modules/@eslint/plugin-kit/dist/esm/types.d.ts
2971
+ //#region ../../node_modules/.pnpm/@eslint+plugin-kit@0.7.1/node_modules/@eslint/plugin-kit/dist/esm/types.d.ts
2972
2972
  /**
2973
2973
  * Adds matching `:exit` selector properties for each key of a `RuleVisitor`.
2974
2974
  */
2975
2975
  type CustomRuleVisitorWithExit$1<RuleVisitorType extends RuleVisitor$1> = { [Key in keyof RuleVisitorType as Key | `${Key & string}:exit`]: RuleVisitorType[Key] };
2976
2976
  //#endregion
2977
- //#region ../../node_modules/.pnpm/@eslint+plugin-kit@0.7.0/node_modules/@eslint/plugin-kit/dist/esm/index.d.ts
2977
+ //#region ../../node_modules/.pnpm/@eslint+plugin-kit@0.7.1/node_modules/@eslint/plugin-kit/dist/esm/index.d.ts
2978
2978
  type RuleVisitor = RuleVisitor$1;
2979
2979
  type CustomRuleVisitorWithExit<RuleVisitorType extends RuleVisitor> = CustomRuleVisitorWithExit$1<RuleVisitorType>;
2980
2980
  //#endregion
2981
- //#region ../../node_modules/.pnpm/eslint@10.2.0_jiti@2.6.1/node_modules/eslint/lib/types/index.d.ts
2981
+ //#region ../../node_modules/.pnpm/eslint@10.2.1_jiti@2.6.1/node_modules/eslint/lib/types/index.d.ts
2982
2982
  //------------------------------------------------------------------------------
2983
2983
  // Exports
2984
2984
  //------------------------------------------------------------------------------
@@ -4112,6 +4112,11 @@ interface TailwindcssOption {
4112
4112
  * Tailwind CSS v4 entry point, e.g. `src/global.css`.
4113
4113
  */
4114
4114
  entryPoint?: string;
4115
+ /**
4116
+ * Working directory passed to eslint-plugin-better-tailwindcss.
4117
+ * Defaults to `dirname(entryPoint)` when present, otherwise `process.cwd()`.
4118
+ */
4119
+ cwd?: string;
4115
4120
  /**
4116
4121
  * Tailwind CSS v3 config file path, e.g. `tailwind.config.js`.
4117
4122
  */
package/dist/index.d.ts CHANGED
@@ -1854,7 +1854,7 @@ interface AwaitExpression extends BaseExpression {
1854
1854
  argument: Expression;
1855
1855
  }
1856
1856
  //#endregion
1857
- //#region ../../node_modules/.pnpm/@eslint+core@1.2.0/node_modules/@eslint/core/dist/esm/types.d.ts
1857
+ //#region ../../node_modules/.pnpm/@eslint+core@1.2.1/node_modules/@eslint/core/dist/esm/types.d.ts
1858
1858
  /**
1859
1859
  * Represents an error inside of a file.
1860
1860
  */
@@ -2968,17 +2968,17 @@ interface Directive {
2968
2968
  justification?: string;
2969
2969
  }
2970
2970
  //#endregion
2971
- //#region ../../node_modules/.pnpm/@eslint+plugin-kit@0.7.0/node_modules/@eslint/plugin-kit/dist/esm/types.d.ts
2971
+ //#region ../../node_modules/.pnpm/@eslint+plugin-kit@0.7.1/node_modules/@eslint/plugin-kit/dist/esm/types.d.ts
2972
2972
  /**
2973
2973
  * Adds matching `:exit` selector properties for each key of a `RuleVisitor`.
2974
2974
  */
2975
2975
  type CustomRuleVisitorWithExit$1<RuleVisitorType extends RuleVisitor$1> = { [Key in keyof RuleVisitorType as Key | `${Key & string}:exit`]: RuleVisitorType[Key] };
2976
2976
  //#endregion
2977
- //#region ../../node_modules/.pnpm/@eslint+plugin-kit@0.7.0/node_modules/@eslint/plugin-kit/dist/esm/index.d.ts
2977
+ //#region ../../node_modules/.pnpm/@eslint+plugin-kit@0.7.1/node_modules/@eslint/plugin-kit/dist/esm/index.d.ts
2978
2978
  type RuleVisitor = RuleVisitor$1;
2979
2979
  type CustomRuleVisitorWithExit<RuleVisitorType extends RuleVisitor> = CustomRuleVisitorWithExit$1<RuleVisitorType>;
2980
2980
  //#endregion
2981
- //#region ../../node_modules/.pnpm/eslint@10.2.0_jiti@2.6.1/node_modules/eslint/lib/types/index.d.ts
2981
+ //#region ../../node_modules/.pnpm/eslint@10.2.1_jiti@2.6.1/node_modules/eslint/lib/types/index.d.ts
2982
2982
  //------------------------------------------------------------------------------
2983
2983
  // Exports
2984
2984
  //------------------------------------------------------------------------------
@@ -4112,6 +4112,11 @@ interface TailwindcssOption {
4112
4112
  * Tailwind CSS v4 entry point, e.g. `src/global.css`.
4113
4113
  */
4114
4114
  entryPoint?: string;
4115
+ /**
4116
+ * Working directory passed to eslint-plugin-better-tailwindcss.
4117
+ * Defaults to `dirname(entryPoint)` when present, otherwise `process.cwd()`.
4118
+ */
4119
+ cwd?: string;
4115
4120
  /**
4116
4121
  * Tailwind CSS v3 config file path, e.g. `tailwind.config.js`.
4117
4122
  */
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from "node:module";
2
- import fs from "node:fs";
3
2
  import path from "node:path";
4
3
  import process from "node:process";
4
+ import fs from "node:fs";
5
5
  import { fileURLToPath } from "node:url";
6
6
  //#region \0rolldown/runtime.js
7
7
  var __defProp = Object.defineProperty;
@@ -179,6 +179,24 @@ const MDX_PACKAGES = ["eslint-plugin-mdx"];
179
179
  const VUE_A11Y_PACKAGES = ["eslint-plugin-vuejs-accessibility"];
180
180
  const REACT_A11Y_PACKAGES = ["eslint-plugin-jsx-a11y"];
181
181
  const QUERY_PACKAGES = ["@tanstack/eslint-plugin-query"];
182
+ const BETTER_TAILWIND_FILES = ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx,vue,html,md,mdx,astro,svelte}"];
183
+ const BETTER_TAILWIND_IGNORES = [
184
+ "**/*.json",
185
+ "**/*.json5",
186
+ "**/*.yaml",
187
+ "**/*.yml",
188
+ "**/*.{lock,lockb}",
189
+ "**/package.json",
190
+ "**/package-lock.json",
191
+ "**/pnpm-lock.yaml",
192
+ "**/yarn.lock",
193
+ "**/bun.lock",
194
+ "**/bun.lockb",
195
+ "**/composer.lock",
196
+ "**/Cargo.lock",
197
+ "**/Gemfile.lock",
198
+ "**/go.sum"
199
+ ];
182
200
  function resolveStylelintConfigLoader(moduleUrl = import.meta.url) {
183
201
  return moduleUrl.endsWith(".ts") ? new URL("./stylelint.ts", moduleUrl).href : new URL("./stylelint.js", moduleUrl).href;
184
202
  }
@@ -187,15 +205,19 @@ function resolveTailwindPresets(option) {
187
205
  if (typeof option === "object") {
188
206
  if (!hasAllPackages(BETTER_TAILWIND_PACKAGES)) return [];
189
207
  return [(0, antfu_exports.interopDefault)(import("eslint-plugin-better-tailwindcss")).then((eslintPluginBetterTailwindcss) => {
208
+ const cwd = option.cwd ?? (option.entryPoint ? path.dirname(option.entryPoint) : void 0) ?? process.cwd();
190
209
  const betterTailwindcssRules = {
191
210
  ...eslintPluginBetterTailwindcss.configs["recommended-warn"].rules,
192
211
  ...eslintPluginBetterTailwindcss.configs["recommended-error"].rules
193
212
  };
194
213
  return {
195
214
  name: "icebreaker/better-tailwindcss",
215
+ files: BETTER_TAILWIND_FILES,
216
+ ignores: BETTER_TAILWIND_IGNORES,
196
217
  plugins: { "better-tailwindcss": eslintPluginBetterTailwindcss },
197
218
  rules: betterTailwindcssRules,
198
219
  settings: { "better-tailwindcss": {
220
+ cwd,
199
221
  entryPoint: option.entryPoint,
200
222
  tailwindConfig: option.tailwindConfig
201
223
  } }
package/index.d.ts CHANGED
@@ -10,6 +10,7 @@ import type { FlatConfigComposer } from 'eslint-flat-config-utils'
10
10
 
11
11
  export interface TailwindcssOption {
12
12
  entryPoint?: string
13
+ cwd?: string
13
14
  tailwindConfig?: string
14
15
  }
15
16
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@icebreakers/eslint-config",
3
3
  "type": "module",
4
- "version": "4.0.4",
4
+ "version": "4.0.6",
5
5
  "description": "ESLint preset from Icebreaker's dev-configs",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -55,15 +55,15 @@
55
55
  "eslint-plugin-better-tailwindcss": "^4.4.1",
56
56
  "eslint-plugin-format": "2.0.1",
57
57
  "eslint-plugin-jsx-a11y": "^6.10.2",
58
- "eslint-plugin-react-hooks": "^7.0.1",
58
+ "eslint-plugin-react-hooks": "^7.1.1",
59
59
  "eslint-plugin-react-refresh": "^0.5.2",
60
- "eslint-plugin-tailwindcss": "3.18.2",
60
+ "eslint-plugin-tailwindcss": "3.18.3",
61
61
  "eslint-plugin-vuejs-accessibility": "^2.5.0",
62
- "@icebreakers/stylelint-config": "3.0.4",
63
- "eslint-plugin-better-stylelint": "1.0.1"
62
+ "@icebreakers/stylelint-config": "3.0.5",
63
+ "eslint-plugin-better-stylelint": "1.0.2"
64
64
  },
65
65
  "optionalDependencies": {
66
- "@next/eslint-plugin-next": "^16.2.3",
66
+ "@next/eslint-plugin-next": "^16.2.4",
67
67
  "@tanstack/eslint-plugin-query": "^5.99.0",
68
68
  "@unocss/eslint-plugin": "66.6.8",
69
69
  "eslint-plugin-mdx": "3.7.0"