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

SyntaxError: Invalid flags supplied to RegExp constructor 'x' #16

Closed
cw-alexcroteau opened this issue Sep 1, 2022 · 2 comments
Closed
Labels
bug Something isn't working external This issue lies upstream fixed This issue has been fixed

Comments

@cw-alexcroteau
Copy link

Because of a change in the upstream repo's Adblock Plus filter list, it looks like the PCRE conversion script detects a "x" flag. I am not able to produce a minimal reproduction of the issue, other than this stack trace:

(node:32624) UnhandledPromiseRejectionWarning: SyntaxError: Invalid flags supplied to RegExp constructor 'x'
    at RegExp (<anonymous>)
    at pcre (/home/alex/projects/code/node_modules/linguist-js/dist/helpers/convert-pcre.js:26:12)
    at /home/alex/projects/code/node_modules/linguist-js/dist/index.js:301:97
    at Array.some (<anonymous>)
    at analyse (/home/alex/projects/code/node_modules/linguist-js/dist/index.js:301:54)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async /home/alex/projects/code/node_modules/linguist-js/dist/cli.js:55:22
(Use `node --trace-warnings ...` to show where the warning was created)
(node:32624) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:32624) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
@Nixinova Nixinova added the bug Something isn't working label Sep 3, 2022
@Nixinova
Copy link
Owner

Nixinova commented Sep 3, 2022

Thanks for the report!
Yep, that PR added this line:
https://github.com/github/linguist/blob/e78ef71af3600f96b9a40a06511ebbe3797e7401/lib/linguist/heuristics.yml#L655
The crash is due to LinguistJS not having a conversion process for the (?x) flag.
I'll fix it and have a patch release out today 👍

@Nixinova Nixinova added the fixed This issue has been fixed label Sep 3, 2022
@Nixinova
Copy link
Owner

Nixinova commented Sep 3, 2022

Should be fixed in v2.5.3 👍

@Nixinova Nixinova added compatibility Compatibility with GitHub Linguist external This issue lies upstream and removed compatibility Compatibility with GitHub Linguist labels Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working external This issue lies upstream fixed This issue has been fixed
Projects
None yet
Development

No branches or pull requests

2 participants