diff --git a/services/web/.eslintrc.js b/services/web/.eslintrc.js index 8faf58d9da..45c87b3c11 100644 --- a/services/web/.eslintrc.js +++ b/services/web/.eslintrc.js @@ -33,6 +33,12 @@ module.exports = { '@typescript-eslint/no-this-alias': 'off', '@typescript-eslint/no-non-null-assertion': 'off', '@typescript-eslint/ban-ts-comment': 'off', + + 'no-use-before-define': 'off', + '@typescript-eslint/no-use-before-define': [ + 'error', + { functions: false, classes: false, variables: false }, + ], }, overrides: [ // NOTE: changing paths may require updating them in the Makefile too. diff --git a/services/web/Makefile b/services/web/Makefile index 390e2faea8..001c2191ec 100644 --- a/services/web/Makefile +++ b/services/web/Makefile @@ -429,11 +429,11 @@ lint_overleafModuleImports: lint: typecheck_frontend typecheck_frontend: - npx -p typescript tsc --noEmit + npm run --silent type-check lint: typecheck_backend typecheck_backend: - npx -p typescript tsc -p tsconfig.backend.json --noEmit + npm run --silent type-check:backend lint_in_docker: $(RUN_LINT_FORMAT) make lint -j2 --output-sync diff --git a/services/web/frontend/js/features/ide-react/connection/editor-watchdog-manager.ts b/services/web/frontend/js/features/ide-react/connection/editor-watchdog-manager.ts index f87473aebc..22911201b4 100644 --- a/services/web/frontend/js/features/ide-react/connection/editor-watchdog-manager.ts +++ b/services/web/frontend/js/features/ide-react/connection/editor-watchdog-manager.ts @@ -148,7 +148,6 @@ class Reporter { export default class EditorWatchdogManager { lastAck: number | null = null reporter: Reporter - // eslint-disable-next-line no-use-before-define parent?: EditorWatchdogManager scope: Scope timeout: number diff --git a/services/web/frontend/js/features/source-editor/context/review-panel/types/review-panel-state.ts b/services/web/frontend/js/features/source-editor/context/review-panel/types/review-panel-state.ts index b64b3f79a6..4aae7e0986 100644 --- a/services/web/frontend/js/features/source-editor/context/review-panel/types/review-panel-state.ts +++ b/services/web/frontend/js/features/source-editor/context/review-panel/types/review-panel-state.ts @@ -12,7 +12,6 @@ import { DocId } from '../../../../../../../types/project-settings' import { dispatchReviewPanelLayout } from '../../../extensions/changes/change-manager' import { UserId } from '../../../../../../../types/user' -/* eslint-disable no-use-before-define */ export interface ReviewPanelState { values: { collapsed: Record @@ -97,8 +96,6 @@ export interface ReviewPanelState { } } -/* eslint-enable no-use-before-define */ - // Getter for values export type Value = ReviewPanelState['values'][T] diff --git a/services/web/package.json b/services/web/package.json index ea8b3941fa..7b74fa7d7a 100644 --- a/services/web/package.json +++ b/services/web/package.json @@ -29,6 +29,7 @@ "lint:styles": "stylelint '**/*.scss'", "lint:styles:fix": "stylelint '**/*.scss' --fix", "type-check": "tsc --noEmit", + "type-check:backend": "tsc -p tsconfig.backend.json --noEmit", "extract-translations": "i18next-scanner", "migrations": "MONGO_SOCKET_TIMEOUT=0 east", "convert-themes": "node frontend/js/features/source-editor/themes/scripts/convert.js", diff --git a/services/web/types/utils.ts b/services/web/types/utils.ts index 52c505dbac..0b1994f9db 100644 --- a/services/web/types/utils.ts +++ b/services/web/types/utils.ts @@ -1,10 +1,10 @@ export type Nullable = T | null -// eslint-disable-next-line no-use-before-define, @typescript-eslint/no-empty-interface +// eslint-disable-next-line @typescript-eslint/no-empty-interface interface DeepReadonlyArray extends ReadonlyArray> {} type DeepReadonlyObject = { - readonly [P in keyof T]: DeepReadonly // eslint-disable-line no-use-before-define + readonly [P in keyof T]: DeepReadonly } export type DeepReadonly = T extends (infer R)[]