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 这 ...
随机推荐
- 百度文库Word下载器
最近我妈的文库VIP用完了,但还有很多资源要下载,于是我便在网上找下载工具. 总算找到个完美的!(虽然没界面) 既然没界面,那就自己写一个呗! 原作者 该程序的下载和写入部分由地球守卫者制作 原文链接 ...
- FreeWheel核心业务团队混沌工程实践之路
https://mp.weixin.qq.com/s/0monDPkAlMk7Yhq9swW7gQ 原创 郭彦梅 InfoQ 2020-11-17
- 公共错误码 - 支付宝开放平台 https://opendocs.alipay.com/open/common/105806
公共错误码 - 支付宝开放平台 https://opendocs.alipay.com/open/common/105806
- REST 架构的替代方案 为什么说GraphQL是API的未来?
Managing enterprise accounts - GitHub Docs https://docs.github.com/en/graphql/guides/managing-enterp ...
- 从epoll构建muduo-1 mini-muduo介绍
https://blog.csdn.net/voidccc/article/details/8719752 ========== https://blog.csdn.net/liangzhao_jay ...
- XV6学习(8)中断和设备驱动
驱动是操作系统中用于管理特定设备的代码:驱动控制设备硬件,通知硬件执行操作,处理中断,与等待该设备IO的进程进行交互. 当设备需要与操作系统进行交互时,就会产生中断(陷阱的一种),之后内核的陷阱处理代 ...
- python atexit模块学习
python atexit模块 只定义了一个register模块用于注册程序退出时的回调函数,我们可以在这个函数中做一下资源清理的操作 注:如果程序是非正常crash,或者通过os._exit()退出 ...
- Java学习路线图()
阶段1 1:学习HTML 2:学习CSS 3:Javascript 4:jquery 5:xml解析 6:Bootstrap 阶段2 7:JAVAse基础 8:mysql数据库 9:Powerdesi ...
- SQL操作数据——SQL组成,查询基础语法,where,Oracle常用函数等
SQL组成 DML数据操作语言 DCL数据控制语言 DQL数据查询语言 DDL数据定义语言 查询基础语法 记录筛选 where 子句 记录筛选 where 子句 实例练习 实例练习 Select语句中 ...
- python2.7.5 +eric4.4.2+PyQt4-4.10.3
1.安装python 双击运行就可以了 当安装好了Pyhon,记得要配置环境变量,把C:\Python27添加到PATH中 2.安装pyqt默认安装就可以 3.把eric4.4.2拷贝到C:\目录下 ...