Skip to content

Commit c797c3b

Browse files
renovate[bot]danez
andauthored
chore(deps): update typescript-eslint monorepo to v6 (major) (#819)
* chore(deps): update typescript-eslint monorepo to v6 * chore: fix eslint warning --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Daniel Tschinder <[email protected]>
1 parent ac879c2 commit c797c3b

File tree

9 files changed

+1441
-1305
lines changed

9 files changed

+1441
-1305
lines changed

.eslintrc.cjs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,19 @@ module.exports = {
4848
files: ['**/*.ts', '**/*.tsx'],
4949
parser: '@typescript-eslint/parser',
5050
plugins: ['@typescript-eslint'],
51-
extends: ['plugin:@typescript-eslint/recommended'],
51+
extends: [
52+
'plugin:@typescript-eslint/recommended',
53+
'plugin:@typescript-eslint/strict',
54+
'plugin:@typescript-eslint/stylistic',
55+
],
5256
rules: {
5357
'no-shadow': 'off',
5458
'@typescript-eslint/no-shadow': 'error',
5559
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
56-
'@typescript-eslint/ban-ts-comment': 'off',
5760
'@typescript-eslint/consistent-type-imports': 'error',
58-
'@typescript-eslint/no-duplicate-imports': 'error',
61+
//'@typescript-eslint/no-duplicate-imports': 'error', //import plugin
5962
'@typescript-eslint/no-non-null-assertion': 'off',
60-
'@typescript-eslint/sort-type-union-intersection-members': 'error',
63+
'@typescript-eslint/sort-type-constituents': 'error',
6164
},
6265
},
6366
],

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"@changesets/changelog-github": "0.4.8",
2020
"@changesets/cli": "2.26.2",
2121
"@types/node": "14.18.53",
22-
"@typescript-eslint/eslint-plugin": "5.62.0",
23-
"@typescript-eslint/parser": "5.62.0",
22+
"@typescript-eslint/eslint-plugin": "6.0.0",
23+
"@typescript-eslint/parser": "6.0.0",
2424
"@vitest/coverage-v8": "0.33.0",
2525
"cpy": "9.0.1",
2626
"eslint": "8.44.0",

packages/react-docgen/src/handlers/componentMethodsJsDocHandler.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ function removeEmpty<T extends Record<string, unknown>>(obj: T): T {
1212
}
1313

1414
// Merges two objects ignoring null/undefined.
15-
function merge<
16-
T extends object | null | undefined,
17-
U extends object | null | undefined,
18-
>(obj1: T, obj2: U): (T & U) | null {
15+
function merge(obj1: null | undefined, obj2: null | undefined): null;
16+
function merge<T1, T2>(obj1: T1, obj2: T2): T1 & T2;
17+
function merge(
18+
obj1: Record<string, unknown> | null | undefined,
19+
obj2: Record<string, unknown> | null | undefined,
20+
): Record<string, unknown> | null {
1921
if (obj1 == null && obj2 == null) {
2022
return null;
2123
}
@@ -24,7 +26,7 @@ function merge<
2426
...removeEmpty(obj2 ?? {}),
2527
};
2628

27-
return merged as T & U;
29+
return merged;
2830
}
2931
/**
3032
* Extract info from the methods jsdoc blocks. Must be run after
@@ -39,7 +41,6 @@ const componentMethodsJsDocHandler: Handler = function (
3941
return;
4042
}
4143

42-
// @ts-ignore
4344
methods = methods.map((method) => {
4445
if (!method.docblock) {
4546
return method;

packages/react-docgen/src/importer/makeFsImporter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export default function makeFsImporter(
9191
path: ImportPath,
9292
name: string,
9393
file: FileState,
94-
seen: Set<string> = new Set(),
94+
seen = new Set<string>(),
9595
): NodePath | null {
9696
// Bail if no filename was provided for the current source file.
9797
// Also never traverse into react itself.

packages/react-docgen/src/utils/getPropType.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,7 @@ function getPropTypeArrayOf(
107107

108108
const subType = getPropType(argumentPath);
109109

110-
// @ts-ignore
111-
if (subType.name !== 'unknown') {
112-
type.value = subType;
113-
}
110+
type.value = subType;
114111

115112
return type;
116113
}
@@ -127,10 +124,7 @@ function getPropTypeObjectOf(
127124

128125
const subType = getPropType(argumentPath);
129126

130-
// @ts-ignore
131-
if (subType.name !== 'unknown') {
132-
type.value = subType;
133-
}
127+
type.value = subType;
134128

135129
return type;
136130
}

packages/react-docgen/tests/NodePathSerializer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ function removeUndefinedProperties(
77
): Record<string, unknown> {
88
for (const key of Object.keys(node)) {
99
if (node[key] === undefined) {
10+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
1011
delete node[key];
1112
} else if (node[key] === Object(node[key])) {
1213
node[key] = removeUndefinedProperties(

packages/react-docgen/tests/integration/integration-test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ describe('integration', () => {
1212
);
1313
const fileNames = fs.readdirSync(fixturePath, { withFileTypes: true });
1414

15-
for (let i = 0; i < fileNames.length; i++) {
16-
if (fileNames[i].isDirectory()) {
15+
for (const entry of fileNames) {
16+
if (entry.isDirectory()) {
1717
continue;
1818
}
19-
const name = fileNames[i].name;
19+
const name = entry.name;
2020

2121
const filePath = join(fixturePath, name);
2222
const fileContent = fs.readFileSync(filePath, 'utf8');

packages/react-docgen/tests/utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { afterEach } from 'vitest';
1414

1515
interface ParseCall {
1616
(code: string, importer: Importer): NodePath<Program>;
17+
// eslint-disable-next-line @typescript-eslint/unified-signatures
1718
(code: string, options: TransformOptions): NodePath<Program>;
1819
<B extends boolean = false>(
1920
code: string,
@@ -41,6 +42,7 @@ interface Parse extends ParseCall {
4142
): NodePath<T>;
4243
statement<T = Statement>(
4344
src: string,
45+
// eslint-disable-next-line @typescript-eslint/unified-signatures
4446
options: TransformOptions,
4547
index?: number,
4648
): NodePath<T>;

0 commit comments

Comments
 (0)