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 这 ...
随机推荐
- 设置一个两边固定中间自适应的css
1.两边浮动,中间自动宽度 给左右两个盒子设置左右浮动,中间的盒子不设置宽度,左右两边边距为左右盒子的宽度,中间盒子的位置必须写在右盒子下面,不然会把右盒子挤下去 如: <div class ...
- 给定HDFS中某一个目录,输出该目录下的所有文件的读写权限、大小、创建时间、路径等信息,如果该文件是目录,则递归输出该目录下所有文件相关信息。
1 import java.text.SimpleDateFormat; 2 import org.apache.hadoop.fs.*; 3 4 public class E_RecursiveRe ...
- 接口新建学习---cookie策略
一.为什么要添加cookie? 模拟浏览器,因为http是无状态协议,像览器一样的存储和发送Cookie,如果发送一个http请求他的响应中包含Cookie,那么Cookie Manager就会自动地 ...
- 如何应对C语言内存泄露! 华为开发者社区 2020-09-29
如何应对C语言内存泄露! 华为开发者社区 2020-09-29
- 死锁案例 GAP 锁 没有就插入,存在就更新
https://mp.weixin.qq.com/s/2obpN57D8hyorCMnIu_YAg 死锁案例八 文 | 杨一 on 运维 转 | 来源:公众号yangyidba 一.前言 死锁其实是一 ...
- 作为一款内存数据库,为什么断电后Redis数据不会丢失
前言 Redis 作为一款内存数据库,被广泛使用于缓存,分布式锁等场景,那么假如断电或者因其他因素导致 Reids 服务宕机,在重启之后数据会丢失吗? Redis 持久化机制 Redis 虽然是定义为 ...
- 消息队列扫盲(RocketMQ 入门)
消息队列扫盲 消息队列顾名思义就是存放消息的队列,队列我就不解释了,别告诉我你连队列都不知道似啥吧? 所以问题并不是消息队列是什么,而是 消息队列为什么会出现?消息队列能用来干什么?用它来干这些事会带 ...
- 小麦苗数据库巡检脚本,支持Oracle、MySQL、SQL Server和PG等数据库
目录 一.巡检脚本简介 二.巡检脚本特点 三.巡检结果展示 1.Oracle数据库 2.MySQL数据库 3.SQL Server数据库 4.PG数据库 5.OS信息 四.脚本运行方式 1.Oracl ...
- LOJ10082
题目描述 原题来自:Centrual Europe 2005 我们有N个字符串,每个字符串都是由 a 至 z 的小写英文字母组成的.如果字符串A的结尾两个字符刚好与字符串B的开头两个字符匹配,那么我们 ...
- Java——break,continue,return语句
break语句: break:用于改变程序控制流 用于do-while.while.for中时,可跳出循环而执行循环后面的语句. break的作用:终止当前循环语句的执行. break还可以用来终止s ...