Skip to content

Commit 14f9486

Browse files
committed
chore: add eslint configs and code pass
1 parent 773bab4 commit 14f9486

File tree

121 files changed

+1669
-969
lines changed

Some content is hidden

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

121 files changed

+1669
-969
lines changed

eslint.config.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// @ts-check
2+
3+
// @ts-ignore Needed due to moduleResolution Node vs Bundler
4+
import { tanstackConfig } from '@tanstack/config/eslint'
5+
6+
export default [
7+
...tanstackConfig,
8+
{
9+
name: 'tanstack/temp',
10+
rules: {
11+
'ts/ban-types': 'off',
12+
'ts/no-empty-function': 'off',
13+
'no-case-declarations': 'off',
14+
'ts/naming-convention': 'off',
15+
},
16+
},
17+
]

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
"clean": "pnpm --filter \"./packages/**\" run clean",
1010
"preinstall": "node -e \"if(process.env.CI == 'true') {console.log('Skipping preinstall...'); process.exit(1)}\" || npx -y only-allow pnpm",
1111
"test": "pnpm run test:ci",
12-
"test:pr": "nx affected --targets=test:format,test:sherif,test:knip,test:lib,test:types,test:build,build",
13-
"test:ci": "nx run-many --targets=test:format,test:sherif,test:knip,test:lib,test:types,test:build,build",
12+
"test:pr": "nx affected --targets=test:format,test:eslint,test:sherif,test:knip,test:lib,test:types,test:build,build",
13+
"test:ci": "nx run-many --targets=test:format,test:eslint,test:sherif,test:knip,test:lib,test:types,test:build,build",
1414
"test:format": "pnpm run prettier --check",
15+
"test:eslint": "nx affected --target=test:eslint --exclude=examples/**",
1516
"test:sherif": "sherif",
1617
"test:lib": "nx affected --targets=test:lib --exclude=examples/**",
1718
"test:lib:dev": "pnpm test:lib && nx watch --all -- pnpm test:lib",
@@ -52,6 +53,7 @@
5253
"@testing-library/react": "^16.0.0",
5354
"@testing-library/react-hooks": "^8.0.1",
5455
"@types/node": "^20.14.9",
56+
"eslint": "^9.6.0",
5557
"jsdom": "^24.1.0",
5658
"knip": "^5.23.2",
5759
"nx": "^19.3.2",
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// @ts-check
2+
3+
import rootConfig from '../../eslint.config.js'
4+
5+
export default [
6+
...rootConfig,
7+
{
8+
rules: {},
9+
},
10+
]

packages/angular-table/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"build:types": "tsc --emitDeclarationOnly",
4747
"clean": "rimraf ./build && rimraf ./dist",
4848
"test:build": "publint --strict",
49+
"test:eslint": "eslint ./src",
4950
"test:lib": "vitest",
5051
"test:lib:dev": "vitest --watch",
5152
"test:types": "tsc"

packages/angular-table/src/flex-render.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ import {
44
Directive,
55
EmbeddedViewRef,
66
Inject,
7-
inject,
87
InjectionToken,
98
Injector,
109
Input,
11-
isSignal,
1210
type OnChanges,
1311
type SimpleChanges,
1412
TemplateRef,
1513
Type,
1614
ViewContainerRef,
15+
inject,
16+
isSignal,
1717
} from '@angular/core'
1818

1919
export type FlexRenderContent<TProps extends NonNullable<unknown>> =
@@ -119,7 +119,7 @@ export class FlexRenderDirective<TProps extends NonNullable<unknown>>
119119
const getContext = () => this.props
120120

121121
const proxy = new Proxy(this.props, {
122-
get: (_, key) => getContext()?.[key as keyof typeof _],
122+
get: (_, key) => getContext()[key as keyof typeof _],
123123
})
124124

125125
const componentInjector = Injector.create({
@@ -148,7 +148,7 @@ export class FlexRenderDirective<TProps extends NonNullable<unknown>>
148148
// Only signal based input can be added here
149149
if (
150150
componentRef.instance?.hasOwnProperty(prop) &&
151-
// @ts-ignore
151+
// @ts-ignore - unknown error
152152
isSignal(componentRef.instance[prop])
153153
) {
154154
componentRef.setInput(prop, this.props[prop])

packages/angular-table/src/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { computed, type Signal, signal } from '@angular/core'
2-
import {
1+
import { type Signal, computed, signal } from '@angular/core'
2+
import { _createTable } from '@tanstack/table-core'
3+
import { lazyInit } from './lazy-signal-initializer'
4+
import { proxifyTable } from './proxy'
5+
import type {
36
RowData,
7+
Table,
48
TableOptions,
59
TableOptionsResolved,
610
TableState,
7-
_createTable,
8-
type Table,
911
} from '@tanstack/table-core'
10-
import { lazyInit } from './lazy-signal-initializer'
11-
import { proxifyTable } from './proxy'
1212

1313
export * from '@tanstack/table-core'
1414

@@ -51,7 +51,7 @@ export function injectTable<TData extends RowData>(
5151
const value =
5252
updater instanceof Function ? updater(tableState) : updater
5353
state.set(value)
54-
resolvedOptions.onStateChange?.(updater)
54+
resolvedOptions.onStateChange(updater)
5555
},
5656
}
5757
})

packages/angular-table/src/lazy-signal-initializer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function lazyInit<T extends object>(initializer: () => T): T {
1818
const table = () => {}
1919

2020
return new Proxy<T>(table as T, {
21-
apply(target: T, thisArg: any, argArray: any[]): any {
21+
apply(target: T, thisArg: any, argArray: Array<any>): any {
2222
initializeObject()
2323
if (typeof object === 'function') {
2424
return Reflect.apply(object, thisArg, argArray)

packages/angular-table/src/proxy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { computed, type Signal, untracked } from '@angular/core'
1+
import { type Signal, computed, untracked } from '@angular/core'
22
import { type Table } from '@tanstack/table-core'
33

44
type TableSignal<T> = Table<T> & Signal<Table<T>>
@@ -76,7 +76,7 @@ function toComputed<T>(signal: Signal<Table<T>>, fn: Function) {
7676

7777
const computedCache: Record<string, Signal<unknown>> = {}
7878

79-
return (...argsArray: any[]) => {
79+
return (...argsArray: Array<any>) => {
8080
const serializedArgs = serializeArgs(...argsArray)
8181
if (computedCache.hasOwnProperty(serializedArgs)) {
8282
return computedCache[serializedArgs]?.()
@@ -92,6 +92,6 @@ function toComputed<T>(signal: Signal<Table<T>>, fn: Function) {
9292
}
9393
}
9494

95-
function serializeArgs(...args: any[]) {
95+
function serializeArgs(...args: Array<any>) {
9696
return JSON.stringify(args)
9797
}

packages/angular-table/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
"experimentalDecorators": true,
1313
"importHelpers": true
1414
},
15-
"include": ["src", "tests", "vite.config.ts"]
15+
"include": ["src", "tests", "eslint.config.js", "vite.config.ts"]
1616
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// @ts-check
2+
3+
import rootConfig from '../../eslint.config.js'
4+
5+
export default [
6+
...rootConfig,
7+
{
8+
rules: {},
9+
},
10+
]

0 commit comments

Comments
 (0)