Skip to content

Commit

Permalink
fix remaining test by doing some upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
djahandarie committed Dec 13, 2024
1 parent 79527f6 commit 704b6e9
Show file tree
Hide file tree
Showing 9 changed files with 484 additions and 625 deletions.
6 changes: 5 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@
"jsdoc/valid-types": "error",

"jsonc/indent": ["error", 4],
"jsonc/no-comments": "off",
"jsonc/array-bracket-newline": ["error", "consistent"],
"jsonc/array-bracket-spacing": ["error", "never"],
"jsonc/array-element-newline": ["error", "consistent"],
Expand Down Expand Up @@ -396,9 +397,12 @@
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/require-await": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/prefer-promise-reject-errors": "off", // TODO: Enable this rule

"@typescript-eslint/ban-ts-comment": ["error", {"ts-expect-error": {"descriptionFormat": "^ - .+$"}}],
"@typescript-eslint/ban-types": ["error", {"types": {"object": true}, "extendDefaults": true}],
"@typescript-eslint/no-empty-object-type": "error",
"@typescript-eslint/no-unsafe-function-type": "error",
"@typescript-eslint/no-wrapper-object-types": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-shadow": ["error", {"builtinGlobals": false}],
"@typescript-eslint/no-this-alias": "error",
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@
"url": "/ext/data/schemas/recommended-dictionaries-schema.json"
}
],
"typescript.tsdk": "node_modules\\typescript\\lib",
"typescript.tsdk": "node_modules/typescript/lib",
"nixEnvSelector.nixFile": "${workspaceRoot}/shell.nix"
}
2 changes: 1 addition & 1 deletion ext/js/app/popup-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export class PopupFactory {
promises.push(promise);
}

/** @type {undefined|unknown} */
/** @type {undefined|Error} */
let error = void 0;
/** @type {{popup: import('popup').PopupAny, token: string}[]} */
const results = [];
Expand Down
2 changes: 2 additions & 0 deletions ext/js/comm/anki-connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,9 @@ export class AnkiConnect {
if (typeof result === 'object' && result !== null && !Array.isArray(result)) {
const apiError = /** @type {import('core').SerializableObject} */ (result).error;
if (typeof apiError !== 'undefined') {
// eslint-disable-next-line @typescript-eslint/no-base-to-string
const error = new ExtensionError(`Anki error: ${apiError}`);
// eslint-disable-next-line @typescript-eslint/no-base-to-string
error.data = {action, params, status: response.status, apiError: typeof apiError === 'string' ? apiError : `${apiError}`};
throw error;
}
Expand Down
1,082 changes: 468 additions & 614 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
"@types/node": "20.11.5",
"@types/wanakana": "^5.3.0",
"@types/zip.js": "^2.0.33",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@typescript-eslint/eslint-plugin": "^8.18.0",
"@typescript-eslint/parser": "^8.18.0",
"@vitest/coverage-v8": "1.2.2",
"ajv": "^8.17.1",
"css": "^3.0.0",
Expand All @@ -89,7 +89,7 @@
"eslint-plugin-no-unsanitized": "^4.0.2",
"eslint-plugin-sonarjs": "^0.24.0",
"eslint-plugin-unicorn": "^51.0.1",
"eslint-plugin-unused-imports": "^3.2.0",
"eslint-plugin-unused-imports": "^4.1.4",
"eslint-plugin-vitest": "0.3.22",
"fake-indexeddb": "^5.0.2",
"handlebars": "^4.7.8",
Expand All @@ -102,8 +102,8 @@
"prettier": "^3.2.5",
"stylelint": "^16.2.1",
"stylelint-config-recommended": "^14.0.0",
"ts-json-schema-generator": "^1.5.1",
"typescript": "^5.4.5",
"ts-json-schema-generator": "^2.3.0",
"typescript": "^5.7.2",
"vitest": "^1.2.2"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion test/data/vitest.json.config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"test": {
"include": [
"../**/json.test.js"
"test/json.test.js"
]
}
}
2 changes: 1 addition & 1 deletion types/ext/core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export type TypeofResult = 'string' | 'number' | 'bigint' | 'boolean' | 'symbol'
export type SafeAny = any;

/** This type is used as an explicit way of permitting the `Function` type. */
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
export type SafeFunction = Function;

/** This type is used as an explicit way of permitting the `any` type. */
Expand Down
1 change: 0 additions & 1 deletion types/ext/simple-dom-parser.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export type {
/**
* This type is used as a generic reference to an element object from a generic DOM API.
*/
// eslint-disable-next-line @typescript-eslint/ban-types
export type Element = object;

export type ISimpleDomParser = {
Expand Down

0 comments on commit 704b6e9

Please sign in to comment.