From 055cb7bf95eabc8dd950c147cfe91221930810fb Mon Sep 17 00:00:00 2001 From: Florian Loitsch Date: Sat, 14 Feb 2026 15:02:38 +0100 Subject: [PATCH] Fix eslint (after update). --- .eslintignore | 5 ---- .eslintrc.yaml | 50 ---------------------------------- eslint.config.js | 70 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 55 deletions(-) delete mode 100644 .eslintignore delete mode 100644 .eslintrc.yaml create mode 100644 eslint.config.js diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index c4f168ae..00000000 --- a/.eslintignore +++ /dev/null @@ -1,5 +0,0 @@ -/node_modules/ -/public/ -/assets/ -/.cache/ -/coverage/ \ No newline at end of file diff --git a/.eslintrc.yaml b/.eslintrc.yaml deleted file mode 100644 index 731587fe..00000000 --- a/.eslintrc.yaml +++ /dev/null @@ -1,50 +0,0 @@ - -parser: "@typescript-eslint/parser" # Specifies the ESLint parser -parserOptions: - ecmaVersion: 6 # Allows for the parsing of modern ECMAScript features - sourceType: module # Allows for the use of imports - ecmaFeatures: - jsx: true # Allows for the parsing of JSX - -# TypeScript specific config here. -overrides: - - files: [ "*.ts", "*.tsx" ] - parserOptions: - project: "./tsconfig.json" - extends: - # Uses the recommended rules from the @typescript-eslint/eslint-plugin - - plugin:@typescript-eslint/recommended - - plugin:@typescript-eslint/recommended-requiring-type-checking - - rules: - # This fails for generics with FunctionalComponent, and is not necessary - # because other TS rules cover it anyway. - react/prop-types: "off" - - "no-unused-vars": "off" # required for the typescript lint - # I decided to leave `args` at the deafult `after-used` but it might make - # sense to set this to `none`. - # https://eslint.org/docs/rules/no-unused-vars#args - "@typescript-eslint/no-unused-vars": ["warn", { "vars": "local", "args": "after-used" }] - - "@typescript-eslint/no-empty-function": "off" - "@typescript-eslint/no-var-requires": "off" - - -settings: - react: - version: detect - -extends: - # Uses the recommended rules from @eslint-plugin-react - - plugin:react/recommended - - prettier - # Enables eslint-plugin-prettier and eslint-config-prettier. This will display - # prettier errors as ESLint errors. Make sure this is always the last - # configuration in the extends array. - - plugin:prettier/recommended - - plugin:react-hooks/recommended - -# Override rules for all files here. -rules: {} - diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..ca1a5339 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,70 @@ +import js from "@eslint/js"; +import typescript from "typescript-eslint"; +import react from "eslint-plugin-react"; +import reactHooks from "eslint-plugin-react-hooks"; +import prettier from "eslint-config-prettier"; +import prettierPlugin from "eslint-plugin-prettier"; + +export default [ + { + ignores: ["node_modules/", "public/", "assets/", ".cache/", "coverage/"], + }, + { + files: ["**/*.{js,jsx,ts,tsx}"], + languageOptions: { + ecmaVersion: 2020, + sourceType: "module", + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, + }, + settings: { + react: { + version: "detect", + }, + }, + }, + { + files: ["**/*.{js,jsx}"], + rules: { + ...js.configs.recommended.rules, + }, + }, + { + files: ["**/*.{ts,tsx}"], + languageOptions: { + parser: typescript.parser, + parserOptions: { + project: "./tsconfig.json", + }, + }, + plugins: { + "@typescript-eslint": typescript.plugin, + }, + rules: { + ...typescript.configs.recommended.rules, + ...typescript.configs["recommended-requiring-type-checking"].rules, + "no-unused-vars": "off", + "@typescript-eslint/no-unused-vars": ["warn", { vars: "local", args: "after-used" }], + "@typescript-eslint/no-empty-function": "off", + "@typescript-eslint/no-var-requires": "off", + }, + }, + { + files: ["**/*.{js,jsx,ts,tsx}"], + plugins: { + react, + "react-hooks": reactHooks, + prettier: prettierPlugin, + }, + rules: { + ...react.configs.recommended.rules, + ...reactHooks.configs.recommended.rules, + ...prettierPlugin.configs.recommended.rules, + "react/prop-types": "off", + }, + }, + prettier, +];