用于 react native 的 ESLint 预置
你首先需要安装 ESLint 和约定的第三方插件包:
yarn add eslint @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-config-prettier eslint-plugin-import eslint-plugin-prettier eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-simple-import-sort eslint-plugin-unicorn prettier typescript eslint-plugin-eslint-plugin --dev
接下来,安装 @sj-distributor/eslint-plugin-react-native
:
yarn add @sj-distributor/eslint-plugin-react-native --dev
Add eslint-plugin-react-native
to the extends section of your .eslintrc
configuration file:
{
"extends": ["plugin:@sj-distributor/react-native/recommended"]
}