wow. none of the above worked.
any text with apostrophe, when i type in 'bob\'s Burgers'
, on save, turns into "bob's burgers"
, then eslint would complain. Prettier was the culprit. prettier would auto double quote, causing eslint to error.
{
...
"singleQuote": true,
"jsxSingleQuote": true,
}
What worked for me: disable prettier, and let eslint and VScode to all the work.
- go to ctrl +p.
- go to "> settings.json"
here's my settings.json
{
"editor.minimap.enabled": false,
"redhat.telemetry.enabled": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.validate": [
"javascript"
],
"[javascript]": {
"editor.tabSize": 2,
"editor.insertSpaces": true,
},
"editor.tabSize": 2,
"workbench.tree.indent": 15,
"editor.wordWrap": "on",
"editor.foldingMaximumRegions": 50000,
"search.exclude": {
"**/*.bundle": true,
"**/*.bundle.map": true,
"**/dist": true,
"**/mobile-gifts": true
},
"[python]": {
"editor.formatOnType": true
},
"editor.inlineSuggest.enabled": true,
"files.exclude": {
"**/mobile-gifts": true
},
"editor.formatOnSave": true
}
and my eslintrc.js
// eslint-disable-next-line
module.exports = {
env: {
browser: true,
es2021: true,
jest: true,
},
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
],
overrides: [],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
plugins: ["react"],
rules: {
"no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
indent: ["error", 2],
"react/react-in-jsx-scope": "off",
camelcase: "off",
"spaced-comment": "error",
quotes: "off",
"no-duplicate-imports": "error",
semi: ["error", "never"],
"react-hooks/exhaustive-deps": "off",
"@typescript-eslint/no-explicit-any": "off",
},
}