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

https://eslint.org/docs/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的更多相关文章

  1. 从零到一详聊如何创建Vue工程及遇到的常见问题

    前言 本文也会在github上我的web-study仓库中同步更新,欢迎star. 戳这里,传送 准备工作 判断是否需要FQ或安装镜像,镜像一般可安装国内淘宝镜像,详情可看这里:cnpm npm in ...

  2. 就是要用Vim写Vue

    Vim关于Vue的生态链还是很少,不过凑活凑活还是能用的. 缩进 缩进采用的是两个空格,.vimrc配置: au BufNewFile,BufRead *.html,*.js,*.vue set ta ...

  3. vue cli 3

    介绍 Vue CLI 是一个基于 Vue.js 进行快速开发的完整系统 通过 @vue/cli 搭建交互式的项目脚手架. 通过 @vue/cli + @vue/cli-service-global 快 ...

  4. Vue 快速原型开发

    快速原型开发 注意: 是:serve 而不是 server 通过使用 vue serve 和 vue build 命令对单个 *.vue 文件进行快速原型开发,不过这需要先额外安装一个全局的扩展 go ...

  5. 【转】手摸手,带你用vue撸后台 系列四(vueAdmin 一个极简的后台基础模板)

    前言 做这个 vueAdmin-template 的主要原因是: vue-element-admin 这个项目的初衷是一个vue的管理后台集成方案,把平时用到的一些组件或者经验分享给大家,同时它也在不 ...

  6. Vue CLi3入门

    摘自:https://www.jianshu.com/p/cf9b56efd3b8 Vue CLi3入门 12018.11.15 14:16:17字数 1222阅读 8895 地址 Vue CLi3 ...

  7. vue-cli & plugin:vue/strongly-recommended bug

    vue-cli & plugin:vue/strongly-recommended bug ESLint plugin:vue/strongly-recommended module.expo ...

  8. Typescript & React & Vue

    Typescript & React & Vue Typescript & React https://facebook.github.io/create-react-app/ ...

  9. vue 快速入门 系列 —— vue-cli 下

    其他章节请看: vue 快速入门 系列 Vue CLI 4.x 下 在 vue loader 一文中我们已经学会从零搭建一个简单的,用于单文件组件开发的脚手架:本篇,我们将全面学习 vue-cli 这 ...

随机推荐

  1. 使用cacti监控linux主机

    介绍:使用cacti监控linux主机,需要在linux主机上面安装snmp服务,并修改snmpd.conf文件,指定cacti服务器的地址,然后在cacti的前台界面添加此主机即可,此处以监控cen ...

  2. charles安装使用乱码连手机等问题解决方案

    捣鼓半天终于安装好了,给大家分享下我的过程 1.安装, 正常网上安装即可,我安装了个有汉化包的,,推荐链接 安装方法下载破解版,安装即可 安装包地址:https://pan.baidu.com/s/1 ...

  3. 它真正的父进程在fork出子进程后就先于子进程exit退出了,所以它是一个由init继承的孤儿进程

    [Linux编程]守护进程(daemon)详解与创建_mick_seu的博客-CSDN博客_linux daemon https://blog.csdn.net/woxiaohahaa/article ...

  4. 文件系统层次结构标准 Linux 系统目录结构

    https://zh.wikipedia.org/wiki/文件系统层次结构标准 多数Linux发行版遵从FHS标准并且声明其自身政策以维护FHS的要求. [3] [4] [5] [6] 但截至200 ...

  5. 翻页bug 在接口文档中应规范参数的取值区间 接口规范

    <?php$a=array("red","green","blue","yellow","brown&q ...

  6. 编写Hello World ts程序

    准备工作 预装软件NodeJs和VSCode 新建文件夹ts_in_action npm命令初始化工程:npm init -y,生成package.json文件 全局安装TypeScript:npm ...

  7. 一本通提高篇——斜率优化DP

    斜率优化DP:DP的一种优化形式,主要用于优化如下形式的DP f[i]=f[j]+x[i]*x[j]+... 学习可以参考下面的博客: https://www.cnblogs.com/Xing-Lin ...

  8. 获取java栈异常

    package com.loan.modules.extbiz.in.rabbitmq.util; import java.io.PrintWriter; import java.io.StringW ...

  9. 子网划分、变长子网掩码和TCP/IP排错__IP寻址排错

    1.Cisco推荐使用的排错四步曲: ping环回地址:ping NIC:ping默认网关和ping远端设备. 1. 打开DOS窗口并ping127.0.0.1.这是一个诊断或环回地址,如果你得到一个 ...

  10. Flink-v1.12官方网站翻译-P029-User-Defined Functions

    用户自定义函数 大多数操作都需要用户定义的函数.本节列出了如何指定这些函数的不同方法.我们还涵盖了累加器,它可以用来深入了解您的Flink应用. Lambda函数 在前面的例子中已经看到,所有的操作都 ...