Skip to content

Commit 930059e

Browse files
committed
lint updates
1 parent b1894d0 commit 930059e

34 files changed

+2016
-600
lines changed

.eslintrc

Lines changed: 0 additions & 18 deletions
This file was deleted.

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20

eslint.config.mjs

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
import eslint from '@eslint/js';
2+
import globals from 'globals';
3+
import prettierPlugin from 'eslint-plugin-prettier/recommended';
4+
import tseslint from 'typescript-eslint';
5+
import react from 'eslint-plugin-react';
6+
import reactHooks from 'eslint-plugin-react-hooks';
7+
8+
export default tseslint.config(
9+
eslint.configs.recommended,
10+
tseslint.configs.recommended,
11+
12+
prettierPlugin,
13+
react.configs.flat.recommended,
14+
react.configs.flat['jsx-runtime'],
15+
16+
{
17+
plugins: {
18+
'react-hooks': reactHooks,
19+
},
20+
settings: {
21+
react: {
22+
version: 'detect',
23+
},
24+
},
25+
rules: {
26+
'react-hooks/rules-of-hooks': 'error',
27+
},
28+
},
29+
{
30+
files: ['**/*.ts', '**/*.tsx', '**/*.mts'],
31+
plugins: {
32+
'@typescript-eslint': tseslint.plugin,
33+
},
34+
languageOptions: {
35+
parser: tseslint.parser,
36+
parserOptions: {
37+
ecmaVersion: 'latest',
38+
ecmaFeatures: {
39+
jsx: true,
40+
},
41+
warnOnUnsupportedTypeScriptVersion: false,
42+
},
43+
},
44+
rules: {
45+
'@typescript-eslint/no-explicit-any': 'off',
46+
'@typescript-eslint/no-unused-vars': [
47+
'error',
48+
{
49+
args: 'after-used',
50+
argsIgnorePattern: '^_',
51+
vars: 'all',
52+
varsIgnorePattern: '^_',
53+
caughtErrors: 'none',
54+
caughtErrorsIgnorePattern: '^_',
55+
ignoreRestSiblings: false,
56+
},
57+
],
58+
},
59+
},
60+
{
61+
ignores: ['**/node_modules/**', '**/lib/**', '**/www/**'],
62+
},
63+
{
64+
languageOptions: {
65+
ecmaVersion: 2022,
66+
sourceType: 'module',
67+
globals: {
68+
...globals.browser,
69+
...globals.commonjs,
70+
...globals.node,
71+
},
72+
},
73+
linterOptions: {
74+
reportUnusedDisableDirectives: true,
75+
},
76+
},
77+
{
78+
files: ['**/test/**/*'],
79+
rules: {
80+
'no-script-url': 'off',
81+
'no-unused-expressions': 'off',
82+
'@typescript-eslint/no-unused-expressions': 'off',
83+
'padded-blocks': 'off',
84+
'react/no-multi-comp': 'off',
85+
'react/prop-types': 'off',
86+
},
87+
},
88+
);

package.json

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"build:pick": "cherry-pick --cwd=lib --input-dir=../src --cjs-dir=cjs --esm-dir=esm",
5353
"build:popper": "rollup src/popper.ts --file lib/cjs/popper.js --format cjs --name popper --plugin @rollup/plugin-node-resolve",
5454
"deploy-docs": "yarn --cwd www deploy",
55-
"lint": "eslint www/*.js www/src src test *.ts --ext .js,.ts,.tsx",
55+
"lint": "eslint src test *.ts",
5656
"prepublishOnly": "yarn build",
5757
"release": "rollout",
5858
"start": "yarn --cwd www start",
@@ -61,7 +61,7 @@
6161
"testonly": "vitest --run"
6262
},
6363
"lint-staged": {
64-
"*.js,*.tsx": "eslint --fix --ext .js,.ts,.tsx"
64+
"*.js,*.tsx": "eslint --fix"
6565
},
6666
"prettier": {
6767
"singleQuote": true,
@@ -75,6 +75,7 @@
7575
"conventionalCommits": true
7676
},
7777
"dependencies": {
78+
"@babel/eslint-parser": "^7.25.9",
7879
"@babel/runtime": "^7.26.0",
7980
"@popperjs/core": "^2.11.8",
8081
"@react-aria/ssr": "^3.5.0",
@@ -93,10 +94,11 @@
9394
"@4c/cli": "^4.0.4",
9495
"@4c/rollout": "^4.0.2",
9596
"@4c/tsconfig": "^0.4.1",
96-
"@babel/cli": "^7.20.7",
97-
"@babel/core": "^7.20.12",
98-
"@babel/preset-react": "^7.18.6",
99-
"@babel/preset-typescript": "^7.18.6",
97+
"@babel/cli": "^7.26.4",
98+
"@babel/core": "^7.26.0",
99+
"@babel/preset-react": "^7.26.3",
100+
"@babel/preset-typescript": "^7.26.0",
101+
"@eslint/js": "^9.17.0",
100102
"@react-bootstrap/eslint-config": "^2.0.0",
101103
"@rollup/plugin-node-resolve": "^15.2.3",
102104
"@testing-library/dom": "^10.3.1",
@@ -106,8 +108,8 @@
106108
"@types/react": "^18.3.3",
107109
"@types/react-dom": "^18.3.0",
108110
"@types/react-transition-group": "^4.4.4",
109-
"@typescript-eslint/eslint-plugin": "^4.33.0",
110-
"@typescript-eslint/parser": "^4.33.0",
111+
"@typescript-eslint/eslint-plugin": "^8.19.1",
112+
"@typescript-eslint/parser": "^8.19.1",
111113
"@vitejs/plugin-react": "^4.3.2",
112114
"@vitest/browser": "^2.1.3",
113115
"@vitest/coverage-istanbul": "2.1.3",
@@ -116,25 +118,27 @@
116118
"babel-preset-env-modules": "^1.0.1",
117119
"cherry-pick": "^0.5.0",
118120
"cross-env": "^7.0.3",
119-
"eslint": "^7.24.0",
120-
"eslint-config-4catalyzer-typescript": "^3.2.1",
121-
"eslint-config-prettier": "^8.5.0",
122-
"eslint-plugin-import": "^2.26.0",
123-
"eslint-plugin-jsx-a11y": "^6.5.1",
124-
"eslint-plugin-prettier": "^3.4.1",
125-
"eslint-plugin-react": "^7.30.0",
126-
"eslint-plugin-react-hooks": "^4.6.0",
121+
"eslint": "^9.17.0",
122+
"eslint-config-4catalyzer-typescript": "^3.3.0",
123+
"eslint-config-prettier": "^9.1.0",
124+
"eslint-plugin-import": "^2.31.0",
125+
"eslint-plugin-jsx-a11y": "^6.10.2",
126+
"eslint-plugin-prettier": "^5.2.1",
127+
"eslint-plugin-react": "^7.37.3",
128+
"eslint-plugin-react-hooks": "^5.1.0",
127129
"gh-pages": "^3.1.0",
130+
"globals": "^15.14.0",
128131
"hookem": "^1.0.9",
129132
"lint-staged": "^10.5.4",
130133
"playwright": "^1.48.0",
131-
"prettier": "^2.7.1",
134+
"prettier": "^3.4.2",
132135
"react": "^18.3.1",
133136
"react-dom": "^18.3.1",
134137
"react-transition-group": "^4.4.1",
135138
"rimraf": "^3.0.2",
136139
"rollup": "^4.18.1",
137-
"typescript": "^4.7.4",
140+
"typescript": "^5.7.3",
141+
"typescript-eslint": "^8.19.1",
138142
"vitest": "^2.1.3"
139143
},
140144
"bugs": {

src/Anchor.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/* eslint-disable jsx-a11y/no-static-element-interactions */
2-
/* eslint-disable jsx-a11y/anchor-has-content */
3-
41
import * as React from 'react';
52

63
import { useEventCallback } from '@restart/hooks';

src/DropdownContext.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import * as React from 'react';
22
import type { Placement } from './usePopper';
33

44
export type DropdownContextValue = {
5-
toggle: (nextShow: boolean, event?: React.SyntheticEvent | Event) => void;
5+
toggle: (
6+
nextShow: boolean,
7+
event?: React.SyntheticEvent | KeyboardEvent | MouseEvent,
8+
) => void;
69
menuElement: HTMLElement | null;
710
toggleElement: HTMLElement | null;
811
setMenu: (ref: HTMLElement | null) => void;

src/DropdownMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export function useDropdownMenu(options: UseDropdownMenuOptions = {}) {
126126
}
127127

128128
const handleClose = (e: React.SyntheticEvent | Event) => {
129-
context?.toggle(false, e);
129+
context?.toggle(false, e as any);
130130
};
131131

132132
const { placement, setMenu, menuElement, toggleElement } = context || {};

src/DropdownToggle.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export function useDropdownToggle(): [
4040
} = useContext(DropdownContext) || {};
4141
const handleClick = useCallback(
4242
(e: Event | React.SyntheticEvent<Element, Event>) => {
43-
toggle(!show, e);
43+
toggle(!show, e as any);
4444
},
4545
[show, toggle],
4646
);

src/ImperativeTransition.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import useMergedRefs from '@restart/hooks/useMergedRefs';
22
import useEventCallback from '@restart/hooks/useEventCallback';
33
import useIsomorphicEffect from '@restart/hooks/useIsomorphicEffect';
4-
import React, { useRef, cloneElement, useState } from 'react';
4+
import { useRef, cloneElement, useState } from 'react';
55
import { TransitionComponent, TransitionProps } from './types';
66
import NoopTransition from './NoopTransition';
77
import RTGTransition from './RTGTransition';
@@ -62,11 +62,8 @@ export function useTransition({
6262

6363
export interface ImperativeTransitionProps extends TransitionProps {
6464
transition: TransitionHandler;
65-
// eslint-disable-next-line react/no-unused-prop-types
6665
appear: true;
67-
// eslint-disable-next-line react/no-unused-prop-types
6866
mountOnEnter: true;
69-
// eslint-disable-next-line react/no-unused-prop-types
7067
unmountOnExit: true;
7168
}
7269

src/Modal.tsx

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable @typescript-eslint/no-use-before-define, react/prop-types */
1+
/* eslint-disable react/prop-types */
22

33
import activeElement from 'dom-helpers/activeElement';
44
import contains from 'dom-helpers/contains';
@@ -21,7 +21,7 @@ import usePrevious from '@restart/hooks/usePrevious';
2121
import useEventCallback from '@restart/hooks/useEventCallback';
2222
import ModalManager from './ModalManager';
2323
import useWaitForDOMRef, { DOMContainer } from './useWaitForDOMRef';
24-
import { TransitionCallbacks } from './types';
24+
import { TransitionCallbacks, TransitionComponent } from './types';
2525
import useWindow from './useWindow';
2626
import { renderTransition, TransitionHandler } from './ImperativeTransition';
2727
import { isEscKey } from './utils';
@@ -438,19 +438,23 @@ const Modal: React.ForwardRefExoticComponent<
438438
</div>
439439
);
440440

441-
dialog = renderTransition(transition, runTransition, {
442-
unmountOnExit: true,
443-
mountOnEnter: true,
444-
appear: true,
445-
in: !!show,
446-
onExit,
447-
onExiting,
448-
onExited: handleHidden,
449-
onEnter,
450-
onEntering,
451-
onEntered,
452-
children: dialog as React.ReactElement,
453-
});
441+
dialog = renderTransition(
442+
transition as TransitionComponent,
443+
runTransition,
444+
{
445+
unmountOnExit: true,
446+
mountOnEnter: true,
447+
appear: true,
448+
in: !!show,
449+
onExit,
450+
onExiting,
451+
onExited: handleHidden,
452+
onEnter,
453+
onEntering,
454+
onEntered,
455+
children: dialog as React.ReactElement,
456+
},
457+
);
454458

455459
let backdropElement = null;
456460
if (backdrop) {
@@ -460,7 +464,7 @@ const Modal: React.ForwardRefExoticComponent<
460464
});
461465

462466
backdropElement = renderTransition(
463-
backdropTransition,
467+
backdropTransition as TransitionComponent,
464468
runBackdropTransition,
465469
{
466470
in: !!show,

0 commit comments

Comments
 (0)