1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-16 00:14:34 +02:00

Tools: Apply @typescript-eslint/ban-ts-comment rule

This commit is contained in:
Laurent Cozic
2023-06-30 10:22:47 +01:00
parent 7591a1182e
commit 48ef6db4a5
22 changed files with 47 additions and 78 deletions

View File

@ -2,9 +2,7 @@
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/@typescript-eslint"
"plugin:@typescript-eslint/recommended"
],
"env": {
"node": true,

View File

@ -51,7 +51,6 @@
"@typescript-eslint/parser": "5.59.0",
"coveralls": "3.1.1",
"eslint": "8.39.0",
"eslint-config-prettier": "8.8.0",
"jest": "29.5.0",
"prettier": "2.8.8",
"ts-jest": "29.1.0",

View File

@ -8,8 +8,7 @@ export class CollectingHandler extends MultiplexHandler {
constructor(cbs: Partial<Handler> = {}) {
super((name, ...args) => {
this.events.push([name, ...args]);
// @ts-ignore
if (this._cbs[name]) this._cbs[name](...args);
if (this._cbs[name]) (this._cbs as any)[name](...args);
});
this._cbs = cbs;
@ -31,8 +30,7 @@ export class CollectingHandler extends MultiplexHandler {
continue;
}
// @ts-ignore
this._cbs[name](...args);
(this._cbs as any)[name](...args);
}
}
}

View File

@ -179,8 +179,7 @@ function addConditionally<T>(
recurse = false
) {
const tmp = fetch(what, where, recurse);
// @ts-ignore
if (tmp) obj[prop] = tmp;
if (tmp) (obj as any)[prop] = tmp;
}
function isValidFeed(value: string) {

View File

@ -225,8 +225,7 @@ export class Parser extends EventEmitter {
//Tokenizer event handlers
ontext(data: string) {
this._updatePosition(1);
// @ts-ignore
this.endIndex--;
this.endIndex = this.endIndex === null ? 0 : this.endIndex + 1;
if (this._cbs.ontext) this._cbs.ontext(data);
}
@ -241,8 +240,7 @@ export class Parser extends EventEmitter {
) {
for (
let el;
// @ts-ignore
openImpliesClose[name].has(
(openImpliesClose as any)[name].has(
(el = this._stack[this._stack.length - 1])
);
this.onclosetag(el)
@ -305,8 +303,7 @@ export class Parser extends EventEmitter {
if (pos !== -1) {
if (this._cbs.onclosetag) {
pos = this._stack.length - pos;
// @ts-ignore
while (pos--) this._cbs.onclosetag(this._stack.pop());
while (pos--) this._cbs.onclosetag((this._stack as any).pop());
} else this._stack.length = pos;
} else if (name === "p" && !this._options.xmlMode) {
this.onopentagname(name);

View File

@ -563,8 +563,7 @@ export default class Tokenizer {
),
map = this._xmlMode ? xmlMap : entityMap;
if (Object.prototype.hasOwnProperty.call(map, entity)) {
// @ts-ignore
this._emitPartial(map[entity]);
this._emitPartial((map as any)[entity]);
this._sectionStart = this._index + 1;
}
}
@ -578,8 +577,7 @@ export default class Tokenizer {
// The min length of legacy entities is 2
const entity = this._buffer.substr(start, limit);
if (Object.prototype.hasOwnProperty.call(legacyMap, entity)) {
// @ts-ignore
this._emitPartial(legacyMap[entity]);
this._emitPartial((legacyMap as any)[entity]);
this._sectionStart += limit + 1;
return;
} else {

View File

@ -51,8 +51,7 @@ function eventReducer(events: Event[], arr: [string, ...unknown[]]): Event[] {
events[events.length - 1].event === "text"
) {
// Combine text nodes
// @ts-ignore
events[events.length - 1].data[0] += arr[1];
(events as any)[events.length - 1].data[0] += arr[1];
} else {
events.push({
event: arr[0].substr(2),