Skip to content

Commit 207d52e

Browse files
committed
fix: update eslint configuration and dependencies
- Disabled unocss in eslint.config.js and added additional ignores for specific files. - Updated package.json to include new dependency versions for eslint-plugin-playwright and tailwind-csstree. - Refactored eslint configuration files to improve rule management and added new rules for TypeScript and CSS processing. - Enhanced interop-default utility to handle default exports more robustly. - Improved handling of environment variables in is-in-git-hooks-or-lint-staged utility.
1 parent 3108a1a commit 207d52e

File tree

15 files changed

+74
-28
lines changed

15 files changed

+74
-28
lines changed

eslint.config.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ import { createConfig } from "./packages/eslint-config/dist/index.mjs";
22

33
export default createConfig({
44
zod: true,
5-
unocss: true,
5+
unocss: false,
66
ignores: [
7-
"eslint.config.js"
7+
"eslint.config.js",
8+
"packages/eslint-config/__fixtures__/**",
9+
"packages/eslint-config/README.md",
10+
"packages/eslint-config/src/vender/**"
811
]
912
});

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,24 +144,24 @@
144144
"overrides": {
145145
"@babel/helpers@<7.26.10": ">=7.27.6",
146146
"@babel/runtime@<7.26.10": ">=7.27.6",
147+
"@eslint/plugin-kit@<0.3.3": ">=0.3.3",
147148
"@octokit/endpoint@>=10.0.0 <10.1.3": ">=10.1.4",
148149
"@octokit/plugin-paginate-rest@>=9.3.0-beta.1 <11.4.1": ">=11.6.0",
149150
"@octokit/request@>=9.0.0-beta.1 <9.2.1": ">=9.2.4",
150151
"@octokit/request-error@>=6.0.0 <6.1.7": ">=6.1.8",
151152
"chrono-node@<2.2.4": ">=2.8.3",
152153
"cross-spawn@>=7.0.0 <7.0.5": ">=7.0.6",
153154
"esbuild@<=0.24.2": ">=0.25.6",
155+
"form-data@>=4.0.0 <4.0.4": ">=4.0.4",
154156
"nanoid@<3.3.8": ">=3.3.11",
157+
"tmp@<=0.2.3": ">=0.2.4",
155158
"vite@>=5.0.0 <=5.4.18": ">=5.4.19",
156159
"vite@>=5.0.0 <=5.4.11": ">=5.4.12",
157160
"vite@>=5.0.0 <5.4.18": ">=5.4.18",
158161
"vite@>=5.0.0 <5.4.17": ">=5.4.17",
159162
"vite@>=5.0.0 <5.4.16": ">=5.4.16",
160163
"vite@>=5.0.0 <5.4.15": ">=5.4.15",
161-
"vitest@>=2.0.0 <2.1.9": ">=2.1.9",
162-
"@eslint/plugin-kit@<0.3.3": ">=0.3.3",
163-
"form-data@>=4.0.0 <4.0.4": ">=4.0.4",
164-
"tmp@<=0.2.3": ">=0.2.4"
164+
"vitest@>=2.0.0 <2.1.9": ">=2.1.9"
165165
}
166166
}
167167
}

packages/eslint-config/eslint.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,24 @@ export default createConfig(
2626
files: ["**/*.ts"],
2727
rules: {
2828
"no-secrets/no-secrets": "off",
29+
"@typescript-eslint/require-await": "off",
30+
"@typescript-eslint/no-unsafe-assignment": "off",
31+
"@typescript-eslint/no-unsafe-argument": "off",
32+
"@typescript-eslint/restrict-template-expressions": "off",
33+
},
34+
},
35+
{
36+
files: ["__fixtures__/**"],
37+
rules: {
38+
"@unocss/order-attributify": "off",
39+
"@unocss/order": "off",
40+
},
41+
},
42+
{
43+
files: ["**/*"],
44+
rules: {
45+
"@unocss/order-attributify": "off",
46+
"@unocss/order": "off",
2947
},
3048
},
3149
{

packages/eslint-config/package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@
212212
"react": "^19.1.1",
213213
"rimraf": "^6.0.1",
214214
"semantic-release": "^24.2.7",
215+
"eslint-plugin-playwright": "2.2.2",
216+
"tailwind-csstree": "0.1.4",
215217
"tinyglobby": "^0.2.14",
216218
"tsx": "^4.20.5",
217219
"type-fest": "^4.41.0",
@@ -242,7 +244,8 @@
242244
"eslint-plugin-tsdoc": "^0.4.0",
243245
"eslint-plugin-validate-jsx-nesting": "^0.1.1",
244246
"eslint-plugin-you-dont-need-lodash-underscore": "^6.14.0",
245-
"eslint-plugin-zod": "^1.4.0"
247+
"eslint-plugin-zod": "^1.4.0",
248+
"tailwind-csstree": "0.1.4"
246249
},
247250
"peerDependenciesMeta": {
248251
"@eslint-react/eslint-plugin": {
@@ -317,6 +320,9 @@
317320
"eslint-plugin-zod": {
318321
"optional": true
319322
},
323+
"tailwind-csstree": {
324+
"optional": true
325+
},
320326
"typescript": {
321327
"optional": true
322328
}

packages/eslint-config/scripts/global-vitest.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,15 @@ const extract = (file: string) => {
3434
if (ts.isModuleDeclaration(node)) {
3535
ts.forEachChild(node.body as ModuleBody, (mNode) => {
3636
if (ts.isVariableStatement(mNode)) {
37-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
38-
ts.forEachChild(mNode, (vNode: any) => {
37+
ts.forEachChild(mNode, (vNode) => {
3938
if (ts.isVariableDeclarationList(vNode)) {
4039
for (const declaration of vNode.declarations) {
4140
const name = ts.getNameOfDeclaration(declaration);
4241

43-
if (name && "escapedText" in name) {
44-
globals.push(name.escapedText as string);
42+
const escaped = (name as unknown as { escapedText?: unknown }).escapedText;
43+
44+
if (typeof escaped === "string") {
45+
globals.push(escaped);
4546
}
4647
}
4748
}

packages/eslint-config/src/config/plugins/css.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ export default createConfig<OptionsFiles & OptionsOverrides & { tailwind?: boole
66
const { files = oFiles, overrides, tailwind } = config;
77

88
const cssPlugin = await interopDefault(import("@eslint/css"));
9-
const cssSyntax = await interopDefault(import("@eslint/css/syntax"));
9+
let tailwindCustomSyntax;
10+
11+
if (tailwind) {
12+
tailwindCustomSyntax = await interopDefault(import("tailwind-csstree"));
13+
}
1014

1115
return [{
1216
files,
@@ -16,21 +20,24 @@ export default createConfig<OptionsFiles & OptionsOverrides & { tailwind?: boole
1620
css: cssPlugin,
1721
},
1822
rules: {
23+
"@stylistic/indent": "off",
1924
"css/no-duplicate-imports": "error",
2025
"css/no-empty-blocks": "error",
2126
"css/no-important": "error",
2227
"css/no-invalid-at-rules": "error",
2328
"css/no-invalid-properties": "error",
2429
"css/use-baseline": "warn",
2530
"css/use-layers": "error",
31+
// Disable JS-core rule for CSS language to avoid parser mismatch errors
32+
"no-irregular-whitespace": "off",
2633

2734
...overrides,
2835
},
2936

30-
...tailwind
37+
...tailwind && tailwindCustomSyntax
3138
? {
3239
languageOptions: {
33-
customSyntax: cssSyntax.tailwindSyntax,
40+
customSyntax: tailwindCustomSyntax.tailwind4,
3441
tolerant: true,
3542
},
3643
}

packages/eslint-config/src/config/plugins/formatters.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const mergePrettierOptions = (options: VendoredPrettierOptions, overrides: Vendo
99
return {
1010
...options,
1111
...overrides,
12-
plugins: [...overrides.plugins || [], ...options.plugins || []],
12+
plugins: [...overrides.plugins ?? [], ...options.plugins ?? []],
1313
};
1414
};
1515

@@ -34,7 +34,7 @@ const formatters = async (options: OptionsFormatters, stylistic: StylisticConfig
3434
trailingComma: "all",
3535
useTabs: indent === "tab",
3636
} satisfies VendoredPrettierOptions,
37-
options.prettierOptions || {},
37+
options.prettierOptions ?? {},
3838
);
3939

4040
const prettierXmlOptions: VendoredPrettierOptions = {

packages/eslint-config/src/config/plugins/markdown.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default createConfig<OptionsComponentExtensions & OptionsFiles & OptionsO
2929
// `eslint-plugin-markdown` only creates virtual files for code blocks,
3030
// but not the markdown file itself. We use `eslint-merge-processors` to
3131
// add a pass-through processor for the markdown file itself.
32-
processor: mergeProcessors([markdown.processors?.markdown, processorPassThrough]),
32+
processor: mergeProcessors([markdown.processors.markdown, processorPassThrough]),
3333
},
3434
{
3535
files,
@@ -53,13 +53,16 @@ export default createConfig<OptionsComponentExtensions & OptionsFiles & OptionsO
5353
"@stylistic/comma-dangle": "off",
5454
"@stylistic/eol-last": "off",
5555
"@stylistic/prefer-global/process": "off",
56+
"@stylistic/quote-props": "off",
57+
"@stylistic/semi": "off",
58+
59+
"@typescript-eslint/no-unused-expressions": "off",
5660

5761
"antfu/no-top-level-await": "off",
5862

5963
"import/newline-after-import": "off",
6064

6165
"no-alert": "off",
62-
6366
"no-console": "off",
6467
"no-labels": "off",
6568
"no-lone-blocks": "off",

packages/eslint-config/src/config/plugins/node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default createConfig<OptionsFiles & OptionsOverrides & OptionsPackageJson
88

99
const pluginNode = await interopDefault(import("eslint-plugin-n"));
1010

11-
const nodeVersion = packageJson?.engines?.["node"];
11+
const nodeVersion = packageJson.engines?.["node"];
1212

1313
return [
1414
{

packages/eslint-config/src/config/plugins/promise.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { fixupPluginRules } from "@eslint/compat";
22

3-
import type { OptionsFiles, OptionsOverrides } from "../../types";
3+
import type { OptionsFiles, OptionsOverrides, Rules } from "../../types";
44
import { createConfig } from "../../utils/create-config";
55
import interopDefault from "../../utils/interop-default";
66

77
// @see https://github.com/xjamundx/eslint-plugin-promise#readme
88
export default createConfig<OptionsFiles & OptionsOverrides>("all", async (config, oFiles) => {
99
const { files = oFiles, overrides } = config;
1010

11+
// @ts-expect-error missing types
1112
const promisesPlugin = await interopDefault(import("eslint-plugin-promise"));
1213

1314
return [
@@ -18,7 +19,8 @@ export default createConfig<OptionsFiles & OptionsOverrides>("all", async (confi
1819
promise: promisesPlugin,
1920
},
2021
rules: {
21-
...fixupPluginRules(promisesPlugin.configs["flat/recommended"].rules),
22+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
23+
...fixupPluginRules(promisesPlugin.configs["flat/recommended"].rules) as Rules,
2224

2325
"promise/prefer-await-to-callbacks": "off",
2426
"promise/prefer-await-to-then": "off",

0 commit comments

Comments
 (0)