From b32b58c59db6efadd7539910784c3b8400c318b2 Mon Sep 17 00:00:00 2001 From: williamlardier Date: Wed, 18 Sep 2024 08:57:10 +0200 Subject: [PATCH] Improve linting - Ignore files through the gitignore file - Avoid ignoring eslint rule when we can improve the code Issue: ZENKO-4882 --- tests/ctst/eslint.config.mjs | 16 +++------ .../ctst/features/resource-policies/regen.js | 11 +++++-- tests/ctst/package.json | 1 + tests/ctst/yarn.lock | 33 +++++++++++++++++-- 4 files changed, 44 insertions(+), 17 deletions(-) diff --git a/tests/ctst/eslint.config.mjs b/tests/ctst/eslint.config.mjs index 04a93c8caa..1cd50bf720 100644 --- a/tests/ctst/eslint.config.mjs +++ b/tests/ctst/eslint.config.mjs @@ -3,30 +3,22 @@ import { fileURLToPath } from 'node:url'; import js from '@eslint/js'; import { FlatCompat } from '@eslint/eslintrc'; import tseslint from 'typescript-eslint'; +import { includeIgnoreFile } from '@eslint/compat'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); +const gitignorePath = path.resolve(__dirname, '.gitignore'); const compat = new FlatCompat({ baseDirectory: __dirname, recommendedConfig: js.configs.recommended, - allConfig: js.configs.all + allConfig: js.configs.all, }); export default tseslint.config( ...compat.extends('scality'), ...tseslint.configs.recommended, + includeIgnoreFile(gitignorePath), { - ignores: [ - '**/.vscode', - '**/vendor/*.js', - '**/build', - '**/coverage', - '**/dist', - '**/node_modules/**/*', - '**/package', - '**/reports', - '**/eslint.config.mjs', - ], rules: { // CucumberJS steps start with an uppercase 'new-cap': 'off', diff --git a/tests/ctst/features/resource-policies/regen.js b/tests/ctst/features/resource-policies/regen.js index 8ed6925d4f..0fe424cdfa 100644 --- a/tests/ctst/features/resource-policies/regen.js +++ b/tests/ctst/features/resource-policies/regen.js @@ -152,8 +152,15 @@ const output = scenarios.map(scenario => { const paddedBucketPolicyApplies = scenario.bucketPolicyApplies.padEnd(longest.bucketPolicyApplies); const paddedBucketPolicyEffect = scenario.bucketPolicyEffect.padEnd(longest.bucketPolicyEffect); - // eslint-disable-next-line max-len - return ` | ${paddedAction} | ${paddedBucketPolicyExists} | ${paddedBucketPolicyApplies} | ${paddedBucketPolicyEffect} | ${paddedIamPolicyExists} | ${paddedIamPolicyApplies} | ${paddedIamPolicyEffect} |`; + return ( + ' ', + paddedAction, + paddedBucketPolicyExists, + paddedBucketPolicyApplies, + paddedBucketPolicyEffect, + paddedIamPolicyExists, + paddedIamPolicyApplies, + paddedIamPolicyEffect).join(' | '); }).join('\n'); targetFiles.forEach(file => { diff --git a/tests/ctst/package.json b/tests/ctst/package.json index 20603e13d4..f2e107e48c 100644 --- a/tests/ctst/package.json +++ b/tests/ctst/package.json @@ -23,6 +23,7 @@ "@aws-sdk/client-iam": "^3.582.0", "@aws-sdk/client-s3": "^3.583.0", "@aws-sdk/client-sts": "^3.583.0", + "@eslint/compat": "^1.1.1", "cli-testing": "github:scality/cli-testing.git#1.2.3", "eslint": "^9.9.1", "eslint-config-scality": "scality/Guidelines#8.3.0", diff --git a/tests/ctst/yarn.lock b/tests/ctst/yarn.lock index 99d93baddc..27828947b4 100644 --- a/tests/ctst/yarn.lock +++ b/tests/ctst/yarn.lock @@ -2338,6 +2338,11 @@ resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.11.0.tgz#b0ffd0312b4a3fd2d6f77237e7248a5ad3a680ae" integrity sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A== +"@eslint/compat@^1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@eslint/compat/-/compat-1.1.1.tgz#5736523f5105c94dfae5f35e31debc38443722cd" + integrity sha512-lpHyRyplhGPL5mGEh6M9O5nnKk0Gz4bFI+Zu6tKlPpDUN7XshWvH9C/px4UVm87IAANE0W81CEsNGbS1KlzXpA== + "@eslint/config-array@^0.18.0": version "0.18.0" resolved "https://registry.yarnpkg.com/@eslint/config-array/-/config-array-0.18.0.tgz#37d8fe656e0d5e3dbaea7758ea56540867fd074d" @@ -5316,7 +5321,7 @@ has-ansi@^4.0.1: dependencies: ansi-regex "^4.1.0" -has-bigints@^1.0.2: +has-bigints@^1.0.1, has-bigints@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.2.tgz#0871bd3e3d51626f6ca0966668ba35d5602d6eaa" integrity sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ== @@ -5488,6 +5493,21 @@ is-arrayish@^0.2.1: resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== +is-bigint@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.0.4.tgz#08147a1875bc2b32005d41ccd8291dffc6691df3" + integrity sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg== + dependencies: + has-bigints "^1.0.1" + +is-boolean-object@^1.1.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.1.2.tgz#5c6dc200246dd9321ae4b885a114bb1f75f63719" + integrity sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA== + dependencies: + call-bind "^1.0.2" + has-tostringtag "^1.0.0" + is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.7: version "1.2.7" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055" @@ -5564,6 +5584,13 @@ is-negative-zero@^2.0.3: resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.3.tgz#ced903a027aca6381b777a5743069d7376a49747" integrity sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw== +is-number-object@^1.0.4: + version "1.0.7" + resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.7.tgz#59d50ada4c45251784e9904f5246c742f07a42fc" + integrity sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ== + dependencies: + has-tostringtag "^1.0.0" + is-number@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" @@ -5594,14 +5621,14 @@ is-stream@^2.0.0: resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== -is-string@^1.0.7: +is-string@^1.0.5, is-string@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.7.tgz#0dd12bf2006f255bb58f695110eff7491eebc0fd" integrity sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg== dependencies: has-tostringtag "^1.0.0" -is-symbol@^1.0.2: +is-symbol@^1.0.2, is-symbol@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.4.tgz#a6dac93b635b063ca6872236de88910a57af139c" integrity sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==