如何获取 visual studio 代码以不将我的双引号变成单引号?
How to get visual studio code to not turn my double quotes into single quotes?
Visual studio 代码不断将我的双引号变成单引号,我不知道如何让它不变成这样。
我正在做一个团队项目,因为他们更喜欢双引号而不是单引号,我注意到 vscode 将我的双引号变成了单引号,我已经尝试了所有我能找到的方法,但没有成功。
我正在使用 prettier,但我有 "prettier.singleQuote": false
所以我不知道为什么它总是把我的单引号变成双引号。
这是我的 eslintrc.js 代码:
module.exports = {
"parser": 'babel-eslint',
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true,
"jest": true,
},
"extends": ["eslint:recommended", "plugin:react/recommended"],
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
},
"sourceType": "module"
},
"plugins": [ "react" ],
"rules": {
"react/prop-types": ["off"],
"indent": ["warn", 2],
"linebreak-style": ["error","unix"],
"quotes": ["error","single"],
"no-unused-vars": ["warn", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }],
"no-console": ["off", { "allow": ["info", "error"] }]
}
};
我的设置修改:
{
"editor.formatOnSave": true,
"[javascript]": {
"editor.formatOnSave": false
},
"eslint.autoFixOnSave": true,
"prettier.disableLanguages": ["js"],
"eslint.alwaysShowStatus": true,
"files.autoSave": "onFocusChange",
"workbench.editor.enablePreview": false,
"breadcrumbs.enabled": true
}
预期:双引号
结果:单引号
有关如何修改 "quotes": ["error","single"],
eslint 规则的选项,请参阅 https://eslint.org/docs/rules/quotes#avoidescape
Visual studio 代码不断将我的双引号变成单引号,我不知道如何让它不变成这样。
我正在做一个团队项目,因为他们更喜欢双引号而不是单引号,我注意到 vscode 将我的双引号变成了单引号,我已经尝试了所有我能找到的方法,但没有成功。 我正在使用 prettier,但我有 "prettier.singleQuote": false 所以我不知道为什么它总是把我的单引号变成双引号。
这是我的 eslintrc.js 代码:
module.exports = {
"parser": 'babel-eslint',
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true,
"jest": true,
},
"extends": ["eslint:recommended", "plugin:react/recommended"],
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
},
"sourceType": "module"
},
"plugins": [ "react" ],
"rules": {
"react/prop-types": ["off"],
"indent": ["warn", 2],
"linebreak-style": ["error","unix"],
"quotes": ["error","single"],
"no-unused-vars": ["warn", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }],
"no-console": ["off", { "allow": ["info", "error"] }]
}
};
我的设置修改:
{
"editor.formatOnSave": true,
"[javascript]": {
"editor.formatOnSave": false
},
"eslint.autoFixOnSave": true,
"prettier.disableLanguages": ["js"],
"eslint.alwaysShowStatus": true,
"files.autoSave": "onFocusChange",
"workbench.editor.enablePreview": false,
"breadcrumbs.enabled": true
}
预期:双引号 结果:单引号
有关如何修改 "quotes": ["error","single"],
eslint 规则的选项,请参阅 https://eslint.org/docs/rules/quotes#avoidescape