Skip to content
Open
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
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = {
'@typescript-eslint/no-explicit-any': 1,
'@typescript-eslint/no-empty-interface': 1,
'@typescript-eslint/no-inferrable-types': 0,
'@typescript-eslint/switch-exhaustiveness-check': 0,
Comment thread
QDyanbing marked this conversation as resolved.
Outdated
'react/no-find-dom-node': 1,
'react/require-default-props': 0,
'no-confusing-arrow': 0,
Expand All @@ -17,4 +18,4 @@ module.exports = {
'jsx-a11y/label-has-for': 0,
'jsx-a11y/label-has-associated-control': 0,
},
};
};
8 changes: 3 additions & 5 deletions docs/examples/components/TooltipSlider.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import type { SliderProps } from '@rc-component/slider';
import Slider from '@rc-component/slider';
import type { TooltipRef } from '@rc-component/tooltip';
import Tooltip from '@rc-component/tooltip';
import Slider, { type SliderProps } from '@rc-component/slider';
import Tooltip, { type TooltipRef } from '@rc-component/tooltip';
import '@rc-component/tooltip/assets/bootstrap.css';
import raf from '@rc-component/util/lib/raf';
import { raf } from '@rc-component/util';
import * as React from 'react';

interface HandleTooltipProps {
Expand Down
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,22 @@
"tsc": "bunx tsc --noEmit"
},
"dependencies": {
"@rc-component/util": "^1.3.0",
"@rc-component/util": "^1.11.1",
"clsx": "^2.1.1"
},
"devDependencies": {
"@rc-component/father-plugin": "^2.1.3",
"@rc-component/father-plugin": "^2.2.0",
"@rc-component/np": "^1.0.0",
"@rc-component/tooltip": "^1.2.1",
"@rc-component/trigger": "^3.5.2",
"@testing-library/jest-dom": "^6.1.5",
"@testing-library/react": "^12.1.3",
"@testing-library/react": "^16.0.0",
"@types/jest": "^29.5.1",
"@types/node": "^22.5.0",
"@types/react": "^18.2.42",
"@types/react-dom": "^18.0.11",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
Comment on lines +59 to +60
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

python - <<'PY'
import json
with open('package.json','r',encoding='utf-8') as f:
    pkg=json.load(f)
print("package.json engines.node =", pkg.get("engines",{}).get("node"))
for name in ["`@typescript-eslint/eslint-plugin`","`@typescript-eslint/parser`","eslint"]:
    print(name, "=>", pkg.get("devDependencies",{}).get(name) or pkg.get("dependencies",{}).get(name))
PY

echo "---- published engines metadata ----"
npm view `@typescript-eslint/eslint-plugin`@5.62.0 engines --json
npm view `@typescript-eslint/parser`@5.62.0 engines --json
npm view eslint@8.54.0 engines --json

Repository: react-component/slider

Length of output: 383


同步提升 Node 引擎声明以匹配 typescript-eslint/eslint 的最低要求

engines.node 仍为 >=8.x,但 @typescript-eslint/eslint-plugin@5.62.0@typescript-eslint/parser@5.62.0(以及 eslint@8.54.0)的发布 engines.node 均要求 ^12.22.0 || ^14.17.0 || >=16.0.0,会导致不兼容 Node 版本被错误放行并在 lint/tsc 阶段失败。建议在本 PR 同步更新下限。

建议修改
  "engines": {
-    "node": ">=8.x"
+    "node": ">=12.22.0"
   }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` around lines 59 - 60, Update the package.json engines.node
declaration to match the minimum Node versions required by
`@typescript-eslint/eslint-plugin`, `@typescript-eslint/parser` and eslint; change
the engines.node field (in package.json) from ">=8.x" to "^12.22.0 || ^14.17.0
|| >=16.0.0" so the runtime constraint aligns with those packages and prevents
incompatible Node versions from being allowed in CI or installs.

"@umijs/fabric": "^4.0.1",
"cross-env": "^7.0.0",
"dumi": "^2.2.10",
Expand All @@ -68,8 +70,8 @@
"glob": "^7.1.6",
"less": "^4.1.3",
"rc-test": "^7.0.15",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"regenerator-runtime": "^0.14.0",
"typescript": "^5.1.6"
},
Expand Down
2 changes: 1 addition & 1 deletion src/Handles/Handle.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { clsx } from 'clsx';
import KeyCode from '@rc-component/util/lib/KeyCode';
import { KeyCode } from '@rc-component/util';
import * as React from 'react';
import SliderContext from '../context';
import type { OnStartMove } from '../interface';
Expand Down
3 changes: 1 addition & 2 deletions src/Handles/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import * as React from 'react';
import { flushSync } from 'react-dom';
import type { OnStartMove } from '../interface';
import { getIndex } from '../util';
import type { HandleProps } from './Handle';
import Handle from './Handle';
import Handle, { type HandleProps } from './Handle';

export interface HandlesProps {
prefixCls: string;
Expand Down
14 changes: 4 additions & 10 deletions src/Slider.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import useControlledState from '@rc-component/util/lib/hooks/useControlledState';
import useEvent from '@rc-component/util/lib/hooks/useEvent';
import isEqual from '@rc-component/util/lib/isEqual';
import warning from '@rc-component/util/lib/warning';
import { isEqual, useControlledState, useEvent, warning } from '@rc-component/util';
import { clsx } from 'clsx';
import * as React from 'react';
import type { HandlesProps, HandlesRef } from './Handles';
import Handles from './Handles';
import type { InternalMarkObj, MarkObj } from './Marks';
import Marks from './Marks';
import Handles, { type HandlesProps, type HandlesRef } from './Handles';
import Marks, { type InternalMarkObj, type MarkObj } from './Marks';
import Steps from './Steps';
import Tracks from './Tracks';
import type { SliderContextProps } from './context';
import SliderContext from './context';
import SliderContext, { type SliderContextProps } from './context';
import useDisabled from './hooks/useDisabled';
import useDrag from './hooks/useDrag';
import useOffset, { getClosestEnabledHandleIndex } from './hooks/useOffset';
Expand Down
3 changes: 1 addition & 2 deletions src/hooks/useDrag.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react';
import useEvent from '@rc-component/util/lib/hooks/useEvent';
import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect';
import { useEvent, useLayoutEffect } from '@rc-component/util';
import { UnstableContext } from '../context';
import type { Direction, OnStartMove } from '../interface';
import type { OffsetValues } from './useOffset';
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useRange.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { warning } from '@rc-component/util/lib/warning';
import { warning } from '@rc-component/util';
import { useMemo } from 'react';
import type { SliderProps } from '../Slider';

Expand Down
3 changes: 1 addition & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { SliderProps, SliderRef } from './Slider';
import Slider from './Slider';
import Slider, { type SliderProps, type SliderRef } from './Slider';
export { UnstableContext } from './context';

export type { SliderProps, SliderRef };
Expand Down
4 changes: 1 addition & 3 deletions tests/Range.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/* eslint-disable max-len, no-undef, react/no-string-refs, no-param-reassign, max-classes-per-file */
import '@testing-library/jest-dom';
import { createEvent, fireEvent, render } from '@testing-library/react';
import keyCode from '@rc-component/util/lib/KeyCode';
import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook';
import { resetWarned } from '@rc-component/util/lib/warning';
import { KeyCode as keyCode, resetWarned, spyElementPrototypes } from '@rc-component/util';
import React from 'react';
import Slider from '../src';

Expand Down
3 changes: 1 addition & 2 deletions tests/Slider.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import '@testing-library/jest-dom';
import { createEvent, fireEvent, render } from '@testing-library/react';
import { clsx } from 'clsx';
import keyCode from '@rc-component/util/lib/KeyCode';
import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook';
import { KeyCode as keyCode, spyElementPrototypes } from '@rc-component/util';
import React from 'react';
import Slider from '../src/Slider';

Expand Down
3 changes: 1 addition & 2 deletions tests/common.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* eslint-disable max-len, no-undef */
import '@testing-library/jest-dom';
import { createEvent, fireEvent, render } from '@testing-library/react';
import KeyCode from '@rc-component/util/lib/KeyCode';
import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook';
import { KeyCode, spyElementPrototypes } from '@rc-component/util';
import React from 'react';
import Slider from '../src';

Expand Down
2 changes: 1 addition & 1 deletion tests/marks.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable max-len, no-undef */
import '@testing-library/jest-dom';
import { fireEvent, render } from '@testing-library/react';
import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook';
import { spyElementPrototypes } from '@rc-component/util';
import React from 'react';
import Slider from '../src';

Expand Down