eslint officially provides 3 pre-installed packages:
-
Google standard
Execute the installation:
npm install eslint eslint-config-google -g
-
Airbnb standard, it relies on plugins such as eslint, eslint-plugin-import, eslint-plugin-react, and eslint-plugin-jsx-a11y, and requires the version of each plugin.
You can execute the following commands to view the versions you depend on:
npm info "eslint-config-airbnb@latest" peerDependencies
You will see the following output, including the version requirements for each plugins
{ eslint: '^3.15.0', 'eslint-plugin-jsx-a11y': '^3.0.2 || ^4.0.0', 'eslint-plugin-import': '^2.2.0', 'eslint-plugin-react': '^6.9.0' }
After knowing the version requirements of each plugins, substitute the following command to execute the installation and use it:
npm install eslint-config-airbnb eslint@^#.#.# eslint-plugin-jsx-a11y@^#.#.# eslint-plugin-import@^#.#.# eslint-plugin-react@^#.#.# -g
-
Standard standard, which is a standard set by some front-end engineers.
Execute the installation:
npm install eslint-config-standard eslint-plugin-standard eslint-plugin-promise -g