Skip to content

Commit 46d6d17

Browse files
committed
chore(soba): pass linting
1 parent 0f9542c commit 46d6d17

File tree

10 files changed

+62
-45
lines changed

10 files changed

+62
-45
lines changed

libs/soba/.eslintrc.json

Lines changed: 44 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,51 @@
66
"files": ["*.ts"],
77
"extends": ["plugin:@nx/angular", "plugin:@angular-eslint/template/process-inline-templates"],
88
"rules": {
9-
"@angular-eslint/directive-selector": 0,
10-
"@angular-eslint/component-selector": 0,
11-
"@angular-eslint/component-class-suffix": 0,
12-
"@angular-eslint/no-input-rename": 0,
13-
"@angular-eslint/no-output-native": 0
9+
"@angular-eslint/directive-selector": "off",
10+
"@angular-eslint/component-selector": "off",
11+
"@angular-eslint/directive-class-suffix": "off",
12+
"@angular-eslint/component-class-suffix": "off",
13+
"@angular-eslint/no-input-rename": "off",
14+
"@angular-eslint/no-output-native": "off",
15+
"@typescript-eslint/no-explicit-any": "off",
16+
"@typescript-eslint/no-non-null-assertion": "off",
17+
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }]
1418
}
1519
},
16-
{
17-
"files": ["*.html"],
18-
"extends": ["plugin:@nx/angular-template"],
19-
"rules": {}
20-
},
21-
{
22-
"files": ["*.json"],
23-
"parser": "jsonc-eslint-parser",
24-
"rules": {
25-
"@nx/dependency-checks": "error"
26-
}
27-
}
20+
{
21+
"files": ["setup-canvas.ts", "*.stories.ts"],
22+
"rules": {
23+
"@typescript-eslint/ban-types": "off",
24+
"@typescript-eslint/no-empty-function": "off"
25+
}
26+
},
27+
{
28+
"files": ["*.html"],
29+
"extends": ["plugin:@nx/angular-template"],
30+
"rules": {}
31+
},
32+
{
33+
"files": ["*.json"],
34+
"parser": "jsonc-eslint-parser",
35+
"rules": {
36+
"@nx/dependency-checks": [
37+
"error",
38+
{
39+
"ignoredDependencies": [
40+
"@analogjs/vite-plugin-angular",
41+
"@angular/common",
42+
"@nx/vite",
43+
"@storybook/angular",
44+
"angular-three",
45+
"hls.js",
46+
"meshline",
47+
"ngxtension",
48+
"tslib",
49+
"vite"
50+
]
51+
}
52+
]
53+
}
54+
}
2855
]
2956
}

libs/soba/.storybook/preview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Preview } from '@storybook/angular';
2-
// @ts-ignore
2+
// @ts-expect-error - we can import mdx
33
import DocumentationTemplate from './documentation-template.mdx';
44

55
export default {

libs/soba/abstractions/src/lib/text.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class NgtsText {
113113

114114
afterNextRender(() => {
115115
this.autoEffect(() => {
116-
const [invalidate, text] = [this.invalidate(), this.text(), this.options()];
116+
const [invalidate] = [this.invalidate(), this.text(), this.options()];
117117
this.troikaMesh.sync(() => {
118118
invalidate();
119119
this.synced.emit(this.troikaMesh);

libs/soba/controls/src/lib/scroll-controls.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,17 +262,17 @@ export class NgtsScrollControls {
262262
return this._fixed;
263263
}
264264

265-
range(from: number, distance: number, margin: number = 0): number {
265+
range(from: number, distance: number, margin = 0): number {
266266
const start = from - margin;
267267
const end = start + distance + margin * 2;
268268
return this.offset < start ? 0 : this.offset > end ? 1 : (this.offset - start) / (end - start);
269269
}
270270

271-
curve(from: number, distance: number, margin: number = 0): number {
271+
curve(from: number, distance: number, margin = 0): number {
272272
return Math.sin(this.range(from, distance, margin) * Math.PI);
273273
}
274274

275-
visible(from: number, distance: number, margin: number = 0): boolean {
275+
visible(from: number, distance: number, margin = 0): boolean {
276276
const start = from - margin;
277277
const end = start + distance + margin * 2;
278278
return this.offset >= start && this.offset <= end;

libs/soba/materials/src/lib/mesh-transmission-material.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ export class NgtsMeshTransmissionMaterial {
188188

189189
material.time = clock.getElapsedTime();
190190
// Render only if the buffer matches the built-in and no transmission sampler is set
191-
// @ts-ignore
191+
// @ts-expect-error - we know material.buffer is not just undefined | null
192192
if (material.buffer === fboMain.texture && !transmissionSampler) {
193193
parent = getLocalState(material)?.parent() as Mesh;
194194

libs/soba/misc/src/lib/sampler.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,10 @@ export class NgtsSampler {
204204

205205
this.meshToSample.set(mesh ?? (localState.objects().find((c) => c.type === 'Mesh') as Mesh));
206206
this.instancedToSample.set(
207-
instances ?? (localState.objects().find((c) => c.hasOwnProperty('instanceMatrix')) as InstancedMesh),
207+
instances ??
208+
(localState
209+
.objects()
210+
.find((c) => !!Object.getOwnPropertyDescriptor(c, 'instanceMatrix')) as InstancedMesh),
208211
);
209212
},
210213
{ allowSignalWrites: true },

libs/soba/src/abstractions/grid.stories.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ChangeDetectionStrategy, Component, CUSTOM_ELEMENTS_SCHEMA, input, Signal } from '@angular/core';
22
import { Meta } from '@storybook/angular';
3-
import { NgtArgs } from 'angular-three';
3+
import { NgtAnyRecord, NgtArgs } from 'angular-three';
44
import { NgtsGrid } from 'angular-three-soba/abstractions';
55
import { NgtsOrbitControls } from 'angular-three-soba/controls';
66
import { injectGLTF } from 'angular-three-soba/loaders';
@@ -11,7 +11,7 @@ import { makeDecorators, makeStoryFunction } from '../setup-canvas';
1111

1212
type SuzanneGLTF = GLTF & {
1313
nodes: { Suzanne: Mesh };
14-
materials: {};
14+
materials: NgtAnyRecord;
1515
};
1616

1717
@Component({

libs/soba/src/performances/instances.stories.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ function randomEuler() {
1717
return [Math.random() * Math.PI, Math.random() * Math.PI, Math.random() * Math.PI];
1818
}
1919

20-
const data = Array.from({ length: 1000 }, (r: number = 10) => ({
20+
const data = Array.from({ length: 1000 }, (r: number) => ({
2121
random: Math.random(),
22-
position: randomVector(r),
22+
position: randomVector(r ?? 10),
2323
rotation: randomEuler(),
2424
}));
2525

libs/soba/staging/src/lib/bounds.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,6 @@ interface ControlsProto {
2323
removeEventListener: (event: string, callback: (event: any) => void) => void;
2424
}
2525

26-
interface OriginT {
27-
camPos: Vector3;
28-
camRot: Quaternion;
29-
camZoom: number;
30-
}
31-
32-
interface GoalT {
33-
camPos: Vector3 | undefined;
34-
camRot: Quaternion | undefined;
35-
camZoom: number | undefined;
36-
camUp: Vector3 | undefined;
37-
target: Vector3 | undefined;
38-
}
39-
4026
enum AnimationState {
4127
NONE = 0,
4228
START = 1,

libs/soba/staging/src/lib/environment.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ export function injectEnvironment(
123123
) {
124124
return assertInjector(injectEnvironment, injector, () => {
125125
const adjustedOptions = computed(() => {
126-
let { files, path, preset, extensions, encoding } = options();
126+
const { preset, extensions, encoding, ...rest } = options();
127+
let { files, path } = rest;
127128

128129
if (files == null) {
129130
files = ['/px.png', '/nx.png', '/py.png', '/ny.png', '/pz.png', '/nz.png'];
@@ -213,7 +214,7 @@ export function injectEnvironment(
213214

214215
const result = injectLoader(
215216
loader,
216-
// @ts-expect-error
217+
// @ts-expect-error - ensure the files is an array
217218
() => {
218219
const { files } = adjustedOptions();
219220
return Array.isArray(files) ? [files] : files;
@@ -242,7 +243,7 @@ export function injectEnvironment(
242243
const { multiFile, extension, isCubeMap } = resultOptions();
243244
const { encoding } = adjustedOptions();
244245

245-
// @ts-expect-error
246+
// @ts-expect-error - ensure textureResult is a Texture or CubeTexture
246247
let textureResult = (multiFile ? loaderResult[0] : loaderResult) as Texture | CubeTexture;
247248

248249
if (extension === 'jpg' || extension === 'jpeg' || extension === 'webp') {

0 commit comments

Comments
 (0)