0

I need to apologize in advance because I am totally confused at the moment. I've been wrangling with my .eslintrc.json (at the end of my post) for several hours now.

All I want, is to set single quotes. To my understanding single quotes are part of the default settings of "eslint:recommended". But when I execute Prettier, double quotes are being set.

Next thing I tried was setting single quotes in rules for "prettier/prettier". That's not working either. Prettier is still setting double quotes.

Last of my options was setting single quotes directly in rules as "quotes: ["error": "single"].

Strangely enough though, double quotes are being shown as linting errors while editing.

I am running out of options.

Maybe someone can help me.

Here's my .eslintrc.json:

{
  "env": {
    "browser": true,
    "commonjs": true,
    "es2021": true,
    "node": true
  },
  "extends": ["eslint:recommended", "prettier"],
  "plugins": ["prettier", "@babel", "vue"],
  "parserOptions": {
    "ecmaVersion": 2022,
    "parser": "@babel/eslint-parser",
    "sourceType": "module"
  },
  "rules": {
    "no-console": "off",
    "indent": ["error", 2],
    "linebreak-style": ["error", "unix"],
    "quotes": ["error", "single"],
    "semi": ["error", "always"],
    "prettier/prettier": [
      "error",
      {
        "singleQuote": true,
        "onlyUseLocalVersion": false
      }
    ]
  }
}
LongHike
  • 4,016
  • 4
  • 37
  • 76

1 Answers1

0

Finally I tried to set

{
    "prettier.singleQuote":true
}

in coc-settings.json (:CocConfig) and now it works.

That shouldn't be necessary if singleQuote is already set in .eslintrc. So I consider setting singelQuote in coc-settings.json rather a workaround than a real solution.

LongHike
  • 4,016
  • 4
  • 37
  • 76