func-names does not report default exported function
See original GitHub issueTell us about your environment
- ESLint Version: 6.3.0
- Node Version: 12
What parser (default, Babel-ESLint, etc.) are you using? default
Please show your full configuration:
func-names: [2, "always"]
or
func-names: [2, "as-needed"]
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
/* eslint func-names: [2, 'as-needed'] */
// or 'always'
export default function () {}
What did you expect to happen? Unnamed function to be reported.
What actually happened? Please include the actual, raw output from ESLint. No error is reported.
Are you willing to submit a pull request to fix this bug? Yes please.
Notes
The main purpose of func-names is to avoid unhelpful names like “anonymous” popping up in stack trace or profiling chart. In the case of unnamed default export, the function names will be _default
for babel transformed code, or default
for node 12 experimental modules. These names are uninformative for debugging. So func-names should report this case.
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (11 by maintainers)
I prefer changing the default behavior on 7.0.0. I’m not sure if there are the cases we use the options.
I think it would be best to treat this as a breaking change or create an option, personally- just in case. I can see the case for it being a bug, but I’m concerned about potential large impact.