这是indexloc提供的服务,不要输入任何密码
Skip to content

chore(linter): Add some more rules to the no-restricted-import rule #2955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions boilerplate/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ module.exports = {
importNames: ["default"],
message: "Import named exports from 'react' instead.",
},
{
name: "react-native",
importNames: ["SafeAreaView"],
message: "Use the SafeAreaView from 'react-native-safe-area-context' instead.",
},
{
name: "react-native",
importNames: ["Text", "Button", "TextInput"],
message: "Use the custom wrapper component from 'app/src/components'.",
}
],
},
],
Expand Down
1 change: 1 addition & 0 deletions boilerplate/app/components/Text.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { TOptions } from "i18next"
// eslint-disable-next-line no-restricted-imports
import { StyleProp, Text as RNText, TextProps as RNTextProps, TextStyle } from "react-native"
import { isRTL, translate, TxKeyPath } from "@/i18n"
import type { ThemedStyle, ThemedStyleArray } from "@/theme"
Expand Down
1 change: 1 addition & 0 deletions boilerplate/app/components/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ComponentType, forwardRef, Ref, useImperativeHandle, useRef } from "rea
import {
ImageStyle,
StyleProp,
// eslint-disable-next-line no-restricted-imports
TextInput,
TextInputProps,
TextStyle,
Expand Down
1 change: 1 addition & 0 deletions boilerplate/app/screens/LoginScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { observer } from "mobx-react-lite"
import { ComponentType, FC, useEffect, useMemo, useRef, useState } from "react"
// eslint-disable-next-line no-restricted-imports
import { TextInput, TextStyle, ViewStyle } from "react-native"
import {
Button,
Expand Down
1 change: 1 addition & 0 deletions boilerplate/test/setup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// we always make sure 'react-native' gets included first
// eslint-disable-next-line no-restricted-imports
import * as ReactNative from "react-native"
import mockFile from "./mockFile"

Expand Down