Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions .dumirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ const isGitPagesSite = process.env.GITHUB_ACTIONS;
export default defineConfig({
favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],
themeConfig: {
name: 'rc-overflow',
name: '@rc-component/overflow',
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
},
exportStatic: {},
outputPath: 'docs-dist',
base: isGitPagesSite ? `/rc-overflow/` : `/`,
publicPath: isGitPagesSite ? `/rc-overflow/` : `/`,
base: isGitPagesSite ? `/@rc-component/overflow/` : `/`,
publicPath: isGitPagesSite ? `/@rc-component/overflow/` : `/`,
styles: [
`
.markdown table {
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# rc-overflow 🐾
# @rc-component/overflow 🐾

[![NPM version][npm-image]][npm-url]
[![npm download][download-image]][download-url]
Expand All @@ -7,8 +7,8 @@
[![bundle size][bundlephobia-image]][bundlephobia-url]
[![dumi][dumi-image]][dumi-url]

[npm-image]: http://img.shields.io/npm/v/rc-overflow.svg?style=flat-square
[npm-url]: http://npmjs.org/package/rc-overflow
[npm-image]: http://img.shields.io/npm/v/@rc-component/overflow.svg?style=flat-square
[npm-url]: http://npmjs.org/package/@rc-component/overflow
[github-actions-image]: https://github.com/react-component/overflow/workflows/CI/badge.svg
[github-actions-url]: https://github.com/react-component/overflow/actions
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/overflow/master.svg?style=flat-square
Expand All @@ -17,10 +17,10 @@
[david-image]: https://david-dm.org/react-component/overflow/status.svg?style=flat-square
[david-dev-url]: https://david-dm.org/react-component/overflow?type=dev
[david-dev-image]: https://david-dm.org/react-component/overflow/dev-status.svg?style=flat-square
[download-image]: https://img.shields.io/npm/dm/rc-overflow.svg?style=flat-square
[download-url]: https://npmjs.org/package/rc-overflow
[bundlephobia-url]: https://bundlephobia.com/result?p=rc-overflow
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/rc-overflow
[download-image]: https://img.shields.io/npm/dm/@rc-component/overflow.svg?style=flat-square
[download-url]: https://npmjs.org/package/@rc-component/overflow
[bundlephobia-url]: https://bundlephobia.com/result?p=@rc-component/overflow
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/@rc-component/overflow
[dumi-url]: https://github.com/umijs/dumi
[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square

Expand All @@ -32,7 +32,7 @@ https://overflow-react-component.vercel.app/

## Install

[![rc-overflow](https://nodei.co/npm/rc-overflow.png)](https://npmjs.org/package/rc-overflow)
[![@rc-component/overflow](https://nodei.co/npm/@rc-component/overflow.png)](https://npmjs.org/package/@rc-component/overflow)

## Usage

Expand All @@ -54,4 +54,4 @@ npm start

## License

rc-overflow is released under the MIT license.
@rc-component/overflow is released under the MIT license.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
hero:
title: rc-overflow
title: @rc-component/overflow
description: React Overflow Component
---

Expand Down
2 changes: 1 addition & 1 deletion examples/fill-width.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import useLayoutEffect from "rc-util/lib/hooks/useLayoutEffect";
import useLayoutEffect from "@rc-component/util/lib/hooks/useLayoutEffect";
import Overflow from '../src';
import '../assets/index.less';
import './common.less';
Expand Down
11 changes: 0 additions & 11 deletions now.json

This file was deleted.

19 changes: 9 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rc-overflow",
"version": "1.4.1",
"name": "@rc-component/overflow",
"version": "1.0.0",
"description": "Auto collapse box when overflow",
"keywords": [
"react",
Expand Down Expand Up @@ -38,19 +38,19 @@
"prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"",
"test": "rc-test",
"test:coverage": "rc-test --coverage",
"prepublishOnly": "npm run compile && np --no-cleanup --yolo --no-publish",
"prepublishOnly": "npm run compile && rc-np",
"lint": "eslint src/ --ext .tsx,.ts",
"lint:tsc": "tsc -p tsconfig.json --noEmit",
"now-build": "npm run docs:build"
},
"dependencies": {
"@babel/runtime": "^7.11.1",
"classnames": "^2.2.1",
"rc-resize-observer": "^1.0.0",
"rc-util": "^5.37.0"
"@rc-component/resize-observer": "^1.0.0",
"@rc-component/util": "^1.3.0"
},
"devDependencies": {
"@rc-component/father-plugin": "^1.0.0",
"@rc-component/father-plugin": "^2.0.2",
"@rc-component/np": "^1.0.4",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^12.0.0",
"@types/classnames": "^2.2.9",
Expand All @@ -68,7 +68,6 @@
"eslint": "^7.0.0",
"father": "^4.0.0",
"less": "^3.10.3",
"np": "^7.0.0",
"prettier": "^2.0.5",
"rc-test": "^7.0",
"react": "^16.0.0",
Expand All @@ -77,8 +76,8 @@
"typescript": "^5.0.0"
},
"peerDependencies": {
"react": ">=16.9.0",
"react-dom": ">=16.9.0"
"react": ">=18.0.0",
"react-dom": ">=18.0.0"
Comment on lines +76 to +77

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Bumping the peerDependencies to require React 18 is a major breaking change. However, the project's devDependencies have not been updated accordingly. For instance, react is still ^16.0.0, and enzyme-adapter-react-16 is used, while Enzyme doesn't have a stable adapter for React 18. This inconsistency will cause issues with the local development setup and testing. To ensure the project is buildable and testable, devDependencies should be updated to be compatible with React 18.

Comment on lines +76 to +77
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Peer 要求 React>=18,但 devDependencies 仍为 React 16:版本不一致会导致本地/CI 构建与测试失配

  • 当前 devDeps:react@^16react-dom@^16@types/react@^16enzyme/enzyme-adapter-react-16 等均与 React 18 不匹配,极易在类型与测试层面报错。
  • 建议方案A(推荐):将 devDeps 升级到 React 18,并迁移测试至 RTL(enzyme 对 React 18 支持不完善)。

参考补丁(最小对齐,版本号可按你们实际约束调整):

   "devDependencies": {
-    "@testing-library/jest-dom": "^5.16.4",
-    "@testing-library/react": "^12.0.0",
-    "@types/react": "^16.14.2",
-    "@types/react-dom": "^16.9.10",
+    "@testing-library/jest-dom": "^6.0.0",
+    "@testing-library/react": "^14.0.0",
+    "@types/react": "^18.0.0",
+    "@types/react-dom": "^18.0.0",
-    "enzyme": "^3.0.0",
-    "enzyme-adapter-react-16": "^1.0.1",
-    "enzyme-to-json": "^3.4.0",
+    // 如仍保留 enzyme,请明确兼容策略;更建议移除并统一使用 RTL
-    "react": "^16.0.0",
-    "react-dom": "^16.0.0",
+    "react": "^18.0.0",
+    "react-dom": "^18.0.0",

若短期无法迁移测试,可临时放宽 peer 到 >=16.9.0,但这与本 PR 目标相悖,不建议。

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In package.json around lines 79-80, peerDependencies require "react" and
"react-dom" >=18 but devDependencies still use React 16 and enzyme (mismatched
versions will break local/CI builds and tests); update devDependencies to align
with React 18 by bumping "react", "react-dom", and "@types/react" to compatible
^18 versions, remove or replace enzyme/enzyme-adapter-react-16 with
testing-library/react and related RTL tooling, update test setup files and
adapters to RTL (or if absolutely necessary as a short-term stopgap only, relax
the peer to ">=16.9.0" temporarily), and run/adjust tests to fix any API/type
changes introduced by React 18 and the new testing library.

},
"overrides": {
"cheerio": "1.0.0-rc.12"
Expand Down
2 changes: 1 addition & 1 deletion src/Item.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import classNames from 'classnames';
import ResizeObserver from 'rc-resize-observer';
import ResizeObserver from '@rc-component/resize-observer';
import type { ComponentType } from './RawItem';

// Use shared variable to save bundle size
Expand Down
4 changes: 2 additions & 2 deletions src/Overflow.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';
import { useState, useMemo, useCallback } from 'react';
import classNames from 'classnames';
import ResizeObserver from 'rc-resize-observer';
import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect';
import ResizeObserver from '@rc-component/resize-observer';
import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect';
import Item from './Item';
import useEffectState, { useBatcher } from './hooks/useEffectState';
import type { ComponentType } from './RawItem';
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/channelUpdate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import raf from 'rc-util/lib/raf';
import raf from '@rc-component/util/lib/raf';

export default function channelUpdate(callback: VoidFunction) {
if (typeof MessageChannel === 'undefined') {
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useEffectState.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import useEvent from 'rc-util/lib/hooks/useEvent';
import useEvent from '@rc-component/util/lib/hooks/useEvent';
import * as React from 'react';
import { unstable_batchedUpdates } from 'react-dom';
import channelUpdate from './channelUpdate';
Expand Down
4 changes: 2 additions & 2 deletions tests/github.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import { render, act } from '@testing-library/react';
import { spyElementPrototypes } from 'rc-util/lib/test/domHook';
import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook';
import Overflow from '../src';

import { _rs as onResize } from 'rc-resize-observer/lib/utils/observerUtil';
import { _rs as onResize } from '@rc-component/resize-observer/lib/utils/observerUtil';

interface ItemType {
label: React.ReactNode;
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"paths": {
"@/*": ["src/*"],
"@@/*": [".dumi/tmp/*"],
"rc-overflow": ["src/index.tsx"]
"@rc-component/overflow": ["src/index.tsx"]
}
}
}
Loading