ESLint & vue
ESLint & vue
{
"name": "app",
"version": "1.0.1",
"private": true,
"description": "JT APP",
"directories": {
"lib": "lib"
},
"scripts": {
"dev": "light release -wb ",
"prod": "light release -p --product",
"lint": "eslint view/**/*.{js,vue}"
},
"bin": {
"testing": "testing",
"local": "local",
"staging": "staging",
"product": "product",
"app": "app",
"dev": "dev",
"lint": "lint"
},
"author": "xgqfrms",
"license": "MIT",
"dependencies": {},
"devDependencies": {
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.2.2"
}
}
.eslintrc
module.exports = {
extends: [
// add more generic rulesets here, such as:
// "eslint:recommended",
"plugin:vue/recommended",
],
rules: {
// override/add rules settings here, such as:
// "vue/no-unused-vars": "error",
}
}
$ yarn add -D eslint eslint-plugin-vue
vscode
Integrates ESLint into VS Code. If you are new to ESLint check the documentation.
The extension uses the ESLint library installed in the opened workspace folder. If the folder doesn't provide one the extension looks for a global install version. If you haven't installed ESLint either locally or globally do so by running npm install eslint in the workspace folder for a local install or npm install -g eslint for a global install.
On new folders you might also need to create a .eslintrc configuration file. You can do this by either using the VS Code command Create ESLint configuration or by running the eslint command in a terminal.
If you have installed ESLint globally (see above) then run `eslint --init` in a terminal.
If you have installed ESLint locally then run `.\node_modules\.bin\eslint --init` under Windows,
and `./node_modules/.bin/eslint --init` under Linux and Mac.
.\node_modules\.bin\eslint --init
=> .\lib\node_modules\.bin\eslint --init
./node_modules/.bin/eslint --init
=> ./lib/node_modules/.bin/eslint --init
"scripts": {
"dev": "light release -wb ",
"prod": "light release -p --product",
"lint": "./lib/node_modules/.bin/eslint view/**/*.{js,vue}",
"li": "./lib/node_modules/.bin/eslint --init",
"test": "eslint view/**/*.{js,vue}"
},
"bin": {
"testing": "testing",
"local": "local",
"staging": "staging",
"product": "product",
"app": "app",
"dev": "dev",
"lint": "lint"
}
OK
\ 路径, 转义字符
{
"scripts": {
"dev": "light release -wb ",
"prod": "light release -p --product",
"lint": ".\\lib\\node_modules\\.bin\\eslint view/**/*.{js,vue}",
"test": ".\\lib\\node_modules\\.bin\\eslint --init",
"global-lint": "eslint view/**/*.{js,vue}"
},
"bin": {
"testing": "testing",
"local": "local",
"staging": "staging",
"product": "product",
"app": "app",
"dev": "dev",
"lint": "lint"
}
}
solution
{
"name": "app",
"version": "1.0.1",
"private": true,
"description": "JT APP",
"author": "xgqfrms",
"license": "MIT",
"directories": {
"lib": "lib"
},
"scripts": {
"dev": "light release -wb ",
"prod": "light release -p --product",
"lint": ".\\lib\\node_modules\\.bin\\eslint view/**/*.{js,vue}",
"test": ".\\lib\\node_modules\\.bin\\eslint --init",
"global-lint": "eslint view/**/*.{js,vue}"
},
"bin": {
"testing": "testing",
"local": "local",
"staging": "staging",
"product": "product",
"app": "app",
"dev": "dev",
"lint": "lint"
}
}
ESLint rules
vue
https://vuejs.github.io/eslint-plugin-vue/rules/
https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules
ESLint, 0, 1, 2
https://eslint.org/docs/user-guide/getting-started
https://eslint.org/docs/user-guide/configuring
https://eslint.org/docs/user-guide/formatters/
solution
module.exports = {
extends: [
// add more generic rulesets here, such as:
// "eslint:recommended",
"plugin:vue/recommended",
],
rules: {
// override/add rules settings here, such as:
"vue/no-unused-vars": "error",
"indent": ["off", 4],
"vue/order-in-components": "off",
"vue/html-indent": "off",
"vue/html-closing-bracket-spacing": "off",
"vue/html-closing-bracket-newline": "off",
"vue/singleline-html-element-content-newline": "off",
"vue/html-self-closing": "off",
"vue/attributes-order": "off",
"vue/attribute-hyphenation": "off",
"vue/max-attributes-per-line": "off",
"vue/mustache-interpolation-spacing": "off",
"vue/name-property-casing": "off",
},
}
OK
Error & warn
ESLint & vue的更多相关文章
- 从零到一详聊如何创建Vue工程及遇到的常见问题
前言 本文也会在github上我的web-study仓库中同步更新,欢迎star. 戳这里,传送 准备工作 判断是否需要FQ或安装镜像,镜像一般可安装国内淘宝镜像,详情可看这里:cnpm npm in ...
- 就是要用Vim写Vue
Vim关于Vue的生态链还是很少,不过凑活凑活还是能用的. 缩进 缩进采用的是两个空格,.vimrc配置: au BufNewFile,BufRead *.html,*.js,*.vue set ta ...
- vue cli 3
介绍 Vue CLI 是一个基于 Vue.js 进行快速开发的完整系统 通过 @vue/cli 搭建交互式的项目脚手架. 通过 @vue/cli + @vue/cli-service-global 快 ...
- Vue 快速原型开发
快速原型开发 注意: 是:serve 而不是 server 通过使用 vue serve 和 vue build 命令对单个 *.vue 文件进行快速原型开发,不过这需要先额外安装一个全局的扩展 go ...
- 【转】手摸手,带你用vue撸后台 系列四(vueAdmin 一个极简的后台基础模板)
前言 做这个 vueAdmin-template 的主要原因是: vue-element-admin 这个项目的初衷是一个vue的管理后台集成方案,把平时用到的一些组件或者经验分享给大家,同时它也在不 ...
- Vue CLi3入门
摘自:https://www.jianshu.com/p/cf9b56efd3b8 Vue CLi3入门 12018.11.15 14:16:17字数 1222阅读 8895 地址 Vue CLi3 ...
- vue-cli & plugin:vue/strongly-recommended bug
vue-cli & plugin:vue/strongly-recommended bug ESLint plugin:vue/strongly-recommended module.expo ...
- Typescript & React & Vue
Typescript & React & Vue Typescript & React https://facebook.github.io/create-react-app/ ...
- vue 快速入门 系列 —— vue-cli 下
其他章节请看: vue 快速入门 系列 Vue CLI 4.x 下 在 vue loader 一文中我们已经学会从零搭建一个简单的,用于单文件组件开发的脚手架:本篇,我们将全面学习 vue-cli 这 ...
随机推荐
- Redis 实战 —— 09. 实现任务队列、消息拉取和文件分发
任务队列 P133 通过将待执行任务的相关信息放入队列里面,并在之后对队列进行处理,可以推迟执行那些耗时对操作,这种将工作交给任务处理器来执行对做法被称为任务队列 (task queue) . P13 ...
- 对于Spring MVC 拦截器的一些了解
Spring MVC 拦截器的执行顺序 应用场景 假设请求 localhost:8080/ 则要求直接重定向到 localhost:8080/login ; 定义拦截器顺序 permission lo ...
- CentOS 镜像下载地址
CentOS镜像地址:http://isoredirect.centos.org/altarch/7/isos/i386/
- 在线配置热加载配置 go-kratos.dev 监听key
paladin https://v1.go-kratos.dev/#/config-paladin example Service(在线配置热加载配置) # service.go type Servi ...
- https://www.cnblogs.com/AloneSword/p/3209653.html
proc/sys/net/ipv4/下各项的意义 - 孤剑 - 博客园 https://www.cnblogs.com/AloneSword/p/3209653.html
- Java多线程--两种实现方式
进程概述: 在这之前,有必要了解一下什么是进程? 在一个操作系统中,每个独立的执行的程序都可称为一个进程,也就是"正在运行的程序".如图所示: 线程概述: 如上所述,每个运行的程序 ...
- Vue技术点整理-vue.config.js
1,proxy代理解决本地开发环境跨域问题 配置proxy代理后,proxy会将任何未知请求 (没有匹配到静态文件的请求) 代理到 https://192.168.3.49:8080 vue.conf ...
- Java——定时任务调度工具
一.什么是定时任务调度? 1.常用的定时调度工具:Timer和Quartz 二.Timer简介 1.Timer的定义以及架构 2.Timer示例 三.Timer的定时调度函数 1.schedule的四 ...
- 误删eth1或者 eth0
不小心把机房,eth1删除了,过2天还演示,折腾一下午.... 首先eth1存在地方是2块./etc/sysconfig/network-scripts/下 /et/sysconfig/network ...
- Spring boot AOP 记录请求日志
如何将所有的通过url的请求参数以及返回结果都输出到日志中? 如果在controller的类中每个方法名都写一个log输出肯定是不明智的选择. 使用spring的AOP功能即可完成. 1. 在pom. ...