Skip to content

Commit

Permalink
feat: unicorn/prefer-trim-start-end for node
Browse files Browse the repository at this point in the history
In preparation for requiring node >= 10, which supports
String#trimStart/trimEnd, prefer these functions in the node
environment.  Leave disabled on other environments until supported by
Firefox LTS.

BREAKING CHANGE: Enable unicorn/prefer-trim-start-end for the node
environment.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
  • Loading branch information
kevinoid committed Feb 1, 2020
1 parent 18a7de7 commit b9b90c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion node.js
Expand Up @@ -25,6 +25,9 @@ module.exports = {

// don't require .flatMap() over .map().flat()
// since .flatMap() only became available in Node 11
"unicorn/prefer-flat-map": "off"
"unicorn/prefer-flat-map": "off",

// prefer String#trimStart/trimEnd to trimLeft/trimRight
"unicorn/prefer-trim-start-end": "error"
}
};
4 changes: 2 additions & 2 deletions rules/unicorn.js
Expand Up @@ -73,8 +73,8 @@ module.exports = {
// these have different behavior and uses
"unicorn/prefer-text-content": "off",

// trimStart/trimEnd are not always available in supported environments
// TODO [engine:node@>=10]: enable for Node, consider for other environments
// don't prefer trimStart/trimEnd to trimLeft/trimRight
// TODO: enable once supported by Firefox ESR
"unicorn/prefer-trim-start-end": "off",

// don't prevent common abbreviations
Expand Down

0 comments on commit b9b90c4

Please sign in to comment.