From c9dd5e8d024a171bb9cb9bedfdf7fe2b7d40caa8 Mon Sep 17 00:00:00 2001 From: Conicaw Date: Fri, 29 Dec 2023 20:10:33 -0600 Subject: [PATCH] refactor: make eslint consistent with other services Make eslint consistent with other services commit-id:5e520892 --- .eslintrc.js | 5 +++++ package-lock.json | 44 ++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 ++ 3 files changed, 51 insertions(+) diff --git a/.eslintrc.js b/.eslintrc.js index f7edfed..aac6e81 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -9,7 +9,9 @@ module.exports = { '@typescript-eslint/eslint-plugin', 'simple-import-sort', 'no-type-assertion', + 'sonarjs', 'import', + 'unused-imports', ], extends: [ 'eslint:recommended', @@ -18,6 +20,7 @@ module.exports = { 'plugin:@typescript-eslint/stylistic-type-checked', 'plugin:@typescript-eslint/strict', 'plugin:prettier/recommended', + 'plugin:sonarjs/recommended', 'plugin:import/recommended', 'plugin:import/typescript', ], @@ -26,6 +29,7 @@ module.exports = { node: true, jest: true, }, + ignorePatterns: ['.eslintrc.js'], rules: { 'simple-import-sort/imports': 'error', 'simple-import-sort/exports': 'error', @@ -72,5 +76,6 @@ module.exports = { ], 'prefer-template': 'error', '@typescript-eslint/return-await': ['error', 'always'], + 'unused-imports/no-unused-imports': 'error', }, }; diff --git a/package-lock.json b/package-lock.json index c6e2616..f44d0f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,6 +25,8 @@ "eslint-plugin-no-type-assertion": "^1.3.0", "eslint-plugin-prettier": "^5.1.2", "eslint-plugin-simple-import-sort": "^10.0.0", + "eslint-plugin-sonarjs": "^0.23.0", + "eslint-plugin-unused-imports": "^3.0.0", "husky": "^8.0.3", "lint-staged": "^15.2.0", "prettier": "^3.1.1", @@ -1835,6 +1837,48 @@ "eslint": ">=5.0.0" } }, + "node_modules/eslint-plugin-sonarjs": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-sonarjs/-/eslint-plugin-sonarjs-0.23.0.tgz", + "integrity": "sha512-z44T3PBf9W7qQ/aR+NmofOTyg6HLhSEZOPD4zhStqBpLoMp8GYhFksuUBnCxbnf1nfISpKBVkQhiBLFI/F4Wlg==", + "dev": true, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "eslint": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/eslint-plugin-unused-imports": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-3.0.0.tgz", + "integrity": "sha512-sduiswLJfZHeeBJ+MQaG+xYzSWdRXoSw61DpU13mzWumCkR0ufD0HmO4kdNokjrkluMHpj/7PJeN35pgbhW3kw==", + "dev": true, + "dependencies": { + "eslint-rule-composer": "^0.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "@typescript-eslint/eslint-plugin": "^6.0.0", + "eslint": "^8.0.0" + }, + "peerDependenciesMeta": { + "@typescript-eslint/eslint-plugin": { + "optional": true + } + } + }, + "node_modules/eslint-rule-composer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz", + "integrity": "sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg==", + "dev": true, + "engines": { + "node": ">=4.0.0" + } + }, "node_modules/eslint-scope": { "version": "7.2.2", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", diff --git a/package.json b/package.json index db6585b..92e1fb7 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,8 @@ "eslint-plugin-no-type-assertion": "^1.3.0", "eslint-plugin-prettier": "^5.1.2", "eslint-plugin-simple-import-sort": "^10.0.0", + "eslint-plugin-sonarjs": "^0.23.0", + "eslint-plugin-unused-imports": "^3.0.0", "husky": "^8.0.3", "lint-staged": "^15.2.0", "prettier": "^3.1.1",