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.

`func-name-matching`: "never"

See original GitHub issue

Change request: func-name-matching

This rule currently has no options, and requires that function names always match the variable or property to which they are assigned.

I’d like to request the schema be expanded to accept a string: “always” (the default) or “never” (the new one).

“never” would require that the function name differ from the variable or property to which it is assigned.

Per /

I’ll be happy to make a PR for this.

Updated: answers from

The version of ESLint you are using.


The problem you want to solve.

I want to prevent named functions from being stored in variables or properties that match their name - in other words, to force the function name and the container name to be different.

Your take on the correct solution to problem.

An optional string (before the object) that defaults to “always” when omitted, and can be set to “never”.

If you’re requesting a change to a rule, it’s helpful to include this information as well: What you did.

const foo = function foo() {};
const bar = function baz() {};

What you would like to happen.

A warning on the first line only.

What actually happened.

A warning on the second line only (with func-name-matching enabled).

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

platinumazurecommented, Oct 18, 2016

Thanks @ljharb! I will champion this change.

mikesherovcommented, Oct 23, 2016


Read more comments on GitHub >

github_iconTop Results From Across the Web

func-name-matching - 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 >
Reduce smelling code and detect JavaScript issues with ESLint
Problem statement: Smelling Code Have you ever had to fix an error in someone else's code - but you had to reformat the...
Read more >
WebStorm not applying ESLint settings - Stack Overflow
I have the following ESLint configuration in .eslintrc.json file: { "extends": [ "eslint:recommended", "plugin:react-hooks/recommended" ] ...
Read more >
Disallow or enforce spaces inside of blocks after opening ...
This rule has a string option: "always" (default) requires one or more spaces; "never" disallows spaces. always. Examples of incorrect code for ...
Read more >
/.eslintrc.yml | value_schema@v0.5.0 | Deno
... error array-bracket-spacing: - error - never array-callback-return: error ... for-direction: error func-call-spacing: error func-name-matching: error ...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found