如何利用技术提升特斯拉网站体验?
摘要:美食网站开发的技术简介,特斯拉ceo进厂拧螺丝,江阴青阳道路建设网站,网站内容专题怎么做在日常开发过程中,经常会碰到代码格式化不一致的问题,还要就是 js 代码语法错误等没有及时发
美食网站开发的技术简介,特斯拉ceo进厂拧螺丝,江阴青阳道路建设网站,网站内容专题怎么做在日常开发过程中#xff0c;经常会碰到代码格式化不一致的问题#xff0c;还要就是 js 代码语法错误等没有及时发行改正#xff0c;下面就介绍一下如何使用eslint、prettier、husky、lint-staged、commitizen来规范代码格式和提高代码质量的方法。 目录
准备工作代码检测代… 在日常开发过程中经常会碰到代码格式化不一致的问题还要就是 js 代码语法错误等没有及时发行改正下面就介绍一下如何使用eslint、prettier、husky、lint-staged、commitizen来规范代码格式和提高代码质量的方法。 目录
准备工作代码检测代码格式化Git 规范
准备工作
新建项目
新建一个测试项目。
mkdir code
cd code
npm init -y
git init测试文件
!-- index.html --
divh1Hello/h1pHello,code!/p
/div/* index.css */
body {width: 10px;
}// index.js
function add(a, b) {return a b;
}代码检测
这里主要是使用eslint来检测代码。
eslint 官网
安装依赖包
npm install eslint生成配置文件
安装配置
npm init eslint/config选择类型
? How would you like to use ESLint? ...To check syntax onlyTo check syntax and find problemsTo check syntax, find problems, and enforce code style选择模块
? What type of modules does your project use? ...JavaScript modules (import/export)CommonJS (require/exports)None of these选择框架
? Which framework does your project use? ...ReactVue.jsNone of these是否使用 ts
? Does your project use TypeScript? » No / Yes运行环境
? Where does your code run? ... (Press space to select, a to toggle all, i to invert selection)
√ Browser
√ Node文件格式
? What format do you want your config file to be in? ...JavaScriptYAMLJSON安装依赖
Local ESLint installation not found.
The config that youve selected requires the following dependencies:eslint-plugin-vuelatest eslintlatest
? Would you like to install them now? » No / Yes选择包管理器
? Which package manager do you want to use? ...npmyarnpnpm等待安装完成。
Installing eslint-plugin-vuelatest, eslintlatest
npm WARN idealTree Removing dependencies.eslint in favor of devDependencies.eslintadded 12 packages in 3s
A config file was generated, but the config file itself may not follow your linting rules.
Successfully created .eslintrc.js file in D:\code下面是生成的配置文件。
