Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e41344f

Browse filesBrowse files
maclover7MylesBorins
authored andcommitted
tools: add docs for prefer-util-format-errors rule
I had a little trouble understanding what the rule was trying to say, so am documenting what would pass/fail. PR-URL: #17376 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
1 parent 7f55f98 commit e41344f
Copy full SHA for e41344f

File tree

Expand file treeCollapse file tree

1 file changed

+5
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-0
lines changed
Open diff view settings
Collapse file

‎tools/eslint-rules/prefer-util-format-errors.js‎

Copy file name to clipboardExpand all lines: tools/eslint-rules/prefer-util-format-errors.js
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ module.exports = {
2626
if (!isArrowFunctionWithTemplateLiteral(msg))
2727
return;
2828

29+
// Checks to see if order of arguments to function is the same as the
30+
// order of them being concatenated in the template string. The idea is
31+
// that if both match, then you can use `util.format`-style args.
32+
// Would pass rule: (a, b) => `${b}${a}`.
33+
// Would fail rule: (a, b) => `${a}${b}`, and needs to be rewritten.
2934
const { expressions } = msg.body;
3035
const hasSequentialParams = msg.params.every((param, index) => {
3136
const expr = expressions[index];

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.