Skip to content

Commit

Permalink
feat: add rules from eslint 4.0.0 and upgrade eslint
Browse files Browse the repository at this point in the history
BREAKING CHANGE:

Old code may cause errors with this new configuration

Use version 13.0.0 for eslint 3.x
  • Loading branch information
lydell authored and keithamus committed Jul 7, 2017
1 parent d3397b5 commit 44e5c5d
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 14 deletions.
68 changes: 55 additions & 13 deletions es5.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ module.exports = {
// # Possible Errors
// The following rules point out areas where you might have made mistakes.

// enforce “for” loop update clause moving the counter in the right direction
'for-direction': 2,
// disallow comparing against -0
'no-compare-neg-zero': 2,
// disallow assignment in conditional expressions
Expand Down Expand Up @@ -112,7 +114,7 @@ module.exports = {
// enforces consistent newlines before or after dots
'dot-location': [
2,
// require the dot to be on the same line as the property
// require the dot to be on the same line as the property
'property',
],
// encourages use of dot notation whenever possible
Expand Down Expand Up @@ -308,7 +310,7 @@ module.exports = {
// enforce or disallow variable initializations at definition
'init-declarations': [
2,
// always expect variables to be assigned upon initialisation
// always expect variables to be assigned upon initialisation
'always',
],
// disallow the catch clause parameter name being the same as a variable in the
Expand Down Expand Up @@ -349,9 +351,11 @@ module.exports = {
// enforces error handling in callbacks
'handle-callback-err': [
2,
// name of error argument
// name of error argument
'^.*(e|E)rr(or)?$',
],
// disallow use of the Buffer() constructor
'no-buffer-constructor': 2,
// disallow mixing regular variable and require declarations
'no-mixed-requires': 2,
// disallow use of new operator with the require function
Expand All @@ -370,11 +374,27 @@ module.exports = {
// # Stylistic Issues
// These rules are purely matters of style and are quite subjective.

// enforce line breaks after opening and before closing array brackets
'array-bracket-newline': [
2,
{
// require line breaks if there are line breaks inside elements or between elements
'multiline': true,
},
],
// enforce spacing inside array brackets
'array-bracket-spacing': [
2,
'always',
],
// enforce line breaks between array elements
'array-element-newline': [
2,
{
// require line breaks if there are line breaks inside elements
'multiline': true,
},
],
// disallow or enforce spaces inside of single line blocks
'block-spacing': [
2,
Expand Down Expand Up @@ -515,7 +535,7 @@ module.exports = {
// specify whether double or single quotes should be used in JSX attributes
'jsx-quotes': [
2,
// Always prefer double quotes
// Always prefer double quotes
'prefer-double',
],
// enforces spacing between keys and values in object literal properties
Expand Down Expand Up @@ -557,11 +577,6 @@ module.exports = {
'beforeLineComment': false,
},
],
// require or disallow newlines around directives
'lines-around-directive': [
2,
'always',
],
// specify the maximum depth that blocks can be nested
'max-depth': [
2,
Expand Down Expand Up @@ -610,10 +625,6 @@ module.exports = {
],
// disallow the omission of parentheses when invoking a constructor with no arguments
'new-parens': 2,
// allow/disallow an empty newline after var statement
'newline-after-var': 0,
// require an empty line before return statements
'newline-before-return': 0,
// enforce newline after each call when chaining the calls
'newline-per-chained-call': [
2,
Expand Down Expand Up @@ -707,6 +718,21 @@ module.exports = {
// enforce them to be "always" used when possible, or "never" used
'never',
],
// require or disallow padding lines between statements
'padding-line-between-statements': [
2,
// equire blank lines after all directive prologues, like the deprecated lines-around-directive rule
{
'blankLine': 'always',
'prev': 'directive',
'next': '*',
},
{
'blankLine': 'any',
'prev': 'directive',
'next': 'directive',
},
],
// require quotes around object literal property names
'quote-props': 0,
// specify whether double or single quotes should be used
Expand All @@ -727,6 +753,12 @@ module.exports = {
'after': true,
},
],
// enforce location of semicolons
'semi-style': [
2,
// enforce that semicolons are at the end of statements
'last',
],
// require or disallow use of semicolons instead of ASI
'semi': [
2,
Expand Down Expand Up @@ -771,6 +803,16 @@ module.exports = {
'exceptions': ['*'],
},
],
// enforce spacing around colons of switch statements
'switch-colon-spacing': [
2,
{
// require one or more spaces after colons
'after': true,
// disallow before colons
'before': false,
},
],
// require or disallow spacing between template tags and their literals
'template-tag-spacing': 2,
// require or disallow the Unicode Byte Order Mark (BOM)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
}
},
"dependencies": {
"eslint": "^3.17.0",
"eslint": "^4.1.1",
"eslint-plugin-filenames": "^1.1.0"
},
"devDependencies": {
Expand Down

0 comments on commit 44e5c5d

Please sign in to comment.