Skip to content

Commit 2c45b4f

Browse files
committed
build(lint): cleanup eslint config and packages
1 parent f6e0790 commit 2c45b4f

File tree

19 files changed

+4148
-1625
lines changed

19 files changed

+4148
-1625
lines changed

eslint.config.mjs

Lines changed: 40 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,36 @@
1-
import tsParser from "@typescript-eslint/parser"
2-
import tsPlugin from "@typescript-eslint/eslint-plugin"
1+
import globals from "globals"
2+
import eslint from "@eslint/js"
3+
import tseslint from "typescript-eslint"
4+
import { defineConfig, globalIgnores } from "eslint/config"
35

4-
/** @type {import('eslint').Linter.Config[]} */
5-
export default [
6+
export default defineConfig(
7+
eslint.configs.recommended,
8+
tseslint.configs.recommended,
69
{
10+
name: "Zag Overrides",
711
languageOptions: {
8-
parser: tsParser,
9-
globals: {
10-
node: true,
11-
},
12+
globals: globals.node,
1213
},
13-
plugins: {
14-
"@typescript-eslint": tsPlugin,
14+
15+
linterOptions: {
16+
reportUnusedDisableDirectives: "error",
1517
},
16-
files: ["**/*.ts", "**/*.tsx"],
17-
ignores: ["dist", "node_modules", "coverage", ".next", "build", "examples/vue-ts", "plop-templates", "**/*.d.ts"],
1818

1919
rules: {
20+
"no-case-declarations": "off",
21+
"no-empty": "off",
22+
"prefer-const": "off",
23+
"prefer-rest-params": "off",
24+
"prefer-spread": "off",
25+
"no-prototype-builtins": "off",
26+
2027
"@typescript-eslint/ban-ts-comment": "off",
21-
"@typescript-eslint/no-use-before-define": "off",
28+
"@typescript-eslint/no-empty-object-type": "off",
2229
"@typescript-eslint/no-explicit-any": "off",
23-
"@typescript-eslint/no-non-null-assertion": "off",
24-
"no-param-reassign": "off",
25-
"prefer-spread": "off",
26-
"no-console": "off",
27-
"prefer-const": "off",
28-
"jsx-a11y/no-autofocus": "off",
29-
"import/named": "off",
30-
"import/prefer-default-export": "off",
31-
"no-underscore-dangle": "off",
32-
"no-shadow": "off",
33-
"no-plusplus": "off",
34-
"spaced-comment": "off",
35-
"guard-for-in": "off",
36-
"operator-assignment": "off",
37-
"prefer-destructuring": "off",
38-
"consistent-return": "off",
39-
"no-restricted-syntax": "off",
40-
"no-continue": "off",
41-
eqeqeq: "off",
42-
"@typescript-eslint/dot-notation": "off",
43-
"no-bitwise": "off",
44-
"no-redeclare": "off",
45-
"@typescript-eslint/naming-convention": "off",
46-
"import/no-extraneous-dependencies": "off",
47-
"@typescript-eslint/lines-between-class-members": "off",
48-
"no-alert": "off",
49-
"@typescript-eslint/no-shadow": "off",
50-
"import/no-named-as-default": "off",
51-
"prefer-object-spread": "off",
52-
"arrow-body-style": "off",
53-
"import/namespace": "off",
54-
"jsx-a11y/label-has-associated-control": "off",
30+
"@typescript-eslint/no-namespace": "off",
31+
"@typescript-eslint/no-non-null-asserted-optional-chain": "off",
32+
"@typescript-eslint/no-unsafe-function-type": "off",
33+
"@typescript-eslint/no-unused-expressions": "off",
5534
"@typescript-eslint/no-unused-vars": [
5635
"error",
5736
{
@@ -60,14 +39,22 @@ export default [
6039
ignoreRestSiblings: true,
6140
},
6241
],
63-
"default-case": "off",
6442
},
6543
},
6644

67-
{
68-
files: ["*.js", "*.jsx"],
69-
parserOptions: {
70-
project: "tsconfig.eslint.json",
71-
},
72-
},
73-
]
45+
globalIgnores(
46+
[
47+
"**/dist/",
48+
"**/coverage/",
49+
"**/.svelte-kit/",
50+
"**/.next/",
51+
"**/.nuxt/",
52+
"**/.contentlayer",
53+
"**/styled-system",
54+
"**/build/",
55+
"examples/vue-ts",
56+
"**/*.d.ts",
57+
],
58+
"Zag Ignores",
59+
),
60+
)

examples/next-ts/hooks/use-controls.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable jsx-a11y/no-onchange */
21
import { ControlRecord, deepGet, deepSet, getControlDefaults } from "@zag-js/shared"
32
import { useState } from "react"
43

examples/solid-ts/src/components/iframe.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable prefer-const */
21
import { JSX, ParentProps, children, createSignal, createUniqueId, onCleanup, onMount, splitProps } from "solid-js"
32
import { render } from "solid-js/web"
43

examples/solid-ts/src/routes/tags-input.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
import { normalizeProps, useMachine } from "@zag-js/solid"
22
import * as tagsInput from "@zag-js/tags-input"
33
import { createMemo, createUniqueId, For } from "solid-js"
4-
import { tagsInputControls } from "@zag-js/shared"
5-
import { StateVisualizer } from "~/components/state-visualizer"
6-
import { Toolbar } from "~/components/toolbar"
7-
import { useControls } from "~/hooks/use-controls"
84

95
function toDashCase(str: string) {
106
return str.replace(/\s+/g, "-").toLowerCase()
117
}
128

139
export default function Page() {
14-
const controls = useControls(tagsInputControls)
15-
1610
const service = useMachine(tagsInput.machine, {
1711
id: createUniqueId(),
1812
defaultValue: ["React", "Vue"],

examples/vanilla-ts/src/combobox.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export class Combobox extends Component<combobox.Props, combobox.Api> {
2525
}
2626

2727
initMachine(props: combobox.Props) {
28+
// eslint-disable-next-line @typescript-eslint/no-this-alias
2829
const self = this
2930
return new VanillaMachine(combobox.machine, {
3031
...props,

examples/vanilla-ts/src/select.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export class Select extends Component<select.Props, select.Api> {
2727
}
2828

2929
initMachine(props: select.Props) {
30+
// eslint-disable-next-line @typescript-eslint/no-this-alias
3031
const self = this
3132
return new VanillaMachine(select.machine, {
3233
...props,

package.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"typecheck": "pnpm packages -- typecheck",
3636
"prettier": "prettier --check packages/**/*",
3737
"prettier-fix": "prettier --write packages/**/*",
38-
"lint": "eslint packages",
38+
"lint": "eslint .",
3939
"version": "changeset version",
4040
"release": "changeset publish",
4141
"version-snapshot": "changeset version --snapshot v1-beta",
@@ -69,26 +69,22 @@
6969
"@changesets/cli": "2.29.7",
7070
"@commitlint/cli": "20.1.0",
7171
"@commitlint/config-conventional": "20.0.0",
72-
"@eslint/eslintrc": "3.3.1",
72+
"@eslint/js": "^9.39.1",
7373
"@internationalized/date": "3.10.0",
7474
"@octokit/rest": "22.0.1",
7575
"@playwright/test": "1.56.1",
7676
"@swc/core": "1.15.0",
7777
"@types/jsdom": "^27.0.0",
7878
"@types/node": "24.10.0",
7979
"@types/signale": "1.4.7",
80-
"@typescript-eslint/eslint-plugin": "8.46.3",
81-
"@typescript-eslint/parser": "8.46.3",
8280
"axe-core": "4.11.0",
8381
"commitlint": "20.1.0",
8482
"cross-env": "^10.1.0",
8583
"dotenv": "17.2.3",
8684
"eslint": "9.38.0",
87-
"eslint-config-prettier": "10.1.8",
88-
"eslint-plugin-import": "2.32.0",
89-
"eslint-plugin-prettier": "5.5.4",
9085
"fast-glob": "3.3.3",
9186
"find-packages": "10.0.4",
87+
"globals": "^16.5.0",
9288
"husky": "9.1.7",
9389
"lint-staged": "16.2.6",
9490
"node-fetch": "3.3.2",
@@ -101,6 +97,7 @@
10197
"tsup": "8.5.0",
10298
"tsx": "4.20.6",
10399
"typescript": "5.9.3",
100+
"typescript-eslint": "^8.47.0",
104101
"vercel-submodules": "1.1.0",
105102
"vite": "7.1.12",
106103
"vite-plugin-dts": "4.5.4",

packages/frameworks/solid/src/normalize-props.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,6 @@ const cache: Record<string, any> = {}
7777

7878
function hyphenateStyleName(name: string) {
7979
if (cache.hasOwnProperty(name)) return cache[name]
80-
var hName = name.replace(uppercasePattern, toHyphenLower)
80+
const hName = name.replace(uppercasePattern, toHyphenLower)
8181
return (cache[name] = msPattern.test(hName) ? "-" + hName : hName)
8282
}

packages/machines/color-picker/src/color-picker.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import type { CommonProperties, DirectionProperty, Orientation, PropTypes, Requi
77
export type ExtendedColorChannel = ColorChannel | "hex" | "css"
88

99
interface EyeDropper {
10+
// eslint-disable-next-line @typescript-eslint/no-misused-new
1011
new (): EyeDropper
1112
open: (options?: { signal?: AbortSignal | undefined }) => Promise<{ sRGBHex: string }>
1213
[Symbol.toStringTag]: "EyeDropper"

packages/machines/listbox/src/listbox.connect.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,14 @@ export function connect<T extends PropTypes, V extends CollectionItem = Collecti
157157
if (!isGridCollection(collection)) return
158158
if (event.ctrlKey) return
159159
forwardEvent()
160+
break
160161
}
161162

162163
case "Home":
163164
case "End": {
164165
if (highlightedValue == null && event.shiftKey) return
165166
forwardEvent()
167+
break
166168
}
167169

168170
case "ArrowDown":

0 commit comments

Comments
 (0)