Created
March 21, 2023 04:13
-
-
Save mwood23/74c931878119f0a6f7d532411f7de8e4 to your computer and use it in GitHub Desktop.
Lint rules used in Tamagui universal development
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"rules": { | |
"no-restricted-imports": [ | |
"error", | |
{ | |
"paths": [ | |
{ | |
"name": "next/router", | |
"message": "Not universal. Use solito/router instead." | |
}, | |
{ | |
"name": "next/link", | |
"message": "Not universal. Use solito/link instead." | |
}, | |
{ | |
"name": "@sentry/react-native", | |
"message": "Import from the universal import located in libs instead." | |
}, | |
{ | |
"name": "@sentry/react", | |
"message": "Import from the universal import located in libs instead." | |
}, | |
{ | |
"name": "tamagui", | |
"message": "Import from @my/design-system instead." | |
}, | |
{ | |
"name": "@tamagui/*", | |
"message": "Import from @my/design-system instead." | |
} | |
] | |
} | |
], | |
"no-restricted-globals": [ | |
"error", | |
{ | |
"name": "localStorage", | |
"message": "Not universal, use AsyncStorage instead." | |
}, | |
{ | |
"name": "console", | |
"message": "Prefer logger instead imported from utils" | |
}, | |
{ | |
"name": "URLSearchParams", | |
"message": "Prefer useParams from Solito to get parameters. If you need this look into https://github.com/charpeni/react-native-url-polyfill." | |
}, | |
{ | |
"name": "URL", | |
"message": "Prefer useParams from Solito to get parameters. If you need this look into https://github.com/charpeni/react-native-url-polyfill." | |
}, | |
{ | |
"name": "location", | |
"message": "Use solito/router for all of your routing needs." | |
}, | |
{ | |
"name": "window", | |
"message": "Cannot access the window in a universal environment." | |
}, | |
{ | |
"name": "process", | |
"message": "Process is a node global and only available in browsers because Next.js is built using Node. For universal support, look at config/env. Expo uses expo-constants and next.js uses process." | |
} | |
], | |
"react/forbid-component-props": [ | |
"error", | |
{ | |
"forbid": [ | |
{ | |
"propName": "disabled", | |
"message": "The disabled attribute is not universal. Use isDisabled instead." | |
}, | |
{ | |
"propName": "spacing", | |
"message": "The spacing prop is Chakra. Use space instead." | |
}, | |
{ | |
"propName": "onClick", | |
"message": "The onClick prop is web only. Use onPress instead for universal." | |
}, | |
{ | |
"propName": "fontSize", | |
"message": "The fontSize property does not control line-height or other properties that the size prop does. Use size instead to be consistent with the design system." | |
} | |
] | |
} | |
], | |
"react/forbid-elements": [ | |
"error", | |
{ | |
"forbid": [ | |
{ | |
"element": "span", | |
"message": "Not universal. Use Text instead." | |
}, | |
{ | |
"element": "div", | |
"message": "Not universal. Use YStack instead." | |
}, | |
{ | |
"element": "button", | |
"message": "Not universal. Use Button instead." | |
}, | |
{ | |
"element": "h1", | |
"message": "Not universal. Use H1 instead." | |
}, | |
{ | |
"element": "h2", | |
"message": "Not universal. Use H2 instead." | |
}, | |
{ | |
"element": "h3", | |
"message": "Not universal. Use H3 instead." | |
}, | |
{ | |
"element": "h4", | |
"message": "Not universal. Use H4 instead." | |
}, | |
{ | |
"element": "h5", | |
"message": "Not universal. Use H5 instead." | |
}, | |
{ | |
"element": "h6", | |
"message": "Not universal. Use H6 instead." | |
}, | |
{ | |
"element": "p", | |
"message": "Not universal. Use Paragraph instead." | |
}, | |
{ | |
"element": "img", | |
"message": "Not universal. Use Image instead." | |
} | |
] | |
} | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment