current position:Home>Scheme summary of eslint check before vue3 + vite configuration project operation and eslint check before git submission

Scheme summary of eslint check before vue3 + vite configuration project operation and eslint check before git submission

2022-05-15 02:07:57Wooden house x

vue3+vite Before the configuration project runs eslint Check and git Before submission eslint Summary of inspection plan

1. Demand background
  • Recently, there is such a demand in the process of building new projects : Because it is a team collaborative development , Therefore, code specification is a very important link in development , The unification of code specifications between teams can avoid a lot of bug produce , At the same time, it is also convenient for the development team to read and maintain the code . A prerequisite for ensuring code specification is to run the project and git Throw out problems and exceptions when submitting code , And prevent the operation and submission of abnormal code , In the new project, I mainly use eslint Tools to constrain code specifications , The following is before the configuration project runs eslint Check and git Change the file code before submitting eslint Inspection scheme .
Solution
  • First , Configure the project before running eslint Check , If there are exceptions that prevent operation , And throw out the abnormal code .

  • 
    // 1. install  vite-plugin-eslint  plug-in unit :
    npm install vite-plugin-eslint --save --dev
    
    // 2. Go to  vite.config.js, Make the following configuration :
    import eslintPlugin 

copyright notice
author[Wooden house x],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/132/202205120527037023.html

Random recommended