react-native - Eslint 仍在将双引号更改为单引号
问题描述
这是我第一次使用 eslint,所以如果我错过了下面的任何信息,请在评论中告诉我。我有一个 react native 项目并在其中配置了 eslint。这是我的规则:
{
"env": {
"browser": true,
"es6": true,
"node": true,
"react-native/react-native": true,
},
"extends": "eslint:recommended",
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"react",
"react-native"
],
"rules": {
"quotes": [2, "double", "avoid-escape"],
"semi": [
"error",
"always"
],
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"react-native/no-unused-styles": 2,
"react-native/split-platform-components": 2,
"react-native/no-inline-styles": 2,
"react-native/no-color-literals": 2,
"react-native/no-raw-text": 2,
"object-curly-spacing": [2, "always", {
"objectsInObjects": true,
"arraysInObjects": true
}]
}
}
正如您在此处看到的关于引号和对象卷曲间距的两个重要规则。即使我已将引号设置为双倍,但当我执行 yarn lint --fix 时,它仍会警告我
警告字符串必须使用单引号
并使用 --fix 标志将其更改为单引号。我在这里做错了什么,请解释一下。
同样,将对象卷曲间距设置为“始终”,我的导入从对象中的空格更改为无空格,即从 {test} 到 {test}。
我想要在对象文字之后和之前使用双引号和空格的字符串。
解决方案
推荐阅读
- python - Pandas:基于索引合并数据框和系列
- javascript - 使用 Fetch Api 从服务器获取数据后,选择框处于非活动状态
- swift - XCode12 导航栏
- node.js - Cookie 不会通过“Set-Cookie”标头在 chrome 中设置
- swift - 放入函数时,工作 Swift 代码返回“表达式类型不明确,没有更多上下文”
- php - PHP自动加载器在远程服务器上不起作用
- java - AES 密钥交换
- javascript - 使用节点 js lambda 调用外部 API 获取令牌和其他获取令牌详细信息的最佳方法
- github - 如何将现有的 repo 从 github 克隆到 windows pc
- mongodb - 如何将带有数组的集合映射到mongodb中的集合