Skip to content

Commit a0766e7

Browse files
kubeclaude
andcommitted
FE-518: Modernize refractive build and lint setup
Replace ESLint with oxlint, tsc with tsgo, upgrade to Vite 8 + Storybook 10, switch to ES-only output with rolldown-plugin-dts for declaration generation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1160826 commit a0766e7

11 files changed

Lines changed: 362 additions & 116 deletions

File tree

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
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+
"no-restricted-imports": [
68+
"error",
69+
{
70+
"patterns": [
71+
{
72+
"group": ["@local/*"],
73+
"message": "You cannot use unpublished local packages in a published package."
74+
}
75+
]
76+
}
77+
],
78+
79+
"import/no-named-as-default": "error",
80+
"import/no-named-as-default-member": "error",
81+
"import/no-mutable-exports": "error",
82+
"import/no-duplicates": "error",
83+
"import/no-named-default": "error",
84+
"import/no-self-import": "error",
85+
"import/no-cycle": "error",
86+
87+
"react/jsx-pascal-case": ["error", { "allowAllCaps": true }],
88+
"react/no-danger": "error",
89+
"react/jsx-no-target-blank": ["error", { "enforceDynamicLinks": "always" }],
90+
"react/jsx-no-comment-textnodes": "error",
91+
"react/no-array-index-key": "error",
92+
"react/button-has-type": [
93+
"error",
94+
{ "button": true, "submit": true, "reset": false }
95+
],
96+
97+
"react-hooks/rules-of-hooks": "error",
98+
"react-hooks/exhaustive-deps": "off",
99+
100+
"jsx-a11y/prefer-tag-over-role": "off",
101+
"jsx-a11y/aria-role": ["error", { "ignoreNonDOM": false }],
102+
"jsx-a11y/no-noninteractive-tabindex": [
103+
"error",
104+
{ "tags": [], "roles": ["tabpanel"] }
105+
],
106+
"jsx-a11y/label-has-associated-control": "error",
107+
"jsx-a11y/no-static-element-interactions": [
108+
"error",
109+
{
110+
"handlers": [
111+
"onClick",
112+
"onMouseDown",
113+
"onMouseUp",
114+
"onKeyPress",
115+
"onKeyDown",
116+
"onKeyUp"
117+
]
118+
}
119+
],
120+
121+
"@typescript-eslint/ban-ts-comment": [
122+
"error",
123+
{
124+
"ts-expect-error": "allow-with-description",
125+
"minimumDescriptionLength": 10
126+
}
127+
],
128+
"@typescript-eslint/no-empty-object-type": "error",
129+
"@typescript-eslint/no-explicit-any": "error",
130+
"@typescript-eslint/no-require-imports": "error",
131+
"@typescript-eslint/no-unnecessary-type-constraint": "error",
132+
"@typescript-eslint/no-implied-eval": "error",
133+
"@typescript-eslint/no-misused-promises": "error",
134+
"@typescript-eslint/no-unnecessary-condition": "error",
135+
"@typescript-eslint/no-unsafe-assignment": "error",
136+
"@typescript-eslint/no-unsafe-call": "error",
137+
"@typescript-eslint/no-unsafe-function-type": "error",
138+
139+
"unicorn/no-new-array": "off",
140+
"unicorn/filename-case": "error",
141+
142+
"constructor-super": "off",
143+
"no-class-assign": "off",
144+
"no-const-assign": "off",
145+
"no-dupe-keys": "off",
146+
"no-func-assign": "off",
147+
"no-import-assign": "off",
148+
"no-obj-calls": "off",
149+
"no-redeclare": "off",
150+
"no-setter-return": "off",
151+
"no-this-before-super": "off",
152+
"no-unsafe-negation": "off",
153+
"no-constant-condition": "off",
154+
"no-throw-literal": "off",
155+
"prefer-promise-reject-errors": "off"
156+
},
157+
"ignorePatterns": [
158+
"dist/**",
159+
"build/**",
160+
"coverage/**",
161+
"*.gen.*",
162+
"*.tsbuildinfo",
163+
".turbo/**"
164+
]
165+
}

libs/@hashintel/refractive/eslint.config.js

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

libs/@hashintel/refractive/package.json

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,33 +18,31 @@
1818
],
1919
"type": "module",
2020
"sideEffects": false,
21-
"main": "./dist/index.cjs",
22-
"module": "./dist/index.js",
21+
"main": "./dist/index.js",
2322
"types": "./dist/index.d.ts",
2423
"scripts": {
2524
"build": "vite build",
2625
"dev": "storybook dev -p 6006",
2726
"dev:lib": "vite build --watch",
28-
"fix:eslint": "eslint --fix .",
29-
"lint:eslint": "eslint --report-unused-disable-directives .",
30-
"lint:tsc": "tsc --noEmit",
27+
"lint:eslint": "oxlint --type-aware --report-unused-disable-directives-severity=error .",
28+
"fix:eslint": "oxlint --fix --type-aware --report-unused-disable-directives-severity=error .",
29+
"lint:tsc": "tsgo --noEmit",
3130
"prepublishOnly": "yarn build",
3231
"build-storybook": "storybook build"
3332
},
3433
"devDependencies": {
35-
"@local/eslint": "workspace:*",
36-
"@local/tsconfig": "workspace:*",
37-
"@storybook/react": "9.1.13",
38-
"@storybook/react-vite": "9.1.13",
34+
"@rolldown/plugin-babel": "0.2.1",
35+
"@storybook/react-vite": "10.2.13",
3936
"@types/react": "19.2.7",
4037
"@types/react-dom": "19.2.3",
41-
"@vitejs/plugin-react": "5.0.4",
38+
"@typescript/native-preview": "7.0.0-dev.20260315.1",
39+
"@vitejs/plugin-react": "6.0.1",
4240
"babel-plugin-react-compiler": "1.0.0",
43-
"eslint": "9.39.3",
44-
"storybook": "9.1.19",
45-
"typescript": "5.9.3",
46-
"vite": "7.1.11",
47-
"vite-plugin-dts": "4.5.4"
41+
"oxlint": "1.55.0",
42+
"oxlint-tsgolint": "0.17.0",
43+
"rolldown-plugin-dts": "0.22.5",
44+
"storybook": "10.2.13",
45+
"vite": "8.0.0"
4846
},
4947
"peerDependencies": {
5048
"react": "^19.0.0",
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
export type SurfaceFnDef = (x: number) => number;
22

3-
export const CONVEX_CIRCLE: SurfaceFnDef = (x) => Math.sqrt(1 - (1 - x) ** 2);
3+
export const convexCircle: SurfaceFnDef = (x) =>
4+
Math.sqrt(1 - (1 - x) ** 2);
45

5-
export const CONVEX: SurfaceFnDef = (x) => (1 - (1 - x) ** 4) ** (1 / 4);
6+
export const convex: SurfaceFnDef = (x) => (1 - (1 - x) ** 4) ** (1 / 4);
67

7-
export const CONCAVE: SurfaceFnDef = (x) => 1 - CONVEX_CIRCLE(x);
8+
export const concave: SurfaceFnDef = (x) => 1 - convexCircle(x);
89

9-
export const LIP: SurfaceFnDef = (x) => {
10-
const convex = CONVEX(x * 2);
11-
const concave = CONCAVE(x) + 0.1;
10+
export const lip: SurfaceFnDef = (x) => {
11+
const cvx = convex(x * 2);
12+
const ccv = concave(x) + 0.1;
1213
const smootherstep = 6 * x ** 5 - 15 * x ** 4 + 10 * x ** 3;
13-
return convex * (1 - smootherstep) + concave * smootherstep;
14+
return cvx * (1 - smootherstep) + ccv * smootherstep;
1415
};

libs/@hashintel/refractive/src/hoc/refractive.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createElement, useEffect, useId, useRef, useState } from "react";
33
import type { JSX } from "react/jsx-runtime";
44

55
import { Filter } from "../components/filter";
6-
import { CONVEX } from "../helpers/surface-equations";
6+
import { convex } from "../helpers/surface-equations";
77

88
type RefractionProps = {
99
refraction: {
@@ -90,7 +90,7 @@ function createRefractiveComponent<
9090
refractiveIndex={refraction.refractiveIndex ?? 1.5}
9191
specularOpacity={refraction.specularOpacity ?? 0}
9292
specularAngle={refraction.specularAngle ?? 0}
93-
bezelHeightFn={refraction.bezelHeightFn ?? CONVEX}
93+
bezelHeightFn={refraction.bezelHeightFn ?? convex}
9494
/>
9595

9696
{/* @ts-expect-error Need to fix types in this file */}

libs/@hashintel/refractive/src/maps/calculate-rounded-square-map.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export function calculateRoundedSquareMap(props: {
7979
const radius = Math.min(props.radius, width / 2, height / 2);
8080
const cornerWidth = Math.max(
8181
radius,
82-
Math.min(props.maximumDistanceToBorder ?? 0, width / 2, height / 2),
82+
Math.min(props.maximumDistanceToBorder, width / 2, height / 2),
8383
);
8484

8585
const widthBetweenCorners = width - cornerWidth * 2;

libs/@hashintel/refractive/src/maps/displacement-map.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable id-length */
21
/* eslint-disable no-param-reassign */
32
import { calculateRoundedSquareMap } from "./calculate-rounded-square-map";
43

libs/@hashintel/refractive/stories/playground.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Meta, StoryObj } from "@storybook/react";
22

3-
import { CONVEX } from "../src/helpers/surface-equations";
3+
import { convex } from "../src/helpers/surface-equations";
44
import { refractive } from "../src/hoc/refractive";
55
import { ExampleArticle } from "./example-article";
66

@@ -11,7 +11,7 @@ const refraction = {
1111
bezelWidth: 30,
1212
glassThickness: 70,
1313
refractiveIndex: 1.5,
14-
bezelHeightFn: CONVEX,
14+
bezelHeightFn: convex,
1515
specularAngle: 2,
1616
};
1717

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
{
2-
"extends": "@local/tsconfig/legacy-base-tsconfig-to-refactor.json",
32
"compilerOptions": {
4-
"module": "ESNext",
5-
"target": "es2022",
6-
"moduleResolution": "bundler",
73
"jsx": "react-jsx",
8-
"lib": ["dom", "dom.iterable", "ES2021"],
4+
"target": "es2024",
5+
"lib": ["dom", "dom.iterable", "ESNext"],
6+
"module": "preserve",
7+
"moduleResolution": "bundler",
8+
"strict": true,
9+
"esModuleInterop": true,
10+
"forceConsistentCasingInFileNames": true,
11+
"noFallthroughCasesInSwitch": true,
12+
"noUncheckedIndexedAccess": true,
13+
"resolveJsonModule": true,
914
"noEmit": true,
15+
"skipLibCheck": true,
1016
"isolatedModules": true
1117
},
12-
"include": ["src/**/*", "stories/**/*"],
13-
"exclude": [
14-
"node_modules",
15-
"dist",
16-
"**/*.test.*",
17-
"**/*.spec.*",
18-
".storybook/**/*"
19-
]
18+
"include": ["src", "stories", ".storybook"]
2019
}

0 commit comments

Comments
 (0)