Add `err` and/or `opts` to the no-param-reassign exclusions?
See original GitHub issueHey 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:
- Created 5 years ago
- Comments:5
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.Exposing that to third party, so it depends.
Ahhh, sweet! How i forgot about that? 😸 Thanks.