chore: replace `@ts-ignore` with `@ts-expect-error` (#1711)

With `@ts-expect-error`, TypeScript will let you know if the comment is
no longer necessary.

See also
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html#-ts-expect-error-comments
This commit is contained in:
Tommy Nguyen 2022-07-01 15:48:50 +02:00 коммит произвёл GitHub
Родитель 45ae71b42c
Коммит caaa2345c4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
10 изменённых файлов: 14 добавлений и 26 удалений

Просмотреть файл

@ -0,0 +1,2 @@
---
---

Просмотреть файл

@ -95,8 +95,7 @@ function plugin() {
}
}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore -- The visit() overloads are bound to UnistNode, but we use the expanded MdAstNode
// @ts-expect-error -- The visit() overloads are bound to UnistNode, but we use the expanded MdAstNode
visit(root, isInclude, processIncludeDirective);
// Replace all include comments with the included file's AST. Do this in

Просмотреть файл

@ -46,10 +46,7 @@
]
},
"eslintConfig": {
"extends": "@rnx-kit/eslint-config",
"rules": {
"@typescript-eslint/ban-ts-comment": "off"
}
"extends": "@rnx-kit/eslint-config"
},
"jest": {
"roots": [

Просмотреть файл

@ -159,8 +159,7 @@ export async function rnxStart(
// merge the Metro config middleware with our middleware
const enhanceMiddleware = metroConfig.server.enhanceMiddleware;
// eslint-disable-next-line
// @ts-ignore
// @ts-expect-error We want to assign to read-only `enhanceMiddleware`
metroConfig.server.enhanceMiddleware = (
metroMiddleware: Middleware,
metroServer: Server

Просмотреть файл

@ -52,10 +52,7 @@
]
},
"eslintConfig": {
"extends": "@rnx-kit/eslint-config",
"rules": {
"@typescript-eslint/ban-ts-comment": "off"
}
"extends": "@rnx-kit/eslint-config"
},
"jest": {
"preset": "@rnx-kit/scripts"

Просмотреть файл

@ -79,9 +79,9 @@ function getTargetPlatform(defaultPlatform) {
/** @type {() => CLIConfig} */
const loadConfig =
// @ts-ignore could not find a declaration file
// @ts-expect-error could not find a declaration file
require("@react-native-community/cli").loadConfig ||
// @ts-ignore could not find a declaration file
// @ts-expect-error could not find a declaration file
require("@react-native-community/cli/build/tools/config").default;
const { platforms } = loadConfig();

Просмотреть файл

@ -153,13 +153,11 @@ function exclusionList(additionalExclusions = [], projectRoot = process.cwd()) {
/** @type {(additionalExclusions: (string | RegExp)[]) => RegExp} */
const exclusionList = (() => {
try {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore There are no type definition files for `metro-config`
// @ts-expect-error There are no type definition files for `metro-config`
return require("metro-config/src/defaults/exclusionList");
} catch (_) {
// `blacklist` was renamed to `exclusionList` in 0.60
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore There are no type definition files for `metro-config`
// @ts-expect-error There are no type definition files for `metro-config`
return require("metro-config/src/defaults/blacklist");
}
})();
@ -195,8 +193,7 @@ module.exports = {
* @returns {MetroConfig}
*/
makeMetroConfig: (customConfig = {}) => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore There are no type definition files for `metro-config`
// @ts-expect-error There are no type definition files for `metro-config`
const { mergeConfig } = require("metro-config");
const { enhanceMiddleware } = require("./assetPluginForMonorepos");

Просмотреть файл

@ -180,8 +180,7 @@ export function loadMetroConfig(
defaultConfig.reporter = overrides.reporter;
}
if (overrides.assetPlugins) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// @ts-expect-error We want to assign to read-only `assetPlugins`
defaultConfig.transformer.assetPlugins = assetPlugins;
}

Просмотреть файл

@ -195,8 +195,7 @@ export class Project {
dispose(): void {
this.languageService.dispose();
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore `languageService` cannot be used after calling dispose
// @ts-expect-error `languageService` cannot be used after calling dispose
this.languageService = null;
}
}

Просмотреть файл

@ -171,8 +171,7 @@ function updateReadme(exportedTypes, exportedFunctions) {
};
/** @type {(table: string[][], options?: {}) => string} */
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// @ts-expect-error
const markdownTable = require("markdown-table");
const types =