Skip to content

TypeError in no-unused-styles rule #60

@randycoulman

Description

@randycoulman

When I'm working in Atom with the linter-eslint plugin, I often encounter a TypeError that originates in the no-used-styles rule while I'm typing. I have linter-eslint configured to lint as I type.

I have found that the code that triggers the error contains the fragment <View style>. So, I'm in the process of adding style information, but before I can add the = {}, I get the type error.

I'm using eslint-plugin-react-native 2.0.0.

Here's the stack trace:

TypeError: Cannot read property 'type' of null
    at Object.astHelpers.hasArrayOfStyleReferences (/path/to/myProject/node_modules/eslint-plugin-react-native/lib/util/stylesheet.js:312:11)
    at Object.astHelpers.collectStyleReferences (/path/to/myProject/node_modules/eslint-plugin-react-native/lib/util/stylesheet.js:157:20)
    at EventEmitter.JSXAttribute (/path/to/myProject/node_modules/eslint-plugin-react-native/lib/rules/no-unused-styles.js:46:35)
    at emitOne (events.js:95:20)
    at EventEmitter.emit (events.js:182:7)
    at NodeEventGenerator.enterNode (/path/to/myProject/node_modules/eslint/lib/util/node-event-generator.js:40:22)
    at CodePathAnalyzer.enterNode (/path/to/myProject/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:608:23)
    at CommentEventGenerator.enterNode (/path/to/myProject/node_modules/eslint/lib/util/comment-event-generator.js:97:23)
    at Controller.enter (/path/to/myProject/node_modules/eslint/lib/eslint.js:895:36)
    at Controller.__execute (/path/to/myProject/node_modules/eslint/node_modules/estraverse/estraverse.js:397:31)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions