0

I have got an indent error with prettier in .vue files.

How can I disable prettier's indent check in .vue files?

enter image description here

This is my eslint config

.eslintrc.js

module.exports = {
  root: true,
  env: {
    node: true,
  },
  plugins: ['prettier'],
  extends: [
    'plugin:vue/vue3-essential',
    'plugin:prettier/recommended',
    'prettier',
    'eslint:recommended',
  ],
  parserOptions: {
    parser: '@babel/eslint-parser',
  },
  rules: {
    'vue/script-indent': 'off',
    'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
  },
  overrides: [
    {
      files: ['*.vue'],
      rules: {
        indent: 'off',
      },
    },
  ],
};

This is my prettier config

.prettierrc.js

module.exports = {
  trailingComma: 'es5',
  tabWidth: 2,
  singleQuote: true,
  semi: true,
};
Arthur Arakelyan
  • 164
  • 1
  • 11
  • I'm not sure what you want to achieve, but try that one: https://stackoverflow.com/a/68880413/8816585 – kissu Feb 05 '23 at 12:41

1 Answers1

3

I found an answer which works for my config.

Just need to add this code to rules of eslint's config.

'prettier/prettier': [
  'error',
  {
    vueIndentScriptAndStyle: false,
  },
],
Arthur Arakelyan
  • 164
  • 1
  • 11