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 这 ...
随机推荐
- STL_map和multimap容器
一.map/multimap的简介 map是标准的关联式容器,一个map是一个键值对序列,即(key,value)对.它提供基于key的快速检索能力. map中key值是唯一的.集合中的元素按一定的顺 ...
- LR 场景中Windows资源配置设置
监视连接前的准备工作 1)进入被监视windows系统,开启以下几个服务Remote Procedure Call(RPC) .Rmote Resgistry.Network DDE.Server.W ...
- (转载)微软数据挖掘算法:Microsoft 神经网络分析算法(10)
前言 有段时间没有进行我们的微软数据挖掘算法系列了,最近手头有点忙,鉴于上一篇的神经网络分析算法原理篇后,本篇将是一个实操篇,当然前面我们总结了其它的微软一系列算法,为了方便大家阅读,我特地整理了一篇 ...
- 数据湖-Apache Hudi
Hudi特性 数据湖处理非结构化数据.日志数据.结构化数据 支持较快upsert/delete, 可插入索引 Table Schema 小文件管理Compaction ACID语义保证,多版本保证 并 ...
- P5689 多叉堆
写在前面 OI 生涯中 AC 的首道组合数学应用题. 开题 5min 发现规律,写了半下午代码,调了两天,然而甚至没过样例,心态崩了.几天之后重新写了一份代码才 AC. 虽然思维难度不大,但毕竟是联赛 ...
- P6584 重拳出击
写在前面 来给 zrm 大佬的题写一篇题解. 这题代码实现难度不高,但是比较锻炼思维,而且应该有不少种解法.着实是一道质量很高的题目. 算法思路 首先呢,显然当小 Z 向当前节点的一棵子树走去时,这棵 ...
- cassandra权威指南读书笔记--数据建模
没有join操作.有轻量级事务和批处理,但是没有外键等.反规范化.3.0支持物化视图,允许在一个表上创建数据的多个物化视图.使用cassandra要从查询入手,而不是先从数据模型开始.先对查询建模,然 ...
- 校招有感:计算机专业毕业生如何找工作(Java方向)
这两年毕业生的就业形势,大家都看在眼里.由于我平时本职会到校园去做校招,兼职会做培训,所以也接触到了不少计算机应届毕业生. 我看到的计算机专业毕业生,各种情况的都有.虽然其中有学校的因素,但学校的因素 ...
- vulnhub靶机练习-Os-hackNos-1,超详细使用
第一次写自己总结的文章,之后也会有更新,目前还在初学阶段. 首先介绍一下靶机,靶机是 vulnhub Os-hackNos-1 简介: 难度容易到中, flag 两个 一个是普通用户的user.txt ...
- WPF 之 MultiBinding(多路 Binding)(四)
一.前言 有时候 UI 需要显示的信息由不止一个数据来源决定,这时候就需要使用 MultiBinding ,即多路 Binding. MultiBinding 与 Binding 一样均以 B ...