From 2ce994dbd04ed6ddcc3aca354935b1e03c755be8 Mon Sep 17 00:00:00 2001 From: "Micael Levi (@micalevisk)" Date: Sat, 21 May 2022 19:11:45 -0400 Subject: [PATCH] chore: keep only one eslint config file for dev --- .eslintrc.js | 54 +++++++++++++++++++++++++++++++++-------------- .eslintrc.spec.js | 13 ------------ package.json | 4 ++-- 3 files changed, 40 insertions(+), 31 deletions(-) delete mode 100644 .eslintrc.spec.js diff --git a/.eslintrc.js b/.eslintrc.js index 280fe9a37..6c2dc7c33 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,8 +1,7 @@ module.exports = { - parser: '@typescript-eslint/parser', - parserOptions: { - project: 'tsconfig.json', - sourceType: 'module', + root: true, + env: { + node: true, }, plugins: ['@typescript-eslint/eslint-plugin'], extends: [ @@ -10,16 +9,39 @@ module.exports = { 'plugin:@typescript-eslint/recommended', 'prettier', ], - root: true, - env: { - node: true, - }, - rules: { - '@typescript-eslint/interface-name-prefix': 'off', - '@typescript-eslint/explicit-function-return-type': 'off', - '@typescript-eslint/no-explicit-any': 'off', - '@typescript-eslint/explicit-module-boundary-types': 'off', - '@typescript-eslint/no-unused-vars': 'off', - '@typescript-eslint/ban-types': 'off', - }, + overrides: [ + { + files: ['**/*.ts'], + parser: '@typescript-eslint/parser', + parserOptions: { + project: 'tsconfig.json', + sourceType: 'module', + }, + rules: { + '@typescript-eslint/interface-name-prefix': 'off', + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/no-unused-vars': 'off', + '@typescript-eslint/ban-types': 'off', + }, + }, + { + files: ['**/*.spec.ts', 'integration/**/*.ts'], + parser: '@typescript-eslint/parser', + parserOptions: { + project: 'tsconfig.spec.json', + sourceType: 'module', + }, + rules: { + '@typescript-eslint/interface-name-prefix': 'off', + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/no-unused-vars': 'off', + '@typescript-eslint/ban-types': 'off', + '@typescript-eslint/no-empty-function': 'off', + }, + } + ] }; diff --git a/.eslintrc.spec.js b/.eslintrc.spec.js deleted file mode 100644 index f7b2e8ed7..000000000 --- a/.eslintrc.spec.js +++ /dev/null @@ -1,13 +0,0 @@ -const baseConfig = require('./.eslintrc'); - -module.exports = { - ...baseConfig, - parserOptions: { - project: 'tsconfig.spec.json', - sourceType: 'module', - }, - rules: { - ...baseConfig.rules, - '@typescript-eslint/no-empty-function': 'off', - }, -}; diff --git a/package.json b/package.json index 15b4bfe0a..5614505da 100644 --- a/package.json +++ b/package.json @@ -31,9 +31,9 @@ "test:docker:down": "docker-compose -f integration/docker-compose.yml down", "lint": "concurrently 'npm run lint:packages' 'npm run lint:integration' 'npm run lint:spec'", "lint:fix": "concurrently 'npm run lint:packages -- --fix' 'npm run lint:integration -- --fix' 'npm run lint:spec -- --fix'", - "lint:integration": "eslint 'integration/*/{,!(node_modules)/**/}/*.ts' -c '.eslintrc.spec.js'", + "lint:integration": "eslint 'integration/*/{,!(node_modules)/**/}/*.ts'", "lint:packages": "eslint 'packages/**/**.ts' --ignore-pattern 'packages/**/*.spec.ts'", - "lint:spec": "eslint 'packages/**/**.spec.ts' -c '.eslintrc.spec.js'", + "lint:spec": "eslint 'packages/**/**.spec.ts'", "prerelease": "gulp copy-misc && gulp build --dist node_modules/@nestjs", "publish": "npm run prerelease && npm run build:prod && ./node_modules/.bin/lerna publish --force-publish --access public --exact -m \"chore(@nestjs) publish %s release\"", "prepublishOnly": "npm run changelog | pbcopy",