Skip to content

Commit

Permalink
chore(deps): update typescript-eslint monorepo to v6 (major) (#819)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
renovate[bot] and danez authored Jul 10, 2023
1 parent ac879c2 commit c797c3b
Show file tree
Hide file tree
Showing 9 changed files with 1,441 additions and 1,305 deletions.
11 changes: 7 additions & 4 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,19 @@ module.exports = {
files: ['**/*.ts', '**/*.tsx'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: ['plugin:@typescript-eslint/recommended'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/strict',
'plugin:@typescript-eslint/stylistic',
],
rules: {
'no-shadow': 'off',
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-duplicate-imports': 'error',
//'@typescript-eslint/no-duplicate-imports': 'error', //import plugin
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/sort-type-union-intersection-members': 'error',
'@typescript-eslint/sort-type-constituents': 'error',
},
},
],
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"@changesets/changelog-github": "0.4.8",
"@changesets/cli": "2.26.2",
"@types/node": "14.18.53",
"@typescript-eslint/eslint-plugin": "5.62.0",
"@typescript-eslint/parser": "5.62.0",
"@typescript-eslint/eslint-plugin": "6.0.0",
"@typescript-eslint/parser": "6.0.0",
"@vitest/coverage-v8": "0.33.0",
"cpy": "9.0.1",
"eslint": "8.44.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ function removeEmpty<T extends Record<string, unknown>>(obj: T): T {
}

// Merges two objects ignoring null/undefined.
function merge<
T extends object | null | undefined,
U extends object | null | undefined,
>(obj1: T, obj2: U): (T & U) | null {
function merge(obj1: null | undefined, obj2: null | undefined): null;
function merge<T1, T2>(obj1: T1, obj2: T2): T1 & T2;
function merge(
obj1: Record<string, unknown> | null | undefined,
obj2: Record<string, unknown> | null | undefined,
): Record<string, unknown> | null {
if (obj1 == null && obj2 == null) {
return null;
}
Expand All @@ -24,7 +26,7 @@ function merge<
...removeEmpty(obj2 ?? {}),
};

return merged as T & U;
return merged;
}
/**
* Extract info from the methods jsdoc blocks. Must be run after
Expand All @@ -39,7 +41,6 @@ const componentMethodsJsDocHandler: Handler = function (
return;
}

// @ts-ignore
methods = methods.map((method) => {
if (!method.docblock) {
return method;
Expand Down
2 changes: 1 addition & 1 deletion packages/react-docgen/src/importer/makeFsImporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default function makeFsImporter(
path: ImportPath,
name: string,
file: FileState,
seen: Set<string> = new Set(),
seen = new Set<string>(),
): NodePath | null {
// Bail if no filename was provided for the current source file.
// Also never traverse into react itself.
Expand Down
10 changes: 2 additions & 8 deletions packages/react-docgen/src/utils/getPropType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,7 @@ function getPropTypeArrayOf(

const subType = getPropType(argumentPath);

// @ts-ignore
if (subType.name !== 'unknown') {
type.value = subType;
}
type.value = subType;

return type;
}
Expand All @@ -127,10 +124,7 @@ function getPropTypeObjectOf(

const subType = getPropType(argumentPath);

// @ts-ignore
if (subType.name !== 'unknown') {
type.value = subType;
}
type.value = subType;

return type;
}
Expand Down
1 change: 1 addition & 0 deletions packages/react-docgen/tests/NodePathSerializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ function removeUndefinedProperties(
): Record<string, unknown> {
for (const key of Object.keys(node)) {
if (node[key] === undefined) {
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete node[key];
} else if (node[key] === Object(node[key])) {
node[key] = removeUndefinedProperties(
Expand Down
6 changes: 3 additions & 3 deletions packages/react-docgen/tests/integration/integration-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ describe('integration', () => {
);
const fileNames = fs.readdirSync(fixturePath, { withFileTypes: true });

for (let i = 0; i < fileNames.length; i++) {
if (fileNames[i].isDirectory()) {
for (const entry of fileNames) {
if (entry.isDirectory()) {
continue;
}
const name = fileNames[i].name;
const name = entry.name;

const filePath = join(fixturePath, name);
const fileContent = fs.readFileSync(filePath, 'utf8');
Expand Down
2 changes: 2 additions & 0 deletions packages/react-docgen/tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { afterEach } from 'vitest';

interface ParseCall {
(code: string, importer: Importer): NodePath<Program>;
// eslint-disable-next-line @typescript-eslint/unified-signatures
(code: string, options: TransformOptions): NodePath<Program>;
<B extends boolean = false>(
code: string,
Expand Down Expand Up @@ -41,6 +42,7 @@ interface Parse extends ParseCall {
): NodePath<T>;
statement<T = Statement>(
src: string,
// eslint-disable-next-line @typescript-eslint/unified-signatures
options: TransformOptions,
index?: number,
): NodePath<T>;
Expand Down
Loading

0 comments on commit c797c3b

Please sign in to comment.