Skip to content

Commit a644056

Browse files
committed
feat(build): migrate to oxlint/oxfmt
1 parent 04c0109 commit a644056

88 files changed

Lines changed: 6316 additions & 20927 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.

.eslintrc.js

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

.oxfmtrc.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"printWidth": 80,
4+
"singleQuote": true,
5+
"trailingComma": "es5",
6+
"arrowParens": "always",
7+
"sortPackageJson": false,
8+
"ignorePatterns": []
9+
}

.oxlintrc.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"plugins": ["import"],
4+
"env": {
5+
"es2020": true,
6+
"es6": true,
7+
"browser": true
8+
},
9+
"globals": {
10+
"__BASE_PATH__": "readonly",
11+
"__VTK_TEST_NO_WEBGL__": "readonly",
12+
"__VTK_TEST_WEBGPU__": "readonly",
13+
"VRFrameData": "readonly"
14+
},
15+
"rules": {
16+
"no-console": "off",
17+
"no-param-reassign": [
18+
"warn",
19+
{
20+
"props": false
21+
}
22+
],
23+
"no-plusplus": "off",
24+
"no-underscore-dangle": "off",
25+
"no-unused-vars": [
26+
"warn",
27+
{
28+
"args": "none"
29+
}
30+
],
31+
"prefer-destructuring": "off"
32+
},
33+
"ignorePatterns": [
34+
"**/example_/*.js",
35+
"Utilities/**/*.js",
36+
"vite.config.js",
37+
"vitest.config.js",
38+
".eslintrc.js"
39+
]
40+
}

Documentation/docs/develop_example.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,5 @@ $ npm run example -- ConeSource
6464
Then the example could be seen at the following URL where standard debug tools could be used within your browser:
6565

6666
```sh
67-
http://localhost:3000/
67+
http://localhost:9999/
6868
```

Documentation/docs/develop_webxr.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,12 @@ serve the "AR" example over a self-signed HTTPS connection:
139139
path/to/vtk-js> npm run example:https -- AR
140140
...
141141
VITE vX.Y.Z ready in XXX ms
142-
➜ Local: https://localhost:3000/
143-
➜ Network: https://xxx.xxx.xxx.xxx:3000/
142+
➜ Local: https://localhost:9999/
143+
➜ Network: https://xxx.xxx.xxx.xxx:9999/
144144
```
145145

146146
The example can then be launched on the WebXR device by navigating in a compatible browser to the
147-
address given at `https://xxx.xxx.xxx.xxx:3000` in the output.
147+
address given at `https://xxx.xxx.xxx.xxx:9999` in the output.
148148

149149
### Emulating XR Hardware
150150

Documentation/docs/vtk_react.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ You can run the app using the project's built-in dev server.
157157
$ yarn start
158158
```
159159

160-
Navigate to `http://localhost:3000`, and you should have an interactive 3D visualization of a cone, similar to the [SimpleCone](../examples/SimpleCone.html) example.
160+
Navigate to `http://localhost:9999`, and you should have an interactive 3D visualization of a cone, similar to the [SimpleCone](../examples/SimpleCone.html) example.
161161

162162
## Where to go next
163163

Examples/Rendering/ImageResliceMapperLabelOutline/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,8 @@ async function update() {
297297
}
298298
});
299299

300-
const { image: itkImage } = await window.itk.readImageDICOMArrayBufferSeries(
301-
arrayBuffers
302-
);
300+
const { image: itkImage } =
301+
await window.itk.readImageDICOMArrayBufferSeries(arrayBuffers);
303302

304303
const vtkImage = vtkITKHelper.convertItkToVtkImage(itkImage);
305304
setImage(vtkImage);

Sources/Common/Core/DataArray/test/testDataArray.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import test from 'tape';
1+
import { it, expect } from 'vitest';
22
import vtk from 'vtk.js/Sources/vtk';
33
import vtkDataArray from 'vtk.js/Sources/Common/Core/DataArray';
44
import { VtkDataTypes } from 'vtk.js/Sources/Common/Core/DataArray/Constants';
@@ -554,30 +554,30 @@ it('Test vtkDataArray resize function', () => {
554554
);
555555
});
556556

557-
test('Test vtkDataArray getState preserveTypedArrays option', (t) => {
557+
it('Test vtkDataArray getState preserveTypedArrays option', () => {
558558
const values = new Uint8Array([1, 2, 3, 4, 5]);
559559
const da = vtkDataArray.newInstance({ values });
560560

561561
// Default: values converted to plain Array
562562
const state = da.getState();
563-
t.ok(Array.isArray(state.values), 'default getState returns plain Array');
563+
expect(
564+
Array.isArray(state.values),
565+
'default getState returns plain Array'
566+
).toBeTruthy();
564567

565568
// With option: values preserved as TypedArray
566569
const transferable = da.getState({ preserveTypedArrays: true });
567-
t.ok(
570+
expect(
568571
transferable.values instanceof Uint8Array,
569572
'TypedArray type is preserved'
570-
);
573+
).toBeTruthy();
571574

572575
// Round-trip via vtk() works with TypedArray values
573576
const da2 = vtk(transferable);
574-
t.ok(da2, 'Can reconstruct from state with TypedArray values');
575-
t.deepEqual(
577+
expect(da2, 'Can reconstruct from state with TypedArray values').toBeTruthy();
578+
expect(
576579
Array.from(da2.getData()),
577-
Array.from(values),
578580
'Values preserved after round-trip'
579-
);
580-
t.equal(da2.getDataType(), 'Uint8Array', 'Data type preserved');
581-
582-
t.end();
581+
).toEqual(Array.from(values));
582+
expect(da2.getDataType(), 'Data type preserved').toBe('Uint8Array');
583583
});

Sources/Common/DataModel/AbstractPointLocator/index.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import vtkLocator, { ILocatorInitialValues } from '../Locator';
55
/**
66
*
77
*/
8-
export interface IAbstractPointLocatorInitialValues
9-
extends ILocatorInitialValues {
8+
export interface IAbstractPointLocatorInitialValues extends ILocatorInitialValues {
109
bounds?: Bounds;
1110
numberOfBuckets: number;
1211
}

Sources/Common/DataModel/CardinalSpline1D/index.d.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import vtkSpline1D, {
44
BoundaryCondition,
55
} from '../Spline1D';
66

7-
export interface ICardinalSpline1DInitialValues
8-
extends ISpline1DInitialValues {}
7+
export interface ICardinalSpline1DInitialValues extends ISpline1DInitialValues {}
98

109
export interface vtkCardinalSpline1D extends vtkSpline1D {
1110
/**
@@ -43,7 +42,7 @@ export interface vtkCardinalSpline1D extends vtkSpline1D {
4342
leftConstraint: BoundaryCondition;
4443
leftValue: number;
4544
rightConstraint: BoundaryCondition;
46-
rightValue: Number;
45+
rightValue: number;
4746
}
4847
): void;
4948

0 commit comments

Comments
 (0)