XO + eslint-plugin-react-native
Я пытаюсь заставить плагин eslint-plugin-react-native работать с XO.
Я пытался следовать разделам «Установка» и «Настройка» для плагина, но всегда получаю следующее:
✖ 1:1 Definition for rule react-native/no-unused-styles was not found. react-native/no-unused-styles
✖ 1:1 Definition for rule react-native/split-platform-components was not found. react-native/split-platform-components
✖ 1:1 Definition for rule react-native/no-inline-styles was not found. react-native/no-inline-styles
✖ 1:1 Definition for rule react-native/no-color-literals was not found. react-native/no-color-literals
✖ 1:1 Definition for rule react-native/no-single-element-style-arrays was not found. react-native/no-single-element-style-arrays
Когда я пытался
yarn xo --plugin=eslint-plugin-react-native
Некоторые из поддерживаемых правил работали. Я предполагаю, что сработавшие правила не зависят от конфигурации плагина, так как я не смог его настроить.
Вот фрагмент из моегоpackage.json
:
"devDependencies": {
"eslint-config-xo-react": "^0.27.0",
"eslint-config-xo-typescript": "^0.51.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-native": "^4.0.0",
"prettier": "2.1.1",
"type-fest": "^0.16.0",
"typescript": "4.0.2",
"xo": "^0.50.0"
},
"prettier": {
"trailingComma": "all",
"useTabs": true,
"singleQuote": true,
"bracketSpacing": true,
"printWidth": 155
},
"xo": {
"prettier": true,
"extends": "xo-react",
"ignore": [
"db-dump-example.js",
"frontend/babel.config.js",
"frontend/components/unused/**/*"
],
"envs": [
"node",
"jest"
],
"rules": {
"react-native/no-unused-styles": "error",
"react-native/split-platform-components": "error",
"react-native/no-inline-styles": "error",
"react-native/no-color-literals": "error",
"react-native/no-raw-text": "error",
"react-native/no-single-element-style-arrays": "error",
"n/prefer-global/buffer": "off",
"n/prefer-global/process": "off",
"import/no-cycle": "off",
"import/order": "off",
"max-params": "off",
"max-depth": "off",
"import/extensions": "off",
"object-shorthand": "error",
"capitalized-comments": "off",
"unicorn/prefer-module": "off",
"unicorn/prevent-abbreviations": "off",
"unicorn/no-array-for-each": "off",
"unicorn/no-array-reduce": "off",
"unicorn/no-empty-file": "off",
"unicorn/numeric-separators-style": "off",
"react/function-component-definition": "off",
"react/prop-types": "off",
"react/no-array-index-key": "off",
"react/jsx-no-bind": "off",
"no-await-in-loop": "off",
"no-lonely-if": "off",
"react/no-children-prop": "off"
}
Как я могу настроить этот плагин и заставить его работать с XO?