-
Couldn't load subscription status.
- Fork 3
autofixes from prettier and eslint --write
#425
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
base: bencmbrook/upgrade-pretter-eslint-node
Are you sure you want to change the base?
autofixes from prettier and eslint --write
#425
Conversation
prettier and eslint --write
| export function extractClientError(err: string): string | null { | ||
| return CLIENT_ERROR.test(err) ? CLIENT_ERROR.exec(err)![1] : null; | ||
| export function extractClientError(error: string): string | null { | ||
| return CLIENT_ERROR.test(error) ? CLIENT_ERROR.exec(error)![1] : null; |
Check failure
Code scanning / CodeQL
Polynomial regular expression used on uncontrolled data High
regular expression
library input
| export function extractClientError(err: string): string | null { | ||
| return CLIENT_ERROR.test(err) ? CLIENT_ERROR.exec(err)![1] : null; | ||
| export function extractClientError(error: string): string | null { | ||
| return CLIENT_ERROR.test(error) ? CLIENT_ERROR.exec(error)![1] : null; |
Check failure
Code scanning / CodeQL
Polynomial regular expression used on uncontrolled data High
regular expression
library input
| [key.replace(/[^a-z_.+\-A-Z -~]/g, '')]: value, | ||
| (accumulator, [key, value]) => | ||
| Object.assign(accumulator, { | ||
| [key.replaceAll(/[^a-z_.+\-A-Z -~]/g, '')]: value, |
Check warning
Code scanning / CodeQL
Overly permissive regular expression range Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 3 months ago
To fix the issue, we need to rewrite the regular expression to avoid overlapping ranges while maintaining its intended functionality. The range -~ should be replaced with a more explicit and non-overlapping set of characters. Since the regex appears to target printable ASCII characters, we can explicitly list the allowed characters without relying on overlapping ranges. This will make the regex clearer and easier to maintain.
The updated regex will explicitly include:
- Lowercase letters (
a-z) - Uppercase letters (
A-Z) - Digits (
0-9) - Specific symbols (
_.+-and space)
The corrected regex will be /[^a-zA-Z0-9_.+\- ]/g.
-
Copy modified line R31
| @@ -30,3 +30,3 @@ | ||
| Object.assign(accumulator, { | ||
| [key.replaceAll(/[^a-z_.+\-A-Z -~]/g, '')]: value, | ||
| [key.replaceAll(/[^a-zA-Z0-9_.+\- ]/g, '')]: value, | ||
| }), |
PR stack:
main
<--#427 (eslint and prettier config changes)<--#425 (auto-formatting from config changes)<--#426 (manual fixes which actually are code changes)Related Issues
Security Implications
[none]
System Availability
[none]