From 4d4ed2a5c4da7467ae0d1d721018ba0766e8fc35 Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Thu, 25 Jul 2024 13:06:26 +0200 Subject: [PATCH] chore: enforce single quotes in JSX (#31855) Discovered in https://github.com/microsoft/playwright/pull/31852#discussion_r1691133106: We're not enforcing single quotes for JSX, and it shows! We need to start enforcing it to prevent even greater damage from being done ;D --- .eslintrc.js | 1 + packages/html-reporter/src/icons.tsx | 14 +++++++------- packages/html-reporter/src/testFileView.tsx | 4 ++-- packages/html-reporter/src/testFilesView.tsx | 8 ++++---- packages/trace-viewer/src/ui/actionList.tsx | 4 ++-- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index bff9ffeeb4..bb351a8c56 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -30,6 +30,7 @@ module.exports = { "avoidEscape": true, "allowTemplateLiterals": true }], + "jsx-quotes": [2, "prefer-single"], "no-extra-semi": 2, "@typescript-eslint/semi": [2], "comma-style": [2, "last"], diff --git a/packages/html-reporter/src/icons.tsx b/packages/html-reporter/src/icons.tsx index c3eb471b4d..6111fac7c1 100644 --- a/packages/html-reporter/src/icons.tsx +++ b/packages/html-reporter/src/icons.tsx @@ -70,36 +70,36 @@ export const blank = () => { }; export const externalLink = () => { - return ; + return ; }; export const calendar = () => { - return ; + return ; }; export const person = () => { - return ; + return ; }; export const commit = () => { - return ; + return ; }; export const image = () => { return ; }; export const video = () => { return ; }; export const trace = () => { return ; }; diff --git a/packages/html-reporter/src/testFileView.tsx b/packages/html-reporter/src/testFileView.tsx index a5f9a7a358..184b2b63ba 100644 --- a/packages/html-reporter/src/testFileView.tsx +++ b/packages/html-reporter/src/testFileView.tsx @@ -41,8 +41,8 @@ export const TestFileView: React.FC filter.matches(t)).map(test =>
-
- +
+ {statusIcon(test.outcome)} diff --git a/packages/html-reporter/src/testFilesView.tsx b/packages/html-reporter/src/testFilesView.tsx index 2a783b5ebe..30c80c075b 100644 --- a/packages/html-reporter/src/testFilesView.tsx +++ b/packages/html-reporter/src/testFilesView.tsx @@ -44,11 +44,11 @@ export const TestFilesView: React.FC<{ }, [report, filter]); return <>
- {projectNames.length === 1 && !!projectNames[0] &&
Project: {projectNames[0]}
} - {!filter.empty() &&
Filtered: {filteredStats.total} {!!filteredStats.total && ('(' + msToString(filteredStats.duration) + ')')}
} + {projectNames.length === 1 && !!projectNames[0] &&
Project: {projectNames[0]}
} + {!filter.empty() &&
Filtered: {filteredStats.total} {!!filteredStats.total && ('(' + msToString(filteredStats.duration) + ')')}
}
-
{report ? new Date(report.startTime).toLocaleString() : ''}
-
Total time: {msToString(report?.duration ?? 0)}
+
{report ? new Date(report.startTime).toLocaleString() : ''}
+
Total time: {msToString(report?.duration ?? 0)}
{report && !!report.errors.length && {report.errors.map((error, index) => )} diff --git a/packages/trace-viewer/src/ui/actionList.tsx b/packages/trace-viewer/src/ui/actionList.tsx index e5866ba310..3935447e7d 100644 --- a/packages/trace-viewer/src/ui/actionList.tsx +++ b/packages/trace-viewer/src/ui/actionList.tsx @@ -107,8 +107,8 @@ export const renderAction = ( {(showDuration || showBadges) &&
} {showDuration &&
{time || }
} {showBadges &&
revealConsole?.()}> - {!!errors &&
{errors}
} - {!!warnings &&
{warnings}
} + {!!errors &&
{errors}
} + {!!warnings &&
{warnings}
}
} ; };