eslint-plugin-react-native
eslint-plugin-react-native copied to clipboard
TypeError: Cannot read property 'type' of undefined (no-single-element-style-arrays)
I'm getting the following error:
ESLint: 7.25.0
TypeError: Cannot read property 'type' of undefined Occurred while linting root/packages/mobile/src/screens/main/index.tsx:22 at JSXAttribute (root/node_modules/eslint-plugin-react-native/lib/rules/no-single-element-style-arrays.js:40:35) at root/node_modules/eslint/lib/linter/safe-emitter.js:45:58 at Array.forEach (
) at Object.emit (root/node_modules/eslint/lib/linter/safe-emitter.js:45:38) at NodeEventGenerator.applySelector (root/node_modules/eslint/lib/linter/node-event-generator.js:256:26) at NodeEventGenerator.applySelectors (root/node_modules/eslint/lib/linter/node-event-generator.js:285:22) at NodeEventGenerator.enterNode (root/node_modules/eslint/lib/linter/node-event-generator.js:299:14) at CodePathAnalyzer.enterNode (root/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:711:23) at root/node_modules/eslint/lib/linter/linter.js:954:32 at Array.forEach ( ) error Command failed with exit code 2.
main/index.tsx:22 -> <View style={styles.container}>
.eslintrc.json:
{
"plugins": ["react-native"],
"extends": ["../../.eslintrc.js", "plugin:react-native/all"],
"rules": {
"react/forbid-component-props": "off",
"react/style-prop-object": "off",
"react-native/no-single-element-style-arrays": "off", // ErrorGoesAwayWhenITurnOffTheRule
"react-native/sort-styles": "off"
},
"env": {
"react-native/react-native": true
},
"globals": {
"__DEV__": true
}
}
"eslint-plugin-react-native": "^3.10.0",
See https://github.com/Intellicode/eslint-plugin-react-native/issues/278
Should be fixed as discussed in #278