From e064659a63f8324b947317aa2ce6aa6b938bbebe Mon Sep 17 00:00:00 2001 From: Viktor Vorona Date: Tue, 24 Oct 2023 14:08:51 +0200 Subject: [PATCH] [NO JIRA] Fix typo in local eslint rule --- server/sonar-web/.eslintrc | 2 +- ...n-test.js => no-implicit-coercion-test.js} | 24 +++++++++---------- server/sonar-web/eslint-local-rules/index.js | 2 +- ...it-coersion.js => no-implicit-coercion.js} | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) rename server/sonar-web/eslint-local-rules/__tests__/{no-implicit-coersion-test.js => no-implicit-coercion-test.js} (87%) rename server/sonar-web/eslint-local-rules/{no-implicit-coersion.js => no-implicit-coercion.js} (97%) diff --git a/server/sonar-web/.eslintrc b/server/sonar-web/.eslintrc index dbf97455776..dd5618dbdf2 100644 --- a/server/sonar-web/.eslintrc +++ b/server/sonar-web/.eslintrc @@ -16,7 +16,7 @@ "local-rules/no-conditional-rendering-of-deferredspinner": "warn", "local-rules/use-jest-mocked": "warn", "local-rules/use-await-expect-async-matcher": "warn", - "local-rules/no-implicit-coersion": "warn", + "local-rules/no-implicit-coercion": "warn", "local-rules/no-api-imports": "warn" } } diff --git a/server/sonar-web/eslint-local-rules/__tests__/no-implicit-coersion-test.js b/server/sonar-web/eslint-local-rules/__tests__/no-implicit-coercion-test.js similarity index 87% rename from server/sonar-web/eslint-local-rules/__tests__/no-implicit-coersion-test.js rename to server/sonar-web/eslint-local-rules/__tests__/no-implicit-coercion-test.js index fe5c346f1ac..03cb3df0663 100644 --- a/server/sonar-web/eslint-local-rules/__tests__/no-implicit-coersion-test.js +++ b/server/sonar-web/eslint-local-rules/__tests__/no-implicit-coercion-test.js @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ const { RuleTester } = require('eslint'); -const noImplicitCoersion = require('../no-implicit-coersion'); +const noImplicitCoercion = require('../no-implicit-coercion'); const ruleTester = new RuleTester({ parserOptions: { @@ -29,7 +29,7 @@ const ruleTester = new RuleTester({ parser: require.resolve('@typescript-eslint/parser'), }); -ruleTester.run('no-implicit-coersion', noImplicitCoersion, { +ruleTester.run('no-implicit-coercion', noImplicitCoercion, { valid: [ { code: ` @@ -135,7 +135,7 @@ ruleTester.run('no-implicit-coersion', noImplicitCoersion, { return true; } }`, - errors: [{ messageId: 'noImplicitCoersion' }], + errors: [{ messageId: 'noImplicitCoercion' }], }, { code: ` @@ -144,7 +144,7 @@ ruleTester.run('no-implicit-coersion', noImplicitCoersion, { return true; } }`, - errors: [{ messageId: 'noImplicitCoersion' }], + errors: [{ messageId: 'noImplicitCoercion' }], }, { code: ` @@ -153,14 +153,14 @@ ruleTester.run('no-implicit-coersion', noImplicitCoersion, { return true; } }`, - errors: [{ messageId: 'noImplicitCoersion' }], + errors: [{ messageId: 'noImplicitCoercion' }], }, { code: ` function test(value?: number) { return value && value > -1; }`, - errors: [{ messageId: 'noImplicitCoersion' }], + errors: [{ messageId: 'noImplicitCoercion' }], }, { code: ` @@ -169,14 +169,14 @@ ruleTester.run('no-implicit-coersion', noImplicitCoersion, { return 1; } }`, - errors: [{ messageId: 'noImplicitCoersion' }], + errors: [{ messageId: 'noImplicitCoercion' }], }, { code: ` function test(value?: number) { return value || 100; }`, - errors: [{ messageId: 'noImplicitCoersion' }], + errors: [{ messageId: 'noImplicitCoercion' }], }, { code: ` @@ -186,7 +186,7 @@ ruleTester.run('no-implicit-coersion', noImplicitCoersion, { function Test(props: Props) { return props.test && props.test.toString(); }`, - errors: [{ messageId: 'noImplicitCoersion' }], + errors: [{ messageId: 'noImplicitCoercion' }], }, { code: ` @@ -199,7 +199,7 @@ ruleTester.run('no-implicit-coersion', noImplicitCoersion, { } return 100; }`, - errors: [{ messageId: 'noImplicitCoersion' }], + errors: [{ messageId: 'noImplicitCoercion' }], }, { code: ` @@ -213,7 +213,7 @@ ruleTester.run('no-implicit-coersion', noImplicitCoersion, { } return 100; }`, - errors: [{ messageId: 'noImplicitCoersion' }], + errors: [{ messageId: 'noImplicitCoercion' }], }, { code: ` @@ -228,7 +228,7 @@ ruleTester.run('no-implicit-coersion', noImplicitCoersion, { ); }`, - errors: [{ messageId: 'noImplicitCoersion' }, { messageId: 'noImplicitCoersion' }], + errors: [{ messageId: 'noImplicitCoercion' }, { messageId: 'noImplicitCoercion' }], }, ], }); diff --git a/server/sonar-web/eslint-local-rules/index.js b/server/sonar-web/eslint-local-rules/index.js index 5ea46f3a210..aecf29ef9c1 100644 --- a/server/sonar-web/eslint-local-rules/index.js +++ b/server/sonar-web/eslint-local-rules/index.js @@ -26,6 +26,6 @@ module.exports = { 'use-metrickey-enum': require('./use-metrickey-enum'), 'use-metrictype-enum': require('./use-metrictype-enum'), 'use-await-expect-async-matcher': require('./use-await-expect-async-matcher'), - 'no-implicit-coersion': require('./no-implicit-coersion'), + 'no-implicit-coercion': require('./no-implicit-coercion'), 'no-api-imports': require('./no-api-imports'), }; diff --git a/server/sonar-web/eslint-local-rules/no-implicit-coersion.js b/server/sonar-web/eslint-local-rules/no-implicit-coercion.js similarity index 97% rename from server/sonar-web/eslint-local-rules/no-implicit-coersion.js rename to server/sonar-web/eslint-local-rules/no-implicit-coercion.js index 705b16a90f0..3ca8ec092d2 100644 --- a/server/sonar-web/eslint-local-rules/no-implicit-coersion.js +++ b/server/sonar-web/eslint-local-rules/no-implicit-coercion.js @@ -27,7 +27,7 @@ module.exports = { recommended: true, }, messages: { - noImplicitCoersion: + noImplicitCoercion: 'Use explicit comparison instead of implicit coercion for strings and numbers.', }, }, @@ -73,7 +73,7 @@ function checkImplicitCoercion(context, argument) { if (type.isUnion() ? type.types.some(isForbiddenType) : isForbiddenType(type)) { context.report({ node: argument, - messageId: 'noImplicitCoersion', + messageId: 'noImplicitCoercion', }); } } -- 2.39.5