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.

[functional-parameters] ignore pattern option not working with object expressions

See original GitHub issue

Bug 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:closed
  • Created 2 years ago
  • Comments:20

github_iconTop GitHub Comments

1reaction
RebeccaStevenscommented, Nov 13, 2021

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.

0reactions
MrZyr0commented, Nov 23, 2021

Hmmm ok you are right, but it is a problem with this rule anyway 😕

Read more comments on GitHub >

github_iconTop 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 >

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