Skip to content

Commit

Permalink
Upgrade tools and add more rules
Browse files Browse the repository at this point in the history
  • Loading branch information
julienw committed Nov 30, 2017
1 parent 41a62cb commit 14d8c47
Show file tree
Hide file tree
Showing 3 changed files with 155 additions and 108 deletions.
156 changes: 85 additions & 71 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,82 +1,96 @@
module.exports = {
"env": {
"browser": true,
"es6": true,
"node": true
env: {
browser: true,
es6: true,
node: true,
},
"parser": "babel-eslint",
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:flowtype/recommended",
"prettier",
"prettier/flowtype",
"prettier/react"
parser: 'babel-eslint',
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:flowtype/recommended',
'prettier',
'prettier/flowtype',
'prettier/react',
],
"parserOptions": {
"ecmaVersion": "2017",
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
parserOptions: {
ecmaVersion: '2017',
ecmaFeatures: {
experimentalObjectRestSpread: true,
jsx: true,
},
"sourceType": "module"
sourceType: 'module',
},
"plugins": [
"react",
"flowtype",
"import",
"prettier"
],
"rules": {
// ES6 Import rules:
"import/no-duplicates": "error",
"import/no-unresolved": "error",
"import/named": "error",
"prettier/prettier": ["error", { singleQuote: true, trailingComma: "es5" }],
plugins: ['react', 'flowtype', 'import', 'prettier'],
rules: {
// Plugin rules:
'import/no-duplicates': 'error',
'import/no-unresolved': 'error',
'import/named': 'error',
'prettier/prettier': ['error', { singleQuote: true, trailingComma: 'es5' }],
'react/no-access-state-in-setstate': 'error',
'react/no-danger': 'error',
'react/no-did-mount-set-state': 'error',
'react/no-did-update-set-state': 'error',
'react/no-will-update-set-state': 'error',
'react/no-redundant-should-component-update': 'error',
'react/no-typos': 'error',
// `no-unused-prop-types` is buggy when we use destructuring parameters in
// functions as it misunderstands them as functional components.
// See https://github.com/yannickcr/eslint-plugin-react/issues/1561
'react/no-unused-prop-types': 'warn',
'react/no-unused-state': 'error',
'react/prefer-stateless-function': 'error',
'react/prefer-stateless-function': [
'error',
{ ignorePureComponents: true },
],
'react/jsx-no-bind': 'error',

// overriding recommended rules
"no-constant-condition": ["error", { checkLoops: false }],
"no-console": [ "error", { allow: ["log", "warn", "error"] } ],
"no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
'no-constant-condition': ['error', { checkLoops: false }],
'no-console': ['error', { allow: ['log', 'warn', 'error'] }],
'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],

// possible errors
"array-callback-return": "error",
"consistent-return": "error",
"default-case": "error",
"dot-notation": "error",
"eqeqeq": "error",
"for-direction": "error",
"no-alert": "error",
"no-caller": "error",
"no-eval": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-extra-label": "error",
"no-implied-eval": "error",
"no-invalid-this": "error",
"no-return-await": "error",
"no-self-compare": "error",
"no-throw-literal": "error",
"no-unmodified-loop-condition": "error",
"no-unused-expressions": "error",
"no-useless-call": "error",
"no-useless-computed-key": "error",
"no-useless-concat": "error",
"no-useless-constructor": "error",
"no-useless-rename": "error",
"no-useless-return": "error",
"no-var": "error",
"no-void": "error",
"no-with": "error",
"prefer-const": "error",
"prefer-promise-reject-errors": "error",
"prefer-rest-params": "error",
"prefer-spread": "error",
'array-callback-return': 'error',
'consistent-return': 'error',
'default-case': 'error',
'dot-notation': 'error',
eqeqeq: 'error',
'for-direction': 'error',
'no-alert': 'error',
'no-caller': 'error',
'no-eval': 'error',
'no-extend-native': 'error',
'no-extra-bind': 'error',
'no-extra-label': 'error',
'no-implied-eval': 'error',
'no-invalid-this': 'error',
'no-return-await': 'error',
'no-self-compare': 'error',
'no-throw-literal': 'error',
'no-unmodified-loop-condition': 'error',
'no-unused-expressions': 'error',
'no-useless-call': 'error',
'no-useless-computed-key': 'error',
'no-useless-concat': 'error',
'no-useless-constructor': 'error',
'no-useless-rename': 'error',
'no-useless-return': 'error',
'no-var': 'error',
'no-void': 'error',
'no-with': 'error',
'prefer-const': 'error',
'prefer-promise-reject-errors': 'error',
'prefer-rest-params': 'error',
'prefer-spread': 'error',
},
settings: {
react: {
pragma: 'React',
version: '15.0',
flowVersion: '0.54.1',
},
},
"settings": {
"react": {
"pragma": "React",
"version": "15.0"
}
}
};
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@
"babel-preset-react-hmre": "^1.1.1",
"css-loader": "^0.28.7",
"devtools-license-check": "^0.5.0",
"eslint": "^4.6.1",
"eslint": "^4.12.0",
"eslint-config-prettier": "^2.4.0",
"eslint-plugin-flowtype": "^2.35.1",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-flowtype": "^2.39.1",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-prettier": "^2.2.0",
"eslint-plugin-react": "^7.4.0",
"eslint-plugin-react": "^7.5.1",
"express": "^4.15.4",
"fake-indexeddb": "^2.0.3",
"file-loader": "^0.11.2",
Expand Down
Loading

0 comments on commit 14d8c47

Please sign in to comment.