Just from the simple book migration, the result does not know how to batch upload files, there is a know elder brother trouble private letter to tell me… I don’t know how to upload all of Jane’s articles to the nuggets.

This article is written for the original old brothers to see, after all, if it is to do JS elder brother is certainly needless to say…

Background: Everyone writes code in different formats, so ESLint was introduced

What is this thing should not need me to say more, as to how to introduce, to be honest, read the official website tutorial, also read a variety of blogs, anyway, I finally made a mess… Fortunately, the introduction succeeded in the end.

I intend that the criteria for each project will be different (because some are RN and some are H5), so I will introduce them locally, not globally. So what I’m going to say is local introductions, which will let you get rid of the global ones, and if you want to do global introductions, pay attention to yourself for a second, don’t follow some steps. Airbnb’s standard is by far the most respected, and I’ve introduced it

Environment and tools: Mac, Webstrom, NPM, YARN

Check whether relevant packages have been installed globally

Open a terminal

npm ls -g --depth 0
Copy the code

See if esLint-related packages are installed globally, and uninstall them if so.

2. Access the project root directory

npm info "eslint-config-airbnb@latest" peerDependencies
Copy the code

Check out the latest Airbnb standards

Now, what you’re going to do is you’re going to be stupid, and you’re going to add all these libraries. Note that this tool itself is only a development aid, so there is no need to add –dev to the formal environment

Yarn add - dev eslint @ ^ 4.19.1 | | ^ 5.3.0 yarn add - dev eslint plugin - import @ ^ 2.14.0 yarn add - dev eslint - plugin - JSX-a11y@^6.1.1
yarn add --dev eslint-plugin-react@^7.11.0
Copy the code

3. At this point your ESLint is installed, and it’s local

Start creating your standard

./node_modules/eslint/bin/eslint.js --init
Copy the code

Then there are a lot of questions, which I think everyone can understand, like I chose to inherit the Airbnb standard, you can also choose other or according to their own project. You must end up generating.esLint js or JSON files in the project root directory.

Four, start the inspection

 ./node_modules/eslint/bin/eslint.js  xx.js
Copy the code

Because you’re importing locally, be sure to use the project’s ESLint to identify it for example:

5. Check webstrom Settings

Edit-Macros-Start-Marcos-Recording
Copy the code

Began to record the screen

Do a quick review of all documents

You can do it in your

package.json-scripts
Copy the code

For example, my js files are in the SRC folder, so that’s all I need to check.

"lint": "eslint --ext .js src"
Copy the code

So all I need to do is type

npm run lint
Copy the code

You can modify it appropriately so that it can check your files, after all, less typing code is some =. =