Skip to content

Commit 079e5fd

Browse files
authored
chore: update code quality tools (#6894)
1 parent 7cb1fc0 commit 079e5fd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2016
-2331
lines changed

.eslintignore

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

.eslintrc

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

.travis.yml

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

eslint.config.mjs

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
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/display-name': 'off',
86+
},
87+
},
88+
{
89+
rules: {
90+
'react/prop-types': 'off',
91+
'react/no-unknown-property': ['error', { ignore: ['x-placement'] }],
92+
},
93+
},
94+
);

karma.conf.js

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

package.json

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@
4141
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
4242
"check-types": "tsc -p ./test/tsconfig.json --noEmit",
4343
"deploy-docs": "yarn --cwd www deploy",
44-
"format": "eslint --ext tsx --ext ts src --fix",
45-
"lint": "eslint --ext tsx --ext ts src && tsc --noEmit && yarn check-types",
44+
"lint": "eslint src test",
4645
"prepublishOnly": "npm run build",
4746
"release": "rollout",
4847
"start": "yarn --cwd www start",
@@ -77,51 +76,40 @@
7776
"@4c/tsconfig": "^0.4.1",
7877
"@babel/cli": "^7.23.4",
7978
"@babel/core": "^7.23.5",
80-
"@babel/eslint-parser": "^7.24.1",
8179
"@babel/preset-typescript": "^7.23.3",
8280
"@babel/register": "^7.22.15",
8381
"@react-bootstrap/babel-preset": "^2.2.0",
84-
"@react-bootstrap/eslint-config": "^3.0.0",
8582
"@testing-library/dom": "^10.4.0",
86-
"@testing-library/react": "^16.0.0",
83+
"@testing-library/react": "^16.2.0",
8784
"@types/invariant": "^2.2.37",
88-
"@types/mocha": "^10.0.6",
8985
"@types/react": "^18.3.3",
9086
"@types/react-dom": "^18.3.0",
9187
"@types/warning": "^3.0.3",
92-
"@typescript-eslint/eslint-plugin": "^7.13.0",
93-
"@typescript-eslint/parser": "^7.13.0",
94-
"@vitejs/plugin-react": "^4.3.2",
95-
"@vitest/browser": "^2.1.3",
96-
"@vitest/coverage-istanbul": "^2.1.3",
88+
"@vitejs/plugin-react": "^4.3.4",
89+
"@vitest/browser": "^3.0.4",
90+
"@vitest/coverage-istanbul": "^3.0.4",
9791
"babel-loader": "^9.1.3",
98-
"babel-plugin-istanbul": "^6.1.1",
9992
"chalk": "^4.1.2",
10093
"cherry-pick": "^0.5.0",
101-
"conventional-changelog-cli": "^2.2.2",
102-
"cpy-cli": "^3.1.1",
94+
"cpy-cli": "^5.0.0",
10395
"cross-env": "^7.0.3",
104-
"dtslint": "^4.2.1",
105-
"eslint": "^8.55.0",
106-
"eslint-config-4catalyzer-typescript": "^3.3.0",
107-
"eslint-import-resolver-node": "^0.3.9",
108-
"eslint-import-resolver-webpack": "^0.13.8",
109-
"eslint-plugin-import": "^2.29.0",
110-
"eslint-plugin-jsx-a11y": "^6.8.0",
111-
"eslint-plugin-prettier": "^5.1.3",
112-
"eslint-plugin-react": "^7.34.2",
96+
"eslint": "^9.19.0",
97+
"eslint-config-prettier": "^10.0.1",
98+
"eslint-plugin-prettier": "^5.2.3",
99+
"eslint-plugin-react": "^7.37.4",
100+
"eslint-plugin-react-hooks": "^5.1.0",
113101
"execa": "^5.1.1",
114102
"fs-extra": "^10.1.0",
115-
"husky": "^9.0.11",
116-
"lint-staged": "^15.2.7",
117-
"lodash": "^4.17.21",
118-
"playwright": "^1.45.3",
119-
"prettier": "^3.3.2",
120-
"process": "^0.11.10",
103+
"globals": "^15.14.0",
104+
"husky": "^9.1.7",
105+
"lint-staged": "^15.4.3",
106+
"playwright": "^1.50.0",
107+
"prettier": "^3.4.2",
121108
"react": "^18.3.1",
122109
"react-dom": "^18.3.1",
123110
"typescript": "^5.5.4",
124-
"vitest": "^2.1.3",
111+
"typescript-eslint": "^8.22.0",
112+
"vitest": "^3.0.4",
125113
"webpack": "^5.93.0"
126114
},
127115
"peerDependencies": {

src/AbstractModalHeader.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ const AbstractModalHeader = React.forwardRef<
7777
},
7878
);
7979

80+
AbstractModalHeader.displayName = 'AbstractModalHeader';
8081
AbstractModalHeader.propTypes = propTypes;
8182

8283
export default AbstractModalHeader;

src/BootstrapModalManager.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ class BootstrapModalManager extends ModalManager {
2020
adjust: number,
2121
) {
2222
const actual = element.style[prop];
23-
// TODO: DOMStringMap and CSSStyleDeclaration aren't strictly compatible
24-
// @ts-ignore
23+
// @ts-expect-error TODO: DOMStringMap and CSSStyleDeclaration aren't strictly compatible
2524
element.dataset[prop] = actual;
2625
css(element, {
2726
[prop]: `${parseFloat(css(element, prop as any)) + adjust}px`,

src/Carousel.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export interface CarouselRef {
3535

3636
export interface CarouselProps
3737
extends BsPrefixProps,
38-
Omit<React.HTMLAttributes<HTMLElement>, 'onSelect'> {
38+
Omit<React.HTMLAttributes<HTMLElement>, 'onSelect'> {
3939
slide?: boolean;
4040
fade?: boolean;
4141
controls?: boolean;
@@ -56,7 +56,9 @@ export interface CarouselProps
5656
nextIcon?: React.ReactNode;
5757
nextLabel?: React.ReactNode;
5858
variant?: CarouselVariant;
59-
ref?: React.Ref<CarouselRef> | React.MutableRefObject<CarouselRef | undefined>
59+
ref?:
60+
| React.Ref<CarouselRef>
61+
| React.MutableRefObject<CarouselRef | undefined>;
6062
}
6163

6264
const SWIPE_THRESHOLD = 40;
@@ -197,6 +199,7 @@ function isVisible(element) {
197199
}
198200

199201
const Carousel: BsPrefixRefForwardingComponent<'div', CarouselProps> =
202+
// eslint-disable-next-line react/display-name
200203
React.forwardRef<CarouselRef, CarouselProps>(
201204
({ defaultActiveIndex = 0, ...uncontrolledProps }, ref) => {
202205
const {
@@ -589,9 +592,9 @@ const Carousel: BsPrefixRefForwardingComponent<'div', CarouselProps> =
589592
child.props.className,
590593
isActive && status !== 'entered' && orderClassName,
591594
(status === 'entered' || status === 'exiting') &&
592-
'active',
595+
'active',
593596
(status === 'entering' || status === 'exiting') &&
594-
directionalClassName,
597+
directionalClassName,
595598
),
596599
})
597600
}

src/Col.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type ColOrder = ColOrderNumber | 'first' | 'last';
2929
type ColSize = boolean | 'auto' | NumberAttr;
3030
type ColSpec =
3131
| ColSize
32-
| { span?: ColSize; offset?: NumberAttr; order?: ColOrder };
32+
| { span?: ColSize | null; offset?: NumberAttr; order?: ColOrder };
3333

3434
export interface ColProps
3535
extends BsPrefixProps,

0 commit comments

Comments
 (0)