Merge pull request #1148 from hgiesel/updatetypescript

Update Typescript to 4.2.4
This commit is contained in:
Damien Elmes 2021-04-23 09:48:34 +10:00 committed by GitHub
commit 8b4446d044
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 413 additions and 348 deletions

View File

@ -8,7 +8,7 @@ module.exports = {
plugins: ["@typescript-eslint"],
rules: {
"prefer-const": "warn",
"@typescript-eslint/ban-ts-ignore": "warn",
"@typescript-eslint/ban-ts-comment": "warn",
"@typescript-eslint/no-unused-vars": [
"warn",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },

1
ts/.gitignore vendored
View File

@ -1 +1,2 @@
node_modules
yarn-error.log

View File

@ -186,7 +186,7 @@ export class EditorToolbar extends HTMLElement {
customElements.define("anki-editor-toolbar", EditorToolbar);
/* Exports for editor */
// @ts-expect-error
// @ts-expect-error insufficient typing of svelte modules
export { updateActiveButtons, clearActiveButtons } from "./CommandIconButton.svelte";
// @ts-expect-error
// @ts-expect-error insufficient typing of svelte modules
export { enableButtons, disableButtons } from "./EditorToolbar.svelte";

View File

@ -140,14 +140,6 @@ export function gatherData(
};
}
interface Reviews {
mature: number;
young: number;
learn: number;
relearn: number;
early: number;
}
export interface SummedDatum {
label: string;
// count of this particular item

View File

@ -4,7 +4,7 @@
/* eslint
@typescript-eslint/no-non-null-assertion: "off",
@typescript-eslint/no-explicit-any: "off",
@typescript-eslint/ban-ts-ignore: "off" */
@typescript-eslint/ban-ts-comment: "off" */
import type pb from "anki/backend_proto";
import type { Selection } from "d3";

View File

@ -41,7 +41,7 @@ const filterStyling = (predicate: (property: string, value: string) => boolean)
element: HTMLElement
): void => {
for (const property of [...element.style]) {
const value = element.style.getPropertyValue(name);
const value = element.style.getPropertyValue(property);
if (!predicate(property, value)) {
element.style.removeProperty(property);

View File

@ -22,13 +22,13 @@
"@types/node": "^14.14.20",
"@types/react": "^16.9.53",
"@types/react-dom": "^16.9.8",
"@typescript-eslint/eslint-plugin": "^2.11.0",
"@typescript-eslint/parser": "^2.11.0",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
"chalk": "^4.1.0",
"cross-env": "^7.0.2",
"diff": "^5.0.0",
"escodegen": "^2.0.0",
"eslint": "^6.7.2",
"eslint": "^7.24.0",
"espree": "^7.3.1",
"estraverse": "^5.2.0",
"glob": "^7.1.6",
@ -46,7 +46,7 @@
"svelte2tsx": "^0.1.133",
"tmp": "^0.2.1",
"tslib": "^2.0.3",
"typescript": "^3.9.7",
"typescript": "^4.2.4",
"uglify-js": "^3.13.1"
},
"scripts": {

View File

@ -2,7 +2,7 @@
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import sqlFormatter from "@sqltools/formatter";
import * as Diff from "diff";
import { createPatch } from "diff";
import process from "process";
import path from "path";
import fs from "fs";
@ -38,7 +38,7 @@ for (const path of process.argv.slice(2)) {
errorFound = true;
console.log("SQL formatting issues found:");
}
console.log(Diff.createPatch(path, orig, formatted));
console.log(createPatch(path, orig, formatted));
}
}
}

View File

@ -100,7 +100,7 @@ function compile(tsPath: string, tsLibs: string[]) {
return createdFiles[parsedCommandLine.fileNames[0].replace(".ts", ".d.ts")];
}
function writeFile(file, data) {
function writeFile(file, data): Promise<void> {
return new Promise((resolve, reject) => {
fs.writeFile(file, data, (err) => {
if (err) {
@ -129,7 +129,7 @@ async function writeDts(tsPath, dtsPath, tsLibs) {
await writeFile(dtsPath, dtsSource);
}
function writeTs(svelteSource, sveltePath, tsPath) {
function writeTs(svelteSource, sveltePath, tsPath): void {
let tsSource = svelte2tsx(svelteSource, {
filename: sveltePath,
strictMode: true,
@ -187,7 +187,7 @@ async function compileSvelte(args) {
const svelteSource = (await readFile(sveltePath)) as string;
const mockTsPath = sveltePath + ".ts";
await writeTs(svelteSource, sveltePath, mockTsPath);
writeTs(svelteSource, sveltePath, mockTsPath);
await writeDts(mockTsPath, dtsPath, tsLibs);
await writeJs(svelteSource, sveltePath, mjsPath, cssPath, binDir, genDir);

File diff suppressed because it is too large Load Diff