Closed fabicious closed 9 years ago
:+1: I created a failing test case for this in my fork which demonstrates the issue: https://github.com/iVantage/jscodesniffer/commit/df7af3c1899ed104d32b7c5d4a312b9825fadd0a. Are there any updates on this? If not I'll try to take a look at it when I get the chance.
+1 for the "1 whitespace between every argument. But not before the first argument and not after the last argument"
Check in the rule set you provide - you specify explicitly what nodes you mean for the exceptions:
"for": [ "FunctionExpression", "ArrayExpression", "ObjectExpression" ]
Arguments of your example o not match any of these:
$(selector).css("width", final + "px");
selector
is Identifier
"width"
- Literal
final + "px"
- BinaryExpression
By http://esprima.org/demo/parse.html
I've just deployed jscodesniffer 2.1.14 where you can simply omit "for"
"ArgumentsSpacing": {
"allowArgPrecedingWhitespaces": 1,
"allowArgTrailingWhitespaces": 0,
"exceptions": {
"singleArg": {
"allowArgPrecedingWhitespaces": 0,
"allowArgTrailingWhitespaces": 0
},
"firstArg": {
"allowArgPrecedingWhitespaces": 0
},
"lastArg": {
"allowArgTrailingWhitespaces": 0
}
}
}
See my test https://github.com/dsheiko/jscodesniffer/blob/master/test/try.js
mocha test/try.js
Hi there,
I'm trying to use my own coding-standard but the exceptions of ArgumentsSpacing and ParametersSpacing aren't working. Here ´'s the rule:
And this line creates following error:
What I want is: 1 whitespace between every argument. But not before the first argument and not after the last argument. That implies no whitespaces before and after a single argument too.
Thanks for help!