Skip to content

Instantly share code, notes, and snippets.

@mikoloism
Last active June 18, 2021 12:11
Show Gist options
  • Save mikoloism/502529f69aa8b07fa727800522552386 to your computer and use it in GitHub Desktop.
Save mikoloism/502529f69aa8b07fa727800522552386 to your computer and use it in GitHub Desktop.
all-in-one eslint

All In One ESLint

Steps

  • install eslint npm i -g eslint npm install --save-dev eslint
  • config eslint
  • config with airbnb
    • install config (vanilla js) npm install --save-dev eslint-config-airbnb-base
    • install config (react/jsx) npm install --save-dev eslint-config-airbnb eslint-plugin-import eslint-plugin-react eslint-plugin-jsx-a11y
# [airbnb-config]
# see : https://eslint.org/docs/user-guide/configuring/
# see : https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb
---
env:
# browser
browser: true
# ES6
es6: true
# node
node: true
# use airbnb (eslint-config-airbnb)
extends: airbnb
parserOptions:
ecmaVersion: 6
# ecmaFeature:
# jsx: true # react | jsx
rules:
# 0 = off | 1 = warn* | 2 = error
no-unused-vars:
- warn
-
args: none
vars: local
comma-dangle:
- warn
- always-multiline
# or
# -
# array: always-multiline
# objects: always-multiline
# imports: always-multiline
# exports: always-multiline
# functions: always-multiline
// [manual-config]
// see : https://eslint.org/docs/user-guide/configuring/
{
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 6,
"ecmaFeature": {
// "jsx": true, // for react or JSX
}
},
"env": {
"node": true,
"browser": true,
"es6": true,
},
}
# [manual-config]
# came : https://eslint.org/docs/user-guide/configuring/
---
extends: 'eslint:recommended'
parserOptions:
ecmaVersion: 6
# ecmaFeature:
# jsx : true # react || jsx
env :
node: true # node
browser: true # browser
es6: true # ES6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment