Personally unnecessary config for ESLint and Prettier. I guess you can use it too, though there's hardly anything in it.
- Lints JavaScript based on the latest standards
- Fixes issues and formatting errors with Prettier
- Lints + Fixes inside of HTML script tags
- Lints + Fixes React via eslint-config-airbnb
Please don't just install some rando's configuration for a potential code-breaking tool. Look at what I'm using and determine which rules work best for you.
We're reasonable people, so let's install this locally.
-
If you don't already have a
package.json
file, create one withnpm init
. -
Install the config's dependencies:
npx install-peerdeps --dev eslint-config-jcv
- Create a
.eslintrc.js
file in the root of your project's directory (it should live where package.json does). Your.eslintrc.js
file should look like this:
{
"extends": [
"jcv"
]
}
For React projects:
{
"extends": [
"jcv"
"jcv/react"
]
}
Alternatively, you can put this object in your package.json
under the property "eslintConfig"
.
- You can add two scripts to your package.json to lint and/or fix:
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},
- Now you can manually lint your code by running
npm run lint
and fix all fixable issues withnpm run lint:fix
. You probably want your editor to do this though.
Setup and instructions "inspired" by Wes Bos' No-Sweat™ config.