Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improve interop between prettier and eslint #1212

Merged
merged 2 commits into from
Jan 6, 2025

Conversation

baev
Copy link
Member

@baev baev commented Jan 6, 2025

Context

  • Set quoteProps to "consistent" to match ESLint's quote-props rule.
  • Set avoidEscape to true for ESLint's @stylistic/quotes rule to match Prettier's formatting behavior when dealing with strings with double quote characters inside (e.g., '"foo"="bar"').

ref allure-framework/allure3#29

Checklist

Sorry, something went wrong.

@baev baev requested a review from epszaw January 6, 2025 15:51
@github-actions github-actions bot added theme:mocha Mocha related issue theme:jasmine Jasmine related issue theme:newman theme:codeceptjs labels Jan 6, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
// eslint-disable-next-line @stylistic/quotes
.replace('"', '"')
);
return val.replace(/\n/g, "").replace(/\r/g, "").replace(/"/g, '\"');

Check warning

Code scanning / CodeQL

Replacement of a substring with itself

This replaces '"' with itself.

Copilot Autofix

AI 3 months ago

To fix the problem, we need to change the replacement string from '\"' to '\\"'. This will ensure that double quotes are properly escaped by adding a backslash before them. The change should be made on line 464 of the file packages/newman-reporter-allure/src/index.ts.

Suggested changeset 1
packages/newman-reporter-allure/src/index.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/newman-reporter-allure/src/index.ts b/packages/newman-reporter-allure/src/index.ts
--- a/packages/newman-reporter-allure/src/index.ts
+++ b/packages/newman-reporter-allure/src/index.ts
@@ -463,3 +463,3 @@
   #escape(val: string) {
-    return val.replace(/\n/g, "").replace(/\r/g, "").replace(/"/g, '\"');
+    return val.replace(/\n/g, "").replace(/\r/g, "").replace(/"/g, '\\"');
   }
EOF
@@ -463,3 +463,3 @@
#escape(val: string) {
return val.replace(/\n/g, "").replace(/\r/g, "").replace(/"/g, '\"');
return val.replace(/\n/g, "").replace(/\r/g, "").replace(/"/g, '\\"');
}
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
@baev baev force-pushed the prettier-eslint-interop branch from 9970f50 to d49a524 Compare January 6, 2025 16:00
@baev baev merged commit 731f19f into main Jan 6, 2025
21 checks passed
@baev baev deleted the prettier-eslint-interop branch January 6, 2025 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants