This is a recommended linter configuration for JavaScript projects based on Standard with extra rules per our guidelines.
Place .eslintrc.yaml file to your project directory.
You will need the following packages:
- eslint
- eslint-config-standard for basic Standard style configuration
You can install all of these as development dependencies:
npm install --save-dev eslint eslint-config-standard
Modify the rules to suit your project. For example, if you have a Node-only project, you may want to remove browser: true from env.
You can also override the rules per-file with special comments. For example you may want to specify environment for worker script in only one file:
/*eslint-env worker */Or you may have some custom globals:
/*global var1, var2*/Learn more about ESLint configuration.
For projects using React and/or JSX syntax use standard-react.
You will need these dependencies (in addition to those above):
- eslint-plugin-react for React-specific rules.
- eslint-config-standard-react for React-specific configuration.
Install everything as development dependency:
npm install --save-dev eslint eslint-config-standard eslint-config-standard-react eslint-plugin-react
In your .eslintrc.yaml file just add standard-react to the extends property, e.g.:
---
extends: [standard, standard-react]
# rest of the file is the same…You will get the most of linting by integrating ESLint to your text editor or IDE. See the list of integrations.