然后,一旦我保存,它将更改为:
我的开发依赖项:
"devDependencies": {
"@babel/preset-flow": "^7.0.0-beta.56",
"babel-eslint": "^8.2.6",
"babel-jest": "23.4.2",
"babel-preset-react-native": "^5",
"eslint": "^4.19.1",
"eslint-config-airbnb": "^17.0.0",
"eslint-plugin-import": "^2.13.0",
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-react": "^7.10.0",
"flow-bin": "^0.78.0",
"jest": "23.4.2",
"prettier-eslint": "^8.8.2",
"react-test-renderer": "16.4.1"},
任何想法为什么会这样?
谢谢您的关注:)
答案 0 :(得分:1)
我认为是由于空白配置(例如 no-irregular-whitespace ?)引起的。我想说,最安全的方法是将它们作为单线包装(并用大括号括起来):
<Text>{'Drawer'}</Text>
答案 1 :(得分:0)
我没有安装eslint-plugin-prettier和eslint-config-prettier,然后执行以下操作:
然后删除“ prettier-eslint”包,以便更漂亮可以完全处理格式。先运行“ prettier-eslint”,再运行eslint,以便eslint可以更改prettier制作的格式。
我还禁用了VScode上的漂亮扩展,并按照eslint-config-prettier https://www.npmjs.com/package/eslint-plugin-prettier
的建议添加了漂亮还要按如下所示配置我的.eslintrc:
{
"extends": [
"airbnb",
"prettier",
"prettier/react"
],
"parser": "babel-eslint",
"parserOptions":{
"ecmaVersion": 8,
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"impliedStrict": true,
"classes": true
}
},
"env": {
"browser": true,
"node": true,
"jquery": true
},
"plugins": ["react", "prettier"],
"rules": {
"react/jsx-filename-extension": [
2,
{
"extensions": [".js", ".jsx"]
}
],
"react/forbid-prop-types": [0],
"react/require-default-props": [0],
"global-require": [0],
"no-underscore-dangle": [0],
"react/destructuring-assignment": 0,
"ignoreClassFields": true,
"no-unused-vars": 1,
"react/prop-types": 1,
"camelcase": 1,
"max-len": 1,
"prettier/prettier": ["error", { "trailingComma": "es5", "singleQuote": true }]
}
}
希望能帮助到那里的人:)