Add method option for space-before-function-paren
See original GitHub issueProposal:
Add a new method
option for the space-before-function-paren
rule to specify whether a method on a class should have a space following it.
Reason:
A common coding style for ES2015 is to never add a space after a named function (ie: function name()
), but to still always add a space after a class method name, (ie: class A { constructor () {} }
).
This style is currently not possible to enforce, since methods get lumped in with all named functions.
ESLint Version Tested: 1.10.1
Documentation Example:
/*eslint space-before-function-paren: [2, { "anonymous": "always", "named": "never", "method": "always" }]*/
/*eslint-env es6*/
function foo () { /*error Unexpected space before function parentheses.*/
// ...
}
var bar = function() { /*error Missing space before function parentheses.*/
// ...
};
class Foo {
constructor() { /*error Missing space before method parentheses.*/
// ...
}
}
var foo = {
bar () { /*error Unexpected space before function parentheses.*/
// ...
}
};
<bountysource-plugin>
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource. </bountysource-plugin>
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
space-before-function-paren - 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 >VS Code - space before function parentheses - Stack Overflow
In VS Code open File -> Preferences -> Settings; Add to your JSON config: "javascript.format.insertSpaceBeforeFunctionParenthesis": true.
Read more >Rule: space-before-function-paren - Palantir Open Source
One argument which is an object which may contain the keys anonymous , named , and asyncArrow These should be set to either...
Read more >space-before-function-paren - TypeScript ESLint
space -before-function-paren ... We strongly recommend you do not use this rule or any other formatting linter rules. Use a separate dedicated formatter...
Read more >space-before-function-paren rule in WebStorm
The ESLint space-before-function-paren rule forbits space before function parentheses. Using the settings below: when formatting this...
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
@iglvzx you want no-spaced-func (func-call-spacing will replace it in the next minor release)
@btmills Thanks!