Eslint works in:

1. Understand the configuration;

2. Application in the project;

3, Remove lint errors from existing projects with prettier

Eslint article summary:

1, the foundation: zhuanlan.zhihu.com/p/80574300

2, eslint and prettier to realize automatic code standard format: www.cnblogs.com/ssaylo/p/12…

Esprima: esprima.org/demo/parse….

4, abstract syntax tree AST: www.e-learn.cn/topic/35736…

5, Babel 答 案 : www.e-learn.cn/topic/39757…

Segmentfault.com/a/119000001…

6, online parser: astexplorer.net/

7, eslint rules and plug-in development: blog.csdn.net/azl39798585…

8, VSCode: ESLint+Prettier: juejin.cn/post/689932…

9, write a ESLint plug-in and the understanding of the principle of operation of ESLint: www.jianshu.com/p/e6ee3f64e… (Heavy)

10 and ESLint working principle: zhuanlan.zhihu.com/p/53680918

11, eslint and prettier to realize automatic code standard format: www.cnblogs.com/ssaylo/p/12…

12. Eslint rule: eslint.org/docs/rules/

13, esLint official website: eslint.org/docs/user-g…

14, zhihu: ESLint principle: zhuanlan.zhihu.com/p/53680918

15, lint – staged use tutorial: www.cnblogs.com/jiaoshou/p/…

Husky + Lint-passively powered team coding specifications: blog.csdn.net/csdn_yudong…

Eslint /prettier

1, Prettier code formatting

2. Eslint sets formatting rules and prompts

3. All rules in ESLint are designed to be pluggable, and the default rules are no different from other plugins, summed up as: configurable, plug-in

4. Both ESLint and TypeScript rely on converting your source code to a data format called AST, but ESLint and TypeScript use different AST versions of each other

5, Esprima parse: tree, syntax, tokens

Var answer = 6 * 7;

a)   Tree:

b)   Syntax:

c)  Tokens:
Copy the code

6. The default configuration of eslint and prettier is overwritten by the corresponding configuration file for the project where eslint and prettier override the default configuration of the vscode plug-in. The configuration level of the.vscode folder in the root directory of the project is higher than that of the settin.json folder of vscode itself, so it will choose the setting.

7, after prettier is enabled, vscode disables eslint by default

8. Eslint’s core capability is static analysis of code

9. The essence of the plugin for Eslint: it is a collection of rules for syntax types (vue\react\js\ts), project integration, etc., that can be introduced at the same time

A. Usage B. Usage C. Usage D. Usage

Typescript-eslint uses typescript-esLint

A) Self-assembly:Copy the code

B) Use recommendations:Copy the code

12. Every item in extents ends up referring to an object with the same configuration rules as ESLint itself.

13. A rule is a Node module consisting of two parts: Meta and Create

14. The core is the listener selector

15. Some rules can be fixed with –fix, while others cannot, such as redundant, unreferenced variables and methods, are syntactically relevant. Lint-staged is a configured Linter (or other) task run from a Git staged file (that is, a file that has been added by Git). Lint-staged always passes a list of all staged files to a task.

 

other

Enabled rules can be inherited from the base configuration

The extends property value can be:

(1) A string specified in the configuration

(2) String arrays: Each configuration inherits its previous configuration

ESLint extends configurations recursively, so a base configuration can also have an extends property. Extends is a code formatting tool that introduces shared configuration packages and plug-ins. To be able to format our code according to our rules.

Prettier has the following advantages:

Configurable support for multiple languages integration of most editors concise configuration itemsCopy the code

Prettier removes all the styling from your code and reprints it in a uniform format.

Lint-passage, pretty-quick pre-commit rapid-commitsCopy the code

Lint-staged is a tool for running Linters on Git staging files,

ESLint is a code-checking tool that recognizes ECMAScript/JavaScript and reports according to rules