build: type-check worker with isolated globals
This commit is contained in:
@@ -27,6 +27,7 @@ export default tseslint.config(
|
|||||||
})),
|
})),
|
||||||
{
|
{
|
||||||
files: ["src/**/*.ts", "tests/**/*.ts"],
|
files: ["src/**/*.ts", "tests/**/*.ts"],
|
||||||
|
ignores: ["src/decode-history-worker.ts"],
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
globals: globals.browser,
|
globals: globals.browser,
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
@@ -40,4 +41,19 @@ export default tseslint.config(
|
|||||||
"@typescript-eslint/restrict-template-expressions": ["error", { allowNumber: true }],
|
"@typescript-eslint/restrict-template-expressions": ["error", { allowNumber: true }],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
files: ["src/decode-history-worker.ts"],
|
||||||
|
languageOptions: {
|
||||||
|
globals: globals.worker,
|
||||||
|
parserOptions: {
|
||||||
|
project: "./tsconfig.worker.json",
|
||||||
|
tsconfigRootDir: import.meta.dirname,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
"no-undef": "off",
|
||||||
|
"@typescript-eslint/no-explicit-any": "error",
|
||||||
|
"@typescript-eslint/restrict-template-expressions": ["error", { allowNumber: true }],
|
||||||
|
},
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node build.mjs",
|
"build": "node build.mjs",
|
||||||
"generate-types": "cargo run -p trx-frontend-http --example generate_typescript",
|
"generate-types": "cargo run -p trx-frontend-http --example generate_typescript",
|
||||||
"typecheck": "tsc --project tsconfig.json",
|
"typecheck": "tsc --project tsconfig.json && tsc --project tsconfig.worker.json",
|
||||||
"lint": "eslint \"src/**/*.ts\" \"tests/**/*.mjs\" build.mjs --no-error-on-unmatched-pattern",
|
"lint": "eslint \"src/**/*.ts\" \"tests/**/*.mjs\" build.mjs --no-error-on-unmatched-pattern",
|
||||||
"test": "node --test tests/*.test.mjs",
|
"test": "node --test tests/*.test.mjs",
|
||||||
"verify-generated": "npm run generate-types && npm run build && git diff --exit-code -- ../assets/web/generated src/api/generated.ts"
|
"verify-generated": "npm run generate-types && npm run build && git diff --exit-code -- ../assets/web/generated src/api/generated.ts"
|
||||||
|
|||||||
@@ -13,5 +13,6 @@
|
|||||||
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
||||||
"types": []
|
"types": []
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts", "src/**/*.js"]
|
"include": ["src/**/*.ts", "src/**/*.js"],
|
||||||
|
"exclude": ["src/decode-history-worker.ts"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "Bundler",
|
||||||
|
"strict": true,
|
||||||
|
"noUncheckedIndexedAccess": true,
|
||||||
|
"exactOptionalPropertyTypes": true,
|
||||||
|
"useUnknownInCatchVariables": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"lib": ["ES2022", "WebWorker"],
|
||||||
|
"types": []
|
||||||
|
},
|
||||||
|
"include": ["src/decode-history-worker.ts"]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user