From b6c0c7a97960ecaa908a6af145388d02029d7e7c Mon Sep 17 00:00:00 2001 From: Peter Andersson Date: Wed, 18 Mar 2026 11:54:05 -0700 Subject: [PATCH 1/4] first passthrough --- .oxlintrc.json | 3 + package.json | 4 + src/client/initialize.ts | 1 + src/react/hooks.ts | 8 +- yarn.lock | 489 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 501 insertions(+), 4 deletions(-) create mode 100644 .oxlintrc.json diff --git a/.oxlintrc.json b/.oxlintrc.json new file mode 100644 index 0000000..b568a2b --- /dev/null +++ b/.oxlintrc.json @@ -0,0 +1,3 @@ +{ + "plugins": ["eslint", "import", "oxc", "react", "typescript"] +} \ No newline at end of file diff --git a/package.json b/package.json index c13bfa6..e986c86 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "build": "yarn tsc --build tsconfig.build.json", "build:watch": "yarn build --watch", "format": "prettier --write 'src/**/*.{ts,tsx}' 'jest.config.ts'", + "lint": "yarn oxlint", "precommit": "lint-staged", "prepublish": "yarn build", "test": "jest --ci", @@ -49,6 +50,9 @@ "jest": "^27.5.1", "jest-watch-typeahead": "^2.1.1", "lint-staged": "^13.0.3", + "oxfmt": "^0.38.0", + "oxlint": "^1.53.0", + "oxlint-tsgolint": "^0.16.0", "prettier": "^2.7.1", "ts-jest": "^27.1.4", "typescript": "^4.8.2" diff --git a/src/client/initialize.ts b/src/client/initialize.ts index e111083..f69dfc6 100644 --- a/src/client/initialize.ts +++ b/src/client/initialize.ts @@ -120,6 +120,7 @@ export function initialize(): PluginInstance { config: { // @ts-ignore getKey(key) { + // oxlint-disable-next-line no-non-null-asserted-optional-chain TODO: Fix return pluginConfig?.config?.[key]!; }, get() { diff --git a/src/react/hooks.ts b/src/react/hooks.ts index 44bafc2..b5c259c 100644 --- a/src/react/hooks.ts +++ b/src/react/hooks.ts @@ -118,7 +118,7 @@ export function usePaginatedElementData( if (configId) { client.elements.fetchMoreElementData(configId); } - }, [configId]); + }, [configId, client.elements]); useEffect(() => { if (configId) { @@ -149,7 +149,7 @@ export function useConfig(key?: string): any { setConfig(newConfig); } }), - [client], + [client, key, config], ); return config; @@ -179,7 +179,7 @@ export function useVariable( const setVariable = useCallback( (...values: unknown[]) => client.config.setVariable(id, ...values), - [id], + [id, client.config], ); return [workbookVariable, setVariable]; @@ -239,7 +239,7 @@ export function useInteraction( (value: WorkbookSelection[]) => { client.config.setInteraction(id, elementId, value); }, - [id], + [id, elementId, client.config], ); return [workbookInteraction, setInteraction]; diff --git a/yarn.lock b/yarn.lock index 5465556..7a31c0e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -780,6 +780,314 @@ __metadata: languageName: node linkType: hard +"@oxfmt/binding-android-arm-eabi@npm:0.38.0": + version: 0.38.0 + resolution: "@oxfmt/binding-android-arm-eabi@npm:0.38.0" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + +"@oxfmt/binding-android-arm64@npm:0.38.0": + version: 0.38.0 + resolution: "@oxfmt/binding-android-arm64@npm:0.38.0" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@oxfmt/binding-darwin-arm64@npm:0.38.0": + version: 0.38.0 + resolution: "@oxfmt/binding-darwin-arm64@npm:0.38.0" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@oxfmt/binding-darwin-x64@npm:0.38.0": + version: 0.38.0 + resolution: "@oxfmt/binding-darwin-x64@npm:0.38.0" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@oxfmt/binding-freebsd-x64@npm:0.38.0": + version: 0.38.0 + resolution: "@oxfmt/binding-freebsd-x64@npm:0.38.0" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + +"@oxfmt/binding-linux-arm-gnueabihf@npm:0.38.0": + version: 0.38.0 + resolution: "@oxfmt/binding-linux-arm-gnueabihf@npm:0.38.0" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@oxfmt/binding-linux-arm-musleabihf@npm:0.38.0": + version: 0.38.0 + resolution: "@oxfmt/binding-linux-arm-musleabihf@npm:0.38.0" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@oxfmt/binding-linux-arm64-gnu@npm:0.38.0": + version: 0.38.0 + resolution: "@oxfmt/binding-linux-arm64-gnu@npm:0.38.0" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + +"@oxfmt/binding-linux-arm64-musl@npm:0.38.0": + version: 0.38.0 + resolution: "@oxfmt/binding-linux-arm64-musl@npm:0.38.0" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@oxfmt/binding-linux-ppc64-gnu@npm:0.38.0": + version: 0.38.0 + resolution: "@oxfmt/binding-linux-ppc64-gnu@npm:0.38.0" + conditions: os=linux & cpu=ppc64 & libc=glibc + languageName: node + linkType: hard + +"@oxfmt/binding-linux-riscv64-gnu@npm:0.38.0": + version: 0.38.0 + resolution: "@oxfmt/binding-linux-riscv64-gnu@npm:0.38.0" + conditions: os=linux & cpu=riscv64 & libc=glibc + languageName: node + linkType: hard + +"@oxfmt/binding-linux-riscv64-musl@npm:0.38.0": + version: 0.38.0 + resolution: "@oxfmt/binding-linux-riscv64-musl@npm:0.38.0" + conditions: os=linux & cpu=riscv64 & libc=musl + languageName: node + linkType: hard + +"@oxfmt/binding-linux-s390x-gnu@npm:0.38.0": + version: 0.38.0 + resolution: "@oxfmt/binding-linux-s390x-gnu@npm:0.38.0" + conditions: os=linux & cpu=s390x & libc=glibc + languageName: node + linkType: hard + +"@oxfmt/binding-linux-x64-gnu@npm:0.38.0": + version: 0.38.0 + resolution: "@oxfmt/binding-linux-x64-gnu@npm:0.38.0" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@oxfmt/binding-linux-x64-musl@npm:0.38.0": + version: 0.38.0 + resolution: "@oxfmt/binding-linux-x64-musl@npm:0.38.0" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + +"@oxfmt/binding-openharmony-arm64@npm:0.38.0": + version: 0.38.0 + resolution: "@oxfmt/binding-openharmony-arm64@npm:0.38.0" + conditions: os=openharmony & cpu=arm64 + languageName: node + linkType: hard + +"@oxfmt/binding-win32-arm64-msvc@npm:0.38.0": + version: 0.38.0 + resolution: "@oxfmt/binding-win32-arm64-msvc@npm:0.38.0" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@oxfmt/binding-win32-ia32-msvc@npm:0.38.0": + version: 0.38.0 + resolution: "@oxfmt/binding-win32-ia32-msvc@npm:0.38.0" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@oxfmt/binding-win32-x64-msvc@npm:0.38.0": + version: 0.38.0 + resolution: "@oxfmt/binding-win32-x64-msvc@npm:0.38.0" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@oxlint-tsgolint/darwin-arm64@npm:0.16.0": + version: 0.16.0 + resolution: "@oxlint-tsgolint/darwin-arm64@npm:0.16.0" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@oxlint-tsgolint/darwin-x64@npm:0.16.0": + version: 0.16.0 + resolution: "@oxlint-tsgolint/darwin-x64@npm:0.16.0" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@oxlint-tsgolint/linux-arm64@npm:0.16.0": + version: 0.16.0 + resolution: "@oxlint-tsgolint/linux-arm64@npm:0.16.0" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + +"@oxlint-tsgolint/linux-x64@npm:0.16.0": + version: 0.16.0 + resolution: "@oxlint-tsgolint/linux-x64@npm:0.16.0" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + +"@oxlint-tsgolint/win32-arm64@npm:0.16.0": + version: 0.16.0 + resolution: "@oxlint-tsgolint/win32-arm64@npm:0.16.0" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@oxlint-tsgolint/win32-x64@npm:0.16.0": + version: 0.16.0 + resolution: "@oxlint-tsgolint/win32-x64@npm:0.16.0" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@oxlint/binding-android-arm-eabi@npm:1.53.0": + version: 1.53.0 + resolution: "@oxlint/binding-android-arm-eabi@npm:1.53.0" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + +"@oxlint/binding-android-arm64@npm:1.53.0": + version: 1.53.0 + resolution: "@oxlint/binding-android-arm64@npm:1.53.0" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@oxlint/binding-darwin-arm64@npm:1.53.0": + version: 1.53.0 + resolution: "@oxlint/binding-darwin-arm64@npm:1.53.0" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@oxlint/binding-darwin-x64@npm:1.53.0": + version: 1.53.0 + resolution: "@oxlint/binding-darwin-x64@npm:1.53.0" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@oxlint/binding-freebsd-x64@npm:1.53.0": + version: 1.53.0 + resolution: "@oxlint/binding-freebsd-x64@npm:1.53.0" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + +"@oxlint/binding-linux-arm-gnueabihf@npm:1.53.0": + version: 1.53.0 + resolution: "@oxlint/binding-linux-arm-gnueabihf@npm:1.53.0" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@oxlint/binding-linux-arm-musleabihf@npm:1.53.0": + version: 1.53.0 + resolution: "@oxlint/binding-linux-arm-musleabihf@npm:1.53.0" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@oxlint/binding-linux-arm64-gnu@npm:1.53.0": + version: 1.53.0 + resolution: "@oxlint/binding-linux-arm64-gnu@npm:1.53.0" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + +"@oxlint/binding-linux-arm64-musl@npm:1.53.0": + version: 1.53.0 + resolution: "@oxlint/binding-linux-arm64-musl@npm:1.53.0" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@oxlint/binding-linux-ppc64-gnu@npm:1.53.0": + version: 1.53.0 + resolution: "@oxlint/binding-linux-ppc64-gnu@npm:1.53.0" + conditions: os=linux & cpu=ppc64 & libc=glibc + languageName: node + linkType: hard + +"@oxlint/binding-linux-riscv64-gnu@npm:1.53.0": + version: 1.53.0 + resolution: "@oxlint/binding-linux-riscv64-gnu@npm:1.53.0" + conditions: os=linux & cpu=riscv64 & libc=glibc + languageName: node + linkType: hard + +"@oxlint/binding-linux-riscv64-musl@npm:1.53.0": + version: 1.53.0 + resolution: "@oxlint/binding-linux-riscv64-musl@npm:1.53.0" + conditions: os=linux & cpu=riscv64 & libc=musl + languageName: node + linkType: hard + +"@oxlint/binding-linux-s390x-gnu@npm:1.53.0": + version: 1.53.0 + resolution: "@oxlint/binding-linux-s390x-gnu@npm:1.53.0" + conditions: os=linux & cpu=s390x & libc=glibc + languageName: node + linkType: hard + +"@oxlint/binding-linux-x64-gnu@npm:1.53.0": + version: 1.53.0 + resolution: "@oxlint/binding-linux-x64-gnu@npm:1.53.0" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@oxlint/binding-linux-x64-musl@npm:1.53.0": + version: 1.53.0 + resolution: "@oxlint/binding-linux-x64-musl@npm:1.53.0" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + +"@oxlint/binding-openharmony-arm64@npm:1.53.0": + version: 1.53.0 + resolution: "@oxlint/binding-openharmony-arm64@npm:1.53.0" + conditions: os=openharmony & cpu=arm64 + languageName: node + linkType: hard + +"@oxlint/binding-win32-arm64-msvc@npm:1.53.0": + version: 1.53.0 + resolution: "@oxlint/binding-win32-arm64-msvc@npm:1.53.0" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@oxlint/binding-win32-ia32-msvc@npm:1.53.0": + version: 1.53.0 + resolution: "@oxlint/binding-win32-ia32-msvc@npm:1.53.0" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@oxlint/binding-win32-x64-msvc@npm:1.53.0": + version: 1.53.0 + resolution: "@oxlint/binding-win32-x64-msvc@npm:1.53.0" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@pkgjs/parseargs@npm:^0.11.0": version: 0.11.0 resolution: "@pkgjs/parseargs@npm:0.11.0" @@ -799,6 +1107,9 @@ __metadata: jest: "npm:^27.5.1" jest-watch-typeahead: "npm:^2.1.1" lint-staged: "npm:^13.0.3" + oxfmt: "npm:^0.38.0" + oxlint: "npm:^1.53.0" + oxlint-tsgolint: "npm:^0.16.0" prettier: "npm:^2.7.1" ts-jest: "npm:^27.1.4" typescript: "npm:^4.8.2" @@ -3540,6 +3851,177 @@ __metadata: languageName: node linkType: hard +"oxfmt@npm:^0.38.0": + version: 0.38.0 + resolution: "oxfmt@npm:0.38.0" + dependencies: + "@oxfmt/binding-android-arm-eabi": "npm:0.38.0" + "@oxfmt/binding-android-arm64": "npm:0.38.0" + "@oxfmt/binding-darwin-arm64": "npm:0.38.0" + "@oxfmt/binding-darwin-x64": "npm:0.38.0" + "@oxfmt/binding-freebsd-x64": "npm:0.38.0" + "@oxfmt/binding-linux-arm-gnueabihf": "npm:0.38.0" + "@oxfmt/binding-linux-arm-musleabihf": "npm:0.38.0" + "@oxfmt/binding-linux-arm64-gnu": "npm:0.38.0" + "@oxfmt/binding-linux-arm64-musl": "npm:0.38.0" + "@oxfmt/binding-linux-ppc64-gnu": "npm:0.38.0" + "@oxfmt/binding-linux-riscv64-gnu": "npm:0.38.0" + "@oxfmt/binding-linux-riscv64-musl": "npm:0.38.0" + "@oxfmt/binding-linux-s390x-gnu": "npm:0.38.0" + "@oxfmt/binding-linux-x64-gnu": "npm:0.38.0" + "@oxfmt/binding-linux-x64-musl": "npm:0.38.0" + "@oxfmt/binding-openharmony-arm64": "npm:0.38.0" + "@oxfmt/binding-win32-arm64-msvc": "npm:0.38.0" + "@oxfmt/binding-win32-ia32-msvc": "npm:0.38.0" + "@oxfmt/binding-win32-x64-msvc": "npm:0.38.0" + tinypool: "npm:2.1.0" + dependenciesMeta: + "@oxfmt/binding-android-arm-eabi": + optional: true + "@oxfmt/binding-android-arm64": + optional: true + "@oxfmt/binding-darwin-arm64": + optional: true + "@oxfmt/binding-darwin-x64": + optional: true + "@oxfmt/binding-freebsd-x64": + optional: true + "@oxfmt/binding-linux-arm-gnueabihf": + optional: true + "@oxfmt/binding-linux-arm-musleabihf": + optional: true + "@oxfmt/binding-linux-arm64-gnu": + optional: true + "@oxfmt/binding-linux-arm64-musl": + optional: true + "@oxfmt/binding-linux-ppc64-gnu": + optional: true + "@oxfmt/binding-linux-riscv64-gnu": + optional: true + "@oxfmt/binding-linux-riscv64-musl": + optional: true + "@oxfmt/binding-linux-s390x-gnu": + optional: true + "@oxfmt/binding-linux-x64-gnu": + optional: true + "@oxfmt/binding-linux-x64-musl": + optional: true + "@oxfmt/binding-openharmony-arm64": + optional: true + "@oxfmt/binding-win32-arm64-msvc": + optional: true + "@oxfmt/binding-win32-ia32-msvc": + optional: true + "@oxfmt/binding-win32-x64-msvc": + optional: true + bin: + oxfmt: bin/oxfmt + checksum: 10c0/9f977a3062eb4107c0bf42149e129fbee2c24aa934ba39efac1ec211e7411f9a7cf9d8efb3468b2520d713cbf4f8bcf595602d5fbd1f801deb5178902ee3bc3f + languageName: node + linkType: hard + +"oxlint-tsgolint@npm:^0.16.0": + version: 0.16.0 + resolution: "oxlint-tsgolint@npm:0.16.0" + dependencies: + "@oxlint-tsgolint/darwin-arm64": "npm:0.16.0" + "@oxlint-tsgolint/darwin-x64": "npm:0.16.0" + "@oxlint-tsgolint/linux-arm64": "npm:0.16.0" + "@oxlint-tsgolint/linux-x64": "npm:0.16.0" + "@oxlint-tsgolint/win32-arm64": "npm:0.16.0" + "@oxlint-tsgolint/win32-x64": "npm:0.16.0" + dependenciesMeta: + "@oxlint-tsgolint/darwin-arm64": + optional: true + "@oxlint-tsgolint/darwin-x64": + optional: true + "@oxlint-tsgolint/linux-arm64": + optional: true + "@oxlint-tsgolint/linux-x64": + optional: true + "@oxlint-tsgolint/win32-arm64": + optional: true + "@oxlint-tsgolint/win32-x64": + optional: true + bin: + tsgolint: bin/tsgolint.js + checksum: 10c0/6a0af5e28e446383260f9a8ada460fef1e95601563860234026a7ccb1e04a7f3efb484d836f9731364d6d12f66335fc9dcaab70328ae84ce23429a752ce8606e + languageName: node + linkType: hard + +"oxlint@npm:^1.53.0": + version: 1.53.0 + resolution: "oxlint@npm:1.53.0" + dependencies: + "@oxlint/binding-android-arm-eabi": "npm:1.53.0" + "@oxlint/binding-android-arm64": "npm:1.53.0" + "@oxlint/binding-darwin-arm64": "npm:1.53.0" + "@oxlint/binding-darwin-x64": "npm:1.53.0" + "@oxlint/binding-freebsd-x64": "npm:1.53.0" + "@oxlint/binding-linux-arm-gnueabihf": "npm:1.53.0" + "@oxlint/binding-linux-arm-musleabihf": "npm:1.53.0" + "@oxlint/binding-linux-arm64-gnu": "npm:1.53.0" + "@oxlint/binding-linux-arm64-musl": "npm:1.53.0" + "@oxlint/binding-linux-ppc64-gnu": "npm:1.53.0" + "@oxlint/binding-linux-riscv64-gnu": "npm:1.53.0" + "@oxlint/binding-linux-riscv64-musl": "npm:1.53.0" + "@oxlint/binding-linux-s390x-gnu": "npm:1.53.0" + "@oxlint/binding-linux-x64-gnu": "npm:1.53.0" + "@oxlint/binding-linux-x64-musl": "npm:1.53.0" + "@oxlint/binding-openharmony-arm64": "npm:1.53.0" + "@oxlint/binding-win32-arm64-msvc": "npm:1.53.0" + "@oxlint/binding-win32-ia32-msvc": "npm:1.53.0" + "@oxlint/binding-win32-x64-msvc": "npm:1.53.0" + peerDependencies: + oxlint-tsgolint: ">=0.15.0" + dependenciesMeta: + "@oxlint/binding-android-arm-eabi": + optional: true + "@oxlint/binding-android-arm64": + optional: true + "@oxlint/binding-darwin-arm64": + optional: true + "@oxlint/binding-darwin-x64": + optional: true + "@oxlint/binding-freebsd-x64": + optional: true + "@oxlint/binding-linux-arm-gnueabihf": + optional: true + "@oxlint/binding-linux-arm-musleabihf": + optional: true + "@oxlint/binding-linux-arm64-gnu": + optional: true + "@oxlint/binding-linux-arm64-musl": + optional: true + "@oxlint/binding-linux-ppc64-gnu": + optional: true + "@oxlint/binding-linux-riscv64-gnu": + optional: true + "@oxlint/binding-linux-riscv64-musl": + optional: true + "@oxlint/binding-linux-s390x-gnu": + optional: true + "@oxlint/binding-linux-x64-gnu": + optional: true + "@oxlint/binding-linux-x64-musl": + optional: true + "@oxlint/binding-openharmony-arm64": + optional: true + "@oxlint/binding-win32-arm64-msvc": + optional: true + "@oxlint/binding-win32-ia32-msvc": + optional: true + "@oxlint/binding-win32-x64-msvc": + optional: true + peerDependenciesMeta: + oxlint-tsgolint: + optional: true + bin: + oxlint: bin/oxlint + checksum: 10c0/378c17f9b0a6a792606c96e409ee792de336cbbef9e94ea9e9d35b6f601353dfda356213738fc14f4ebc0d33ddd8a5987e412ee642f7599940e283370e2d0154 + languageName: node + linkType: hard + "p-limit@npm:^2.2.0": version: 2.3.0 resolution: "p-limit@npm:2.3.0" @@ -4306,6 +4788,13 @@ __metadata: languageName: node linkType: hard +"tinypool@npm:2.1.0": + version: 2.1.0 + resolution: "tinypool@npm:2.1.0" + checksum: 10c0/9fb1c760558c6264e0f4cfde96a63b12450b43f1730fbe6274aa24ddbdf488745c08924d0dea7a1303b47d555416a6415f2113898c69b6ecf731e75ac95238a5 + languageName: node + linkType: hard + "tmpl@npm:1.0.5": version: 1.0.5 resolution: "tmpl@npm:1.0.5" From efec8c901a8131fb9c92e59ac562f0db672edfa4 Mon Sep 17 00:00:00 2001 From: Peter Andersson Date: Wed, 18 Mar 2026 14:07:45 -0700 Subject: [PATCH 2/4] add a TODO for the bad type --- src/client/initialize.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/client/initialize.ts b/src/client/initialize.ts index f69dfc6..bafd8a8 100644 --- a/src/client/initialize.ts +++ b/src/client/initialize.ts @@ -118,10 +118,9 @@ export function initialize(): PluginInstance { }, config: { - // @ts-ignore + // @ts-ignore TODO: Fix getKey(key) { - // oxlint-disable-next-line no-non-null-asserted-optional-chain TODO: Fix - return pluginConfig?.config?.[key]!; + return pluginConfig?.config?.[key]; }, get() { return pluginConfig.config; From ee5fb04f59a749cf764ce9c2b1498856c6134412 Mon Sep 17 00:00:00 2001 From: Peter Andersson Date: Wed, 18 Mar 2026 14:10:55 -0700 Subject: [PATCH 3/4] add & fix format --- .github/workflows/semgrep.yml | 2 +- .oxfmtrc.json | 20 ++++++++++++++++++++ .oxlintrc.json | 4 ++-- .yarnrc.yml | 2 +- README.md | 31 +++++++++++++------------------ jest.config.ts | 1 + package.json | 2 +- src/client/initialize.ts | 2 +- src/react/Provider.tsx | 3 ++- src/react/hooks.ts | 5 +++-- src/types.ts | 27 +++++++++++---------------- tsconfig.json | 3 +-- 12 files changed, 57 insertions(+), 45 deletions(-) create mode 100644 .oxfmtrc.json diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml index 076a390..ca0ff26 100644 --- a/.github/workflows/semgrep.yml +++ b/.github/workflows/semgrep.yml @@ -5,7 +5,7 @@ on: jobs: semgrep: - name: Run Semgrep + name: Run Semgrep runs-on: ubuntu-latest timeout-minutes: 30 container: diff --git a/.oxfmtrc.json b/.oxfmtrc.json new file mode 100644 index 0000000..d6d9dc2 --- /dev/null +++ b/.oxfmtrc.json @@ -0,0 +1,20 @@ +{ + "$schema": "./node_modules/oxfmt/configuration_schema.json", + "arrowParens": "avoid", + "singleQuote": true, + "trailingComma": "all", + "printWidth": 80, + "sortPackageJson": false, + "sortImports": { + "ignoreCase": false, + "newlinesBetween": true, + "groups": [ + ["side_effect"], + ["builtin"], + ["external"], + ["parent"], + ["sibling"], + ["index"] + ] + } +} diff --git a/.oxlintrc.json b/.oxlintrc.json index b568a2b..7fbc6ee 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -1,3 +1,3 @@ { - "plugins": ["eslint", "import", "oxc", "react", "typescript"] -} \ No newline at end of file + "plugins": ["eslint", "import", "oxc", "react", "typescript"] +} diff --git a/.yarnrc.yml b/.yarnrc.yml index 456dd5c..6981882 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -1,3 +1,3 @@ nodeLinker: node-modules -npmMinimalAgeGate: 7d \ No newline at end of file +npmMinimalAgeGate: 7d diff --git a/README.md b/README.md index b420cf8..ff0dd47 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,6 @@ To test your plugin in Sigma Plugin Dev Playground, you must: To test a development version of a registered plugin, you must: - Have either: - - An Admin account type - A custom account type that supports plugin developer feature permissions @@ -106,7 +105,6 @@ and a React Hooks API. ``` 7. Start developing: - - Get started with Sigma’s Plugin APIs. - Test your plugin directly in a Sigma workbook using the Sigma Plugin Dev Playground. @@ -264,14 +262,14 @@ type CustomPluginConfigOptions = label?: string; } | { - type: 'action-effect'; - name: string; - label?: string; - } + type: 'action-effect'; + name: string; + label?: string; + } | { - type: 'url-parameter'; - name: string; - }; + type: 'url-parameter'; + name: string; + }; ``` @@ -814,9 +812,12 @@ console.log(urlParam?.value); client.config.setUrlParameter('myParamId', 'new-value'); // Subscribe to changes -const unsubscribe = client.config.subscribeToUrlParameter('myParamId', (urlParam) => { - console.log('URL parameter updated:', urlParam.value); -}); +const unsubscribe = client.config.subscribeToUrlParameter( + 'myParamId', + urlParam => { + console.log('URL parameter updated:', urlParam.value); + }, +); ``` #### useInteraction() @@ -904,33 +905,27 @@ Github. ### Available Plugins - **Recharts Bar Chart** - A basic bar chart built with the Recharts library. - - [Source Code](https://github.com/sigmacomputing/sigma-sample-plugins/tree/main/sample-plugin-bar-chart) - Production URL: https://sigma-sample-bar-chart-54049.netlify.app/ - **D3 Candlestick** - A candlestick visualization built with D3. - - [Source Code](https://github.com/sigmacomputing/sigma-sample-plugins/tree/main/sample-plugin-bar-chart) - Production URL: https://sigma-sample-candlestick-chart-1664e5.netlify.app/ - **Narrative Science Quill** - Demonstrates secure text entry. - - [Source Code]() - Production URL: https://narrativescience-quill-3ee312.netlify.app/ - **D3 Graph** - Demonstrates usage of multiple data sources and in-memory joins. - - [Source Code](https://github.com/sigmacomputing/sigma-sample-plugins/tree/main/d3-graph) - Production URL: https://d3-graph-3a0d0f.netlify.app/ - **D3 Sunburst** - A sunburst visualization built with D3. - - [Source Code](https://github.com/sigmacomputing/sigma-sample-plugins/tree/main/d3-sunburst) - Production URL: https://d3-sunburst-b97c7c.netlify.app/ - **Frappe Heatmap** - A basic Frappe visualization example. - - [Source Code](https://github.com/sigmacomputing/sigma-sample-plugins/tree/main/frappe-heatmap) - Production URL: https://frappe-heatmap-9a4163.netlify.app/ diff --git a/jest.config.ts b/jest.config.ts index 5d0c4b9..fdf728a 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -1,4 +1,5 @@ import path from 'path'; + import { Config } from '@jest/types'; const config: Config.InitialOptions = { diff --git a/package.json b/package.json index e986c86..7f85f8f 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "scripts": { "build": "yarn tsc --build tsconfig.build.json", "build:watch": "yarn build --watch", - "format": "prettier --write 'src/**/*.{ts,tsx}' 'jest.config.ts'", + "format": "yarn oxfmt", "lint": "yarn oxlint", "precommit": "lint-staged", "prepublish": "yarn build", diff --git a/src/client/initialize.ts b/src/client/initialize.ts index bafd8a8..42c492f 100644 --- a/src/client/initialize.ts +++ b/src/client/initialize.ts @@ -219,7 +219,7 @@ export function initialize(): PluginInstance { setUrlParameter(configId: string, value: string) { validateConfigId(configId, 'url-parameter'); void execPromise('wb:plugin:url-parameter:set', configId, value); - } + }, }, elements: { getElementColumns(configId) { diff --git a/src/react/Provider.tsx b/src/react/Provider.tsx index bf733ee..9a2a64d 100644 --- a/src/react/Provider.tsx +++ b/src/react/Provider.tsx @@ -1,8 +1,9 @@ import type { ReactNode } from 'react'; -import { PluginContext } from './Context'; import { PluginInstance } from '../types'; +import { PluginContext } from './Context'; + export interface SigmaClientProviderProps { client: PluginInstance; children?: ReactNode; diff --git a/src/react/hooks.ts b/src/react/hooks.ts index b5c259c..0f1c4c3 100644 --- a/src/react/hooks.ts +++ b/src/react/hooks.ts @@ -1,6 +1,5 @@ import { useContext, useEffect, useCallback, useRef, useState } from 'react'; -import { PluginContext } from './Context'; import { PluginInstance, CustomPluginConfigOptions, @@ -13,6 +12,8 @@ import { } from '../types'; import { deepEqual } from '../utils/deepEqual'; +import { PluginContext } from './Context'; + /** * Gets the entire plugin instance * @returns {PluginInstance} Context for the current plugin instance @@ -191,7 +192,7 @@ export function useVariable( * @returns {[(UrlParameter | undefined), Function]} Constantly updating value of the url parameter and setter for the url parameter */ export function useUrlParameter( - id: string + id: string, ): [UrlParameter | undefined, (value: string) => void] { const client = usePlugin(); const [urlParameter, setUrlParameter] = useState(); diff --git a/src/types.ts b/src/types.ts index 0f5ad3e..f6fecc6 100644 --- a/src/types.ts +++ b/src/types.ts @@ -105,8 +105,7 @@ export interface CustomPluginConfigOptionBase { export interface CustomPluginConfigGroup extends CustomPluginConfigOptionBase { type: 'group'; } -export interface CustomPluginConfigElement - extends CustomPluginConfigOptionBase { +export interface CustomPluginConfigElement extends CustomPluginConfigOptionBase { type: 'element'; } export interface CustomPluginConfigColumn extends CustomPluginConfigOptionBase { @@ -129,8 +128,7 @@ export interface CustomPluginConfigToggle extends CustomPluginConfigOptionBase { source?: string; defaultValue?: boolean; } -export interface CustomPluginConfigCheckbox - extends CustomPluginConfigOptionBase { +export interface CustomPluginConfigCheckbox extends CustomPluginConfigOptionBase { type: 'checkbox'; source?: string; defaultValue?: boolean; @@ -142,8 +140,7 @@ export interface CustomPluginConfigRadio extends CustomPluginConfigOptionBase { values: string[]; defaultValue?: string; } -export interface CustomPluginConfigDropdown - extends CustomPluginConfigOptionBase { +export interface CustomPluginConfigDropdown extends CustomPluginConfigOptionBase { type: 'dropdown'; source?: string; width?: string; @@ -154,25 +151,23 @@ export interface CustomPluginConfigColor extends CustomPluginConfigOptionBase { type: 'color'; source?: string; } -export interface CustomPluginConfigVariable - extends CustomPluginConfigOptionBase { +export interface CustomPluginConfigVariable extends CustomPluginConfigOptionBase { type: 'variable'; allowedTypes?: ControlType[]; } -export interface CustomPluginConfigInteraction - extends CustomPluginConfigOptionBase { +export interface CustomPluginConfigInteraction extends CustomPluginConfigOptionBase { type: 'interaction'; } -export interface CustomPluginConfigActionTrigger - extends CustomPluginConfigOptionBase { +export interface CustomPluginConfigActionTrigger extends CustomPluginConfigOptionBase { type: 'action-trigger'; } -export interface CustomPluginConfigActionEffect - extends CustomPluginConfigOptionBase { +export interface CustomPluginConfigActionEffect extends CustomPluginConfigOptionBase { type: 'action-effect'; } -export interface CustomPluginConfigUrlParameter - extends Omit { +export interface CustomPluginConfigUrlParameter extends Omit< + CustomPluginConfigOptionBase, + 'label' +> { type: 'url-parameter'; } diff --git a/tsconfig.json b/tsconfig.json index 9d04e37..7556bba 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,8 +19,7 @@ "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "skipLibCheck": true, - "resolveJsonModule": true, - + "resolveJsonModule": true }, "include": ["src", "jest.config.ts"] } From 5837bee89f314959395873afb65b4dc8ddb8a71a Mon Sep 17 00:00:00 2001 From: Peter Andersson Date: Wed, 18 Mar 2026 14:11:37 -0700 Subject: [PATCH 4/4] remove prettier --- package.json | 1 - yarn.lock | 10 ---------- 2 files changed, 11 deletions(-) diff --git a/package.json b/package.json index 7f85f8f..17f7d78 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,6 @@ "oxfmt": "^0.38.0", "oxlint": "^1.53.0", "oxlint-tsgolint": "^0.16.0", - "prettier": "^2.7.1", "ts-jest": "^27.1.4", "typescript": "^4.8.2" } diff --git a/yarn.lock b/yarn.lock index 7a31c0e..266b08d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1110,7 +1110,6 @@ __metadata: oxfmt: "npm:^0.38.0" oxlint: "npm:^1.53.0" oxlint-tsgolint: "npm:^0.16.0" - prettier: "npm:^2.7.1" ts-jest: "npm:^27.1.4" typescript: "npm:^4.8.2" peerDependencies: @@ -4173,15 +4172,6 @@ __metadata: languageName: node linkType: hard -"prettier@npm:^2.7.1": - version: 2.7.1 - resolution: "prettier@npm:2.7.1" - bin: - prettier: bin-prettier.js - checksum: 10c0/359d2b7ecf36bd52924a48331cae506d335f18637fde6c686212f952b9ce678ce9f554a80571049b36ec2897a8a6c40094b776dea371cc5c04c481cf5b78504b - languageName: node - linkType: hard - "pretty-format@npm:^27.0.0, pretty-format@npm:^27.5.1": version: 27.5.1 resolution: "pretty-format@npm:27.5.1"