Skip to content

Commit 519c658

Browse files
chore: Use type aware linting (#2162)
1 parent a690382 commit 519c658

106 files changed

Lines changed: 374 additions & 320 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.oxlintrc.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"suspicious": "warn"
77
},
88
"rules": {
9+
"typescript/restrict-template-expressions": "off",
10+
"typescript/no-unsafe-type-assertion": "off",
911
"typescript/no-explicit-any": "error",
1012
"typescript/no-non-null-assertion": "error",
1113
"eslint-plugin-unicorn/prefer-add-event-listener": "off",
@@ -17,11 +19,12 @@
1719
{ "ignorePackages": true }
1820
]
1921
},
20-
"ignorePatterns": ["**/*.astro"],
22+
"ignorePatterns": ["**/*.astro", "**/*.mjs"],
2123
"overrides": [
2224
{
2325
"files": ["**/*.test.ts", "**/tests/**"],
2426
"rules": {
27+
"typescript/unbound-method": "off",
2528
"typescript/no-non-null-assertion": "off",
2629
"eslint/no-unused-vars": "off",
2730
"eslint/no-unused-expressions": "off",

apps/bun-example/preload.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import { plugin } from 'bun';
22
import typegpu from 'unplugin-typegpu/bun';
33

4-
plugin(typegpu({ include: /\.(ts)$/ }));
4+
void plugin(typegpu({ include: /\.(ts)$/ }));

apps/typegpu-docs/public/coi-serviceworker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ if (typeof window === 'undefined') {
124124

125125
// If we're already coi: do nothing. Perhaps it's due to this script doing its job, or COOP/COEP are
126126
// already set from the origin server. Also if the browser has no notion of crossOriginIsolated, just give up here.
127-
if (window.crossOriginIsolated !== false || !coi.shouldRegister()) return;
127+
if (window.crossOriginIsolated || !coi.shouldRegister()) return;
128128

129129
if (!window.isSecureContext) {
130130
if (!coi.quiet) {

apps/typegpu-docs/src/components/ControlPanel.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function ToggleRow({
4848
checked={value}
4949
onChange={(e) => {
5050
setValue(e.target.checked);
51-
runWithCatch(() => onChange(e.target.checked));
51+
void runWithCatch(() => onChange(e.target.checked));
5252
}}
5353
/>
5454
</label>
@@ -85,7 +85,7 @@ function SliderRow({
8585
value={value}
8686
onChange={(newValue) => {
8787
setValue(newValue);
88-
runWithCatch(() => onChange(newValue));
88+
void runWithCatch(() => onChange(newValue));
8989
}}
9090
/>
9191
</>
@@ -121,7 +121,7 @@ function VectorSliderRow({
121121
value={value}
122122
onChange={(newValue) => {
123123
setValue(newValue);
124-
runWithCatch(() => onChange(newValue));
124+
void runWithCatch(() => onChange(newValue));
125125
}}
126126
/>
127127
</>
@@ -148,7 +148,7 @@ function ColorPickerRow({
148148
value={value}
149149
onChange={(newValue) => {
150150
setValue(newValue);
151-
runWithCatch(() => onChange(newValue));
151+
void runWithCatch(() => onChange(newValue));
152152
}}
153153
/>
154154
</>
@@ -175,7 +175,7 @@ function TextAreaRow({
175175
value={value}
176176
onChange={(newValue) => {
177177
setValue(newValue);
178-
runWithCatch(() => onChange(newValue));
178+
void runWithCatch(() => onChange(newValue));
179179
}}
180180
/>
181181
</>
@@ -205,7 +205,7 @@ function SelectRow({
205205
options={options}
206206
onChange={(newValue) => {
207207
setValue(newValue);
208-
runWithCatch(() => onChange(newValue));
208+
void runWithCatch(() => onChange(newValue));
209209
}}
210210
/>
211211
</>

apps/typegpu-docs/src/components/translator/TranslatorApp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export default function TranslatorApp() {
8181
useAutoCompile();
8282

8383
useEffect(() => {
84-
initialize();
84+
void initialize();
8585
}, [initialize]);
8686

8787
const handleEditorLoaded = () => setEditorLoaded(false);

apps/typegpu-docs/src/components/translator/lib/rolldown.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export async function bundle(
3535
cwd: '/',
3636
onLog(level, log, logger) {
3737
if (level === 'warn') {
38+
// oxlint-disable-next-line typescript/no-base-to-string
3839
warnings.push(String(log));
3940
} else {
4041
logger(level, log);

apps/typegpu-docs/src/components/translator/lib/useAutoCompile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export function useAutoCompile() {
3333

3434
const timer = setTimeout(() => {
3535
console.log('Auto-compiling...');
36-
handleCompile();
36+
void handleCompile();
3737
}, 1000);
3838

3939
return () => clearTimeout(timer);

apps/typegpu-docs/src/examples/algorithms/jump-flood-voronoi/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ function initRandom() {
279279
function reset() {
280280
currentRunId++;
281281
initRandom();
282-
runFloodAnimated(currentRunId);
282+
void runFloodAnimated(currentRunId);
283283
}
284284

285285
reset();
@@ -300,7 +300,7 @@ export const controls = defineControls({
300300
'Run Algorithm': {
301301
onButtonClick: () => {
302302
currentRunId++;
303-
runFloodAnimated(currentRunId);
303+
void runFloodAnimated(currentRunId);
304304
},
305305
},
306306
'Random Seeds': {

apps/typegpu-docs/src/examples/algorithms/matrix-multiplication/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ async function run() {
120120
printMatrixToHtml(resultTable, multiplicationResult);
121121
}
122122

123-
run();
123+
void run();
124124

125125
// #region UI
126126

@@ -152,7 +152,7 @@ const paramSettings = {
152152
export const controls = defineControls({
153153
Reshuffle: {
154154
onButtonClick: () => {
155-
run();
155+
void run();
156156
},
157157
},
158158

@@ -161,7 +161,7 @@ export const controls = defineControls({
161161
...paramSettings,
162162
onSliderChange: (value) => {
163163
firstRowCount = value;
164-
run();
164+
void run();
165165
},
166166
},
167167

@@ -170,7 +170,7 @@ export const controls = defineControls({
170170
...paramSettings,
171171
onSliderChange: (value) => {
172172
firstColumnCount = value;
173-
run();
173+
void run();
174174
},
175175
},
176176

@@ -179,7 +179,7 @@ export const controls = defineControls({
179179
...paramSettings,
180180
onSliderChange: (value) => {
181181
secondColumnCount = value;
182-
run();
182+
void run();
183183
},
184184
},
185185
});

apps/typegpu-docs/src/examples/algorithms/mnist-inference/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ const network = createNetwork(await downloadLayers(root));
208208
const canvas = document.querySelector('canvas') as HTMLCanvasElement;
209209
const context = canvas.getContext('2d') as CanvasRenderingContext2D;
210210

211+
// oxlint-disable-next-line typescript/no-unnecessary-type-assertion not really unnecessary
211212
const bars = Array.from(document.querySelectorAll('.bar')) as HTMLDivElement[];
212213
const subgroupsEl = document.getElementById(
213214
'subgroups-status',
@@ -393,7 +394,7 @@ canvas.addEventListener('mousemove', (event) => {
393394
const cellSize = canvas.width / SIZE;
394395
const x = Math.floor((event.offsetX * window.devicePixelRatio) / cellSize);
395396
const y = Math.floor((event.offsetY * window.devicePixelRatio) / cellSize);
396-
handleDrawing(x, y);
397+
void handleDrawing(x, y);
397398
});
398399

399400
canvas.addEventListener('touchmove', (event) => {
@@ -407,7 +408,7 @@ canvas.addEventListener('touchmove', (event) => {
407408
const y = Math.floor(
408409
((touch.clientY - canvasPos.top) * window.devicePixelRatio) / cellSize,
409410
);
410-
handleDrawing(x, y);
411+
void handleDrawing(x, y);
411412
}, { passive: false });
412413

413414
export const controls = defineControls({

0 commit comments

Comments
 (0)