vue加入eslint

2018-12-18  本文已影响0人  Jackie吉吉

.editorconfig

root = true

[*]

charset = utf-8

indent_style = space

indent_size = 2

end_of_line = lf

insert_final_newline = true

trim_trailing_whitespace = true

.eslintignore

/build/

/config/

/dist/

/*.js

.eslintrc.js

// 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'

  }

}

package.json

"scripts": {

    "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",

    "start": "npm run dev",

    "lint": "eslint --ext .js,.vue src",

    "build": "node build/build.js"

  },

"devDependencies": {

"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",

}

上一篇下一篇

猜你喜欢

热点阅读