These are devalore settings for ESLint configurations based of airabnb.
- Lints JavaScript based on the latest standards
You can use eslint globally and/or locally per project.
It's usually best to install this locally once per project, that way you can have project specific settings as well as sync those settings with others working on your project via git.
-
If you don't already have a
package.json
file, create one withnpm init
. -
Then install everything needed by the config:
npx install-peerdeps --dev eslint-config-devalore
-
You can see in your package.json there are now a list of devDependencies.
-
Create a
.eslintrc
file in the root of your project's root directory. The.eslintrc
file should look like this:
{
"extends": [
"devalore"
]
}
You can alternatively 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.
- First install everything needed:
npx install-peerdeps --global eslint-config-devalore
- Then you need to make a global
.eslintrc
file:
ESLint will look for one in your home directory
-
~/.eslintrc
for mac -
C:\Users\username\.eslintrc
for windows
In your .eslintrc
file, it should look like this:
{
"extends": [
"devalore
]
}
- To use from the CLI, you can now run
eslint .
or configure your editor as we show next.
If you'd like to overwrite eslint or prettier settings, you can add the rules in your .eslintrc
file.
{
"extends": [
"devalore
],
"rules": {
"no-console": 1
}
}
- Ejct first
npm run eject
oryarn eject
- run `npx install-peerdeps --dev eslint-config-devalore
- Crack open your
package.json
and replace"extends": "react-app"
with"extends": "devalore"