Skip to content

Commit 46e4caf

Browse files
kubeclaude
andauthored
H-6324: Migrate petrinaut to oxlint and verify React Compiler (#8539)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b597c15 commit 46e4caf

33 files changed

Lines changed: 1156 additions & 523 deletions

File tree

apps/hash-frontend/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@
127127
"signia-react": "0.1.5",
128128
"url-regex-safe": "4.0.0",
129129
"use-font-face-observer": "1.3.0",
130-
"uuid": "13.0.0"
130+
"uuid": "13.0.0",
131+
"web-worker": "1.4.1"
131132
},
132133
"devDependencies": {
133134
"@graphql-codegen/cli": "^5.0.3",
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"plugins": ["import", "react", "jsx-a11y", "unicorn", "typescript"],
4+
"categories": {
5+
"correctness": "error"
6+
},
7+
"env": {
8+
"builtin": true,
9+
"es2026": true,
10+
"browser": true
11+
},
12+
"rules": {
13+
"array-callback-return": ["error", { "allowImplicit": true }],
14+
"default-case-last": "error",
15+
"default-param-last": "error",
16+
"eqeqeq": ["error", "always", { "null": "ignore" }],
17+
"guard-for-in": "error",
18+
"no-alert": "error",
19+
"no-cond-assign": ["error", "always"],
20+
"no-extend-native": "error",
21+
"no-loop-func": "error",
22+
"no-new": "error",
23+
"no-param-reassign": [
24+
"error",
25+
{
26+
"props": true,
27+
"ignorePropertyModificationsForRegex": ["^existing", "draft"]
28+
}
29+
],
30+
"no-return-assign": ["error", "always"],
31+
"no-self-compare": "error",
32+
"no-sequences": "error",
33+
"no-template-curly-in-string": "error",
34+
"no-unsafe-optional-chaining": [
35+
"error",
36+
{ "disallowArithmeticOperators": true }
37+
],
38+
"no-unused-vars": [
39+
"error",
40+
{
41+
"args": "all",
42+
"argsIgnorePattern": "^_+",
43+
"varsIgnorePattern": "^_+"
44+
}
45+
],
46+
"no-void": ["error", { "allowAsStatement": true }],
47+
48+
"no-console": "error",
49+
"new-cap": "error",
50+
"no-new-func": "error",
51+
"func-names": "error",
52+
"no-bitwise": "error",
53+
"no-multi-assign": "error",
54+
55+
"no-restricted-globals": [
56+
"error",
57+
{ "name": "isFinite", "message": "Use Number.isFinite instead" },
58+
{ "name": "isNaN", "message": "Use Number.isNaN instead" },
59+
"event",
60+
"name",
61+
"length",
62+
"status"
63+
],
64+
"no-shadow": "error",
65+
"no-use-before-define": "error",
66+
67+
"import/no-named-as-default": "error",
68+
"import/no-named-as-default-member": "error",
69+
"import/no-mutable-exports": "error",
70+
"import/no-duplicates": "error",
71+
"import/no-named-default": "error",
72+
"import/no-self-import": "error",
73+
"import/no-cycle": "error",
74+
75+
"react/jsx-pascal-case": ["error", { "allowAllCaps": true }],
76+
"react/no-danger": "error",
77+
"react/jsx-no-target-blank": ["error", { "enforceDynamicLinks": "always" }],
78+
"react/jsx-no-comment-textnodes": "error",
79+
"react/no-array-index-key": "error",
80+
"react/button-has-type": [
81+
"error",
82+
{ "button": true, "submit": true, "reset": false }
83+
],
84+
85+
"react-hooks/rules-of-hooks": "error",
86+
"react-hooks/exhaustive-deps": "off",
87+
88+
"jsx-a11y/prefer-tag-over-role": "off",
89+
"jsx-a11y/aria-role": ["error", { "ignoreNonDOM": false }],
90+
"jsx-a11y/no-noninteractive-tabindex": [
91+
"error",
92+
{ "tags": [], "roles": ["tabpanel"] }
93+
],
94+
"jsx-a11y/label-has-associated-control": "error",
95+
"jsx-a11y/no-static-element-interactions": [
96+
"error",
97+
{
98+
"handlers": [
99+
"onClick",
100+
"onMouseDown",
101+
"onMouseUp",
102+
"onKeyPress",
103+
"onKeyDown",
104+
"onKeyUp"
105+
]
106+
}
107+
],
108+
109+
"@typescript-eslint/ban-ts-comment": [
110+
"error",
111+
{
112+
"ts-expect-error": "allow-with-description",
113+
"minimumDescriptionLength": 10
114+
}
115+
],
116+
"@typescript-eslint/no-empty-object-type": "error",
117+
"@typescript-eslint/no-explicit-any": "error",
118+
"@typescript-eslint/no-require-imports": "error",
119+
"@typescript-eslint/no-unnecessary-type-constraint": "error",
120+
"@typescript-eslint/no-implied-eval": "error",
121+
"@typescript-eslint/no-misused-promises": "error",
122+
"@typescript-eslint/no-unnecessary-condition": "error",
123+
"@typescript-eslint/no-unsafe-assignment": "error",
124+
"@typescript-eslint/no-unsafe-call": "error",
125+
"@typescript-eslint/no-unsafe-function-type": "error",
126+
127+
"unicorn/no-new-array": "off",
128+
"unicorn/filename-case": "error",
129+
130+
"constructor-super": "off",
131+
"no-class-assign": "off",
132+
"no-const-assign": "off",
133+
"no-dupe-keys": "off",
134+
"no-func-assign": "off",
135+
"no-import-assign": "off",
136+
"no-obj-calls": "off",
137+
"no-redeclare": "off",
138+
"no-setter-return": "off",
139+
"no-this-before-super": "off",
140+
"no-unsafe-negation": "off",
141+
"no-constant-condition": "off",
142+
"no-throw-literal": "off",
143+
"prefer-promise-reject-errors": "off"
144+
},
145+
"ignorePatterns": [
146+
"dist/**",
147+
"build/**",
148+
"coverage/**",
149+
"*.gen.*",
150+
"*.tsbuildinfo",
151+
".turbo/**"
152+
]
153+
}

apps/petrinaut-website/eslint.config.js

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

apps/petrinaut-website/package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
"scripts": {
77
"build": "vite build",
88
"dev": "vite",
9-
"fix:eslint": "eslint --fix .",
10-
"lint:eslint": "eslint --report-unused-disable-directives .",
11-
"lint:tsc": "tsgo --noEmit"
9+
"lint:tsc": "tsgo --noEmit",
10+
"lint:eslint": "oxlint --type-aware --report-unused-disable-directives-severity=error .",
11+
"fix:eslint": "oxlint --fix --type-aware --report-unused-disable-directives-severity=error ."
1212
},
1313
"dependencies": {
1414
"@hashintel/petrinaut": "workspace:*",
@@ -19,13 +19,14 @@
1919
"react-dom": "19.2.3"
2020
},
2121
"devDependencies": {
22-
"@local/eslint": "workspace:*",
22+
"@rolldown/plugin-babel": "0.2.1",
2323
"@types/react": "19.2.7",
2424
"@types/react-dom": "19.2.3",
25-
"@typescript/native-preview": "7.0.0-dev.20260309.1",
26-
"@vitejs/plugin-react": "5.1.4",
25+
"@typescript/native-preview": "7.0.0-dev.20260315.1",
26+
"@vitejs/plugin-react": "6.0.1",
2727
"babel-plugin-react-compiler": "1.0.0",
28-
"eslint": "9.39.3",
29-
"vite": "8.0.0-beta.18"
28+
"oxlint": "1.55.0",
29+
"oxlint-tsgolint": "0.17.0",
30+
"vite": "8.0.0"
3031
}
3132
}

apps/petrinaut-website/turbo.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": ["//"],
3+
"tasks": {
4+
"lint:eslint": {
5+
"dependsOn": []
6+
}
7+
}
8+
}

apps/petrinaut-website/vite.config.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import react from "@vitejs/plugin-react";
1+
import babel from "@rolldown/plugin-babel";
2+
import react, { reactCompilerPreset } from "@vitejs/plugin-react";
23
import { defineConfig } from "vite";
34

45
/** Petrinaut website dev server and production build config. */
@@ -13,10 +14,16 @@ export default defineConfig(() => {
1314
},
1415

1516
plugins: [
16-
react({
17-
babel: {
18-
plugins: ["babel-plugin-react-compiler"],
19-
},
17+
react(),
18+
babel({
19+
presets: [
20+
reactCompilerPreset({
21+
target: "19",
22+
compilationMode: "infer",
23+
// @ts-expect-error - panicThreshold is accepted at runtime
24+
panicThreshold: "critical_errors",
25+
}),
26+
],
2027
}),
2128
],
2229
};

0 commit comments

Comments
 (0)