Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

v2.9.0

Compare
Choose a tag to compare
@hzoo hzoo released this 25 Jan 15:54
· 278 commits to master since this release

Version 2.9.0 (2015-01-23):

Changed the changelog date format to be YYYY-MM-DD.

Whoo a release during this blizzard! Hopefully, this will be our last release before we start pushing out pre-release versions of 3.0. (If necessary, we can push bug fixes to 2.x)

The plan:

  • Push the 2.9.0 release
  • Create a 2.x branch off of master
  • Switch master to be the 3.0 branch
  • Merge in 2.x changes + cleanup stuff for a 3.0 alpha release.
  • Do what we can in our 3.0 milestone. We would really appreciate any help!
    • Especially for deprecating rules/options, rule merging, renames/inconsistencies that we don't catch.

New Rules

requireCapitalizedConstructorsNew (Alexander O'Mara)

// Description: Requires capitalized constructors to to use the `new` keyword

// Usage
"requireCapitalizedConstructors": {
  "allExcept": ["somethingNative"]
}

// Valid
var x = new Y();
var x = new somethingNative(); // exception

// Invalid
var x = Y();

Rule Updates

// can turn
var a = [0,
1,
2];

// into
var a = [
0,
1,
2
];

This was @joerideg's first PR, so congrats and hope to see more contributions (not necessarily here)!

I think we would need a seperate rule to both check/fix alignment properly.

class A {
  prop; // will add a semicolon here
  prop2 = 1; // and here
}
  • requireCamelCaseOrUpperCaseIdentifiers: add extra options allowedPrefixes, allowedSuffixes, allExcept
    • This lets you specify a permitted array of String, RegExp, or ESTree RegExpLiteral values

For options: { allowedSuffixes: ["_dCel", {regex:{pattern:"_[kMG]?Hz"}}] }

// Extra valid options
var camelCase_dCel = 5;
var _camelCase_MHz = 6;
// Invalid
var camelCase_cCel = 4;
var CamelCase_THz = 5;
// Valid for requireNewlineBeforeBlockStatements
switch (a)
{
  case 1: break;
}

// Valid for disallowNewlineBeforeBlockStatements
switch (a) {
  case 1: break;
}

Presets

  • airbnb: Enforce rule 25.1 (Joe Bartlett)
    • This adds requireDollarBeforejQueryAssignment
  • airbnb: Enforce rule 7.11 (Joe Bartlett)
    • This fixes up function spacing issues (autofixable)
  • google: Enforce naming rules
    • This adds "requireCamelCaseOrUpperCaseIdentifiers": { "allowedPrefixes": ["opt_"], "allExcept": ["var_args"] }

Bug Fixes

Misc