如何删除 React Native 默认 eslint 配置中的 eslint 单引号规则?
How to remove eslint single quote rule in React Native default eslint config?
我已经用cli设置了一个react-native项目。它有效,但我有一个非常烦人的 eslint 错误:
Strings must use singlequote.eslint(quotes)
我试过这样写:
module.exports = {
root: true,
extends: "@react-native-community",
rules: {
avoidEscape: true,
allowTemplateLiterals: true,
},
};
我也尝试创建自己的配置:
module.exports = {
globals: {
Atomics: "readonly",
SharedArrayBuffer: "readonly",
},
parser: "@typescript-eslint/parser",
extends: ["@react-native-community"],
parserOptions: {
ecmaVersion: 2018,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
plugins: ["react", "react-hooks"],
rules: {
avoidEscape: true,
allowTemplateLiterals: true,
},
settings: {
react: {
version: "detect",
},
},
"sort-imports": [
"error",
{
ignoreCase: false,
ignoreDeclarationSort: false,
ignoreMemberSort: false,
memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
},
],
};
没有任何效果。如何删除这条规则?
您可以像这样关闭任何特定规则:
{
"rules": {
"quotes": "off"
}
}
我已经用cli设置了一个react-native项目。它有效,但我有一个非常烦人的 eslint 错误:
Strings must use singlequote.eslint(quotes)
我试过这样写:
module.exports = {
root: true,
extends: "@react-native-community",
rules: {
avoidEscape: true,
allowTemplateLiterals: true,
},
};
我也尝试创建自己的配置:
module.exports = {
globals: {
Atomics: "readonly",
SharedArrayBuffer: "readonly",
},
parser: "@typescript-eslint/parser",
extends: ["@react-native-community"],
parserOptions: {
ecmaVersion: 2018,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
plugins: ["react", "react-hooks"],
rules: {
avoidEscape: true,
allowTemplateLiterals: true,
},
settings: {
react: {
version: "detect",
},
},
"sort-imports": [
"error",
{
ignoreCase: false,
ignoreDeclarationSort: false,
ignoreMemberSort: false,
memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
},
],
};
没有任何效果。如何删除这条规则?
您可以像这样关闭任何特定规则:
{
"rules": {
"quotes": "off"
}
}