Add setting to disallow "arrow function declarations" at the global/top level
See original GitHub issueI would like to forbid top level function declarations that use arrow syntax. This works using global.
const bad = () => {
console.log('bad');
};
But I would like to allow top level arrow functions present within a function call. I cannot get this to work because these are considered global. I recognize they are indeed global. I would like to carve out an exception here. This issue here blocks me from being able to benefit from this plugin and I am going to have to disable it.
const things = [].map(x => console.log('eh, this is ok, it is in a function call');
Issue Analytics
- State:
- Created 3 years ago
- Comments:18 (8 by maintainers)
Top Results From Across the Web
getify/eslint-plugin-proper-arrows - GitHub
Placing => arrow functions in the global/top-level-module scope has no benefit other than preferred style; they're more proper as regular function declarations.
Read more >Arrow function expressions - JavaScript - MDN Web Docs
An arrow function expression is a compact alternative to a traditional function expression, with some semantic differences and deliberate ...
Read more >Understanding Arrow Functions in JavaScript | DigitalOcean
In this article, you will review function declarations and expressions, learn about the differences between traditional function expressions and ...
Read more >Learning JavaScript functions and how you should use them
Function names are either global or local, depending on whether the function is at the program's top level or nested inside a class,...
Read more >Struggling with TypeScript, React, Eslint and simple Arrow ...
In case you want to support both "arrow-function" & "function-declaration", set the value to an array of strings. Consider my setup as below....
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 Free
Top 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
I debated on what to call it… maybe I made the wrong call here, but I felt like camel-casing would make things more confusing.
This worked exactly how I wanted it to:
This is an error:
This is not an error:
This is not an error:
Thanks!