S
S
sergey199408082018-07-16 19:02:17
Vue.js
sergey19940808, 2018-07-16 19:02:17

Vue cli, how to set up eslint properly?

Created a project with vue cli: vue init webpack vue-example
How to configure eslint. In the .editorconfig file changed the content to:

root = true

[*]
charset = utf-8
indent_style = tab
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

But I am getting errors:
Expected indentation of 2 spaces but found 4 spaces
  src/App.vue:2:1
      <div id="app">
   ^

  ✘  https://google.com/#q=vue%2Fhtml-self-closing  Require self-closing on HTML elements (<div>)
  src/App.vue:2:5
      <div id="app">
       ^

  ✘  https://google.com/#q=vue%2Fhtml-indent        Expected indentation of 2 spaces but found 4 spaces
  src/App.vue:3:1
      </div>
   ^

  ✘  http://eslint.org/docs/rules/indent            Expected indentation of 1 tab but found 4 spaces

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
aloky, 2018-07-16
@aloky

maybe you need to change it .eslintrc?
Example:

{
    "parser": "babel-eslint",
    "extends": "airbnb",
    "plugins": [
        "react",
        "jsx-a11y",
        "import"
    ],
    "rules":{
        "indent": [2, "tab"],
        "no-tabs": 0
    }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question