From 3ca2719b8f1fecde9d84fce0b638235becd0a508 Mon Sep 17 00:00:00 2001 From: Abdeldjalil Fortas <9090674+Fcmam5@users.noreply.github.com> Date: Thu, 23 Jan 2025 02:14:13 +0100 Subject: [PATCH] fix eslint after upgrade FWIW --- .../.eslintrc.js | 25 -------- .../eslint.config.mjs | 46 ++++++++++++++ .../package.json | 4 ++ .../pnpm-lock.yaml | 58 ++++++++++------- .../src/app/controllers/dragons.controller.ts | 4 +- .../.eslintrc.js | 25 -------- .../eslint.config.mjs | 46 ++++++++++++++ .../package.json | 4 ++ .../pnpm-lock.yaml | 62 +++++++++++-------- libs/nest-problem-details-filter/.eslintrc.js | 25 -------- .../eslint.config.mjs | 46 ++++++++++++++ libs/nest-problem-details-filter/package.json | 10 ++- .../src/filters/http-exception.filter.ts | 1 - 13 files changed, 227 insertions(+), 129 deletions(-) delete mode 100644 examples/express-example-with-default-settings/.eslintrc.js create mode 100644 examples/express-example-with-default-settings/eslint.config.mjs delete mode 100644 examples/fastify-example-with-default-settings/.eslintrc.js create mode 100644 examples/fastify-example-with-default-settings/eslint.config.mjs delete mode 100644 libs/nest-problem-details-filter/.eslintrc.js create mode 100644 libs/nest-problem-details-filter/eslint.config.mjs diff --git a/examples/express-example-with-default-settings/.eslintrc.js b/examples/express-example-with-default-settings/.eslintrc.js deleted file mode 100644 index 259de13..0000000 --- a/examples/express-example-with-default-settings/.eslintrc.js +++ /dev/null @@ -1,25 +0,0 @@ -module.exports = { - parser: '@typescript-eslint/parser', - parserOptions: { - project: 'tsconfig.json', - tsconfigRootDir: __dirname, - sourceType: 'module', - }, - plugins: ['@typescript-eslint/eslint-plugin'], - extends: [ - 'plugin:@typescript-eslint/recommended', - 'plugin:prettier/recommended', - ], - root: true, - env: { - node: true, - jest: true, - }, - ignorePatterns: ['.eslintrc.js'], - rules: { - '@typescript-eslint/interface-name-prefix': 'off', - '@typescript-eslint/explicit-function-return-type': 'off', - '@typescript-eslint/explicit-module-boundary-types': 'off', - '@typescript-eslint/no-explicit-any': 'off', - }, -}; diff --git a/examples/express-example-with-default-settings/eslint.config.mjs b/examples/express-example-with-default-settings/eslint.config.mjs new file mode 100644 index 0000000..347288c --- /dev/null +++ b/examples/express-example-with-default-settings/eslint.config.mjs @@ -0,0 +1,46 @@ +import typescriptEslintEslintPlugin from "@typescript-eslint/eslint-plugin"; +import globals from "globals"; +import tsParser from "@typescript-eslint/parser"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import js from "@eslint/js"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all +}); + +export default [{ + ignores: ["**/.eslintrc.js"], +}, ...compat.extends("plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"), { + plugins: { + "@typescript-eslint": typescriptEslintEslintPlugin, + }, + + languageOptions: { + globals: { + ...globals.node, + ...globals.jest, + }, + + parser: tsParser, + ecmaVersion: 5, + sourceType: "module", + + parserOptions: { + project: "tsconfig.json", + tsconfigRootDir: "/Users/fcmam5/lab/nest-http-problem-details/examples/express-example-with-default-settings", + }, + }, + + rules: { + "@typescript-eslint/interface-name-prefix": "off", + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/explicit-module-boundary-types": "off", + "@typescript-eslint/no-explicit-any": "off", + }, +}]; \ No newline at end of file diff --git a/examples/express-example-with-default-settings/package.json b/examples/express-example-with-default-settings/package.json index d8fa9fa..953fbe3 100644 --- a/examples/express-example-with-default-settings/package.json +++ b/examples/express-example-with-default-settings/package.json @@ -26,6 +26,8 @@ "rxjs": "^7.8.1" }, "devDependencies": { + "@eslint/eslintrc": "^3.2.0", + "@eslint/js": "^9.18.0", "@nestjs/cli": "^11.0.2", "@nestjs/schematics": "^11.0.0", "@nestjs/testing": "^11.0.4", @@ -37,6 +39,8 @@ "eslint": "^9.18.0", "eslint-config-prettier": "^10.0.1", "eslint-plugin-prettier": "^5.2.3", + "globals": "^15.14.0", + "install": "^0.13.0", "jest": "^29.7.0", "prettier": "^3.4.2", "source-map-support": "^0.5.21", diff --git a/examples/express-example-with-default-settings/pnpm-lock.yaml b/examples/express-example-with-default-settings/pnpm-lock.yaml index e82c16c..09a7c6a 100644 --- a/examples/express-example-with-default-settings/pnpm-lock.yaml +++ b/examples/express-example-with-default-settings/pnpm-lock.yaml @@ -27,6 +27,12 @@ importers: specifier: ^7.8.1 version: 7.8.1 devDependencies: + '@eslint/eslintrc': + specifier: ^3.2.0 + version: 3.2.0 + '@eslint/js': + specifier: ^9.18.0 + version: 9.18.0 '@nestjs/cli': specifier: ^11.0.2 version: 11.0.2(@types/node@22.10.7) @@ -60,6 +66,12 @@ importers: eslint-plugin-prettier: specifier: ^5.2.3 version: 5.2.3(@types/eslint@8.44.3)(eslint-config-prettier@10.0.1(eslint@9.18.0))(eslint@9.18.0)(prettier@3.4.2) + globals: + specifier: ^15.14.0 + version: 15.14.0 + install: + specifier: ^0.13.0 + version: 0.13.0 jest: specifier: ^29.7.0 version: 29.7.0(@types/node@22.10.7)(ts-node@10.9.2(@types/node@22.10.7)(typescript@5.7.3)) @@ -900,9 +912,6 @@ packages: ajv@6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} - ajv@8.12.0: - resolution: {integrity: sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==} - ajv@8.17.1: resolution: {integrity: sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==} @@ -1655,6 +1664,10 @@ packages: resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} engines: {node: '>=18'} + globals@15.14.0: + resolution: {integrity: sha512-OkToC372DtlQeje9/zHIo5CT8lRP/FUgEOKBEhU4e0abL7J7CD24fD9ohiLN5hagG/kWCYj4K5oaxxtj2Z0Dig==} + engines: {node: '>=18'} + gopd@1.2.0: resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} engines: {node: '>= 0.4'} @@ -1743,6 +1756,10 @@ packages: inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + install@0.13.0: + resolution: {integrity: sha512-zDml/jzr2PKU9I8J/xyZBQn8rPCAY//UOYNmR01XwNwyfhEWObo2SWfSl1+0tm1u6PhxLwDnfsT/6jB7OUxqFA==} + engines: {node: '>= 0.10'} + ipaddr.js@1.9.1: resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==} engines: {node: '>= 0.10'} @@ -3002,7 +3019,7 @@ snapshots: '@babel/traverse': 7.23.0 '@babel/types': 7.23.0 convert-source-map: 2.0.0 - debug: 4.3.4 + debug: 4.3.6 gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -3168,7 +3185,7 @@ snapshots: '@babel/helper-split-export-declaration': 7.22.6 '@babel/parser': 7.23.0 '@babel/types': 7.23.0 - debug: 4.3.4 + debug: 4.3.6 globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -3210,10 +3227,10 @@ snapshots: '@eslint/eslintrc@3.2.0': dependencies: ajv: 6.12.6 - debug: 4.3.4 + debug: 4.3.6 espree: 10.3.0 globals: 14.0.0 - ignore: 5.2.4 + ignore: 5.3.2 import-fresh: 3.3.0 js-yaml: 4.1.0 minimatch: 3.1.2 @@ -3980,9 +3997,9 @@ snapshots: acorn@8.14.0: {} - ajv-formats@2.1.1(ajv@8.12.0): + ajv-formats@2.1.1(ajv@8.17.1): optionalDependencies: - ajv: 8.12.0 + ajv: 8.17.1 ajv-formats@3.0.1(ajv@8.17.1): optionalDependencies: @@ -3992,9 +4009,9 @@ snapshots: dependencies: ajv: 6.12.6 - ajv-keywords@5.1.0(ajv@8.12.0): + ajv-keywords@5.1.0(ajv@8.17.1): dependencies: - ajv: 8.12.0 + ajv: 8.17.1 fast-deep-equal: 3.1.3 ajv@6.12.6: @@ -4004,13 +4021,6 @@ snapshots: json-schema-traverse: 0.4.1 uri-js: 4.4.1 - ajv@8.12.0: - dependencies: - fast-deep-equal: 3.1.3 - json-schema-traverse: 1.0.0 - require-from-string: 2.0.2 - uri-js: 4.4.1 - ajv@8.17.1: dependencies: fast-deep-equal: 3.1.3 @@ -4805,6 +4815,8 @@ snapshots: globals@14.0.0: {} + globals@15.14.0: {} + gopd@1.2.0: {} graceful-fs@4.2.11: {} @@ -4876,6 +4888,8 @@ snapshots: inherits@2.0.4: {} + install@0.13.0: {} + ipaddr.js@1.9.1: {} is-arrayish@0.2.1: {} @@ -4942,7 +4956,7 @@ snapshots: istanbul-lib-source-maps@4.0.1: dependencies: - debug: 4.3.4 + debug: 4.3.6 istanbul-lib-coverage: 3.2.0 source-map: 0.6.1 transitivePeerDependencies: @@ -5730,9 +5744,9 @@ snapshots: schema-utils@4.3.0: dependencies: '@types/json-schema': 7.0.13 - ajv: 8.12.0 - ajv-formats: 2.1.1(ajv@8.12.0) - ajv-keywords: 5.1.0(ajv@8.12.0) + ajv: 8.17.1 + ajv-formats: 2.1.1(ajv@8.17.1) + ajv-keywords: 5.1.0(ajv@8.17.1) semver@6.3.1: {} diff --git a/examples/express-example-with-default-settings/src/app/controllers/dragons.controller.ts b/examples/express-example-with-default-settings/src/app/controllers/dragons.controller.ts index 31b24e2..ee3ae53 100644 --- a/examples/express-example-with-default-settings/src/app/controllers/dragons.controller.ts +++ b/examples/express-example-with-default-settings/src/app/controllers/dragons.controller.ts @@ -25,7 +25,7 @@ export class DragonsController { getOneById( @Param('id', ParseIntPipe) id: number, @Query('title') hasTitle?: boolean, - @Query('details') hasDetails?: boolean + @Query('details') hasDetails?: boolean, // @Query('has-details') hasDetails?: boolean, ): IDragonResponse { const dragon = this.service.getByIdOrNull(id); @@ -36,7 +36,7 @@ export class DragonsController { if (hasTitle && hasDetails) { throw new NotFoundException( 'Dragon not found', - `Could not find any dragon with ID: ${id}` + `Could not find any dragon with ID: ${id}`, ); } diff --git a/examples/fastify-example-with-default-settings/.eslintrc.js b/examples/fastify-example-with-default-settings/.eslintrc.js deleted file mode 100644 index 259de13..0000000 --- a/examples/fastify-example-with-default-settings/.eslintrc.js +++ /dev/null @@ -1,25 +0,0 @@ -module.exports = { - parser: '@typescript-eslint/parser', - parserOptions: { - project: 'tsconfig.json', - tsconfigRootDir: __dirname, - sourceType: 'module', - }, - plugins: ['@typescript-eslint/eslint-plugin'], - extends: [ - 'plugin:@typescript-eslint/recommended', - 'plugin:prettier/recommended', - ], - root: true, - env: { - node: true, - jest: true, - }, - ignorePatterns: ['.eslintrc.js'], - rules: { - '@typescript-eslint/interface-name-prefix': 'off', - '@typescript-eslint/explicit-function-return-type': 'off', - '@typescript-eslint/explicit-module-boundary-types': 'off', - '@typescript-eslint/no-explicit-any': 'off', - }, -}; diff --git a/examples/fastify-example-with-default-settings/eslint.config.mjs b/examples/fastify-example-with-default-settings/eslint.config.mjs new file mode 100644 index 0000000..121d9b7 --- /dev/null +++ b/examples/fastify-example-with-default-settings/eslint.config.mjs @@ -0,0 +1,46 @@ +import typescriptEslintEslintPlugin from "@typescript-eslint/eslint-plugin"; +import globals from "globals"; +import tsParser from "@typescript-eslint/parser"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import js from "@eslint/js"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all +}); + +export default [{ + ignores: ["**/.eslintrc.js"], +}, ...compat.extends("plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"), { + plugins: { + "@typescript-eslint": typescriptEslintEslintPlugin, + }, + + languageOptions: { + globals: { + ...globals.node, + ...globals.jest, + }, + + parser: tsParser, + ecmaVersion: 5, + sourceType: "module", + + parserOptions: { + project: "tsconfig.json", + tsconfigRootDir: "/Users/fcmam5/lab/nest-http-problem-details/examples/fastify-example-with-default-settings", + }, + }, + + rules: { + "@typescript-eslint/interface-name-prefix": "off", + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/explicit-module-boundary-types": "off", + "@typescript-eslint/no-explicit-any": "off", + }, +}]; \ No newline at end of file diff --git a/examples/fastify-example-with-default-settings/package.json b/examples/fastify-example-with-default-settings/package.json index d72ba00..041ae13 100644 --- a/examples/fastify-example-with-default-settings/package.json +++ b/examples/fastify-example-with-default-settings/package.json @@ -26,6 +26,8 @@ "rxjs": "^7.8.1" }, "devDependencies": { + "@eslint/eslintrc": "^3.2.0", + "@eslint/js": "^9.18.0", "@nestjs/cli": "^11.0.2", "@nestjs/schematics": "^11.0.0", "@nestjs/testing": "^11.0.4", @@ -36,6 +38,8 @@ "eslint": "^9.18.0", "eslint-config-prettier": "^10.0.1", "eslint-plugin-prettier": "^5.2.3", + "globals": "^15.14.0", + "install": "^0.13.0", "jest": "^29.7.0", "prettier": "^3.4.2", "source-map-support": "^0.5.21", diff --git a/examples/fastify-example-with-default-settings/pnpm-lock.yaml b/examples/fastify-example-with-default-settings/pnpm-lock.yaml index 4c8d39d..a670c84 100644 --- a/examples/fastify-example-with-default-settings/pnpm-lock.yaml +++ b/examples/fastify-example-with-default-settings/pnpm-lock.yaml @@ -27,6 +27,12 @@ importers: specifier: ^7.8.1 version: 7.8.1 devDependencies: + '@eslint/eslintrc': + specifier: ^3.2.0 + version: 3.2.0 + '@eslint/js': + specifier: ^9.18.0 + version: 9.18.0 '@nestjs/cli': specifier: ^11.0.2 version: 11.0.2(@types/node@22.10.7) @@ -57,6 +63,12 @@ importers: eslint-plugin-prettier: specifier: ^5.2.3 version: 5.2.3(@types/eslint@8.44.3)(eslint-config-prettier@10.0.1(eslint@9.18.0))(eslint@9.18.0)(prettier@3.4.2) + globals: + specifier: ^15.14.0 + version: 15.14.0 + install: + specifier: ^0.13.0 + version: 0.13.0 jest: specifier: ^29.7.0 version: 29.7.0(@types/node@22.10.7)(ts-node@10.9.2(@types/node@22.10.7)(typescript@5.7.3)) @@ -897,9 +909,6 @@ packages: ajv@6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} - ajv@8.12.0: - resolution: {integrity: sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==} - ajv@8.17.1: resolution: {integrity: sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==} @@ -1545,6 +1554,10 @@ packages: resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} engines: {node: '>=18'} + globals@15.14.0: + resolution: {integrity: sha512-OkToC372DtlQeje9/zHIo5CT8lRP/FUgEOKBEhU4e0abL7J7CD24fD9ohiLN5hagG/kWCYj4K5oaxxtj2Z0Dig==} + engines: {node: '>=18'} + graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} @@ -1609,6 +1622,10 @@ packages: inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + install@0.13.0: + resolution: {integrity: sha512-zDml/jzr2PKU9I8J/xyZBQn8rPCAY//UOYNmR01XwNwyfhEWObo2SWfSl1+0tm1u6PhxLwDnfsT/6jB7OUxqFA==} + engines: {node: '>= 0.10'} + ipaddr.js@2.2.0: resolution: {integrity: sha512-Ag3wB2o37wslZS19hZqorUnrnzSkpOVy+IiiDEiTqNubEYpYuHWIf6K4psgN2ZWKExS4xhVCrRVfb/wfW8fWJA==} engines: {node: '>= 10'} @@ -2982,7 +2999,7 @@ snapshots: debug: 4.3.4 espree: 10.3.0 globals: 14.0.0 - ignore: 5.2.4 + ignore: 5.3.2 import-fresh: 3.3.0 js-yaml: 4.1.0 minimatch: 3.1.2 @@ -3001,8 +3018,8 @@ snapshots: '@fastify/ajv-compiler@4.0.2': dependencies: - ajv: 8.12.0 - ajv-formats: 3.0.1(ajv@8.12.0) + ajv: 8.17.1 + ajv-formats: 3.0.1(ajv@8.17.1) fast-uri: 3.0.6 '@fastify/cors@10.0.2': @@ -3738,13 +3755,9 @@ snapshots: acorn@8.14.0: {} - ajv-formats@2.1.1(ajv@8.12.0): + ajv-formats@2.1.1(ajv@8.17.1): optionalDependencies: - ajv: 8.12.0 - - ajv-formats@3.0.1(ajv@8.12.0): - optionalDependencies: - ajv: 8.12.0 + ajv: 8.17.1 ajv-formats@3.0.1(ajv@8.17.1): optionalDependencies: @@ -3754,9 +3767,9 @@ snapshots: dependencies: ajv: 6.12.6 - ajv-keywords@5.1.0(ajv@8.12.0): + ajv-keywords@5.1.0(ajv@8.17.1): dependencies: - ajv: 8.12.0 + ajv: 8.17.1 fast-deep-equal: 3.1.3 ajv@6.12.6: @@ -3766,13 +3779,6 @@ snapshots: json-schema-traverse: 0.4.1 uri-js: 4.4.1 - ajv@8.12.0: - dependencies: - fast-deep-equal: 3.1.3 - json-schema-traverse: 1.0.0 - require-from-string: 2.0.2 - uri-js: 4.4.1 - ajv@8.17.1: dependencies: fast-deep-equal: 3.1.3 @@ -4287,8 +4293,8 @@ snapshots: fast-json-stringify@6.0.1: dependencies: '@fastify/merge-json-schemas': 0.2.1 - ajv: 8.12.0 - ajv-formats: 3.0.1(ajv@8.12.0) + ajv: 8.17.1 + ajv-formats: 3.0.1(ajv@8.17.1) fast-uri: 3.0.6 json-schema-ref-resolver: 2.0.1 rfdc: 1.4.1 @@ -4453,6 +4459,8 @@ snapshots: globals@14.0.0: {} + globals@15.14.0: {} + graceful-fs@4.2.11: {} graphemer@1.4.0: {} @@ -4500,6 +4508,8 @@ snapshots: inherits@2.0.4: {} + install@0.13.0: {} + ipaddr.js@2.2.0: {} is-arrayish@0.2.1: {} @@ -5316,9 +5326,9 @@ snapshots: schema-utils@4.3.0: dependencies: '@types/json-schema': 7.0.13 - ajv: 8.12.0 - ajv-formats: 2.1.1(ajv@8.12.0) - ajv-keywords: 5.1.0(ajv@8.12.0) + ajv: 8.17.1 + ajv-formats: 2.1.1(ajv@8.17.1) + ajv-keywords: 5.1.0(ajv@8.17.1) secure-json-parse@3.0.2: {} diff --git a/libs/nest-problem-details-filter/.eslintrc.js b/libs/nest-problem-details-filter/.eslintrc.js deleted file mode 100644 index 259de13..0000000 --- a/libs/nest-problem-details-filter/.eslintrc.js +++ /dev/null @@ -1,25 +0,0 @@ -module.exports = { - parser: '@typescript-eslint/parser', - parserOptions: { - project: 'tsconfig.json', - tsconfigRootDir: __dirname, - sourceType: 'module', - }, - plugins: ['@typescript-eslint/eslint-plugin'], - extends: [ - 'plugin:@typescript-eslint/recommended', - 'plugin:prettier/recommended', - ], - root: true, - env: { - node: true, - jest: true, - }, - ignorePatterns: ['.eslintrc.js'], - rules: { - '@typescript-eslint/interface-name-prefix': 'off', - '@typescript-eslint/explicit-function-return-type': 'off', - '@typescript-eslint/explicit-module-boundary-types': 'off', - '@typescript-eslint/no-explicit-any': 'off', - }, -}; diff --git a/libs/nest-problem-details-filter/eslint.config.mjs b/libs/nest-problem-details-filter/eslint.config.mjs new file mode 100644 index 0000000..ad14bbc --- /dev/null +++ b/libs/nest-problem-details-filter/eslint.config.mjs @@ -0,0 +1,46 @@ +import typescriptEslintEslintPlugin from "@typescript-eslint/eslint-plugin"; +import globals from "globals"; +import tsParser from "@typescript-eslint/parser"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import js from "@eslint/js"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all +}); + +export default [{ + ignores: ["**/.eslintrc.js"], +}, ...compat.extends("plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"), { + plugins: { + "@typescript-eslint": typescriptEslintEslintPlugin, + }, + + languageOptions: { + globals: { + ...globals.node, + ...globals.jest, + }, + + parser: tsParser, + ecmaVersion: 5, + sourceType: "module", + + parserOptions: { + project: "tsconfig.json", + tsconfigRootDir: "/Users/fcmam5/lab/nest-http-problem-details/libs/nest-problem-details-filter", + }, + }, + + rules: { + "@typescript-eslint/interface-name-prefix": "off", + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/explicit-module-boundary-types": "off", + "@typescript-eslint/no-explicit-any": "off", + }, +}]; \ No newline at end of file diff --git a/libs/nest-problem-details-filter/package.json b/libs/nest-problem-details-filter/package.json index c56c5ce..7057e08 100644 --- a/libs/nest-problem-details-filter/package.json +++ b/libs/nest-problem-details-filter/package.json @@ -28,11 +28,11 @@ "test:cov": "jest --coverage" }, "devDependencies": { + "@eslint/eslintrc": "^3.2.0", + "@eslint/js": "^9.18.0", + "@nestjs/cli": "^11.0.2", "@nestjs/common": "^11.0.4", "@nestjs/core": "^11.0.4", - "reflect-metadata": "^0.2.2", - "rxjs": "^7.8.1", - "@nestjs/cli": "^11.0.2", "@nestjs/schematics": "^11.0.0", "@nestjs/testing": "^11.0.4", "@types/jest": "^29.5.14", @@ -42,8 +42,12 @@ "eslint": "^9.18.0", "eslint-config-prettier": "^10.0.1", "eslint-plugin-prettier": "^5.2.3", + "globals": "^15.14.0", + "install": "^0.13.0", "jest": "^29.7.0", "prettier": "^3.4.2", + "reflect-metadata": "^0.2.2", + "rxjs": "^7.8.1", "source-map-support": "^0.5.21", "ts-jest": "^29.2.5", "ts-loader": "^9.5.2", diff --git a/libs/nest-problem-details-filter/src/filters/http-exception.filter.ts b/libs/nest-problem-details-filter/src/filters/http-exception.filter.ts index fd2a395..982cf87 100644 --- a/libs/nest-problem-details-filter/src/filters/http-exception.filter.ts +++ b/libs/nest-problem-details-filter/src/filters/http-exception.filter.ts @@ -85,7 +85,6 @@ export class HttpExceptionFilter implements ExceptionFilter { } interface IExceptionResponse { - // eslint-disable-next-line @typescript-eslint/ban-types error?: string | IErrorDetail; message: string; type?: string;