本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《
书写规范是非常重要的,除了统一,还要简洁。
在项目根目录新建
.editorconfig
文件,加入设置:
在项目根目录新建
.eslintrc.json
文件,加入设置:
{
"env": {
"browser": true,
"es2021": true,
"jquery": true // $不报错
"extends": [
"standard"
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
"rules": {
"space-before-function-paren": ["error", {
"anonymous": "always",
"named": "never",
"asyncArrow": "always"
}
3、VS Code保存去掉自动加分号、逗号、双引号
在VS Code的是settings.json插入:
{
"prettier.useEditorConfig": true,
"prettier.jsxSingleQuote": true,
"prettier.singleQuote": true,
"prettier.trailingComma": "none",
"prettier.semi": false,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
// For ESLint
"source.fixAll.eslint": true,
// For TSLint
"source.fixAll.tslint": true,
// For Stylelint
"source.fixAll.stylelint": true
"[html]": {
"editor.defaultFormatter": "HookyQR.beautify"
"files.exclude": {
"node_modules": true
怎么去掉文章或产品介绍中的垃圾代码?怎么过滤这些垃圾代码?
一般从网页或从WORD中复制粘贴时,会带来一些垃圾代码,有可能会导致显示异常,例如如下样例中的灰色方框,无法直接删掉,怎么办?
小技巧:如点右键粘贴不能用,可以用粘贴快捷键:Ctrl+V
1、删掉方法如下:如下图,先点HTML图标,然后 就可以看到下面的代码了,直接删掉就行了。
阿里云小秘
操作如下图所示:
我的GitHub地址:https://github.com/heizemingjun
我的博客园地址:http://www.cnblogs.com/chenmingjun
我的蚂蚁笔记博客地址:http://blog.