Closed lancecaraccioli closed 8 years ago
Intent: to force function definitions to have a space after the keyword "function"
.jscsrc
"preset": "google", "requireSpaceAfterKeywords": true
example.js
(function() { console.log('foo'); }());
run auto fix
jscs --fix ./example.js
cat ./example.js results
(function () { console.log('foo'); }());
running auto fix again results in the fix being reverted
.jscsrc workaround gives the expected behaviour
{ "preset": "google", "disallowSpacesInAnonymousFunctionExpression": null, "disallowSpacesInFunctionExpression": null, "disallowSpacesInFunctionDeclaration": null, "requireSpacesInFunctionExpression": null, "requireSpaceAfterKeywords": true }
Well, yeah, requireSpaceAfterKeywords conflicts with pre-defined rules in google preset, so you need to disable them.
requireSpaceAfterKeywords
google
And since their conflict with each other, --fix will always give different output
--fix
Intent: to force function definitions to have a space after the keyword "function"
.jscsrc
example.js
run auto fix
cat ./example.js results
running auto fix again results in the fix being reverted
cat ./example.js results
.jscsrc workaround gives the expected behaviour