2
votes

I want ESLint to stop removing whitespaces around an element, like this:

GIF showing removal of whitespace

I can't seem to find any rule to disable this. I've searched https://eslint.org/docs/rules/ and tried different rules that I thought might solve my problem, but without success. I'm not even 100% sure if it's ESLint or my VS Code settings.

My eslintrc:

      root: true,
  env: {
    node: true
  },
  extends: [
    'plugin:vue/essential',
    'plugin:prettier/recommended',
    '@vue/prettier'
  ],
  rules: {
    'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
  },
  parserOptions: {
    parser: 'babel-eslint'
  }

and my VS Code user settings:

{
  "prettier.eslintIntegration": true,
  "prettier.jsxSingleQuote": true,
  "vetur.validation.template": false,

  "eslint.validate": [
    {
      "language": "vue",
      "autoFix": true
    },
    {
      "language": "html",
      "autoFix": true
    },
    {
      "language": "javascript",
      "autoFix": true
    }
  ],
  "eslint.autoFixOnSave": true,
  "editor.formatOnSave": true,
  "vetur.completion.useScaffoldSnippets": false,
  "diffEditor.ignoreTrimWhitespace": false,

Thank you.

1

1 Answers

0
votes

In VSCode you can add .editorconfig file at the root of project and add following code so vscode does not remove whitespace

[*]

trim_trailing_whitespace = false