Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 0 additions & 70 deletions .oxlintrc.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ async function runBenchmarks() {
drawCharts();
}

runBenchmarks();
void runBenchmarks();

// #region Example controls & Cleanup

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export function setupFirstPersonCamera(

// mouse events
canvas.addEventListener('mousedown', () => {
canvas.requestPointerLock();
void canvas.requestPointerLock();
});

canvas.addEventListener('mousemove', (event: MouseEvent) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function applyOp(
a: number | undefined,
b: number | undefined,
): number {
return op.operation(a as number & d.F32, b as number & d.F32) as number;
return op.operation(a as number & d.F32, b as number & d.F32);
}

export function prefixScanJS(arr: number[], op: BinaryOp) {
Expand Down
2 changes: 1 addition & 1 deletion apps/typegpu-docs/src/examples/tests/prefix-scan/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ const table = document.querySelector<HTMLDivElement>('.result');
if (!table) {
throw new Error('Nowhere to display the results');
}
runTests().then((result) => {
void runTests().then((result) => {
table.innerText = `Tests ${result ? 'succeeded' : 'failed'}.`;
});

Expand Down
2 changes: 1 addition & 1 deletion apps/typegpu-docs/src/examples/threejs/varyings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ dirLight.position.set(-7, 10, 0);
scene.add(dirLight);
scene.add(new THREE.AmbientLight(0x444444));

renderer.setAnimationLoop(() => {
void renderer.setAnimationLoop(() => {
renderer.render(scene, camera);
});

Expand Down
51 changes: 51 additions & 0 deletions oxlint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { defineConfig } from 'oxlint';
import typegpu from 'eslint-plugin-typegpu';

const typegpuPreset = typegpu.configs?.recommended;
const typegpuRules = typegpuPreset && 'rules' in typegpuPreset
? typegpuPreset.rules
: {};

export default defineConfig({
plugins: ['eslint', 'typescript', 'import', 'unicorn', 'oxc'],
jsPlugins: ['eslint-plugin-typegpu'],
categories: {
correctness: 'warn',
suspicious: 'warn',
},
rules: {
...typegpuRules,
'typescript/no-unsafe-enum-comparison': 'off',
'typescript/restrict-template-expressions': 'off',
'typescript/no-unsafe-type-assertion': 'off',
'typescript/no-explicit-any': 'error',
'typescript/no-non-null-assertion': 'error',
'eslint/no-shadow': 'off',
'eslint-plugin-unicorn/prefer-add-event-listener': 'off',
'eslint-plugin-import/no-named-as-default': 'off',
'eslint-plugin-import/no-named-as-default-member': 'off',
'eslint-plugin-import/extensions': [
'error',
'always',
{ ignorePackages: true },
],
},
ignorePatterns: ['**/*.astro', '**/*.mjs'],
overrides: [
{
files: ['**/*.test.ts', '**/tests/**'],
rules: {
'typescript/unbound-method': 'off',
'typescript/no-non-null-assertion': 'off',
'eslint/no-unused-vars': 'off',
'eslint/no-unused-expressions': 'off',
'eslint-plugin-unicorn/consistent-function-scoping': 'off',
'eslint/no-unsafe-optional-chaining': 'off',
'eslint/no-constant-condition': 'off',
},
},
],
env: {
builtin: true,
},
});
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"test": "pnpm run test:types && pnpm run test:style && pnpm run test:unit-and-attest && pnpm run test:circular-deps",
"test:circular-deps": "pnpm dpdm -T --exit-code circular:1 packages/**/index.ts",
"test:types": "pnpm run -r --parallel test:types",
"test:style": "oxlint --type-aware && deno fmt --check",
"test:style": "oxlint --max-warnings=0 --type-aware && deno fmt --check",
"test:unit-and-attest": "vitest run --project=!browser",
"test:unit": "ATTEST_skipTypes=1 vitest run --project=!browser",
"test:unit:watch": "ATTEST_skipTypes=1 vitest --project=!browser",
Expand Down Expand Up @@ -43,8 +43,9 @@
"@vitest/coverage-v8": "3.1.2",
"@webgpu/types": "catalog:types",
"dpdm": "^3.14.0",
"eslint-plugin-typegpu": "workspace:*",
"jiti": "catalog:build",
"oxlint": "^1.43.0",
"oxlint": "^1.49.0",
"oxlint-tsgolint": "^0.12.1",
"pkg-pr-new": "^0.0.62",
"typescript": "catalog:types",
Expand Down
15 changes: 12 additions & 3 deletions packages/eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,20 @@
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
"types": "./src/index.ts",
"import": "./src/index.ts"
}
},
"publishConfig": {
"exports": {
".": {
"types": "./dist/index.d.mts",
"import": "./dist/index.mjs"
}
}
},
"scripts": {
"build": "tsup",
"build": "tsdown",
"test:types": "pnpm tsc --p ./tsconfig.json --noEmit",
"test": "vitest"
},
Expand All @@ -27,6 +35,7 @@
"@types/node": "^25.0.10",
"@typescript-eslint/rule-tester": "^8.53.1",
"eslint": "^9.39.2",
"tsdown": "^0.20.3",
"typescript": "^5.9.3",
"vitest": "^4.0.17"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pkg from '../package.json';
import pkg from '../package.json' with { type: 'json' };
import type { TSESLint } from '@typescript-eslint/utils';
import { allRules, recommendedRules, rules } from './configs.ts';

Expand Down
9 changes: 9 additions & 0 deletions packages/eslint-plugin/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from 'tsdown';

export default defineConfig({
entry: ['src/index.ts'],
format: ['esm'],
dts: true,
clean: true,
sourcemap: true,
});
12 changes: 0 additions & 12 deletions packages/eslint-plugin/tsup.config.ts

This file was deleted.

1 change: 1 addition & 0 deletions packages/typegpu/src/data/wgslTypes.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// oxlint-disable-next-line no-unused-vars it is used
import type { Operator } from 'tsover-runtime';
import type { TgpuNamable } from '../shared/meta.ts';
import type {
Expand Down
4 changes: 2 additions & 2 deletions packages/typegpu/tests/offsetUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('getOffsetInfoAt (vectors)', () => {
});

it('supports numeric component access', () => {
const info = getOffsetInfoAt(d.vec3f, (v) => v[1] as number);
const info = getOffsetInfoAt(d.vec3f, (v) => v[1]);

expect(info.offset).toBe(4);
expect(info.contiguous).toBe(8);
Expand Down Expand Up @@ -172,7 +172,7 @@ describe('getOffsetInfoAt (edge cases)', () => {

const info = getOffsetInfoAt(
S,
(s) => s.l.vec.z as number,
(s) => s.l.vec.z,
);

expect(info.offset).toBe(8);
Expand Down
4 changes: 4 additions & 0 deletions packages/typegpu/tests/std/numeric/div.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ describe('div', () => {
});

it('const u32 / const u32', () => {
// oxlint-disable-next-line typegpu/integer-division it's a test
const foo = tgpu.fn([], d.f32)(() => d.u32(1) / d.u32(2));
expect(foo()).toBe(0.5);
expect(tgpu.resolve([foo])).toMatchInlineSnapshot(`
Expand All @@ -93,6 +94,7 @@ describe('div', () => {
});

it('const i32 / const i32', () => {
// oxlint-disable-next-line typegpu/integer-division it's a test
const foo = tgpu.fn([], d.f32)(() => d.i32(1) / d.i32(2));
expect(foo()).toBe(0.5);
expect(tgpu.resolve([foo])).toMatchInlineSnapshot(`
Expand Down Expand Up @@ -133,6 +135,7 @@ describe('div', () => {
});

it('const f32 / const i32', () => {
// oxlint-disable-next-line typegpu/integer-division it's a test
const foo = tgpu.fn([], d.f32)(() => d.f32(1.0) / d.i32(2.0));
expect(foo()).toBe(0.5);
expect(tgpu.resolve([foo])).toMatchInlineSnapshot(`
Expand All @@ -143,6 +146,7 @@ describe('div', () => {
});

it('const u32 / const i32', () => {
// oxlint-disable-next-line typegpu/integer-division it's a test
const foo = tgpu.fn([], d.f32)(() => d.u32(1) / d.i32(2));
expect(foo()).toBe(0.5);
expect(tgpu.resolve([foo])).toMatchInlineSnapshot(`
Expand Down
6 changes: 3 additions & 3 deletions packages/unplugin-typegpu/src/babel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function functionVisitor(ctx: Context): TraverseOptions {
path.node.left,
types.callExpression(types.identifier(runtimeFn), [
path.node.left as babel.Expression,
path.node.right as babel.Expression,
path.node.right,
]),
),
);
Expand Down Expand Up @@ -202,7 +202,7 @@ function functionVisitor(ctx: Context): TraverseOptions {
path.replaceWith(
types.callExpression(types.identifier(runtimeFn), [
path.node.left as babel.Expression,
path.node.right as babel.Expression,
path.node.right,
]),
);
}
Expand Down Expand Up @@ -306,7 +306,7 @@ function functionVisitor(ctx: Context): TraverseOptions {
const transpiled = functionToTranspiled(
implementation,
null,
) as babel.CallExpression;
);

path.replaceWith(
types.callExpression(node.callee, [
Expand Down
Loading
Loading