question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Requesting underscore demarcation for no-unused-vars

See original GitHub issue

The rule no-unused-vars is very useful. However there are times at which its current structure is at odds with other peoples’ APIs.

Consider the case of a page error handler to express.js, whose signature is roughly

app.use(function(err, req, res, next) { ... });

If you want to write a 404 handler that looks at what the actual error was, and sets things on the response, but doesn’t care what the request is (say, maybe you’re making an imgur clone,) then you’re out of luck: there is no way to write that which won’t ring eslint’s bell.

Could eslint be extended to do what erlang does? Prefixing a name with an underscore in erlang suppresses non-use detection. Then we could just name them _req and _next and the problem goes away.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
zckrscommented, Jul 15, 2016

Since 2014 the rule no-unused-vars have news options.

You can use http://eslint.org/docs/rules/no-unused-vars#argsignorepattern

Example in package.json

"eslintConfig": {
    "rules": {
      "no-unused-vars": ["error", { "argsIgnorePattern": "next" }]
    }
  }
0reactions
StoneCyphercommented, Jul 15, 2016

cheers, thanks 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to disable warn about some unused params, but keep ...
Only way that I found is to use ignore pattern argsIgnorePattern in rule options. If your variable is unused, just add underscore _ctx...
Read more >
no-unused-vars - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Fix list for IBM WebSphere Application Server V8.5
IBM WebSphere Application Server provides periodic fixes for the base and Network Deployment editions of release V8.5. The following is a complete listing ......
Read more >
Core Technologies - Spring
As a corner case, it is possible to receive destruction callbacks from a custom scope — for example, for a request-scoped inner bean...
Read more >
Debezium connector for PostgreSQL
This means that the connector does not have the complete history of all changes that ... You initiate an ad hoc snapshot by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found