Skip to content

Commit b4a58cc

Browse files
committed
Update to eslint 9
1 parent 0cd38b0 commit b4a58cc

File tree

7 files changed

+1349
-1473
lines changed

7 files changed

+1349
-1473
lines changed

.eslintignore

Lines changed: 0 additions & 9 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 55 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import js from "@eslint/js";
2+
import reactHooks from "eslint-plugin-react-hooks";
3+
import ts from "typescript-eslint";
4+
5+
const typescriptRules = [
6+
ts.configs.eslintRecommended,
7+
...ts.configs.recommended,
8+
]
9+
.map((config) => config.rules)
10+
.reduce((acc, rules) => ({ ...acc, ...rules }), {});
11+
12+
/** @type {import("eslint").Linter.Config[]} */
13+
export default [
14+
{
15+
ignores: ["dist/**", "docs/**"],
16+
},
17+
{
18+
files: ["src/**/*.ts", "src/**/*.tsx"],
19+
20+
plugins: {
21+
"@typescript-eslint": ts.plugin,
22+
"react-hooks": reactHooks,
23+
},
24+
25+
languageOptions: {
26+
sourceType: "module",
27+
parser: ts.parser,
28+
29+
parserOptions: {
30+
tsconfigRootDir: import.meta.dirname,
31+
projectService: true,
32+
},
33+
},
34+
35+
rules: {
36+
...js.configs.recommended.rules,
37+
...typescriptRules,
38+
39+
curly: "error",
40+
"no-implicit-coercion": "error",
41+
"no-param-reassign": "error",
42+
"object-shorthand": "error",
43+
44+
"react-hooks/rules-of-hooks": "error",
45+
"react-hooks/exhaustive-deps": "warn",
46+
47+
"@typescript-eslint/ban-ts-comment": [
48+
"error",
49+
{ "ts-check": true, "ts-expect-error": false },
50+
],
51+
"@typescript-eslint/no-unused-vars": [
52+
"error",
53+
{ argsIgnorePattern: "^_", ignoreRestSiblings: true },
54+
],
55+
56+
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
57+
"@typescript-eslint/no-base-to-string": "error",
58+
"@typescript-eslint/no-explicit-any": "error",
59+
"@typescript-eslint/no-non-null-assertion": "error",
60+
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
61+
"@typescript-eslint/no-unnecessary-condition": "error",
62+
"@typescript-eslint/no-unnecessary-qualifier": "error",
63+
"@typescript-eslint/no-unnecessary-type-arguments": "error",
64+
"@typescript-eslint/prefer-nullish-coalescing": "error",
65+
"@typescript-eslint/prefer-optional-chain": "error",
66+
"@typescript-eslint/strict-boolean-expressions": "error",
67+
},
68+
},
69+
];

example/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
"@swan-io/chicane": "workspace:*",
1111
"react": "^18.3.1",
1212
"react-dom": "^18.3.1",
13-
"ts-pattern": "^5.2.0"
13+
"ts-pattern": "^5.9.0"
1414
},
1515
"devDependencies": {
1616
"@types/react": "^18.3.3",
1717
"@types/react-dom": "^18.3.0",
18-
"@vitejs/plugin-react-swc": "^3.7.0",
19-
"typescript": "^5.5.3",
20-
"vite": "^5.3.4"
18+
"@vitejs/plugin-react-swc": "^4.2.1",
19+
"typescript": "^5.9.3",
20+
"vite": "^7.2.2"
2121
}
2222
}

package.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@swan-io/chicane",
33
"version": "2.2.1",
44
"license": "MIT",
5-
"packageManager": "pnpm@10.12.1",
5+
"packageManager": "pnpm@10.21.0",
66
"description": "A simple and safe router for React and TypeScript",
77
"author": "Mathieu Acthernoene <[email protected]>",
88
"homepage": "https://swan-io.github.io/chicane",
@@ -30,7 +30,7 @@
3030
"scripts": {
3131
"clean": "rm -rf dist",
3232
"format": "prettier '**/*' --ignore-unknown --write",
33-
"lint": "eslint --ext ts,tsx ./src",
33+
"lint": "eslint",
3434
"test": "vitest --run",
3535
"test:watch": "vitest --watch",
3636
"typecheck": "tsc --noEmit",
@@ -47,26 +47,26 @@
4747
},
4848
"dependencies": {
4949
"@emotion/hash": "^0.9.2",
50-
"use-sync-external-store": "^1.2.2"
50+
"use-sync-external-store": "^1.5.0"
5151
},
5252
"devDependencies": {
53-
"@testing-library/dom": "^10.4.0",
54-
"@testing-library/react": "^16.0.0",
55-
"@types/node": "^20.14.11",
56-
"@types/react": "^18.3.3",
57-
"@types/react-dom": "^18.3.0",
58-
"@types/use-sync-external-store": "^0.0.6",
59-
"@typescript-eslint/eslint-plugin": "^7.16.1",
60-
"@typescript-eslint/parser": "^7.16.1",
61-
"eslint": "^8.57.0",
62-
"eslint-plugin-react-hooks": "^4.6.2",
63-
"jsdom": "^24.1.1",
64-
"prettier": "^3.3.3",
65-
"prettier-plugin-organize-imports": "^4.0.0",
53+
"@eslint/js": "^9.39.1",
54+
"@testing-library/dom": "^10.4.1",
55+
"@testing-library/react": "^16.3.0",
56+
"@types/node": "^20.19.24",
57+
"@types/react": "^18.3.26",
58+
"@types/react-dom": "^18.3.7",
59+
"@types/use-sync-external-store": "^1.5.0",
60+
"eslint": "^9.39.1",
61+
"eslint-plugin-react-hooks": "^7.0.1",
62+
"jsdom": "^27.1.0",
63+
"prettier": "^3.6.2",
64+
"prettier-plugin-organize-imports": "^4.3.0",
6665
"react": "^18.3.1",
6766
"react-dom": "^18.3.1",
68-
"tsup": "^8.2.2",
69-
"typescript": "^5.5.3",
70-
"vitest": "^2.0.4"
67+
"tsup": "^8.5.0",
68+
"typescript": "^5.9.3",
69+
"typescript-eslint": "^8.46.3",
70+
"vitest": "^4.0.8"
7171
}
7272
}

0 commit comments

Comments
 (0)