Skip to content

Instantly share code, notes, and snippets.

@zacharyabresch
Last active April 10, 2018 14:17
Show Gist options
  • Save zacharyabresch/a4ddf4e2d6278f5c273c88d7f8a416b7 to your computer and use it in GitHub Desktop.
Save zacharyabresch/a4ddf4e2d6278f5c273c88d7f8a416b7 to your computer and use it in GitHub Desktop.
`eslint` rules for code quality, CLI style
#!/bin/bash
ln -s ./.gitignore ./.eslintignore && eslint --rule 'array-callback-return: 2' --rule 'complexity: [2, 5]' --rule 'max-statements: [2, 10]' --rule 'max-statements-per-line: [2, {max: 1}]' --rule 'max-nested-callbacks: [2, 2]' --rule 'max-depth: [2, {max: 2}]' --rule 'max-lines: [2, 100]' --rule 'no-return-assign: 2' --rule 'no-param-reassign: 2' --rule 'no-var: 2' --rule 'no-else-return: 2' ./
@zacharyabresch
Copy link
Author

zacharyabresch commented Apr 10, 2018

Some tips:

  • Replace the ./ at the end with what ever paths or files you want to run this on (i.e. ./src ./lib)
  • Have eslint installed globally (yarn global add eslint or npm i -g eslint)
  • This script assumes there is a .gitignore in your project
  • This script assumes you are already using eslint with a config file and, hopefully, extending eslint:recommended and/or airbnb

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