mirror of
https://github.com/ankitects/anki.git
synced 2025-09-22 16:02:23 -04:00
Merge pull request #1148 from hgiesel/updatetypescript
Update Typescript to 4.2.4
This commit is contained in:
commit
8b4446d044
10 changed files with 413 additions and 348 deletions
|
@ -8,7 +8,7 @@ module.exports = {
|
||||||
plugins: ["@typescript-eslint"],
|
plugins: ["@typescript-eslint"],
|
||||||
rules: {
|
rules: {
|
||||||
"prefer-const": "warn",
|
"prefer-const": "warn",
|
||||||
"@typescript-eslint/ban-ts-ignore": "warn",
|
"@typescript-eslint/ban-ts-comment": "warn",
|
||||||
"@typescript-eslint/no-unused-vars": [
|
"@typescript-eslint/no-unused-vars": [
|
||||||
"warn",
|
"warn",
|
||||||
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
|
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
|
||||||
|
|
1
ts/.gitignore
vendored
1
ts/.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
node_modules
|
node_modules
|
||||||
|
yarn-error.log
|
||||||
|
|
|
@ -186,7 +186,7 @@ export class EditorToolbar extends HTMLElement {
|
||||||
customElements.define("anki-editor-toolbar", EditorToolbar);
|
customElements.define("anki-editor-toolbar", EditorToolbar);
|
||||||
|
|
||||||
/* Exports for editor */
|
/* Exports for editor */
|
||||||
// @ts-expect-error
|
// @ts-expect-error insufficient typing of svelte modules
|
||||||
export { updateActiveButtons, clearActiveButtons } from "./CommandIconButton.svelte";
|
export { updateActiveButtons, clearActiveButtons } from "./CommandIconButton.svelte";
|
||||||
// @ts-expect-error
|
// @ts-expect-error insufficient typing of svelte modules
|
||||||
export { enableButtons, disableButtons } from "./EditorToolbar.svelte";
|
export { enableButtons, disableButtons } from "./EditorToolbar.svelte";
|
||||||
|
|
|
@ -140,14 +140,6 @@ export function gatherData(
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Reviews {
|
|
||||||
mature: number;
|
|
||||||
young: number;
|
|
||||||
learn: number;
|
|
||||||
relearn: number;
|
|
||||||
early: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SummedDatum {
|
export interface SummedDatum {
|
||||||
label: string;
|
label: string;
|
||||||
// count of this particular item
|
// count of this particular item
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/* eslint
|
/* eslint
|
||||||
@typescript-eslint/no-non-null-assertion: "off",
|
@typescript-eslint/no-non-null-assertion: "off",
|
||||||
@typescript-eslint/no-explicit-any: "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 pb from "anki/backend_proto";
|
||||||
import type { Selection } from "d3";
|
import type { Selection } from "d3";
|
||||||
|
|
|
@ -41,7 +41,7 @@ const filterStyling = (predicate: (property: string, value: string) => boolean)
|
||||||
element: HTMLElement
|
element: HTMLElement
|
||||||
): void => {
|
): void => {
|
||||||
for (const property of [...element.style]) {
|
for (const property of [...element.style]) {
|
||||||
const value = element.style.getPropertyValue(name);
|
const value = element.style.getPropertyValue(property);
|
||||||
|
|
||||||
if (!predicate(property, value)) {
|
if (!predicate(property, value)) {
|
||||||
element.style.removeProperty(property);
|
element.style.removeProperty(property);
|
||||||
|
|
|
@ -22,13 +22,13 @@
|
||||||
"@types/node": "^14.14.20",
|
"@types/node": "^14.14.20",
|
||||||
"@types/react": "^16.9.53",
|
"@types/react": "^16.9.53",
|
||||||
"@types/react-dom": "^16.9.8",
|
"@types/react-dom": "^16.9.8",
|
||||||
"@typescript-eslint/eslint-plugin": "^2.11.0",
|
"@typescript-eslint/eslint-plugin": "^4.22.0",
|
||||||
"@typescript-eslint/parser": "^2.11.0",
|
"@typescript-eslint/parser": "^4.22.0",
|
||||||
"chalk": "^4.1.0",
|
"chalk": "^4.1.0",
|
||||||
"cross-env": "^7.0.2",
|
"cross-env": "^7.0.2",
|
||||||
"diff": "^5.0.0",
|
"diff": "^5.0.0",
|
||||||
"escodegen": "^2.0.0",
|
"escodegen": "^2.0.0",
|
||||||
"eslint": "^6.7.2",
|
"eslint": "^7.24.0",
|
||||||
"espree": "^7.3.1",
|
"espree": "^7.3.1",
|
||||||
"estraverse": "^5.2.0",
|
"estraverse": "^5.2.0",
|
||||||
"glob": "^7.1.6",
|
"glob": "^7.1.6",
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
"svelte2tsx": "^0.1.133",
|
"svelte2tsx": "^0.1.133",
|
||||||
"tmp": "^0.2.1",
|
"tmp": "^0.2.1",
|
||||||
"tslib": "^2.0.3",
|
"tslib": "^2.0.3",
|
||||||
"typescript": "^3.9.7",
|
"typescript": "^4.2.4",
|
||||||
"uglify-js": "^3.13.1"
|
"uglify-js": "^3.13.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import sqlFormatter from "@sqltools/formatter";
|
import sqlFormatter from "@sqltools/formatter";
|
||||||
import * as Diff from "diff";
|
import { createPatch } from "diff";
|
||||||
import process from "process";
|
import process from "process";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
@ -38,7 +38,7 @@ for (const path of process.argv.slice(2)) {
|
||||||
errorFound = true;
|
errorFound = true;
|
||||||
console.log("SQL formatting issues found:");
|
console.log("SQL formatting issues found:");
|
||||||
}
|
}
|
||||||
console.log(Diff.createPatch(path, orig, formatted));
|
console.log(createPatch(path, orig, formatted));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ function compile(tsPath: string, tsLibs: string[]) {
|
||||||
return createdFiles[parsedCommandLine.fileNames[0].replace(".ts", ".d.ts")];
|
return createdFiles[parsedCommandLine.fileNames[0].replace(".ts", ".d.ts")];
|
||||||
}
|
}
|
||||||
|
|
||||||
function writeFile(file, data) {
|
function writeFile(file, data): Promise<void> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
fs.writeFile(file, data, (err) => {
|
fs.writeFile(file, data, (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -129,7 +129,7 @@ async function writeDts(tsPath, dtsPath, tsLibs) {
|
||||||
await writeFile(dtsPath, dtsSource);
|
await writeFile(dtsPath, dtsSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
function writeTs(svelteSource, sveltePath, tsPath) {
|
function writeTs(svelteSource, sveltePath, tsPath): void {
|
||||||
let tsSource = svelte2tsx(svelteSource, {
|
let tsSource = svelte2tsx(svelteSource, {
|
||||||
filename: sveltePath,
|
filename: sveltePath,
|
||||||
strictMode: true,
|
strictMode: true,
|
||||||
|
@ -187,7 +187,7 @@ async function compileSvelte(args) {
|
||||||
const svelteSource = (await readFile(sveltePath)) as string;
|
const svelteSource = (await readFile(sveltePath)) as string;
|
||||||
|
|
||||||
const mockTsPath = sveltePath + ".ts";
|
const mockTsPath = sveltePath + ".ts";
|
||||||
await writeTs(svelteSource, sveltePath, mockTsPath);
|
writeTs(svelteSource, sveltePath, mockTsPath);
|
||||||
await writeDts(mockTsPath, dtsPath, tsLibs);
|
await writeDts(mockTsPath, dtsPath, tsLibs);
|
||||||
await writeJs(svelteSource, sveltePath, mjsPath, cssPath, binDir, genDir);
|
await writeJs(svelteSource, sveltePath, mjsPath, cssPath, binDir, genDir);
|
||||||
|
|
||||||
|
|
724
ts/yarn.lock
724
ts/yarn.lock
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue