From 5b56f09e2769bd83135581535a5351f6e9820974 Mon Sep 17 00:00:00 2001 From: regexowl Date: Wed, 19 Jun 2024 10:40:17 +0200 Subject: [PATCH] ESLint: Merge .js and .ts configs to one file Since our code base is now mostly TypeScript, we can merge the configs and have a unified one. `@typescript-eslint/no-var-requires` was temporarily disabled in webpack configs. These files will be replaced by fec.config.ts in the foreseeable future together with their ESLint override. --- .eslintrc-typescript.yml | 13 ------------- .eslintrc.yml | 16 +++++++++++----- config/dev.webpack.config.js | 1 + config/devel.webpack.config.js | 1 + config/prod.webpack.config.js | 1 + 5 files changed, 14 insertions(+), 18 deletions(-) delete mode 100644 .eslintrc-typescript.yml diff --git a/.eslintrc-typescript.yml b/.eslintrc-typescript.yml deleted file mode 100644 index aaf8c311..00000000 --- a/.eslintrc-typescript.yml +++ /dev/null @@ -1,13 +0,0 @@ -extends: [ - "plugin:@typescript-eslint/recommended", - ] - -rules: - "@typescript-eslint/ban-ts-comment": - - error - - ts-expect-error: "allow-with-description" - ts-ignore: "allow-with-description" - ts-nocheck: true - ts-check: true - minimumDescriptionLength: 5 - "@typescript-eslint/ban-types": off diff --git a/.eslintrc.yml b/.eslintrc.yml index 8285c695..0896d7c1 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -4,6 +4,7 @@ extends: [ "plugin:react/recommended", "plugin:react-hooks/recommended", "plugin:testing-library/react", + "plugin:@typescript-eslint/recommended", "plugin:react-redux/recommended" ] globals: @@ -11,6 +12,7 @@ globals: shallow: readonly render: 'readonly' mount: 'readonly' +parser: "@typescript-eslint/parser" plugins: - import rules: @@ -36,13 +38,17 @@ rules: prefer-const: - error - destructuring: any - no-console: 1 + no-console: error eqeqeq: error array-callback-return: warn + "@typescript-eslint/ban-ts-comment": + - error + - ts-expect-error: "allow-with-description" + ts-ignore: "allow-with-description" + ts-nocheck: true + ts-check: true + minimumDescriptionLength: 5 + "@typescript-eslint/ban-types": off # Temporarily disabled jsx-a11y/no-autofocus: off rulesdir/forbid-pf-relative-imports: off -overrides: - - files: "**/*.ts?(x)" - parser: "@typescript-eslint/parser" - extends: ".eslintrc-typescript.yml" diff --git a/config/dev.webpack.config.js b/config/dev.webpack.config.js index 5d6e708f..96cabd45 100644 --- a/config/dev.webpack.config.js +++ b/config/dev.webpack.config.js @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-var-requires */ const { resolve } = require('path'); const config = require('@redhat-cloud-services/frontend-components-config'); diff --git a/config/devel.webpack.config.js b/config/devel.webpack.config.js index 522be4c1..0aa1ce5e 100644 --- a/config/devel.webpack.config.js +++ b/config/devel.webpack.config.js @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-var-requires */ const { resolve } = require('path'); const config = require('@redhat-cloud-services/frontend-components-config'); diff --git a/config/prod.webpack.config.js b/config/prod.webpack.config.js index 054970c5..28e6c569 100644 --- a/config/prod.webpack.config.js +++ b/config/prod.webpack.config.js @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-var-requires */ const { resolve } = require('path'); const config = require('@redhat-cloud-services/frontend-components-config');