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: combine multiple RegEx replaces with one #6669

Closed
thefourtheye opened this issue Jul 13, 2016 · 3 comments
Closed

chore: combine multiple RegEx replaces with one #6669

thefourtheye opened this issue Jul 13, 2016 · 3 comments
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion chore This change is not user-facing core Relates to ESLint's core APIs and features

Comments

@thefourtheye
Copy link
Contributor

What version of ESLint are you using?

latest master

What parser (default, Babel-ESLint, etc.) are you using?

N/A

Please show your full configuration:

N/A

What did you do? Please include the actual source code causing the issue.

N/A

What did you expect to happen?

N/A

What actually happened? Please include the actual, raw output from ESLint.

N/A


I would like to propose a small improvement in the way boolean configuration values are
processed. As it is, there are two RegEx based replacements happening to clean up whitespaces
around :, and ,, here

    // Collapse whitespace around : to make parsing easier
    string = string.replace(/\s*:\s*/g, ":");

    // Collapse whitespace around ,
    string = string.replace(/\s*,\s*/g, ",");

That can actually be simplified into a single RegEx based replace, like this

    string = string.replace(/\s*([:,])\s*/g, "$1");
@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Jul 13, 2016
@thefourtheye
Copy link
Contributor Author

thefourtheye commented Jul 13, 2016

The proposed fix improvement is in #6661

@platinumazure platinumazure added core Relates to ESLint's core APIs and features evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion chore This change is not user-facing and removed triage An ESLint team member will look at this issue soon labels Jul 13, 2016
@platinumazure
Copy link
Member

Thanks for writing an issue! I'd love to see the proposed PR land. 👍

@ilyavolodin
Copy link
Member

Since this is a very minor issue, marking as accepted.

@ilyavolodin ilyavolodin added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Jul 15, 2016
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion chore This change is not user-facing core Relates to ESLint's core APIs and features
Projects
None yet
Development

No branches or pull requests

4 participants