Skip to content

Commit

Permalink
Revert "Chore: rewrite parseListConfig for a small perf gain." (#9325)
Browse files Browse the repository at this point in the history
* Revert "4.7.0"

This reverts commit 439e8e6.

* Revert "Build: changelog update for 4.7.0"

This reverts commit 2ec62f9.

* Revert "Upgrade: Espree v3.5.1 (fixes #9153) (#9314)"

This reverts commit 787b78b.

* Revert "Update: run rules after `node.parent` is already set (fixes #9122) (#9283)"

This reverts commit 1488b51.

* Revert "Docs: fix wrong config in max-len example. (#9309)"

This reverts commit 4431d68.

* Revert "Chore: Revert "avoid handling Rules instances in config-validator" (#9295)"

This reverts commit 9d1df92.

* Revert "Docs: Fix code snippet to refer to the correct option (#9313)"

This reverts commit 7d24dde.

* Revert "�Chore: rewrite parseListConfig for a small perf gain. (#9300)"

This reverts commit 12388d4.
  • Loading branch information
aladdin-add authored and ilyavolodin committed Sep 18, 2017
1 parent 439e8e6 commit 9226495
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/linter.js
Expand Up @@ -146,15 +146,17 @@ function parseJsonConfig(string, location) {
*/
function parseListConfig(string) {
const items = {};
const reg = /[\w\-/]+/g;
const elementMatches = string.match(reg);

if (elementMatches) {
elementMatches.forEach(name => {
items[name] = true;
});
}
// Collapse whitespace around ,
string = string.replace(/\s*,\s*/g, ",");

string.split(/,+/).forEach(name => {
name = name.trim();
if (!name) {
return;
}
items[name] = true;
});
return items;
}

Expand Down

0 comments on commit 9226495

Please sign in to comment.