diff --git a/assets/eslint.config.js b/assets/eslint.config.js index 2c7a6e63..89159b71 100644 --- a/assets/eslint.config.js +++ b/assets/eslint.config.js @@ -181,7 +181,7 @@ export default tsEslint.config( 'no-trailing-spaces': 2, 'no-undef-init': 2, 'no-undef': 2, - 'no-undefined': 2, + 'no-undefined': 0, 'no-underscore-dangle': 0, 'no-unexpected-multiline': 2, 'no-unmodified-loop-condition': 2, diff --git a/assets/js/query/parse.ts b/assets/js/query/parse.ts index 7f725c6c..d33e1496 100644 --- a/assets/js/query/parse.ts +++ b/assets/js/query/parse.ts @@ -17,7 +17,7 @@ export function parseTokens(lexicalArray: TokenList): AstMatcher { const op2 = operandStack.pop(); const op1 = operandStack.pop(); - if (typeof op1 === 'undefined' || typeof op2 === 'undefined') { + if (op1 === undefined || op2 === undefined) { throw new ParseError('Missing operand.'); } @@ -43,7 +43,7 @@ export function parseTokens(lexicalArray: TokenList): AstMatcher { const op1 = operandStack.pop(); - if (typeof op1 === 'undefined') { + if (op1 === undefined) { return matchNone(); } diff --git a/assets/js/utils/assert.ts b/assets/js/utils/assert.ts index 09a17433..ff2ba965 100644 --- a/assets/js/utils/assert.ts +++ b/assets/js/utils/assert.ts @@ -7,7 +7,6 @@ export function assertNotNull(value: T | null): T { } export function assertNotUndefined(value: T | undefined): T { - // eslint-disable-next-line no-undefined if (value === undefined) { throw new Error('Expected non-undefined value'); } diff --git a/assets/js/utils/tag.ts b/assets/js/utils/tag.ts index af2b1095..15d135df 100644 --- a/assets/js/utils/tag.ts +++ b/assets/js/utils/tag.ts @@ -45,7 +45,7 @@ export function getSpoileredTags(): TagData[] { export function imageHitsTags(img: HTMLElement, matchTags: TagData[]): TagData[] { const imageTagsString = img.dataset.imageTags; - if (typeof imageTagsString === 'undefined') { + if (imageTagsString === undefined) { return []; } const imageTags = JSON.parse(imageTagsString); diff --git a/assets/js/utils/unique-heap.ts b/assets/js/utils/unique-heap.ts index 92aeab91..6c3d70f2 100644 --- a/assets/js/utils/unique-heap.ts +++ b/assets/js/utils/unique-heap.ts @@ -24,7 +24,7 @@ export class UniqueHeap { const key = this.unique(value); const prevIndex = this.keys.get(key); - if (typeof prevIndex === 'undefined') { + if (prevIndex === undefined) { this.keys.set(key, this.length); this.values[this.length++] = value; } else if (forceReplace) {