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.

Add `err` and/or `opts` to the no-param-reassign exclusions?

See original GitHub issue

Hey there.

Most frequent i have problem with this rule. And specifically in cases of options, opts and err. I also seen in #1089 that this rules is disabled for different reasons. What’s your thoughts? Could you consider adding opts and err?

I know that there is a bit better and more proper way for adding to the error instance, for example creating whole new error class based on the original one. But there is simple things like adding some single metadata property.

In my case such metadata is err.commandArgv and err.commandName where commandName isn’t exactly the terminal/unix one, but command of some cli - for example mycli hello so err.commandName will be hello regardless what that command does.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
ljharbcommented, May 17, 2018

Do you actually need the stack trace from the original error? If not, it seems like it’d be better to make a new Error instance; either way, you can do Object.assign(err, { comandName: 'blah' }) and the linter rule won’t complain.

0reactions
tunnckoCorecommented, May 17, 2018

Do you actually need the stack trace from the original error?

Exposing that to third party, so it depends.

and the linter rule won’t complain.

Ahhh, sweet! How i forgot about that? 😸 Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

no-param-reassign - 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 >
How to avoid no-param-reassign when setting a property on a ...
I have a method which's main purpose is to set a property on a DOM object function ( ...
Read more >
no-param-reassign with props, again #719 - airbnb/javascript
This code is O(n) but it violates the no-param-reassign rule on the 3rd line because we mutate one of the function params. Having...
Read more >
Andor_Software_Development_Kit.pdf
The Andor Software Development Kit (SDK) gives the programmer access to the Andor range ... detailing the function syntax, parameters passed and error...
Read more >
Software Guide Software Development Kit V3.15
Add the SDK3 installation directory to the include path for the project. E.g. C:\Program Files\Andor SDK3. 3. Add the appropriate library from the...
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