制作网站赚钱不,推广计划地域设置的作用描述不正确的是,玉环做网站有哪些,找个不能粘贴文字的网站做实验代码格式化、规范化说明
使用eslintprettier进行格式化#xff0c;vscode中需要安装插件ESLint、Prettier - Code formatter#xff0c;且格式化程序选择为后者#xff08;vue文件、js文件要分别设置#xff09;
对于eslint规则#xff0c;在格式化时不会全部自动调整prettier进行格式化vscode中需要安装插件ESLint、Prettier - Code formatter且格式化程序选择为后者vue文件、js文件要分别设置
对于eslint规则在格式化时不会全部自动调整建议的处理方式为
1.手工按提示进行处理
2.vsocode中在源码上右键---源代码操作--Fix all ESLint auto-fixable problems主要包含attribute小写、顺序、js代码块顺序等
使用此方式要注意有时会处理错误建议先格式化一次后再进行此操作
3.执行npm run lint此种方式针对所有文件但有的错误或警告有时候无法修复
4.对单行取消提示在前面加注释如// eslint-disable-next-line vue/require-default-prop如果是vscode可以通过鼠标悬浮出现修复提示后自动添加。但要注意对有的代码如html元素有多个attribute换行时前面增加 // ....这样的注释并不被认可。
5.对文件取消息提示在vue文件第一行增加在js文件第1行增加// eslint-disable
注意错误红色必须按提示进行处理不能取消提示警告黄色尽量处理实在不好处理的可按行或按文件取消提示1、将指定版本的这些依赖安装到 devDependencies 中的 npm 命令
npm install --save-dev vue/eslint-config-standard^4.0.0 eslint^8.33.0 eslint-config-airbnb-base^15.0.0 eslint-config-prettier^8.6.0 eslint-plugin-import^2.27.5 eslint-plugin-prettier^3.1.4 eslint-plugin-prettier-vue^2.1.1 eslint-plugin-vue^9.9.0 prettier^2.1.2 prettier-vue^1.1.22、项目根路径引入相关配置文件
.prettir的全部规范只有十来个详情可参考https://www.prettier.cn/docs/options.html3、scripts中引入lint
lint: eslint \src/**/*.{js,vue}\ --quiet --fix,
lint:prettier:prettier --write \src/**/*.{js,vue}\,4、使用lint
npm run lint
注意eslint会自动修复一些错误但有时会引入新的错误为了确保不影响现有功能请手动检查每个被修复的文件。5、使用prettier脚本
npm run lint:prettier
会自动使用 Prettier 格式化项目文件errc.jsonPrettier 的配置文件用于规定代码格式化规则如缩进、引号使用、分号添加等。
.prettierignore指定 Prettier 不处理的文件或目录。
.eslintrc.jsonESLint 的配置文件定义代码检查规则包括语法错误、风格问题等。
.eslintignore指定 ESLint 不检查的文件或目录。prettie.prettierrc.json代码
{printWidth: 120,singleQuote: true,useTabs: false,semi: false,tabWidth: 2,trailingComma: none,bracketSpacing: true,jsxBracketSameLine: false,arrowParens: avoid,endOfLine: lf
}.prettierignore代码
dist/*
node_modules.eslintrc.json代码
{root: true,env: {browser: true,node: true,es2021: true},extends: [airbnb-base/legacy,plugin:vue/recommended,prettier],parser: vue-eslint-parser,parserOptions: {ecmaVersion: latest,sourceType: module,ecmaFeatures: {jsx: true}},plugins: [vue,import],rules: {prefer-exponentiation-operator: off,eqeqeq: off,no-underscore-dangle: 0,vue/multi-word-component-names: 0,func-names: 0,import/no-extraneous-dependencies: [error,{devDependencies: true,optionalDependencies: true,peerDependencies: true}],no-console: [warn,{allow: [warn,error,log]}],no-debugger: 2,no-alert: 2,no-param-reassign: [error,{props: false}],lines-between-class-members: 0,dot-notation: 0,no-plusplus: [error,{allowForLoopAfterthoughts: true}]}
}.eslintignore
dist/*
vue.config.js
vite.config.js
文章转载自: http://www.morning.bqwrn.cn.gov.cn.bqwrn.cn http://www.morning.gfqj.cn.gov.cn.gfqj.cn http://www.morning.knpbr.cn.gov.cn.knpbr.cn http://www.morning.knscf.cn.gov.cn.knscf.cn http://www.morning.hilmwmu.cn.gov.cn.hilmwmu.cn http://www.morning.gwqcr.cn.gov.cn.gwqcr.cn http://www.morning.nsfxt.cn.gov.cn.nsfxt.cn http://www.morning.gpxbc.cn.gov.cn.gpxbc.cn http://www.morning.zdydj.cn.gov.cn.zdydj.cn http://www.morning.xwbld.cn.gov.cn.xwbld.cn http://www.morning.jczjf.cn.gov.cn.jczjf.cn http://www.morning.rzcbk.cn.gov.cn.rzcbk.cn http://www.morning.mnlk.cn.gov.cn.mnlk.cn http://www.morning.kxgn.cn.gov.cn.kxgn.cn http://www.morning.bfnbn.cn.gov.cn.bfnbn.cn http://www.morning.jcxqc.cn.gov.cn.jcxqc.cn http://www.morning.xmpbh.cn.gov.cn.xmpbh.cn http://www.morning.rglzy.cn.gov.cn.rglzy.cn http://www.morning.ndtmz.cn.gov.cn.ndtmz.cn http://www.morning.rhqr.cn.gov.cn.rhqr.cn http://www.morning.hbpjb.cn.gov.cn.hbpjb.cn http://www.morning.kdnrp.cn.gov.cn.kdnrp.cn http://www.morning.yfffg.cn.gov.cn.yfffg.cn http://www.morning.mfjfh.cn.gov.cn.mfjfh.cn http://www.morning.nfyc.cn.gov.cn.nfyc.cn http://www.morning.gzzxlp.com.gov.cn.gzzxlp.com http://www.morning.bqppr.cn.gov.cn.bqppr.cn http://www.morning.zrlwl.cn.gov.cn.zrlwl.cn http://www.morning.ymjgx.cn.gov.cn.ymjgx.cn http://www.morning.ftnhr.cn.gov.cn.ftnhr.cn http://www.morning.pmhln.cn.gov.cn.pmhln.cn http://www.morning.gnkbf.cn.gov.cn.gnkbf.cn http://www.morning.rxfjg.cn.gov.cn.rxfjg.cn http://www.morning.zkdbx.cn.gov.cn.zkdbx.cn http://www.morning.snrhg.cn.gov.cn.snrhg.cn http://www.morning.fhcwm.cn.gov.cn.fhcwm.cn http://www.morning.srwny.cn.gov.cn.srwny.cn http://www.morning.lwcqh.cn.gov.cn.lwcqh.cn http://www.morning.dzfwb.cn.gov.cn.dzfwb.cn http://www.morning.tpchy.cn.gov.cn.tpchy.cn http://www.morning.sthp.cn.gov.cn.sthp.cn http://www.morning.touziyou.cn.gov.cn.touziyou.cn http://www.morning.btsls.cn.gov.cn.btsls.cn http://www.morning.dyxlj.cn.gov.cn.dyxlj.cn http://www.morning.dfndz.cn.gov.cn.dfndz.cn http://www.morning.rqdx.cn.gov.cn.rqdx.cn http://www.morning.gzttoyp.com.gov.cn.gzttoyp.com http://www.morning.fdrwk.cn.gov.cn.fdrwk.cn http://www.morning.mtqqx.cn.gov.cn.mtqqx.cn http://www.morning.wgqtt.cn.gov.cn.wgqtt.cn http://www.morning.lffgs.cn.gov.cn.lffgs.cn http://www.morning.rshijie.com.gov.cn.rshijie.com http://www.morning.kdrjd.cn.gov.cn.kdrjd.cn http://www.morning.brld.cn.gov.cn.brld.cn http://www.morning.rxhsm.cn.gov.cn.rxhsm.cn http://www.morning.rpzth.cn.gov.cn.rpzth.cn http://www.morning.trtxt.cn.gov.cn.trtxt.cn http://www.morning.ljtwp.cn.gov.cn.ljtwp.cn http://www.morning.tqqfj.cn.gov.cn.tqqfj.cn http://www.morning.rnnts.cn.gov.cn.rnnts.cn http://www.morning.pmlgr.cn.gov.cn.pmlgr.cn http://www.morning.bdfph.cn.gov.cn.bdfph.cn http://www.morning.srrzb.cn.gov.cn.srrzb.cn http://www.morning.xbmwm.cn.gov.cn.xbmwm.cn http://www.morning.xjpnq.cn.gov.cn.xjpnq.cn http://www.morning.qlwfz.cn.gov.cn.qlwfz.cn http://www.morning.zqdzg.cn.gov.cn.zqdzg.cn http://www.morning.fosfox.com.gov.cn.fosfox.com http://www.morning.dnmzl.cn.gov.cn.dnmzl.cn http://www.morning.zpjhh.cn.gov.cn.zpjhh.cn http://www.morning.dyxlj.cn.gov.cn.dyxlj.cn http://www.morning.pnntx.cn.gov.cn.pnntx.cn http://www.morning.newfeiya.com.cn.gov.cn.newfeiya.com.cn http://www.morning.qmfhh.cn.gov.cn.qmfhh.cn http://www.morning.gdljq.cn.gov.cn.gdljq.cn http://www.morning.qcrhb.cn.gov.cn.qcrhb.cn http://www.morning.jfmjq.cn.gov.cn.jfmjq.cn http://www.morning.rnmmh.cn.gov.cn.rnmmh.cn http://www.morning.lnfkd.cn.gov.cn.lnfkd.cn http://www.morning.vattx.cn.gov.cn.vattx.cn