jscs v2.9.0 Release Notes

Release Date: 2016-01-23 // over 8 years ago
  • 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