From b3aa44f34283c98890fbd6d435f11de0f8bd1632 Mon Sep 17 00:00:00 2001 From: soup Date: Mon, 11 Nov 2024 10:35:48 +0100 Subject: [PATCH] fix(makefile): use proper typecheck (#19) --- Makefile | 2 +- web/eslint.config.js | 47 ++++++++++++++++++++++++++++-------------- web/tsconfig.node.json | 3 +-- 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index a350e1b..6ba61c5 100644 --- a/Makefile +++ b/Makefile @@ -61,7 +61,7 @@ lint: # Type check frontend code type-check: @echo "Type checking frontend code..." - cd web && $(PNPM) run tsc -b + cd web && $(PNPM) run build --mode=typecheck # Preview frontend build preview: diff --git a/web/eslint.config.js b/web/eslint.config.js index 092408a..0015052 100644 --- a/web/eslint.config.js +++ b/web/eslint.config.js @@ -1,28 +1,45 @@ -import js from '@eslint/js' -import globals from 'globals' -import reactHooks from 'eslint-plugin-react-hooks' -import reactRefresh from 'eslint-plugin-react-refresh' -import tseslint from 'typescript-eslint' +import js from "@eslint/js"; +import globals from "globals"; +import reactHooks from "eslint-plugin-react-hooks"; +import reactRefresh from "eslint-plugin-react-refresh"; +import * as tseslint from "typescript-eslint"; export default tseslint.config( - { ignores: ['dist'] }, + { ignores: ["dist", "dev-dist"] }, + js.configs.recommended, + ...tseslint.configs.recommended, { - extends: [js.configs.recommended, ...tseslint.configs.recommended], - files: ['**/*.{ts,tsx}'], + files: ["scripts/**/*.js"], + languageOptions: { + globals: { + ...globals.node, + process: true, + console: true, + }, + }, + }, + { + files: ["**/*.{ts,tsx}"], languageOptions: { ecmaVersion: 2020, - globals: globals.browser, + globals: { + ...globals.browser, + }, + parser: tseslint.parser, + parserOptions: { + project: ["./tsconfig.app.json", "./tsconfig.node.json"], + }, }, plugins: { - 'react-hooks': reactHooks, - 'react-refresh': reactRefresh, + "react-hooks": reactHooks, + "react-refresh": reactRefresh, }, rules: { ...reactHooks.configs.recommended.rules, - 'react-refresh/only-export-components': [ - 'warn', + "react-refresh/only-export-components": [ + "warn", { allowConstantExport: true }, ], }, - }, -) + } +); diff --git a/web/tsconfig.node.json b/web/tsconfig.node.json index 42ad60d..42ea64a 100644 --- a/web/tsconfig.node.json +++ b/web/tsconfig.node.json @@ -16,8 +16,7 @@ "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true, - "noUncheckedSideEffectImports": true + "noFallthroughCasesInSwitch": true }, "include": ["./vite.config.ts"] }