ESLint shareable configs for Go Nimbly
- @gonimbly/eslint-config: React apps and Babel
- @gonimbly/eslint-config-base-babel: Node.js apps with Babel
- @gonimbly/eslint-config-base: Node.js apps without Babel
Exported configs both support ES2017 and formatting with Prettier.
Extend these configs in your ESLint configurations to use. If you have a monorepo, only exend the @gonimbly/eslint-config-base
in your root and then extend @gonimbly
(ie: @gonimbly/eslint-config
) inside inidividual packages that use React and Babel.
Note that the ESLint configurations' "extends" field allows you to ommit the eslint-config-
prefix (unless it is both a scoped package, like @gonimbly
, and there is text after the @scoped/estlint-config-
part).
To deploy to Heroku, you'll need to add the following engines
parameter to your package.json
{
"engines": {
"node": ">=7.10.1",
"yarn": "0.27.5 || >=1.0.2"
}
}
Set up your project to automatically run eslint --fix
on changed *.js
files and/or prettier on *.{json|css|scss}
files before commits are made. Changes made by eslint will be re-staged, and if there are no errors, will allow the
commit. If any eslint errors are found, the commit will be aborted so that they can be fixed manually.
yarn add -D lint-staged husky prettier
- Update your project's root
package.json
, like this:
{
"scripts": {
"precommit": "lint-staged"
},
"lint-staged": {
"*.js": ["eslint --fix", "git add"],
"*.{json,css,scss}": ["prettier --write", "git add"]
},
}
- Now change a few files,
git add
some of them and try togit commit
.
You can easily enable automatic code formatting by installing the ESLint and Prettier extensions via VSCode's extension manager.
After installation you'll want to enable the following setting to allow prettier to respect the eslint settings:
"prettier.eslintIntegration": true
- Clone this repo,
cd
to it, then runyarn
- Create branch off
master
- ...commit stuff...
- Push branch and open PR
- Merge approved PR(s) to
master
using "squash" option - Checkout
master
- Run
npm login
(only need to do this once per machine) - Check your
~/.npmrc
and make sure it isn't overriding the default registry. Comment the line out if it does. - Run
lerna publish
and increment version according to semver