Hello everyone, I am dongdong acridine. It’s the weekend again, and I’ve been a little busy lately, but I’ll be Posting weekly updates on what configuration files can do in projects and how to use them.

1、.gitignore

Ignore: indicates to ignore. As the name suggests, this configuration file is used to manage Git. When you write a file name to this file, the file is ignored and not committed. When you write a folder name to this file, the entire folder is ignored and not committed. Why do you need this configuration file? How many dependencies do you think we download? Such a large file must not be committed to Git, but is committed to online deployment dependencies. There are similar small programs, ah, due to package restrictions, we will choose to put some static file resources on the online access, not the front-end local resource files submitted, put in the local is just convenient for us to debug and backup.

2, eslintrc. Js

This configuration file is used to manage ESLint rules. In multiplayer development, if you don’t set ESLint and someone else turns eslingt on, it can be disastrous for someone else. Take our project as an example, this project is a public account that is mainly used for payment. It hasn’t been updated for a whole year, it’s a bunch of Eslingt bugs, and nobody cares. Recently, I have to do some security measures on this project, such as face recognition, living detection, anti-money laundering and so on. Every time I modify one line of code, the project takes more than 10 seconds, which is no exaggeration. Looking at a lot of ESLint errors, MY head really hurts.

Solution: You can use scripts to automatically detect and correct syntax errors. But only one part can be modified. Add these two lines to the package.json script and run it.

In this configuration file, the rules are used to specify the rules.

  • “off”  或 0– Turn off this rule checking
  • “warn”  或 1– Enable this rule check and prompt (does not affect exit status)
  • “error”  或 2– Enable rule checking and report errors

For example, we run the project:— ESLint error: ‘===’ is expected when ‘==’ is used. The key for this rule is roles/, or eqeqed. We configure ‘eqeqeq’:0 in the configuration file, run it again, and the error won’t be visible.

Another question is how to quickly find the esLint error in your project and fix it without turning it off.

There is an NPM script in the same directory as our project name, click on it to find the script that allows it, and the console will print the corresponding eslint error. In this case, we can hold down CRTR and click on the corresponding eslint error, and vscode will automatically jump us to the corresponding eslint error folder, Modify it correctly as required.

3、.eslintignore

As the name suggests, this configuration file is used to manage files that esLint will ignore. Files or folders written to this configuration will not be detected by ESLint, similar to.gitignore.

4, package. Json

This configuration file is used to manage packages and scripts. For example, we just added two lines of script to the configuration file, then running NPM run checkLint will detect errors, and running NPM run ReviselInt will automatically correct some selint errors.

5.package-lock.json

This file is used to lock the package. It will download the version of the specified package.

6.README.md

This is a private prosecution document that describes how to run the project, what technologies to use and so on.

7.favicon.icon

This is the icon icon in our address bar. If you need to replace it, for example, we dig a lock, name the lock picture as favicon.icon and replace the picture in the project. Sometimes there’s a cache, so just refresh it.

8, index. HTML

Here is mainly used to configure the project address bar title, such as I change the title to east acridine, the project will run after the east acridine. You can also preload some resource files in this configuration file.

Of course, these are just the most basic configuration files, and I will continue to share other configuration files and supplement them in this article. Remember to focus on favorites, I will remind you after the follow-up supplement. That’s all for today’s sharing!

Previous good articles of the author:

Learn how to use XSS attack to experience a hacker

8 ways for components to communicate, have you figured it out?

Learn Node.js from 0 to 1: Getting your first taste of the API