Skip to content

Commit

Permalink
[js/web] fix lint error when run without ort-web TS types (#10429)
Browse files Browse the repository at this point in the history
* [js/web] fix lint error when run without ort-web TS types

* update CI to run linter before 'npm ci' in /js/web
  • Loading branch information
fs-eire authored Feb 18, 2022
1 parent 1af4c17 commit 893ee65
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion js/web/lib/wasm/proxy-worker/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {initializeWebAssembly} from '../wasm-factory';
self.onmessage = (ev: MessageEvent<OrtWasmMessage>): void => {
switch (ev.data.type) {
case 'init-wasm':
initializeWebAssembly(ev.data.in!)
initializeWebAssembly(ev.data.in)
.then(
() => postMessage({type: 'init-wasm'} as OrtWasmMessage),
err => postMessage({type: 'init-wasm', err} as OrtWasmMessage));
Expand Down
4 changes: 2 additions & 2 deletions js/web/script/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ if (WASM) {
}

fs.writeFileSync(WASM_BINDING_THREADED_MIN_JS_PATH, terser.stdout);
fs.writeFileSync(WASM_THREADED_JS_PATH, COPYRIGHT_BANNER + terser.stdout);
fs.writeFileSync(WASM_THREADED_JS_PATH, `${COPYRIGHT_BANNER}${terser.stdout}`);

validateFile(WASM_BINDING_THREADED_MIN_JS_PATH);
validateFile(WASM_THREADED_JS_PATH);
Expand All @@ -124,7 +124,7 @@ if (WASM) {
}

fs.writeFileSync(WASM_BINDING_THREADED_MIN_WORKER_JS_PATH, terser.stdout);
fs.writeFileSync(WASM_THREADED_WORKER_JS_PATH, COPYRIGHT_BANNER + terser.stdout);
fs.writeFileSync(WASM_THREADED_WORKER_JS_PATH, `${COPYRIGHT_BANNER}${terser.stdout}`);

validateFile(WASM_BINDING_THREADED_MIN_WORKER_JS_PATH);
validateFile(WASM_THREADED_WORKER_JS_PATH);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ jobs:
npm ci
workingDirectory: '$(Build.SourcesDirectory)\js'
displayName: 'npm ci /js/'
- script: |
npm run lint
workingDirectory: '$(Build.SourcesDirectory)\js'
displayName: 'run ESLint without TS type populated'
- script: |
npm ci
workingDirectory: '$(Build.SourcesDirectory)\js\common'
Expand All @@ -83,7 +87,7 @@ jobs:
- script: |
npm run lint
workingDirectory: '$(Build.SourcesDirectory)\js'
displayName: 'ESLint'
displayName: 'run ESLint'
- script: |
npm run format
workingDirectory: '$(Build.SourcesDirectory)\js'
Expand Down

0 comments on commit 893ee65

Please sign in to comment.