This repository has been archived by the owner on Mar 23, 2024. It is now read-only.
v2.6.0
Version 2.6.0 (11-18-2015):
Thanks to @seanpdoyle, we're able to move some of the ES6 rules from the ember-suave preset to JSCS!
New Rules
disallowVar
(Sean Doyle)
Disallows declaring variables with var
.
"disallowVar": true
// Valid
let foo;
const bar = 1;
// Invalid
var baz;
You can also use "disallowKeywords": ["var"]
requireArrayDestructuring
(Sean Doyle)
Requires that variable assignment from array values are destructured.
"requireArrayDestructuring": true
// Valid
var colors = ['red', 'green', 'blue'];
var [ red ] = colors;
// Invalid
var colors = ['red', 'green', 'blue'];
var red = colors[0];
requireEnhancedObjectLiterals
(Sean Doyle)
Requires declaring objects via ES6 enhanced object literals (shorthand versions of properties)
"requireEnhancedObjectLiterals": true
var obj = {
foo() { },
bar
};
var obj = {
foo: function() { },
bar: bar
};
requireObjectDestructuring
(Sean Doyle)
Requires variable declarations from objects via destructuring
"requireObjectDestructuring": true
// Valid
var { foo } = SomeThing;
var { bar } = SomeThing.foo;
// Invalid
var foo = SomeThing.foo;
var bar = SomeThing.foo.bar;
disallowSpacesInGenerator
(Francisc Romano)
Checks the spacing around the *
in a generator function.
"disallowSpacesInGenerator": {
"beforeStar": true,
"afterStar": true
}
var x = function*() {};
function*a() {};
var x = async function*() {};
New Rule Options
requireCamelCaseOrUpperCaseIdentifiers
: addstrict
option (Jan-Pieter Zoutewelle)
Also forces the first character to not be capitalized.
"requireCamelCaseOrUpperCaseIdentifiers": {
"strict": true
}
// Valid
var camelCase = 0;
var UPPER_CASE = 4;
// Invalid
var Mixed_case = 2;
var Snake_case = { snake_case: 6 };
var snake_case = { SnakeCase: 6 };
disallowSpace(After|Before)Comma
: addallExcept: ['sparseArrays']
(Brian Dixon)validateQuoteMarks
: add "ignoreJSX" value (Oleg Gaidarenko)requireMatchingFunctionName
: addincludeModuleExports
option (George Chung)
Fixes
- Account for sparse arrays in rules with spacing and commas (Brian Dixon)
requireSpaceBeforeBinaryOperators
: report "operator =" correctly when erroring (Rob Wu)requireAlignedMultilineParams
: do not throw on function without body (Oleg Gaidarenko)
Preset Changes
WordPress
: addrequireBlocksOnNewLines
(Gary Jones)