Skip to content

Commit

Permalink
feat(v2): implement new rules and remove reprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
5im0n committed Feb 18, 2016
1 parent c03870f commit 18801d0
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 30 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"meetic"
],
"peerDependencies": {
"eslint": "2.0.0-alpha-2",
"eslint": "~2.1.0",
"eslint-plugin-angular": "~0.15.0"
},
"devDependencies": {
Expand Down
29 changes: 22 additions & 7 deletions rules/best-practices.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ module.exports = {
rules: {
// Enforces getter/setter pairs in objects
'accessor-pairs': 0,
// Enforces return statements in callbacks of array's methods
'array-callback-return': 2,
// treat var statements as if they were block scoped
'block-scoped-var': 2,
// specify the maximum cyclomatic complexity allowed in a program
Expand All @@ -20,10 +22,10 @@ module.exports = {
curly: [2, 'multi-line', 'consistent'],
// require default case in switch statements
'default-case': 2,
// encourages use of dot notation whenever possible
'dot-notation': [2, { allowKeywords: true }],
// enforces consistent newlines before or after dots
'dot-location': 0,
// encourages use of dot notation whenever possible
'dot-notation': [2, { allowKeywords: true }],
// require the use of === and !==
eqeqeq: 2,
// make sure for-in loops have an if statement
Expand All @@ -32,12 +34,16 @@ module.exports = {
'no-alert': 2,
// disallow use of arguments.caller or arguments.callee
'no-caller': 2,
// Disallow lexical declarations in case/default clauses
'no-case-declarations': 2,
// disallow division operators explicitly at beginning of regular expression
'no-div-regex': 0,
// disallow else after a return in an if
'no-else-return': 2,
// disallow use of labels for anything other then loops and switches
'no-empty-label': 2,
// Disallow empty functions
'no-empty-function': 1,
// disallow use of empty destructuring patterns
'no-empty-pattern': 2,
// disallow comparisons to null without a type-checking operator
'no-eq-null': 2,
// disallow use of eval()
Expand All @@ -46,12 +52,16 @@ module.exports = {
'no-extend-native': 2,
// disallow unnecessary function binding
'no-extra-bind': 2,
// Disallow Unnecessary Labels
'no-extra-label': 2,
// disallow fallthrough of case statements
'no-fallthrough': 2,
// disallow the use of leading or trailing decimal points in numeric literals
'no-floating-decimal': 2,
// disallow the type conversions with shorter notations
'no-implicit-coercion': 1,
// Disallow var and Named Functions in Global Scope
'no-implicit-globals': 2,
// disallow use of eval()-like methods
'no-implied-eval': 2,
// disallow this keywords outside of classes or class-like objects
Expand All @@ -72,16 +82,15 @@ module.exports = {
'no-multi-str': 2,
// disallow reassignments of native objects
'no-native-reassign': 2,
// disallow use of new operator when not part of the assignment or comparison
'no-new': 2,
// disallow use of new operator for Function object
'no-new-func': 2,
// disallows creating new instances of String,Number, and Boolean
'no-new-wrappers': 2,
// disallow use of new operator when not part of the assignment or comparison
'no-new': 2,
// disallow use of (old style) octal literals
'no-octal': 2,
// disallow use of octal escape sequences in string literals, such as
// var foo = 'Copyright \251';
'no-octal-escape': 2,
// disallow reassignment of function parameters
'no-param-reassign': 2,
Expand All @@ -95,14 +104,20 @@ module.exports = {
'no-return-assign': 2,
// disallow use of `javascript:` urls.
'no-script-url': 2,
// disallow assignments where both sides are exactly the same
'no-self-assign': 2,
// disallow comparisons where both sides are exactly the same
'no-self-compare': 2,
// disallow use of comma operator
'no-sequences': 2,
// restrict what can be thrown as an exception
'no-throw-literal': 2,
// Disallow unmodified conditions of loops
'no-unmodified-loop-condition': 1,
// disallow usage of expressions in statement position
'no-unused-expressions': 2,
// Disallow Unused Labels (no-unused-labels)
'no-unused-labels': 2,
// disallow unnecessary .call() and .apply()
'no-useless-call': 2,
// disallow unnecessary concatenation of literals or template literals
Expand Down
18 changes: 13 additions & 5 deletions rules/ecmascript-6.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,20 @@ module.exports = {
'constructor-super': 2,
// Enforce the spacing around the * in generator functions
'generator-star-spacing': [2, 'after'],
// disallow arrow functions where a condition is expected
'no-arrow-condition': 2,
// Disallow arrow functions where they could be confused with comparisons
'no-confusing-arrow': 2,
// Disallow modifying variables of class declarations
'no-class-assign': 2,
// Disallow arrow functions where they could be confused with comparisons
'no-confusing-arrow': 2,
// Disallow modifying variables that are declared using const
'no-const-assign': 2,
// Disallow duplicate name in class members
'no-dupe-class-members': 2,
// disallow use of the new operator with the Symbol object
'no-new-symbol': 2,
// Disallow to use this/super before super() calling in constructors. (off by default)
'no-this-before-super': 2,
// disallow unnecessary constructor
'no-useless-constructor': 2,
// Require let or const instead of var (off by default)
'no-var': 2,
// Require method and property shorthand syntax for object literals (off by default)
Expand All @@ -41,11 +43,17 @@ module.exports = {
'prefer-const': 2,
// Suggest using Reflect methods where applicable
'prefer-reflect': 0,
// Suggest using the rest parameters instead of arguments
'prefer-rest-params': 2,
// Suggest using the spread operator instead of .apply().
'prefer-spread': 2,
// Suggest using template literals instead of strings concatenation
'prefer-template': 2,
// Disallow generator functions that do not have yield
'require-yield': 2
'require-yield': 2,
// Enforce spacing around embedded expressions of template strings
'template-curly-spacing': [2, 'never'],
// Enforce spacing around the * in yield* expressions
'yield-star-spacing': [2, 'before']
}
};
2 changes: 2 additions & 0 deletions rules/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ module.exports = {
'no-path-concat': 2,
// Disallow process.exit() (on by default in the node environment)
'no-process-exit': 2,
// restrict usage of specified node imports
'no-restricted-imports': 0,
// Restrict usage of specified node modules (off by default)
'no-restricted-modules': 0,
// Disallow use of synchronous methods (off by default)
Expand Down
8 changes: 4 additions & 4 deletions rules/possible-errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
// disallow use of console
'no-console': 0,
// disallow use of constant expressions in conditions
'no-constant-condition': 1,
'no-constant-condition': 2,
// disallow control characters in regular expressions
'no-control-regex': 2,
// disallow use of debugger
Expand All @@ -26,10 +26,10 @@ module.exports = {
'no-dupe-keys': 2,
// disallow a duplicate case label.
'no-duplicate-case': 2,
// disallow the use of empty character classes in regular expressions
'no-empty-character-class': 2,
// disallow empty statements
'no-empty': 2,
// disallow the use of empty character classes in regular expressions
'no-empty-character-class': 2,
// disallow assigning to the exception in a catch block
'no-ex-assign': 2,
// disallow double-negation boolean casts in a boolean context
Expand All @@ -55,7 +55,7 @@ module.exports = {
// disallow sparse arrays
'no-sparse-arrays': 2,
// Avoid code that looks like two expressions but is actually one
'no-unexpected-multiline': 1,
'no-unexpected-multiline': 2,
// disallow unreachable statements after a return, throw, continue, or break statement
'no-unreachable': 2,
// disallow comparisons with the value NaN
Expand Down
24 changes: 15 additions & 9 deletions rules/stylistic-issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ module.exports = {
'func-names': 0,
// enforces use of function declarations or expressions
'func-style': [1, 'declaration'],
// blacklist certain identifiers to prevent them being used
'id-blacklist': [2, 'e', 'cb'],
// enforce this rules this option enforces minimum and maximum identifier lengths (variable names, property names etc.)
'id-length': [0, { min: 2, properties: 'never', exceptions: ['i'] }],
// require identifiers to match the provided regular expression
Expand All @@ -40,6 +42,8 @@ module.exports = {
'jsx-quotes': 2,
// enforces spacing between keys and values in object literal properties
'key-spacing': [0, { align: 'colon', beforeColon: false, afterColon: true }],
// enforce spacing before and after keywords
'keyword-spacing': [2, {'before': true, 'after': true, 'overrides': {}}],
// disallow mixed 'LF' and 'CRLF' as linebreaks
'linebreak-style': 1,
// enforces empty lines around comments
Expand All @@ -60,6 +64,8 @@ module.exports = {
'new-parens': 1,
// allow/disallow an empty newline after var statement
'newline-after-var': [0, 'always'],
// enforce newline after each call when chaining the calls
'newline-per-chained-call': [2, { 'ignoreChainWithDepth': 2 }], // TODO
// disallow use of the Array constructor
'no-array-constructor': 2,
// disallow use of bitwise operators
Expand Down Expand Up @@ -94,10 +100,14 @@ module.exports = {
'no-underscore-dangle': 0,
// disallow the use of Boolean literals in conditional expressions
'no-unneeded-ternary': 1,
// disallow whitespace before properties
'no-whitespace-before-property': 2,
// require or disallow padding inside curly braces
'object-curly-spacing': [1, 'always', { objectsInObjects: false, arraysInObjects: true }],
// allow just one var statement per function
'one-var': [2, 'never'],
// require or disallow an newline around variable declarations
'one-var-declaration-per-line': 2,
// require assignment operator shorthand where possible or prohibit it entirely
'operator-assignment': [1, 'always'],
// enforce operators to be placed before or after line breaks
Expand All @@ -110,28 +120,24 @@ module.exports = {
quotes: [2, 'single', 'avoid-escape'],
// require JSDoc comment
'require-jsdoc': 0,
// enforce spacing before and after semicolons
'semi-spacing': [2, { before: false, after: true }],
// require or disallow use of semicolons instead of ASI
semi: [2, 'always'],
// enforce spacing before and after semicolons
'semi-spacing': [2, { before: false, after: true }],
// sort import declarations within module
'sort-imports': 0,
// sort variables within the same declaration block
'sort-vars': 0,
// require a space after certain keywords
'space-after-keywords': [2, 'always'],
// require or disallow space before blocks
'space-before-blocks': 2,
// require or disallow space before function opening parenthesis
'space-before-function-paren': [2, 'never'],
// require a space before certain keywords
'space-before-keywords': [2, 'always'],
// require or disallow spaces inside parentheses
'space-in-parens': [2, 'never'],
// require spaces around operators
'space-infix-ops': 2,
// require a space after return, throw, and case
'space-return-throw-case': 2,
// Require or disallow spaces before/after unary operators
'space-unary-ops': 0,
'space-unary-ops': 2,
// require or disallow a space immediately following the // or /* in a comment
'spaced-comment': [2, 'always', {
exceptions: ['-', '+'],
Expand Down
8 changes: 4 additions & 4 deletions rules/variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ module.exports = {
'no-delete-var': 2,
// disallow labels that share a name with a variable
'no-label-var': 0,
// disallow shadowing of names such as arguments
'no-shadow-restricted-names': 2,
// disallow declaration of variables already declared in the outer scope
'no-shadow': 2,
// disallow use of undefined when initializing variables
'no-undef-init': 2,
// disallow shadowing of names such as arguments
'no-shadow-restricted-names': 2,
// disallow use of undeclared variables unless mentioned in a /*global / block
'no-undef': 2,
// disallow use of undefined when initializing variables
'no-undef-init': 2,
// disallow use of undefined variable
'no-undefined': 0,
// disallow declaration of variables that are not used in the code
Expand Down

0 comments on commit 18801d0

Please sign in to comment.