mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
6611c4b8f4
Summary: Ports an internal ESLint rule used at Facebook, `error-subclass-name`, to cover the React Native codebase. This rule enforces that error classes ( = those with PascalCase names ending with `Error`) only extend other error classes, and that regular functions don't have names that could be mistaken for those of error classes. Reviewed By: rubennorte Differential Revision: D17829298 fbshipit-source-id: 834e457343034a0897ab394b6a2d941789953d2e
eslint-plugin-react-native-community
This plugin is intended to be used in @react-native-community/eslint-plugin. You probably want to install that package instead.
Installation
yarn add --dev eslint @react-native-community/eslint-plugin
Note: We're using yarn to install deps. Feel free to change commands to use npm 3+ and npx if you like
Usage
Add to your eslint config (.eslintrc, or eslintConfig field in package.json):
{
"plugins": ["@react-native-community"]
}
Rules
error-subclass-name
NOTE: This rule is primarily used for developing React Native itself and is not generally applicable to other projects.
Enforces that error classes ( = classes with PascalCase names ending with Error) only extend other error classes, and that regular functions don't have names that could be mistaken for those of error classes.
no-haste-imports
Disallows Haste module names in import statements and require() calls.