J
J
jekanok2020-05-07 10:54:41
JavaScript
jekanok, 2020-05-07 10:54:41

How to setup esliint+ prettier plugin to work with vue?

I have a problem when I installed with the eslint + prettier project via (create-nuxt-app) and when I start editing the standard template it shows me errors, I think this is a compatibility problem, for example, such an error

Parsing error: Unexpected token `:`, expected an identifiereslintprettier/prettier
Parsing error: Unexpected token <. Remember, adjacent JSX elements must be wrapped in an enclosing parent tageslintprettier/prettier
error  Parsing error: Unexpected token `=`, expected an identifier

vs code settings
{
    "workbench.iconTheme": "material-icon-theme",
    "workbench.colorTheme": "Atom One Dark",
    "window.zoomLevel": 1,
    "git.autofetch": true,
    "git.enableSmartCommit": true,
    "editor.formatOnSave": true,
    "vetur.validation.template": true
}


.eslintrc
module.exports = {
  root: true,
  env: {
    browser: true,
    node: true,
    'es6': true
  },
  parserOptions: {
    parser: 'babel-eslint'
  },
  extends: [
    '@nuxtjs',
    'prettier',
    'prettier/vue',
    'plugin:prettier/recommended',
    'plugin:nuxt/recommended',
    'plugin:vue/essential',
    'standard'
  ],
  plugins: [
    'prettier','vue'
  ],
  // add your custom rules here
  rules: {
    'nuxt/no-cjs-in-config': 'off',
    'max-len': ["error", 500],
    "prettier/prettier": ["error", {
    "endOfLine":"auto"
  }],
  }
}

.prettierrc
{
  "semi": true,
  "arrowParens": "always",
  "singleQuote": true,
  "parser": "flow"
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question