Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 172
chore: update maintenance dependencies#367
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
f1d998118e3af8587c2d4b99f2639a53eeec392e69d2d4ff5597450f45fd1c4fe588a0b975ea1c69a50869bb66962e0d255e26fec22d734dcd09b9b193ebac51c0c086f978c9File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| import js from '@eslint/js'; | ||
| import { defineConfig } from 'eslint/config'; | ||
| import { dirname } from 'node:path'; | ||
| import { fileURLToPath } from 'node:url'; | ||
| import prettier from 'eslint-config-prettier'; | ||
| import jest from 'eslint-plugin-jest'; | ||
| import react from 'eslint-plugin-react'; | ||
| import reactHooks from 'eslint-plugin-react-hooks'; | ||
| import globals from 'globals'; | ||
| import tseslint from 'typescript-eslint'; | ||
| const tsconfigRootDir = dirname(fileURLToPath(import.meta.url)); | ||
| export default defineConfig([ | ||
| { | ||
| plugins: { | ||
| '@typescript-eslint': tseslint.plugin, | ||
| }, | ||
| }, | ||
| { | ||
| linterOptions: { | ||
| reportUnusedDisableDirectives: 'warn', | ||
| }, | ||
| }, | ||
| { | ||
| ignores: [ | ||
| 'node_modules/', | ||
| 'coverage/', | ||
| 'es/', | ||
| 'lib/', | ||
| 'dist/', | ||
| 'docs-dist/', | ||
| '.docs-dist/', | ||
| '.dumi/', | ||
| '.doc/', | ||
| '.vercel/', | ||
| ], | ||
| }, | ||
| { | ||
| files: ['**/*.{js,jsx,ts,tsx}'], | ||
| extends: [ | ||
| js.configs.recommended, | ||
| react.configs.flat.recommended, | ||
| react.configs.flat['jsx-runtime'], | ||
| prettier, | ||
| ], | ||
| plugins: { | ||
| 'react-hooks': reactHooks, | ||
| }, | ||
| languageOptions: { | ||
| globals: { | ||
| ...globals.browser, | ||
| ...globals.node, | ||
| }, | ||
| }, | ||
| settings: { | ||
| react: { | ||
| version: 'detect', | ||
| }, | ||
| }, | ||
| rules: { | ||
| 'no-async-promise-executor': 'off', | ||
| 'no-empty-pattern': 'off', | ||
| 'no-irregular-whitespace': 'off', | ||
| 'no-prototype-builtins': 'off', | ||
| 'no-useless-escape': 'off', | ||
| 'no-extra-boolean-cast': 'off', | ||
| 'no-undef': 'off', | ||
| 'no-unused-vars': 'off', | ||
| 'react/no-find-dom-node': 'off', | ||
| 'react/display-name': 'off', | ||
| 'react/no-unknown-property': 'off', | ||
| 'react/prop-types': 'off', | ||
| 'react-hooks/exhaustive-deps': 'warn', | ||
| 'react-hooks/rules-of-hooks': 'error', | ||
| }, | ||
| }, | ||
| { | ||
| files: ['**/*.{ts,tsx}'], | ||
| extends: [...tseslint.configs.recommended], | ||
| rules: { | ||
| '@typescript-eslint/ban-ts-comment': 'off', | ||
| '@typescript-eslint/no-empty-object-type': 'off', | ||
| '@typescript-eslint/no-explicit-any': 'off', | ||
| '@typescript-eslint/no-unsafe-function-type': 'off', | ||
| '@typescript-eslint/no-unnecessary-type-constraint': 'off', | ||
| '@typescript-eslint/no-unused-vars': 'off', | ||
| }, | ||
| }, | ||
| { | ||
| files: ['src/**/*.{ts,tsx}'], | ||
| languageOptions: { | ||
| parserOptions: { | ||
| projectService: true, | ||
| tsconfigRootDir, | ||
| }, | ||
| }, | ||
| }, | ||
| { | ||
| files: ['tests/**/*.{js,jsx,ts,tsx}', '**/*.{test,spec}.{js,jsx,ts,tsx}'], | ||
| extends: [jest.configs['flat/recommended']], | ||
| rules: { | ||
| 'jest/no-disabled-tests': 'off', | ||
| 'jest/no-done-callback': 'off', | ||
| 'jest/no-identical-title': 'off', | ||
| 'jest/expect-expect': 'off', | ||
| 'jest/no-alias-methods': 'off', | ||
| 'jest/no-conditional-expect': 'off', | ||
| 'jest/no-export': 'off', | ||
| 'jest/no-standalone-expect': 'off', | ||
| 'jest/valid-expect': 'off', | ||
| 'jest/valid-title': 'off', | ||
| }, | ||
| }, | ||
| ]); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -6,7 +6,7 @@ interface Item { | ||
| id: number; | ||
| } | ||
| const MyItem: React.FC<Item> = ({ id }, ref) => ( | ||
| const MyItem = React.forwardRef<HTMLSpanElement, Item>(({ id }, ref) => ( | ||
afc163 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| <span | ||
| ref={ref} | ||
| style={{ | ||
| @@ -21,9 +21,9 @@ const MyItem: React.FC<Item> = ({ id }, ref) => ( | ||
| > | ||
| {id} | ||
| </span> | ||
| ); | ||
| )); | ||
| const ForwardMyItem = React.forwardRef(MyItem as any); | ||
| const ForwardMyItem = MyItem; | ||
| function getData(count: number) { | ||
| const data: Item[] = []; | ||
| @@ -39,7 +39,7 @@ const Demo = () => { | ||
| const [height, setHeight] = React.useState(200); | ||
| const [data, setData] = React.useState(getData(20)); | ||
| const [fullHeight, setFullHeight] = React.useState(true); | ||
| const listRef = React.useRef<ListRef>(); | ||
| const listRef = React.useRef<ListRef>(null); | ||
| return ( | ||
| <React.StrictMode> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| /// <reference types="jest" /> | ||
| /// <reference types="node" /> | ||
| /// <reference types="react" /> | ||
| /// <reference types="react-dom" /> | ||
| /// <reference types="@testing-library/jest-dom" /> | ||
| declare module '*.css'; | ||
| declare module '*.less'; | ||
| declare module 'jsonp'; | ||
| declare module 'moment/locale/zh-cn'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -2,15 +2,18 @@ import * as React from 'react'; | ||
| export interface ItemProps { | ||
| children: React.ReactElement; | ||
| setRef: (element: HTMLElement) => void; | ||
| setRef: (element: HTMLElement | null) => void; | ||
| } | ||
| export function Item({ children, setRef }: ItemProps) { | ||
| const refFunc = React.useCallback(node => { | ||
| setRef(node); | ||
| }, []); | ||
| const refFunc = React.useCallback( | ||
| (node) => { | ||
| setRef(node); | ||
| }, | ||
| [setRef], | ||
coderabbitai[bot] marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| ); | ||
| return React.cloneElement(children, { | ||
| return React.cloneElement(children as React.ReactElement<any>, { | ||
| ref: refFunc, | ||
| }); | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.