[functional-parameters] ignore pattern option not working with object expressions
See original GitHub issueBug Report
I am trying to use the functional-parameters rule in a Nuxt.Js 2 project.
As you may know, Vue.Js (on which Nuxt.Js is based) provides functions for its lifecycle like mounted()
.
Expected behavior
These functions will have no parameters in most cases, so I have to ignore them.
Actual behavior
Unfortunately, despite many attempts, I was unable to ignore them.
Steps to reproduce
Here is the last configuration I tried for the rule:
{
"rules": {
"functional/functional-parameters": [
"error",
{
"ignorePattern": [
"^mounted$",
"^created$",
"^unmount$",
"^unmounted$",
"^beforeDestroy$",
"^destroy$",
"^updated$",
"^beforeUpdate$",
"^onBeforeUpdate$",
"^onUpdated$",
"^onMounted$"
]
}
]
}
}
Proposed changes
- [ ] Fix
ignorePattern
property for this rule - Propose some ignorance models according to frameworks in the documentation
Issue Analytics
- State:
- Created 2 years ago
- Comments:20
Top Results From Across the Web
Optional chaining (?.) - JavaScript - MDN Web Docs - Mozilla
This results in shorter and simpler expressions when accessing chained properties when the possibility exists that a reference may be missing.
Read more >Discards - unassigned discardable variables
Discards make the intent of your code clear. A discard indicates that our code never uses the variable.
Read more >Pattern syntax
Use the ellipsis operator to search for function calls or function calls with specific arguments. For example, the pattern insecure_function(.
Read more >re — Regular expression operations — Python 3.11.1 ...
The solution is to use Python's raw string notation for regular expression patterns; backslashes are not handled in any special way in a...
Read more >Regular Expressions
When you program against the grain of the problem, much code is needed.' ... Both of those regular expression objects represent the same...
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
Ah, if you’re not using typescript then you can’t use the
ignoreVoid
option. That option requires type information in order to identify what functions are void returning functions. You’ll need to manually specify the names of all the functions when just using JavaScript.Hmmm ok you are right, but it is a problem with this rule anyway 😕