Does anyone know how to configure stylelint for react native (typescript) and StyleSheet?
src/sample.tsx
import React from "react";
import { StyleSheet, Text, View } from "react-native";
const App = () => (
<View style={styles.container}>
<Text style={styles.title}>React Native</Text>
</View>
);
const styles = StyleSheet.create({
container: {
flex: 1,
padding: 24,
backgroundColor: "#eaeaea"
},
title: {
marginTop: 16,
paddingVertical: 8,
borderWidth: 4,
borderColor: "#20232a",
borderRadius: 6,
backgroundColor: "#61dafb",
color: "#20232a",
textAlign: "center",
fontSize: 30,
fontWeight: "bold"
},
example: {
unknown: "property"
}
});
export default App;
.stylelintrc.js
module.exports = {
"plugins": ["stylelint-react-native"],
"rules": {
"react-native/css-property-no-unknown": true
}
}
When I run stylelint '/src/**/.tsx'*, I got error like "you need use postcss". Ok, I found this @stylelint/postcss-css-in-js package, but no matter how I connect it, nothing works.
In the best case, the command runs without errors, although I added a property of which does not exist.
PS. stylelint version - 14, react native version - 0.66.4