Skip to content

Commit

Permalink
fix(prettier): enforce prettier rules to pass after ours
Browse files Browse the repository at this point in the history
  • Loading branch information
vvo committed Mar 24, 2017
1 parent b4e7805 commit 5476a88
Show file tree
Hide file tree
Showing 2 changed files with 178 additions and 174 deletions.
180 changes: 6 additions & 174 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,194 +6,26 @@ module.exports = {
node: true,
jest: true,
},
parser: 'babel-eslint',
parser: 'babel-eslint', // https://github.com/babel/babel-eslint#why-use-babel-eslint
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
ecmaFeatures: {
experimentalObjectRestSpread: true,
impliedStrict: true,
jsx: true,
},
sourceType: 'module',
},
plugins: ['react', 'import', 'jest'],
extends: [
'plugin:react/recommended',
'plugin:import/errors',
'plugin:jest/recommended',
'prettier',
'./rules.js',
'prettier', // enforce prettier rules to pass after our rules, so it disables useless rules
'prettier/react',
],
settings: {
'import/extensions': ['.js'],
},
rules: {
// Possible errors
// http://eslint.org/docs/rules/#possible-errors
'no-cond-assign': ['error'],
'no-console': ['error'],
'no-constant-condition': ['error'],
'no-control-regex': ['error'],
'no-debugger': ['error'],
'no-dupe-args': ['error'],
'no-dupe-keys': ['error'],
'no-duplicate-case': ['error'],
'no-empty': ['error'],
'no-empty-character-class': ['error'],
'no-ex-assign': ['error'],
'no-extra-boolean-cast': ['error'],
'no-extra-semi': ['error'],
'no-func-assign': ['error'],
'no-inner-declarations': ['error'],
'no-invalid-regexp': ['error'],
'no-irregular-whitespace': ['error'],
'no-obj-calls': ['error'],
'no-prototype-builtins': ['off'],
'no-regex-spaces': ['error'],
'no-template-curly-in-string': ['error'],
'no-sparse-arrays': ['error'],
'no-unexpected-multiline': ['error'],
'no-unreachable': ['error'],
'no-unsafe-finally': ['error'],
'no-unsafe-negation': ['error'],
'use-isnan': ['error'],
'valid-jsdoc': ['error'],
'valid-typeof': ['error'],

// Best practices
// http://eslint.org/docs/rules/#best-practices
'accessor-pairs': ['error'],
'array-callback-return': ['error'],
'block-scoped-var': ['error'],
'class-methods-use-this': ['off'],
complexity: ['error'],
'consistent-return': ['error'],
curly: ['off'],
'default-case': ['error'],
'dot-location': ['off'],
'dot-notation': ['error'],
eqeqeq: ['error'],
'guard-for-in': ['error'],
'no-alert': ['error'],
'no-caller': ['error'],
'no-case-declarations': ['error'],
'no-div-regex': ['error'],
'no-empty-function': ['off'],
'no-empty-pattern': ['error'],
'no-eq-null': ['error'],
'no-eval': ['error'],
'no-extend-native': ['error'],
'no-extra-bind': ['error'],
'no-extra-label': ['error'],
'no-fallthrough': ['error'],
'no-floating-decimal': ['error'],
'no-global-assign': ['error'],
'no-implicit-coercion': ['error', { string: false }],
'no-implicit-globals': ['error'],
'no-implied-eval': ['error'],
'no-invalid-this': ['off'],
'no-iterator': ['error'],
'no-labels': ['error'],
'no-lone-blocks': ['error'],
'no-loop-func': ['error'],
'no-magic-numbers': ['off'],
'no-multi-spaces': ['error'],
'no-multi-str': ['error'],
'no-new': ['error'],
'no-new-func': ['error'],
'no-new-wrappers': ['error'],
'no-octal': ['error'],
'no-octal-escape': ['error'],
'no-param-reassign': ['off'],
'no-proto': ['error'],
'no-redeclare': ['error'],
'no-return-assign': ['error'],
'no-script-url': ['error'],
'no-self-assign': ['error'],
'no-self-compare': ['error'],
'no-sequences': ['error'],
'no-throw-literal': ['error'],
'no-unmodified-loop-condition': ['error'],
'no-unused-expressions': ['error'],
'no-unused-labels': ['error'],
'no-useless-call': ['error'],
'no-useless-concat': ['error'],
'no-useless-escape': ['error'],
'no-void': ['error'],
'no-warning-comments': ['error'],
'no-with': ['error'],
radix: ['error'],
'vars-on-top': ['error'],
'wrap-iife': ['error'],
yoda: ['error'],

// Strict mode
// http://eslint.org/docs/rules/#strict-mode
strict: ['error', 'never'],

// Variables
// http://eslint.org/docs/rules/#variables
'init-declarations': ['off'],
'no-catch-shadow': ['error'],
'no-delete-var': ['error'],
'no-label-var': ['error'],
'no-restricted-globals': ['error', 'event'],
'no-shadow': ['error'],
'no-shadow-restricted-names': ['error'],
'no-undef': ['error'],
'no-undefined': ['off'],
'no-unused-vars': ['error'],
'no-use-before-define': ['error', { functions: false }],

// Node.js and Common.js
// http://eslint.org/docs/rules/#nodejs-and-commonjs
'callback-return': ['off'],
'global-require': ['off'],
'handle-callback-err': ['error'],
'no-mixed-requires': ['error'],
'no-new-require': ['error'],
'no-path-concat': ['error'],
'no-process-env': ['off'],
'no-process-exit': ['error'],
'no-restricted-modules': ['error'],
'no-sync': ['off'],

// ECMAScript 6
// http://eslint.org/docs/rules/#ecmascript-6
'arrow-body-style': ['error'],
'arrow-parens': ['error', 'as-needed'],
'arrow-spacing': ['error'],
'constructor-super': ['error'],
'generator-star-spacing': ['error'],
'no-class-assign': ['error'],
'no-confusing-arrow': ['off'],
'no-const-assign': ['error'],
'no-dupe-class-members': ['error'],
'no-duplicate-imports': ['error'],
'no-new-symbol': ['error'],
'no-restricted-imports': ['off'],
'no-this-before-super': ['error'],
'no-useless-computed-key': ['error'],
'no-useless-constructor': ['error'],
'no-useless-rename': ['error'],
'no-var': ['error'],
'object-shorthand': ['error'],
'prefer-arrow-callback': ['error'],
'prefer-const': ['error'],
'prefer-reflect': ['off'],
'prefer-rest-params': ['error'],
'prefer-spread': ['error'],
'prefer-template': ['error'],
'require-yield': ['error'],
'rest-spread-spacing': ['error'],
'sort-imports': ['off'],
'symbol-description': ['error'],
'template-curly-spacing': ['error'],
'yield-star-spacing': ['error'],

'react/no-danger': ['off'],
'react/display-name': ['off'],
'react/jsx-key': ['error'],
'import/no-amd': ['error'],
'import/no-commonjs': ['error'],
'import/no-extraneous-dependencies': ['error'],
},
};
172 changes: 172 additions & 0 deletions rules.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
module.exports = {
// Possible errors
// http://eslint.org/docs/rules/#possible-errors
'no-cond-assign': ['error'],
'no-console': ['error'],
'no-constant-condition': ['error'],
'no-control-regex': ['error'],
'no-debugger': ['error'],
'no-dupe-args': ['error'],
'no-dupe-keys': ['error'],
'no-duplicate-case': ['error'],
'no-empty': ['error'],
'no-empty-character-class': ['error'],
'no-ex-assign': ['error'],
'no-extra-boolean-cast': ['error'],
'no-extra-parens': ['error'],
'no-extra-semi': ['error'],
'no-func-assign': ['error'],
'no-inner-declarations': ['error'],
'no-invalid-regexp': ['error'],
'no-irregular-whitespace': ['error'],
'no-obj-calls': ['error'],
'no-prototype-builtins': ['off'],
'no-regex-spaces': ['error'],
'no-template-curly-in-string': ['error'],
'no-sparse-arrays': ['error'],
'no-unexpected-multiline': ['error'],
'no-unreachable': ['error'],
'no-unsafe-finally': ['error'],
'no-unsafe-negation': ['error'],
'use-isnan': ['error'],
'valid-jsdoc': ['error'],
'valid-typeof': ['error'],

// Best practices
// http://eslint.org/docs/rules/#best-practices
'accessor-pairs': ['error'],
'array-callback-return': ['error'],
'block-scoped-var': ['error'],
'class-methods-use-this': ['off'],
complexity: ['error'],
'consistent-return': ['error'],
curly: ['off'],
'default-case': ['error'],
'dot-location': ['off'],
'dot-notation': ['error'],
eqeqeq: ['error'],
'guard-for-in': ['error'],
'no-alert': ['error'],
'no-caller': ['error'],
'no-case-declarations': ['error'],
'no-div-regex': ['error'],
'no-empty-function': ['off'],
'no-empty-pattern': ['error'],
'no-eq-null': ['error'],
'no-eval': ['error'],
'no-extend-native': ['error'],
'no-extra-bind': ['error'],
'no-extra-label': ['error'],
'no-fallthrough': ['error'],
'no-floating-decimal': ['error'],
'no-global-assign': ['error'],
'no-implicit-coercion': ['error', { string: false }],
'no-implicit-globals': ['error'],
'no-implied-eval': ['error'],
'no-invalid-this': ['off'],
'no-iterator': ['error'],
'no-labels': ['error'],
'no-lone-blocks': ['error'],
'no-loop-func': ['error'],
'no-magic-numbers': ['off'],
'no-multi-spaces': ['error'],
'no-multi-str': ['error'],
'no-new': ['error'],
'no-new-func': ['error'],
'no-new-wrappers': ['error'],
'no-octal': ['error'],
'no-octal-escape': ['error'],
'no-param-reassign': ['off'],
'no-proto': ['error'],
'no-redeclare': ['error'],
'no-return-assign': ['error'],
'no-script-url': ['error'],
'no-self-assign': ['error'],
'no-self-compare': ['error'],
'no-sequences': ['error'],
'no-throw-literal': ['error'],
'no-unmodified-loop-condition': ['error'],
'no-unused-expressions': ['error'],
'no-unused-labels': ['error'],
'no-useless-call': ['error'],
'no-useless-concat': ['error'],
'no-useless-escape': ['error'],
'no-void': ['error'],
'no-warning-comments': ['error'],
'no-with': ['error'],
radix: ['error'],
'vars-on-top': ['error'],
'wrap-iife': ['error'],
yoda: ['error'],

// Strict mode
// http://eslint.org/docs/rules/#strict-mode
strict: ['error', 'never'],

// Variables
// http://eslint.org/docs/rules/#variables
'init-declarations': ['off'],
'no-catch-shadow': ['error'],
'no-delete-var': ['error'],
'no-label-var': ['error'],
'no-restricted-globals': ['error', 'event'],
'no-shadow': ['error'],
'no-shadow-restricted-names': ['error'],
'no-undef': ['error'],
'no-undefined': ['off'],
'no-unused-vars': ['error'],
'no-use-before-define': ['error', { functions: false }],

// Node.js and Common.js
// http://eslint.org/docs/rules/#nodejs-and-commonjs
'callback-return': ['off'],
'global-require': ['off'],
'handle-callback-err': ['error'],
'no-mixed-requires': ['error'],
'no-new-require': ['error'],
'no-path-concat': ['error'],
'no-process-env': ['off'],
'no-process-exit': ['error'],
'no-restricted-modules': ['error'],
'no-sync': ['off'],

// ECMAScript 6
// http://eslint.org/docs/rules/#ecmascript-6
'arrow-body-style': ['error'],
'arrow-parens': ['error', 'as-needed'],
'arrow-spacing': ['error'],
'constructor-super': ['error'],
'generator-star-spacing': ['error'],
'no-class-assign': ['error'],
'no-confusing-arrow': ['off'],
'no-const-assign': ['error'],
'no-dupe-class-members': ['error'],
'no-duplicate-imports': ['error'],
'no-new-symbol': ['error'],
'no-restricted-imports': ['off'],
'no-this-before-super': ['error'],
'no-useless-computed-key': ['error'],
'no-useless-constructor': ['error'],
'no-useless-rename': ['error'],
'no-var': ['error'],
'object-shorthand': ['error'],
'prefer-arrow-callback': ['error'],
'prefer-const': ['error'],
'prefer-reflect': ['off'],
'prefer-rest-params': ['error'],
'prefer-spread': ['error'],
'prefer-template': ['error'],
'require-yield': ['error'],
'rest-spread-spacing': ['error'],
'sort-imports': ['off'],
'symbol-description': ['error'],
'template-curly-spacing': ['error'],
'yield-star-spacing': ['error'],

'react/no-danger': ['off'],
'react/display-name': ['off'],
'react/jsx-key': ['error'],
'import/no-amd': ['error'],
'import/no-commonjs': ['error'],
'import/no-extraneous-dependencies': ['error'],
};

0 comments on commit 5476a88

Please sign in to comment.