From 4ac1988b34d3ca4361aef4e1938f7e8bab9c6fbd Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 10 May 2023 13:03:02 +0200 Subject: [PATCH 1/4] lint eslint comments --- backend/.eslintrc.js | 3 +++ backend/package.json | 1 + backend/yarn.lock | 10 +++++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/backend/.eslintrc.js b/backend/.eslintrc.js index 7f2ecd578..158d1a0bb 100644 --- a/backend/.eslintrc.js +++ b/backend/.eslintrc.js @@ -13,6 +13,7 @@ module.exports = { 'plugin:import/recommended', 'plugin:import/typescript', 'plugin:security/recommended', + 'plugin:@eslint-community/eslint-comments/recommended', ], settings: { 'import/parsers': { @@ -152,6 +153,8 @@ module.exports = { 'promise/valid-params': 'warn', 'promise/prefer-await-to-callbacks': 'error', 'promise/no-multiple-resolved': 'error', + // eslint comments + '@eslint-community/eslint-comments/disable-enable-pair': ['error', { allowWholeFile: true }], }, overrides: [ // only for ts files diff --git a/backend/package.json b/backend/package.json index c6e852841..8a8d14e00 100644 --- a/backend/package.json +++ b/backend/package.json @@ -46,6 +46,7 @@ "uuid": "^8.3.2" }, "devDependencies": { + "@eslint-community/eslint-plugin-eslint-comments": "^3.2.1", "@types/email-templates": "^10.0.1", "@types/express": "^4.17.12", "@types/faker": "^5.5.9", diff --git a/backend/yarn.lock b/backend/yarn.lock index 4a283e482..237a265e3 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -382,6 +382,14 @@ dependencies: "@cspotcode/source-map-consumer" "0.8.0" +"@eslint-community/eslint-plugin-eslint-comments@^3.2.1": + version "3.2.1" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-plugin-eslint-comments/-/eslint-plugin-eslint-comments-3.2.1.tgz#3c65061e27f155eae3744c3b30c5a8253a959040" + integrity sha512-/HZbjIGaVO2zLlWX3gRgiHmKRVvvqrC0zVu3eXnIj1ORxoyfGSj50l0PfDfqihyZAqrDYzSMdJesXzFjvAoiLQ== + dependencies: + escape-string-regexp "^1.0.5" + ignore "^5.2.4" + "@eslint-community/eslint-utils@^4.2.0": version "4.2.0" resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.2.0.tgz#a831e6e468b4b2b5ae42bf658bea015bf10bc518" @@ -3984,7 +3992,7 @@ ignore@^5.1.1: resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57" integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw== -ignore@^5.2.0: +ignore@^5.2.0, ignore@^5.2.4: version "5.2.4" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324" integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== From 7483cef63419f2d9bab099d1ebaa4f95b0ff2298 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 10 May 2023 13:03:13 +0200 Subject: [PATCH 2/4] ignore coverage folder for linting --- backend/.eslintignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/.eslintignore b/backend/.eslintignore index f6b255e92..1ae86fe5e 100644 --- a/backend/.eslintignore +++ b/backend/.eslintignore @@ -1,3 +1,4 @@ node_modules **/*.min.js -build \ No newline at end of file +build +coverage \ No newline at end of file From ab5aac5c6ba9bb26998d0b5f4748690b4f6af20e Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 10 May 2023 13:03:23 +0200 Subject: [PATCH 3/4] remove duplicate ignore --- backend/src/apis/HttpRequest.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/backend/src/apis/HttpRequest.ts b/backend/src/apis/HttpRequest.ts index f40d577bd..27578463a 100644 --- a/backend/src/apis/HttpRequest.ts +++ b/backend/src/apis/HttpRequest.ts @@ -7,7 +7,6 @@ import axios from 'axios' import { LogError } from '@/server/LogError' import { backendLogger as logger } from '@/server/logger' -// eslint-disable-next-line @typescript-eslint/no-explicit-any export const apiPost = async (url: string, payload: unknown): Promise => { logger.trace('POST', url, payload) try { @@ -25,7 +24,6 @@ export const apiPost = async (url: string, payload: unknown): Promise => { } } -// eslint-disable-next-line @typescript-eslint/no-explicit-any export const apiGet = async (url: string): Promise => { logger.trace('GET: url=' + url) try { From ac89b845edb6b9cdb6ff35690336051581c8ad89 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 10 May 2023 13:08:31 +0200 Subject: [PATCH 4/4] enable and document optional rules --- backend/.eslintrc.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/.eslintrc.js b/backend/.eslintrc.js index 158d1a0bb..798bef1e6 100644 --- a/backend/.eslintrc.js +++ b/backend/.eslintrc.js @@ -155,6 +155,9 @@ module.exports = { 'promise/no-multiple-resolved': 'error', // eslint comments '@eslint-community/eslint-comments/disable-enable-pair': ['error', { allowWholeFile: true }], + '@eslint-community/eslint-comments/no-restricted-disable': 'error', + '@eslint-community/eslint-comments/no-use': 'off', + '@eslint-community/eslint-comments/require-description': 'off', }, overrides: [ // only for ts files