Probably the fastest way to add ESLint to your project
- Create package.json if it does not exist
- Creates
.eslintrc.js
with Airbnb base and some additional rules - Run npm install and save as devDependencies
- eslint
- eslint-config-airbnb-base
- eslint-plugin-import
bash <(curl https://raw.githubusercontent.com/ecrmnn/eslintrc.js/master/init.sh)
You'll probably want eslint on another project too?
Just pop this alias in your .bash_profile
alias eslint='bash <(curl https://raw.githubusercontent.com/ecrmnn/eslintrc.js/master/init.sh)'
Ok, ok I get it. You don't want to run some scary command and risk it all. Well, copy, inspect and (maybe) paste if you like.
printf "module.exports = {\n extends: 'airbnb-base',\n parserOptions: {\n sourceType: 'script',\n },\n plugins: [\n 'import',\n ],\n rules: {\n 'curly': [\n 'error',\n 'all',\n ],\n 'brace-style': [\n 'error',\n '1tbs',\n { 'allowSingleLine': false },\n ],\n 'no-console': 'error',\n 'no-ternary': 'error',\n 'newline-before-return': 'error',\n },\n};\n" > .eslintrc.js && [ -f package.json ] || echo {} > package.json && npm install eslint eslint-config-airbnb-base eslint-plugin-import -D