Skip to content

Instantly share code, notes, and snippets.

@madhums madhums/.eslintignore
Last active Apr 24, 2019

Embed
What would you like to do?
eslint prettier config
node_modules
styleguide
.next
.vscode
static
i18n
module.exports = {
"extends": ["eslint:recommended", "plugin:prettier/recommended"],
"env": {
"browser": true,
"es6": true,
"node": true
},
"parser": "babel-eslint",
"rules": {
"prettier/prettier": ["error", {
"singleQuote": true,
"jsxBracketSameLine": true
}],
"max-len": ["error", {
"code": 80,
"ignoreUrls": true,
"ignoreComments": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true,
"ignoreRegExpLiterals": true
}],
"quotes": ["error", "single"],
"camelcase": "off",
"no-console": "off"
}
}
npm i eslint prettier eslint-config-prettier eslint-plugin-prettier babel-eslint -D
  1. If you want to add react

    npm i eslint-plugin-react -D
    "extends": [
        "eslint:recommended", 
    +    "plugin:react/recommended", 
        "plugin:prettier/recommended"
      ],
  2. If you want to add pre-commit hook to fix code style

    npm i husky lint-staged

    In package.json

    {
      "husky": {
        "hooks": {
          "pre-commit": "lint-staged"
        }
      },
      "lint-staged": {
        "*.js": [
          "eslint --fix",
          "git add"
        ]
      },
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.