Open
Description
Our project conventions prefer namespaced imports of libraries, meaning that we import React Native with import RN from 'react-native';
instead of import {Long, List, Of, Things} from 'react-native';
. Unfortunately for us, it seems as if the no-unused-styles
rule is not compatible with this type of import usage.
For example, the following code
import RN from 'react-native';
const styles = RN.StyleSheet.create({
unusedStyle: {},
});
does not trigger the rule.
I tried configuring the react-native/style-sheet-object-names
setting to ["RN.StyleSheet"]
, but this didn't seem to help the situation.
I wonder if it would be possible to improve the rule so that it is able to identify the cases where the StyleSheet
isn't imported individually.
Metadata
Metadata
Assignees
Labels
No labels