Skip to content

Commit

Permalink
Merge branch 'tweak_for_eslint'
Browse files Browse the repository at this point in the history
  • Loading branch information
tamuratak committed Oct 30, 2024
2 parents 0679e28 + a05df47 commit 46624b9
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 7 deletions.
3 changes: 0 additions & 3 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import eslint from "@eslint/js";
import tseslint from 'typescript-eslint';

const commonRules = {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/consistent-type-assertions": ["error", {
assertionStyle: "as",
objectLiteralTypeAssertions: "never",
Expand Down Expand Up @@ -34,7 +33,6 @@ const commonRules = {
"ignoreRestSiblings": true
}
],
"@typescript-eslint/no-unsafe-enum-comparison": "off",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-readonly": "error",
"no-return-await": "off",
Expand Down Expand Up @@ -175,7 +173,6 @@ export default tseslint.config(
format: null,
}
],
"@typescript-eslint/ban-ts-comment": "off",
...commonRules
},
}
Expand Down
2 changes: 2 additions & 0 deletions src/components/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,7 @@ export class Manager {

private buildOnFileChanged(fileUri: vscode.Uri, bibChanged = false) {
const configuration = vscode.workspace.getConfiguration('latex-toybox', fileUri)
// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
if (configuration.get('latex.autoBuild.run') as string !== BuildEvents.onFileChange) {
return
}
Expand All @@ -873,6 +874,7 @@ export class Manager {

private buildOnSave(fileUri: vscode.Uri) {
const configuration = vscode.workspace.getConfiguration('latex-toybox', fileUri)
// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
if (configuration.get('latex.autoBuild.run') as string !== BuildEvents.onSave) {
return
}
Expand Down
6 changes: 4 additions & 2 deletions src/utils/externalpromise.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
function promiseTriplet<T>() {
let resolve: ((value: T | PromiseLike<T>) => void) = () => undefined
let reject: ((reason?: any) => void) = () => undefined
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let reject: ((reason: any) => void) = () => undefined
const promise = new Promise<T>((r, rej) => {
resolve = r
reject = rej
Expand All @@ -27,7 +28,8 @@ export class ExternalPromise<T> {
this.promiseTriplet.resolve(value)
}

reject(reason?: any) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
reject(reason: any) {
if (this.#isResolved) {
return
}
Expand Down
1 change: 1 addition & 0 deletions src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export function escapeRegExp(str: string) {
* @author Joseph JDBar Barron
* @link https://dev.to/jdbar/the-problem-with-handling-node-js-errors-in-typescript-and-the-workaround-m64
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function instanceOfNodeError<T extends new(...args: any) => Error>(
value: unknown,
errorType: T
Expand Down
2 changes: 1 addition & 1 deletion test/unittests/components/linter.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access */

import * as vscode from 'vscode'
import * as fs from 'node:fs'
Expand Down
2 changes: 1 addition & 1 deletion test/unittests/providers/structure.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access */

import * as vscode from 'vscode'
import * as path from 'node:path'
Expand Down
1 change: 1 addition & 0 deletions viewer/components/pagetrimmer.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */
import { ScaleMode, trimSelectElement, viewerDom } from './constants.js'
import type { IPDFViewerApplication } from './interface.js'

Expand Down
2 changes: 2 additions & 0 deletions viewer/latextoybox.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const importPdfMjsPromise = import('/node_modules/pdfjs-dist/build/pdf.mjs')
// Edit viewer.html
Expand Down Expand Up @@ -168,6 +169,7 @@ const extension = new LateXToyboxPdfViewer()
await extension.waitSetupAppOptionsReady()

// Defines PDFViewerApplication, PDFViewerApplicationOptions, and PDFViewerApplicationConstants globally.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
await import('/viewer.mjs')

Expand Down

0 comments on commit 46624b9

Please sign in to comment.