Configuration and usage of eslint in atom
This article focuses on "the configuration and use of eslint in atom". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "the configuration and use of eslint in atom".
Download the aotm plug-in linter-eslint
Https://github.com/AtomLinter/linter-eslint
The settings need to be set as follows:
Install locally to your project eslint and the plugin
$npm I-- save-dev eslint [eslint-plugins]
Install globally eslint and plugins
Activate Use Global Eslint package option
(Optional) Set Global Node Path with $npm config get prefix
$npm I-g eslint [eslint-plugins]
Some plug-ins are provided, which can be downloaded by yourself (ps: version differences can cause some plug-ins to report errors)
Eslint-config-airbnb
Eslint-plugin-import
Eslint-plugin-jsx-a11y
Eslint-plugin-react
Eslint-plugin-html (parsable scripts in html, the latest version v4 conflicts with earlier eslint)
And then under the project
$eslint-init
Use the following comments to turn off the prompt. / * eslint-disable * / use eslintignore to ignore specific files and directories
Create a .eslintignore file, add folders to filter, or files
Build/* app/lib/*
The command line uses-- ignore-path:
$eslint-ignore-path .eslintignore-fix app/*
The path is relative to the location of .eslintignore or the current working directory
See more http://eslint.cn/docs/user-guide/configuring
Basic configuration: module.exports = {parser: 'babel-eslint', "env": {"browser": true, "commonjs": true, "es6": true}, / / take the current directory as the root directory No longer look up .eslintrc.js root: true, / / prohibit the use of spaces and tab mixed indentation "extends": "eslint:recommended", globals: {/ / fill in the global variables / / jQuery: false, $: false, wx: false,} required for your project. / / eslint-plugin-html opens "plugins": ["html"], "parserOptions": {"ecmaFeatures": {"jsx": false}, "sourceType": "module"}, "rules": {"indent": ["error", 'tab'], "linebreak-style": ["error", "unix"] "quotes": ["error", "single"], "semi": ["error", "always"], "semi": ["error", "always"], "arrow-spacing": ["error", {"before": true, "after": true}], "no-unused-vars": "off", / / prohibit prompting unused variables Or the function "block-spacing": "error", "no-console": "off", / / you can use console "keyword-spacing": ["error", {"before": true}] / / enforce the consistency of spaces around keywords}} At this point, I believe you have a deeper understanding of "the configuration and use of eslint in atom". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!