From e01fb1fbe9b89ead305a0b80a76c5f216b248347 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Wed, 23 Nov 2022 17:07:22 -0600 Subject: [PATCH] eslint: strict equality Enforce use of ===/!== and fix existing issues. --- .eslintrc.js | 1 + src/app/App.tsx | 2 +- src/editor/sagas.ts | 4 ++-- src/explorer/sagas.ts | 2 +- src/serviceWorkerRegistration.ts | 4 ++-- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 5adfed40..3f5ea2f3 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -17,6 +17,7 @@ module.exports = { plugins: ['react'], rules: { curly: 'error', + eqeqeq: 'error', 'no-multi-spaces': 'error', 'no-trailing-spaces': 'error', 'no-multiple-empty-lines': 'error', diff --git a/src/app/App.tsx b/src/app/App.tsx index ac64ab44..967ad324 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -128,7 +128,7 @@ const Docs: React.VFC = () => { ? e.metaKey && !e.ctrlKey : e.ctrlKey && !e.metaKey) && !e.altKey && - e.key == 'd' + e.key === 'd' ) { e.preventDefault(); // since the iframe is only visible when docs are shown diff --git a/src/editor/sagas.ts b/src/editor/sagas.ts index c5ec31a1..422f21b2 100644 --- a/src/editor/sagas.ts +++ b/src/editor/sagas.ts @@ -205,9 +205,9 @@ function* handleEditorActivateFile( yield* put(editorOpenFile(action.uuid)); const { didFailToOpen } = yield* race({ - didOpen: take(editorDidOpenFile.when((a) => a.uuid == action.uuid)), + didOpen: take(editorDidOpenFile.when((a) => a.uuid === action.uuid)), didFailToOpen: take( - editorDidFailToOpenFile.when((a) => a.uuid == action.uuid), + editorDidFailToOpenFile.when((a) => a.uuid === action.uuid), ), }); diff --git a/src/explorer/sagas.ts b/src/explorer/sagas.ts index b083a00b..5d272c6e 100644 --- a/src/explorer/sagas.ts +++ b/src/explorer/sagas.ts @@ -177,7 +177,7 @@ function* handleExplorerImportFiles(): Generator { const result = validateFileName(baseName, pythonFileExtension, []); - if (result != FileNameValidationResult.IsOk) { + if (result !== FileNameValidationResult.IsOk) { yield* put(renameImportDialogShow(file.name)); const { accepted, cancelled } = yield* race({ diff --git a/src/serviceWorkerRegistration.ts b/src/serviceWorkerRegistration.ts index c377b777..7ab545a3 100644 --- a/src/serviceWorkerRegistration.ts +++ b/src/serviceWorkerRegistration.ts @@ -74,7 +74,7 @@ function registerValidSW(swUrl: string, config?: Config): void { registration.onupdatefound = () => { const installingWorker = registration.installing; - if (installingWorker == null) { + if (installingWorker === null) { return; } installingWorker.onstatechange = () => { @@ -122,7 +122,7 @@ function checkValidServiceWorker(swUrl: string, config?: Config): void { const contentType = response.headers.get('content-type'); if ( response.status === 404 || - (contentType != null && contentType.indexOf('javascript') === -1) + (contentType !== null && contentType.indexOf('javascript') === -1) ) { // No service worker found. Probably a different app. Reload the page. navigator.serviceWorker.ready.then((registration) => {