From f175aef07843aa5c7d53d6c6cb30960faff3c8bd Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Fri, 25 Mar 2022 09:30:02 +0000 Subject: [PATCH] Add typechecking (#7221) GitOrigin-RevId: 5b5bc5d2f9e5361e868cc6c9560f28a872d90ae1 --- services/web/Makefile | 4 ++++ services/web/frontend/js/shared/components/icon.js | 9 --------- services/web/package.json | 1 + services/web/tsconfig.json | 2 +- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/services/web/Makefile b/services/web/Makefile index d22ae7d901..f80860fadd 100644 --- a/services/web/Makefile +++ b/services/web/Makefile @@ -427,6 +427,10 @@ lint: lint_flag_res_send_usage lint_flag_res_send_usage: bin/lint_flag_res_send_usage +lint: typecheck_frontend +typecheck_frontend: + npx tsc --noEmit + lint_in_docker: $(RUN_LINT_FORMAT) make lint -j --output-sync diff --git a/services/web/frontend/js/shared/components/icon.js b/services/web/frontend/js/shared/components/icon.js index 303ac0a320..353e1fa3d2 100644 --- a/services/web/frontend/js/shared/components/icon.js +++ b/services/web/frontend/js/shared/components/icon.js @@ -1,15 +1,6 @@ import PropTypes from 'prop-types' import classNames from 'classnames' -/** - * @param {string} type - * @param {boolean} [spin] - * @param {boolean} [fw] - * @param {string} [modifier] - * @param {string} [className] - * @param {string} [accessibilityLabel] - * @return {JSX.Element} - */ function Icon({ type, spin, diff --git a/services/web/package.json b/services/web/package.json index fc023dde65..1aa64555cb 100644 --- a/services/web/package.json +++ b/services/web/package.json @@ -28,6 +28,7 @@ "format:styles:fix": "prettier --write $PWD/'**/*.less'", "lint": "eslint --max-warnings 0 --format unix .", "lint:fix": "eslint --fix .", + "type-check": "tsc --noEmit", "extract-translations": "i18next-scanner", "migrations": "east", "storybook": "start-storybook -p 6006", diff --git a/services/web/tsconfig.json b/services/web/tsconfig.json index 623eeb123e..00ee0f3903 100644 --- a/services/web/tsconfig.json +++ b/services/web/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "target": "esnext" /* Specify ECMAScript target version */, - "module": "esnext" /* Specify module code generation */, + "module": "commonjs" /* Specify module code generation */, "allowJs": true /* Allow JavaScript files to be compiled. */, // "checkJs": true /* Report errors in .js files. */, "jsx": "preserve" /* Specify JSX code generation */,