From 5782bb1750cf658c571cf222dac63d493d4ce5a6 Mon Sep 17 00:00:00 2001 From: Dmitry Baev Date: Mon, 6 Jan 2025 15:48:17 +0000 Subject: [PATCH 1/2] chore: improve interop between prettier and eslint --- .eslintrc.cjs | 2 +- .prettierrc.js | 1 + packages/allure-codeceptjs/test/utils.ts | 1 - packages/allure-jasmine/test/utils.ts | 1 - packages/allure-mocha/src/extraReporters.ts | 2 +- packages/allure-mocha/test/spec/framework/fixtures.test.ts | 1 - packages/allure-mocha/test/spec/framework/retries.test.ts | 2 -- packages/newman-reporter-allure/src/index.ts | 1 - packages/newman-reporter-allure/test/spec/errorMessage.test.ts | 1 - packages/newman-reporter-allure/test/spec/exec.test.ts | 1 - packages/newman-reporter-allure/test/spec/globalLabels.test.ts | 1 - packages/newman-reporter-allure/test/spec/headers.test.ts | 1 - packages/newman-reporter-allure/test/spec/requestError.test.ts | 1 - packages/newman-reporter-allure/test/spec/simple.test.ts | 1 - packages/newman-reporter-allure/test/spec/syntaxError.test.ts | 1 - 15 files changed, 3 insertions(+), 15 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index ffffd95cf..4961e88fc 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -137,7 +137,7 @@ module.exports = { "@typescript-eslint/prefer-namespace-keyword": "error", "@typescript-eslint/prefer-regexp-exec": "off", "@typescript-eslint/prefer-promise-reject-errors": "off", - "@stylistic/quotes": ["error", "double"], + "@stylistic/quotes": ["error", "double", { avoidEscape: true }], "@typescript-eslint/restrict-template-expressions": [ "error", { diff --git a/.prettierrc.js b/.prettierrc.js index 7e3053db4..8a3aaa610 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -9,4 +9,5 @@ module.exports = { importOrderSeparation: false, importOrderSortSpecifiers: true, importOrderParserPlugins: ["typescript", "decorators-legacy"], + quoteProps: "consistent", }; diff --git a/packages/allure-codeceptjs/test/utils.ts b/packages/allure-codeceptjs/test/utils.ts index eb5a17c49..bcb42f770 100644 --- a/packages/allure-codeceptjs/test/utils.ts +++ b/packages/allure-codeceptjs/test/utils.ts @@ -24,7 +24,6 @@ export const runCodeceptJsInlineTest = async ( ): Promise => { const testFiles = { // package.json is used to find project root in case of absolute file paths are used - // eslint-disable-next-line @stylistic/quotes "package.json": '{ "name": "dummy"}', "codecept.conf.js": await readFile(resolvePath(__dirname, "./samples/codecept.conf.js"), "utf-8"), "helper.js": await readFile(resolvePath(__dirname, "./samples/helper.js"), "utf-8"), diff --git a/packages/allure-jasmine/test/utils.ts b/packages/allure-jasmine/test/utils.ts index 6deaab3ce..4a5e90fbb 100644 --- a/packages/allure-jasmine/test/utils.ts +++ b/packages/allure-jasmine/test/utils.ts @@ -13,7 +13,6 @@ export const runJasmineInlineTest = async ( const testDir = path.join(__dirname, "fixtures", randomUUID()); const testFiles = { // package.json is used to find project root in case of absolute file paths are used - // eslint-disable-next-line @stylistic/quotes "package.json": '{ "name": "dummy"}', "spec/support/jasmine.json": await readFile(path.join(__dirname, "./samples/spec/support/jasmine.json"), "utf8"), // eslint-disable-next-line @typescript-eslint/no-require-imports diff --git a/packages/allure-mocha/src/extraReporters.ts b/packages/allure-mocha/src/extraReporters.ts index 7b57b2eeb..93726103f 100644 --- a/packages/allure-mocha/src/extraReporters.ts +++ b/packages/allure-mocha/src/extraReporters.ts @@ -72,7 +72,7 @@ const instantiateReporters = ( ...options, reporterOptions, // eslint-disable-next-line quote-props - reporterOption: reporterOptions, + "reporterOption": reporterOptions, "reporter-option": reporterOptions, }; reporters.push(new Reporter(runner, optionsForReporter)); diff --git a/packages/allure-mocha/test/spec/framework/fixtures.test.ts b/packages/allure-mocha/test/spec/framework/fixtures.test.ts index e148ae185..c10525670 100644 --- a/packages/allure-mocha/test/spec/framework/fixtures.test.ts +++ b/packages/allure-mocha/test/spec/framework/fixtures.test.ts @@ -1,4 +1,3 @@ -/* eslint @stylistic/quotes: off */ import { beforeAll, describe, expect, it } from "vitest"; import type { Assertion } from "vitest"; import type { TestResult, TestResultContainer } from "allure-js-commons"; diff --git a/packages/allure-mocha/test/spec/framework/retries.test.ts b/packages/allure-mocha/test/spec/framework/retries.test.ts index 451768c84..b8bd56d45 100644 --- a/packages/allure-mocha/test/spec/framework/retries.test.ts +++ b/packages/allure-mocha/test/spec/framework/retries.test.ts @@ -148,7 +148,6 @@ describe("retries", () => { expect(befores).toEqual( expect.arrayContaining([ expect.objectContaining({ - // eslint-disable-next-line @stylistic/quotes name: '"before each" hook', steps: expect.arrayContaining([ expect.objectContaining({ @@ -164,7 +163,6 @@ describe("retries", () => { expect(afters).toEqual( expect.arrayContaining([ expect.objectContaining({ - // eslint-disable-next-line @stylistic/quotes name: '"after each" hook', steps: expect.arrayContaining([ expect.objectContaining({ diff --git a/packages/newman-reporter-allure/src/index.ts b/packages/newman-reporter-allure/src/index.ts index e9e5d045d..598b2067f 100644 --- a/packages/newman-reporter-allure/src/index.ts +++ b/packages/newman-reporter-allure/src/index.ts @@ -465,7 +465,6 @@ class AllureReporter { val .replace("\n", "") .replace("\r", "") - // eslint-disable-next-line @stylistic/quotes .replace('"', '"') ); } diff --git a/packages/newman-reporter-allure/test/spec/errorMessage.test.ts b/packages/newman-reporter-allure/test/spec/errorMessage.test.ts index 32e91a424..cd7eb236f 100644 --- a/packages/newman-reporter-allure/test/spec/errorMessage.test.ts +++ b/packages/newman-reporter-allure/test/spec/errorMessage.test.ts @@ -1,4 +1,3 @@ -/* eslint-disable @stylistic/quotes */ import { afterAll, afterEach, beforeAll, expect, test } from "vitest"; import { server } from "../mocks/server.js"; import { runNewmanCollection } from "../utils.js"; diff --git a/packages/newman-reporter-allure/test/spec/exec.test.ts b/packages/newman-reporter-allure/test/spec/exec.test.ts index 562619470..7b0a520e8 100644 --- a/packages/newman-reporter-allure/test/spec/exec.test.ts +++ b/packages/newman-reporter-allure/test/spec/exec.test.ts @@ -1,4 +1,3 @@ -/* eslint-disable @stylistic/quotes */ import { afterAll, afterEach, beforeAll, expect, test } from "vitest"; import { server } from "../mocks/server.js"; import { runNewmanCollection } from "../utils.js"; diff --git a/packages/newman-reporter-allure/test/spec/globalLabels.test.ts b/packages/newman-reporter-allure/test/spec/globalLabels.test.ts index 257145387..0b38157a1 100644 --- a/packages/newman-reporter-allure/test/spec/globalLabels.test.ts +++ b/packages/newman-reporter-allure/test/spec/globalLabels.test.ts @@ -1,4 +1,3 @@ -/* eslint-disable @stylistic/quotes */ import { afterAll, afterEach, beforeAll, expect, test } from "vitest"; import { server } from "../mocks/server.js"; import { runNewmanCollection } from "../utils.js"; diff --git a/packages/newman-reporter-allure/test/spec/headers.test.ts b/packages/newman-reporter-allure/test/spec/headers.test.ts index ca954b6b6..7de45b554 100644 --- a/packages/newman-reporter-allure/test/spec/headers.test.ts +++ b/packages/newman-reporter-allure/test/spec/headers.test.ts @@ -1,4 +1,3 @@ -/* eslint-disable @stylistic/quotes */ import { afterAll, afterEach, beforeAll, expect, test } from "vitest"; import { server } from "../mocks/server.js"; import { runNewmanCollection } from "../utils.js"; diff --git a/packages/newman-reporter-allure/test/spec/requestError.test.ts b/packages/newman-reporter-allure/test/spec/requestError.test.ts index 5fa69dd01..c17eb30b8 100644 --- a/packages/newman-reporter-allure/test/spec/requestError.test.ts +++ b/packages/newman-reporter-allure/test/spec/requestError.test.ts @@ -1,4 +1,3 @@ -/* eslint-disable @stylistic/quotes */ import { afterAll, afterEach, beforeAll, expect, test } from "vitest"; import { server } from "../mocks/server.js"; import { runNewmanCollection } from "../utils.js"; diff --git a/packages/newman-reporter-allure/test/spec/simple.test.ts b/packages/newman-reporter-allure/test/spec/simple.test.ts index 5cc4db176..3ab660113 100644 --- a/packages/newman-reporter-allure/test/spec/simple.test.ts +++ b/packages/newman-reporter-allure/test/spec/simple.test.ts @@ -1,4 +1,3 @@ -/* eslint-disable @stylistic/quotes */ import { afterAll, afterEach, beforeAll, expect, test } from "vitest"; import { LabelName, Stage, Status } from "allure-js-commons"; import { server } from "../mocks/server.js"; diff --git a/packages/newman-reporter-allure/test/spec/syntaxError.test.ts b/packages/newman-reporter-allure/test/spec/syntaxError.test.ts index 63eb3da04..60b964d2c 100644 --- a/packages/newman-reporter-allure/test/spec/syntaxError.test.ts +++ b/packages/newman-reporter-allure/test/spec/syntaxError.test.ts @@ -1,4 +1,3 @@ -/* eslint-disable @stylistic/quotes */ import { afterAll, afterEach, beforeAll, expect, test } from "vitest"; import { server } from "../mocks/server.js"; import { runNewmanCollection } from "../utils.js"; From d49a524504aee9d526be01cd2e5220d7eba75bac Mon Sep 17 00:00:00 2001 From: Dmitry Baev Date: Mon, 6 Jan 2025 15:52:52 +0000 Subject: [PATCH 2/2] fix prettier --- packages/newman-reporter-allure/src/index.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/newman-reporter-allure/src/index.ts b/packages/newman-reporter-allure/src/index.ts index 598b2067f..cea6cb1b6 100644 --- a/packages/newman-reporter-allure/src/index.ts +++ b/packages/newman-reporter-allure/src/index.ts @@ -461,12 +461,7 @@ class AllureReporter { } #escape(val: string) { - return ( - val - .replace("\n", "") - .replace("\r", "") - .replace('"', '"') - ); + return val.replace("\n", "").replace("\r", "").replace('"', '"'); } }