Я создаю проект React Native с версией 0.62.2
Я изменяю eslintrc.js
, как показано ниже
module.exports = {
parser:'babel-eslint',
env: {
browser: true,
es6: true,
},
extends: '@react-native-community',
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: [
'react',
],
rules: {
... my other rules
"react-native/no-inline-styles": 1,
"prettier/prettier": ["error", {
"no-inline-styles": false
}],
},
};
Надеюсь, мой код стиля будет таким {{ flex: 1, marginTop: 5 }}
, а не {{flex:1,marginTop:5}}
Но мое предупреждение показывает информацию:
(property) FlexStyle.marginTop?: React.ReactText
Inline style: { flex: 1, marginTop: 5 }eslint(react-native/no-inline-styles)
Replace `·flex:1,·marginTop:5·` with `flex:·1,·marginTop:·5`eslintprettier/prettier
![enter image description here](https://i.stack.imgur.com/ewHM9.png)
Я понятия не имею, как установить пространство встроенных стилей и как исправить проблему красивее.