Skip to content

Commit c9b27d7

Browse files
committed
build(lint): cleanup eslint config and packages
1 parent fb3b5c1 commit c9b27d7

File tree

15 files changed

+187
-289
lines changed

15 files changed

+187
-289
lines changed

eslint.config.mjs

Lines changed: 39 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,21 @@ 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+
"**/build/",
54+
"examples/vue-ts",
55+
"**/*.d.ts",
56+
],
57+
"Zag Ignores",
58+
),
59+
)

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,

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",
@@ -66,25 +66,21 @@
6666
"@changesets/cli": "2.29.4",
6767
"@commitlint/cli": "19.8.1",
6868
"@commitlint/config-conventional": "19.8.1",
69-
"@eslint/eslintrc": "3.3.1",
69+
"@eslint/js": "^9.39.1",
7070
"@octokit/rest": "22.0.0",
7171
"@playwright/test": "1.53.0",
7272
"@swc/core": "1.12.1",
7373
"@types/jsdom": "^21.1.7",
7474
"@types/node": "24.0.3",
7575
"@types/signale": "1.4.7",
76-
"@typescript-eslint/eslint-plugin": "8.34.1",
77-
"@typescript-eslint/parser": "8.34.1",
7876
"axe-core": "4.10.3",
7977
"commitlint": "19.8.1",
8078
"cross-env": "^7.0.3",
8179
"dotenv": "16.5.0",
8280
"eslint": "9.29.0",
83-
"eslint-config-prettier": "10.1.5",
84-
"eslint-plugin-import": "2.31.0",
85-
"eslint-plugin-prettier": "5.5.0",
8681
"fast-glob": "3.3.3",
8782
"find-packages": "10.0.4",
83+
"globals": "^16.5.0",
8884
"husky": "9.1.7",
8985
"lint-staged": "16.1.2",
9086
"node-fetch": "3.3.2",
@@ -97,6 +93,7 @@
9793
"tsup": "8.5.0",
9894
"tsx": "4.20.3",
9995
"typescript": "5.8.3",
96+
"typescript-eslint": "^8.47.0",
10097
"vercel-submodules": "1.0.10",
10198
"vite": "6.3.5",
10299
"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/menu/src/menu.machine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ export const machine = createMachine<MenuSchema>({
539539
return () => clearTimeout(timer)
540540
},
541541
trackPositioning({ context, prop, scope, refs }) {
542-
if (!!dom.getContextTriggerEl(scope)) return
542+
if (dom.getContextTriggerEl(scope)) return
543543
const positioning = {
544544
...prop("positioning"),
545545
...refs.get("positioningOverride"),

packages/store/src/clone.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function set(obj: any, key: string | symbol, val: PropertyDescriptor) {
1212

1313
export function clone<T>(x: T): T {
1414
if (typeof x !== "object") return x
15-
var i = 0,
15+
let i = 0,
1616
k: string,
1717
list: Array<string | symbol>,
1818
tmp: any,

0 commit comments

Comments
 (0)