Repository navigation
tools: some eslint rules proposals #14253
Description
Activity
- addedmetaIssues and PRs related to the general management of the project.Issues and PRs related to the general management of the project.toolsIssues and PRs related to the tools directory.Issues and PRs related to the tools directory.
on Jul 15, 2017 Ref: #10129
Reacted by Vse Mozhe Buty and Refael Ackermannno-unused-vars: ['error', {args: 'after-used'}]
FWIW,
{args: 'after-used'}is the default, so it can just be:no-unused-vars: error.Reacted by Vse Mozhe Buty and Refael Ackermann@Trott Yes, I've used some defaults to be more explicit. Some rules can be shortened.
Reacted by Rich Trott- addeddiscussIssues opened for discussion and feedback.Issues opened for discussion and feedback.
on Jul 15, 2017 +1 to
no-unused-vars, but I'd suggest these options:{args: all, argsIgnorePattern: ^_, varsIgnorePattern: ^_}This way, one can just underscore-prefix unused variabled in function arguments or during destructuring:
doSomething((_unused, used) => {}); const [_unused, used] = doSomething();
Reacted by Refael Ackermann@silverwind With
varsIgnorePatternwe can miss some unused "internal" variables outside of destructuring, while in destructuring we can simply omit the unused variables:const [, , file] = process.argv;
But I am OK with this decision if there are some +1.
Any chance of adopting StandardJS? Avoids lots of stylistic bikeshedding. Many projects use it nowadays. As one example, migration was relatively painless for NPM (npm/npm#9954). The auto-formatter has improved since then, though it may not be perfect.
Reacted by Colin Ihrig and Ruben BridgewaterReacted by Refael Ackermann@sebdeckers I doubt we will have consensus about "no semicolons" or "space after function name" :) The churn will be tremendous :)
Reacted by Anna Henningsen, Rich Trott, Michaël Zasso, Oleksii Orlenko, Colin Ihrig, Gibson Fahnestock and Ruben BridgewaterIt seems this has not got enough approvement and can be closed for now. Feel free to reopen if something changes.
+1 to no-unused-vars, but I'd suggest these options:
{args: all, argsIgnorePattern: ^, varsIgnorePattern: ^}
@vsemozhetbyt I think
no-unused-varson it's own will get wider support (personally I likeallwith an^_+$ignore pattern)
Recently some big PRs with churn was mostly rejected or gave sporadic -1, so these are some preliminarily proposals to check the opinions before investing time.
Rule: http://eslint.org/docs/rules/no-unused-vars
Proposal:
Hits:
Refs: tools: delete an unused argument #14251
Rule: http://eslint.org/docs/rules/prefer-arrow-callback
Proposal:
Hits:
Rule: http://eslint.org/docs/rules/prefer-destructuring
Proposal:
Hits:
If there is some consensus for any proposal, it can be used as a starting point for code-and-learn or similar events.
If some or all approved proposals are not appropriate for code-and-learn, I can do any or all if there are volunteers to review.