Skip to content

Instantly share code, notes, and snippets.

@agrcrobles
Last active December 22, 2017 05:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agrcrobles/5bca1ccb6268829f7594cfc2c93e6d8c to your computer and use it in GitHub Desktop.
Save agrcrobles/5bca1ccb6268829f7594cfc2c93e6d8c to your computer and use it in GitHub Desktop.
My eslintrc favourite configuration! :)
module.exports = {
parser: require.resolve("babel-eslint"),
env: {
es6: true
},
parserOptions: {
sourceType: "module",
ecmaFeatures: {
jsx: true
}
},
extends: [
require.resolve("eslint-config-prettier"),
require.resolve("eslint-config-prettier/flowtype"),
require.resolve("eslint-config-prettier/react")
],
plugins: ["flowtype", "import", "jest", "prettier", "react"],
rules: {
"constructor-super": "error",
"no-case-declarations": "error",
"no-class-assign": "error",
"no-cond-assign": "error",
"no-const-assign": "error",
"no-constant-condition": "error",
"no-control-regex": "error",
"no-delete-var": "error",
"no-dupe-args": "error",
"no-dupe-class-members": "error",
"no-dupe-keys": "error",
"no-duplicate-case": "error",
"no-empty": "error",
"no-empty-character-class": "error",
"no-empty-pattern": "error",
"no-ex-assign": "error",
"no-extra-boolean-cast": "error",
"no-extra-semi": "error",
"no-fallthrough": "error",
"no-func-assign": "error",
"no-global-assign": "error",
"no-inner-declarations": "error",
"no-invalid-regexp": "error",
"no-new-symbol": "error",
"no-obj-calls": "error",
"no-octal": "error",
"no-redeclare": "error",
"no-regex-spaces": "error",
"no-self-assign": "error",
"no-sparse-arrays": "error",
"no-this-before-super": "error",
"no-unexpected-multiline": "error",
"no-unreachable": "error",
"no-unsafe-finally": "error",
"no-unsafe-negation": "error",
"no-unused-labels": "error",
"no-unused-vars": "warn",
"require-yield": "error",
"use-isnan": "error",
"valid-typeof": "error",
"flowtype/boolean-style": ["error", "boolean"],
"flowtype/define-flow-type": "error",
"flowtype/no-dupe-keys": "error",
"flowtype/no-primitive-constructor-types": "error",
"flowtype/no-weak-types": "off",
"flowtype/require-parameter-type": "off",
"flowtype/require-return-type": "off",
"flowtype/require-valid-file-annotation": "error",
"flowtype/require-variable-type": "off",
"flowtype/sort-keys": "off",
"flowtype/type-id-match": "off",
"flowtype/use-flow-type": "error",
"flowtype/valid-syntax": "error",
"import/no-unresolved": "error",
"import/named": "error",
"import/default": "off",
"import/namespace": "off",
"import/export": "error",
"import/no-named-as-default": "off",
"import/no-named-as-default-member": "off",
"import/no-deprecated": "off",
"import/no-extraneous-dependencies": "off",
"import/no-commonjs": "warn",
"import/no-amd": "error",
"import/no-nodejs-modules": "off",
"import/imports-first": "warn",
"import/no-duplicates": "error",
"import/no-namespace": "off",
"import/extensions": ["error", { js: "never", json: "always" }],
"import/order": "off",
"jest/no-disabled-tests": "error",
"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"jest/valid-expect": "error",
"react/display-name": "off",
"react/forbid-prop-types": "off",
"react/no-danger": "error",
"react/no-deprecated": "error",
"react/no-did-mount-set-state": "error",
"react/no-did-update-set-state": "error",
"react/no-direct-mutation-state": "error",
"react/no-is-mounted": "error",
"react/no-multi-comp": "off",
"react/no-set-state": "off",
"react/no-string-refs": "error",
"react/no-unknown-property": "error",
"react/prefer-es6-class": "error",
"react/prop-types": "off",
"react/react-in-jsx-scope": "error",
"react/require-render-return": "error",
"react/self-closing-comp": "error",
"react/sort-comp": "warn",
"react/sort-prop-types": "off",
"react/jsx-boolean-value": ["error", "never"],
"react/jsx-handler-names": "off",
"react/jsx-key": "error",
"react/jsx-no-bind": "off",
"react/jsx-no-duplicate-props": "error",
"react/jsx-no-literals": "off",
"react/jsx-no-undef": "error",
"react/jsx-pascal-case": "error",
"react/jsx-sort-props": "off",
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"react/prefer-stateless-function": "off",
"prettier/prettier": [
"error",
{
trailingComma: "es5",
singleQuote: false,
jsxBracketSameLine: false,
parser: "flow",
useTabs: true,
printWidth: 80,
tabWidth: 2
}
]
},
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".native.js", ".ios.js", ".android.js"]
}
}
},
overrides: {
files: ["**/__tests__/**/*.js", "**/?(*.)(spec|test).js"],
env: {
jest: true
}
}
};
@agrcrobles
Copy link
Author

Installed by
npm i --save-dev eslint eslint-plugin-flowtype eslint-plugin-import eslint-plugin -react babel-eslint eslint-plugin-prettier eslint-config-prettier babel-eslint

@agrcrobles
Copy link
Author

npm i eslint-plugin-jest@latest --save-dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment