Przeglądaj źródła

Add typechecking (#7221)

GitOrigin-RevId: 5b5bc5d2f9e5361e868cc6c9560f28a872d90ae1
Alf Eaton 4 lat temu
rodzic
commit
f175aef078

+ 4 - 0
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
 

+ 0 - 9
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,

+ 1 - 0
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",

+ 1 - 1
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 */,