Created
December 19, 2018 15:04
-
-
Save josefaidt/ba0e6c5e010bb89c2ab2a1260e6f8377 to your computer and use it in GitHub Desktop.
Installs my current ESLint configuration, add to PATH to execute anywhere. Meant for setting up new projects.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Sets up ESLint for my projects | |
# 1. install dev deps | |
yarn add -D \ | |
eslint babel-eslint eslint-loader \ | |
prettier eslint-config-prettier eslint-plugin-prettier \ | |
eslint-config-standard eslint-plugin-standard \ | |
eslint-plugin-node \ | |
eslint-plugin-jsx-a11y \ | |
eslint-plugin-promise \ | |
eslint-plugin-import \ | |
eslint-plugin-react | |
# 2. define eslint dotfile name | |
FILE=".eslintrc.js" | |
# 3. write our config to file | |
/bin/cat <<EOF >$FILE | |
module.exports = { | |
extends: [ | |
'standard', | |
'plugin:react/recommended', | |
'plugin:jsx-a11y/recommended', | |
'prettier', | |
'prettier/react', | |
'prettier/standard' | |
], | |
plugins: [ | |
'prettier', | |
'react', | |
'standard', | |
'jsx-a11y' | |
], | |
parser: 'babel-eslint', | |
parserOptions: { | |
'ecmaVersion': 8, | |
'ecmaFeatures': { | |
'impliedStrict': true, | |
'classes': true, | |
'jsx': true | |
} | |
}, | |
'env': { | |
'browser': true, | |
'node': true, | |
'es6': true | |
}, | |
rules: { | |
'strict': 0, | |
'no-console': 'warn', | |
'no-var': 2, | |
'no-unused-vars': [1, { 'argsIgnorePattern': 'res|next|^err|reject' }], | |
'no-tabs': 2, | |
'no-param-reassign': [2, { 'props': false }], | |
'quotes': [2, 'single', { | |
'avoidEscape': true, | |
'allowTemplateLiterals': true | |
}], | |
'prefer-const': [2, { 'destructuring': 'all' }], | |
// standard plugin - options | |
// 'standard/object-curly-even-spacing': [2, 'either'], | |
// 'standard/array-bracket-even-spacing': [2, 'either'], | |
// 'standard/computed-property-even-spacing': [2, 'even'], | |
'standard/no-callback-literal': [2, ['cb', 'callback']], | |
// react plugin - options | |
'react/jsx-uses-react': 2, | |
'react/jsx-uses-vars': 2, | |
// prettier | |
'prettier/prettier': [2, { | |
'trailingComma': 'none', | |
'singleQuote': true, | |
'semi': false, | |
'tabWidth': 2, | |
'printWidth': 100, | |
'bracketSpacing': true, | |
'jsxBracketSameLine': true, | |
'arrowParens': 'avoid' | |
}] | |
} | |
} | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment