1.scripts里添加快捷eslint检查命令
"lint": "eslint --ext .js,.vue src"
2.添加eslint依赖包
"babel-eslint": "^8.2.1", "eslint": "^4.15.0", "eslint-config-standard": "^10.2.1", "eslint-friendly-formatter": "^3.0.0", "eslint-loader": "^1.7.1", "eslint-plugin-import": "^2.7.0", "eslint-plugin-node": "^5.2.0", "eslint-plugin-promise": "^3.4.0", "eslint-plugin-standard": "^3.0.1", "eslint-plugin-vue": "^4.0.0",
// https://eslint.org/docs/user-guide/configuring module.exports = { root: true, parserOptions: { parser: 'babel-eslint' }, env: { browser: true, }, extends: [ // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules. 'plugin:vue/essential', // https://github.com/standard/standard/blob/master/docs/RULES-en.md 'standard' ], // required to lint *.vue files plugins: [ 'vue' ], // add your custom rules here rules: { // allow async-await 'generator-star-spacing': 'off', // allow debugger during development 'no-debugger': process.env.NODE_ENV === 'production' 'error' : 'off' } }
/build/
/config/
/dist/
/*.js
const createLintingRule = () => ({ test: /\.(js|vue)$/, loader: 'eslint-loader', enforce: 'pre', include: [resolve('src'), resolve('test')], options: { formatter: require('eslint-friendly-formatter'), emitWarning: !config.dev.showEslintErrorsInOverlay } }) module.exports = { //....... module: { rules: [ ...(config.dev.useEslint [createLintingRule()] : []), //.....
useEslint: true, showEslintErrorsInOverlay: false,
如下:
对于有强迫症的我来说不能无视,怎么搞定?
首先找到.eslintrc.js文件
在 rules添加以下规则
"vue/html-self-closing": ["error",{ "html": { "void": "never", "normal": "any", "component": "any" }, "svg": "always", "math": "always" }],
保存即可
规则:
"vue/singleline-html-element-content-newline": false,
以上为个人经验,希望能给大家一个参考,也希望大家多多支持源码搜藏网。
【JQ】无限滚动条-jquery.infinitescroll.j
query多选下拉框插件 jquery-multiselect(
手机站jQuery自动完成插件autoComplete.js
热门源码