-
Notifications
You must be signed in to change notification settings - Fork 924
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This moves our JS file to use TS instead, which allows us to use a proper linter to check the code. All related files where moved out from the root in a dedicated folder to avoid polluting the Rust environment.
- Loading branch information
Showing
13 changed files
with
120 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: 2 | ||
|
||
updates: | ||
- package-ecosystem: npm | ||
directory: src/platform_impl/web/script | ||
schedule: | ||
interval: daily | ||
groups: | ||
github-actions: | ||
patterns: | ||
- '*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import eslint from '@eslint/js' | ||
import tseslint from 'typescript-eslint' | ||
import globals from 'globals' | ||
|
||
export default tseslint.config( | ||
{ | ||
ignores: ['**/*.min.js', 'eslint.config.mjs'], | ||
}, | ||
eslint.configs.recommended, | ||
...tseslint.configs.strictTypeChecked, | ||
...tseslint.configs.stylisticTypeChecked, | ||
{ | ||
languageOptions: { | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
project: ['tsconfig.json'], | ||
sourceType: 'module', | ||
}, | ||
globals: { | ||
...globals.browser, | ||
}, | ||
}, | ||
rules: { | ||
'@typescript-eslint/no-confusing-void-expression': [ | ||
'error', | ||
{ | ||
ignoreArrowShorthand: true, | ||
}, | ||
], | ||
}, | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"devDependencies": { | ||
"@eslint/js": "^9", | ||
"@types/eslint__js": "^8", | ||
"eslint": "^8", | ||
"typescript": "^5", | ||
"typescript-eslint": "^7" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
declare global { | ||
// eslint-disable-next-line no-var | ||
var scheduler: Scheduler | ||
} | ||
|
||
export interface Scheduler { | ||
postTask<T>(callback: () => T | PromiseLike<T>, options?: SchedulerPostTaskOptions): Promise<T> | ||
} | ||
|
||
export interface SchedulerPostTaskOptions { | ||
delay?: number | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ESNext", | ||
"allowUnreachableCode": false, | ||
"allowUnusedLabels": false, | ||
"exactOptionalPropertyTypes": true, | ||
"noImplicitOverride": true, | ||
"noPropertyAccessFromIndexSignature": true, | ||
"noUncheckedIndexedAccess": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"strict": true, | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
onmessage = (event) => { | ||
const [port, timeout] = event.data as [MessagePort, number] | ||
const f = () => port.postMessage(undefined) | ||
|
||
if ('scheduler' in globalThis) { | ||
void globalThis.scheduler.postTask(f, { delay: timeout }) | ||
} else { | ||
setTimeout(f, timeout) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.