From ddaa2bda971f479992f48f642cc5eadbc8d0bb40 Mon Sep 17 00:00:00 2001 From: Ira Hopkinson Date: Thu, 29 Aug 2024 14:04:59 +1200 Subject: [PATCH] add type checking - use `noImplicitReturns` instead of `consistent-return` --- .eslintrc.js | 2 ++ package-lock.json | 22 ++++++++++++++++++++-- package.json | 3 ++- src/main.ts | 1 + tsconfig.json | 8 ++++---- 5 files changed, 29 insertions(+), 7 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 279bb37..c1de14e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -16,6 +16,8 @@ module.exports = { // #region ERB rules + // Use `noImplicitReturns` instead. See https://typescript-eslint.io/rules/consistent-return/. + 'consistent-return': 'off', 'import/extensions': 'off', // A temporary hack related to IDE not resolving correct package.json 'import/no-extraneous-dependencies': 'off', diff --git a/package-lock.json b/package-lock.json index f3ed63f..108526a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -563,13 +563,22 @@ "@emotion/react": ">=11.11.4", "@emotion/styled": ">=11.11.0", "@mui/material": ">=5.15.10", + "@radix-ui/react-checkbox": "^1.0.4", + "@radix-ui/react-dialog": "^1.1.1", "@radix-ui/react-dropdown-menu": "^2.0.6", "@radix-ui/react-label": "^2.0.2", + "@radix-ui/react-popover": "^1.1.1", + "@radix-ui/react-select": "^2.0.0", + "@radix-ui/react-separator": "^1.1.0", + "@radix-ui/react-slider": "^1.2.0", "@radix-ui/react-slot": "^1.0.2", + "@radix-ui/react-switch": "^1.1.0", "@radix-ui/react-tabs": "^1.0.4", + "@tanstack/react-table": "^8.19.2", "autoprefixer": "^10.4.19", "class-variance-authority": "^0.7.0", "clsx": "^2.1.0", + "cmdk": "^1.0.0", "lucide-react": "^0.367.0", "platform-bible-utils": "file:../platform-bible-utils", "react-data-grid": ">=7.0.0-beta.34", @@ -599,7 +608,7 @@ "jest-environment-jsdom": "^29.7.0", "prettier": "^3.2.5", "prettier-plugin-jsdoc": "^1.3.0", - "prettier-plugin-tailwindcss": "^0.5.14", + "prettier-plugin-tailwindcss": "^0.6.1", "stylelint": "^16.3.1", "stylelint-config-recommended": "^14.0.0", "stylelint-config-sass-guidelines": "^11.0.0", @@ -21939,11 +21948,19 @@ "@emotion/styled": ">=11.11.0", "@mui/icons-material": "^5.15.10", "@mui/material": ">=5.15.10", + "@radix-ui/react-checkbox": "^1.0.4", + "@radix-ui/react-dialog": "^1.1.1", "@radix-ui/react-dropdown-menu": "^2.0.6", "@radix-ui/react-label": "^2.0.2", + "@radix-ui/react-popover": "^1.1.1", + "@radix-ui/react-select": "^2.0.0", + "@radix-ui/react-separator": "^1.1.0", + "@radix-ui/react-slider": "^1.2.0", "@radix-ui/react-slot": "^1.0.2", + "@radix-ui/react-switch": "^1.1.0", "@radix-ui/react-tabs": "^1.0.4", "@senojs/rollup-plugin-style-inject": "^0.2.3", + "@tanstack/react-table": "^8.19.2", "@testing-library/jest-dom": "^6.4.2", "@testing-library/react": "^14.2.2", "@testing-library/user-event": "^14.5.2", @@ -21956,6 +21973,7 @@ "autoprefixer": "^10.4.19", "class-variance-authority": "^0.7.0", "clsx": "^2.1.0", + "cmdk": "^1.0.0", "dts-bundle-generator": "^9.3.1", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", @@ -21966,7 +21984,7 @@ "platform-bible-utils": "file:../platform-bible-utils", "prettier": "^3.2.5", "prettier-plugin-jsdoc": "^1.3.0", - "prettier-plugin-tailwindcss": "^0.5.14", + "prettier-plugin-tailwindcss": "^0.6.1", "react-data-grid": ">=7.0.0-beta.34", "stylelint": "^16.3.1", "stylelint-config-recommended": "^14.0.0", diff --git a/package.json b/package.json index 4ed1749..71e0921 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,8 @@ "lint:scripts": "eslint --ext .cjs,.js,.jsx,.ts,.tsx --cache .", "lint:styles": "stylelint **/*.{css,scss}", "lint-fix": "npm run lint-fix:scripts && npm run lint:styles -- --fix", - "lint-fix:scripts": "prettier --write \"**/*.{ts,tsx,js,jsx,cjs}\" && npm run lint:scripts" + "lint-fix:scripts": "prettier --write \"**/*.{ts,tsx,js,jsx,cjs}\" && npm run lint:scripts", + "typecheck": "tsc -p ./tsconfig.json" }, "browserslist": [], "peerDependencies": { diff --git a/src/main.ts b/src/main.ts index 08b5a55..1df9db1 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,3 +1,4 @@ +// @ts-ignore: TS2307 - Cannot find module '@papi/backend' or its corresponding type declarations import { logger } from '@papi/backend'; export async function activate() { diff --git a/tsconfig.json b/tsconfig.json index e34d04d..f12808b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -25,12 +25,12 @@ // Include default type declarations "node_modules/@types", // Include papi-dts type declarations (for papi.d.ts) - "../paranext-core/lib", + // "../paranext-core/lib", // Include core extensions' type declarations - "../paranext-core/extensions/src", + // "../paranext-core/extensions/src", // Include this extension's type declarations. It's in this location so there aren't any // unexpected files there for typeRoots to include - "src/types", + "src/types" /** * Add extension repos' `src/types` folders here if you want to use local development type @@ -48,7 +48,7 @@ // Include cached extension type declarations in case this extension needs to depend on them // These are last, so any modules in the above typeRoots take precedence. - "../paranext-core/dev-appdata/cache/extension-types" + // "../paranext-core/dev-appdata/cache/extension-types" ], // Papi exposes decorators for use in classes "experimentalDecorators": true,