Disable class-methods-use-this rule

This commit is contained in:
the1812 2024-04-18 23:21:53 +08:00
parent 8253c469de
commit d042be88cc
6 changed files with 1 additions and 15 deletions

View File

@ -84,6 +84,7 @@ module.exports = {
'lines-between-class-members': 'off', 'lines-between-class-members': 'off',
radix: ['error', 'as-needed'], radix: ['error', 'as-needed'],
'max-classes-per-file': 'off', 'max-classes-per-file': 'off',
'class-methods-use-this': 'off',
'prefer-destructuring': [ 'prefer-destructuring': [
'error', 'error',
{ {

View File

@ -307,7 +307,6 @@ export class ExtendSpeedComponent extends EntrySpeedComponent<Options> {
} }
} }
// eslint-disable-next-line class-methods-use-this
getSpeedContextMixin({ menuListElement }: SpeedContext): Partial<SpeedContext> { getSpeedContextMixin({ menuListElement }: SpeedContext): Partial<SpeedContext> {
return { return {
query: (speed: number) => query: (speed: number) =>
@ -444,7 +443,6 @@ export class ExtendSpeedComponent extends EntrySpeedComponent<Options> {
setTimeout(() => this.forceUpdateStyle(value)) setTimeout(() => this.forceUpdateStyle(value))
} }
// eslint-disable-next-line class-methods-use-this
protected readonly filterNativeSpeed = protected readonly filterNativeSpeed =
() => () =>
({ subscribe, next }: PublishContext<number>) => { ({ subscribe, next }: PublishContext<number>) => {

View File

@ -12,15 +12,11 @@ export class Translator {
static map: Map<string, any> static map: Map<string, any>
static regex: [RegExp, string][] static regex: [RegExp, string][]
// eslint-disable-next-line class-methods-use-this
protected accepts = (node: Node) => node.nodeType === Node.ELEMENT_NODE protected accepts = (node: Node) => node.nodeType === Node.ELEMENT_NODE
// eslint-disable-next-line class-methods-use-this
protected getValue = (node: Node) => node.nodeValue protected getValue = (node: Node) => node.nodeValue
// eslint-disable-next-line class-methods-use-this
protected setValue = (node: Node, value: string) => { protected setValue = (node: Node, value: string) => {
node.nodeValue = value node.nodeValue = value
} }
// eslint-disable-next-line class-methods-use-this
protected getElement = (node: Node) => node as Element protected getElement = (node: Node) => node as Element
translate(node: Node) { translate(node: Node) {
let value = this.getValue(node) let value = this.getValue(node)
@ -103,23 +99,17 @@ export class Translator {
} }
} }
export class TextNodeTranslator extends Translator { export class TextNodeTranslator extends Translator {
// eslint-disable-next-line class-methods-use-this
accepts = (node: Node) => node.nodeType === Node.TEXT_NODE accepts = (node: Node) => node.nodeType === Node.TEXT_NODE
// eslint-disable-next-line class-methods-use-this
getElement = (node: Node) => node.parentElement getElement = (node: Node) => node.parentElement
} }
export class TitleTranslator extends Translator { export class TitleTranslator extends Translator {
// eslint-disable-next-line class-methods-use-this
getValue = (node: Node) => (node as Element).getAttribute('title') getValue = (node: Node) => (node as Element).getAttribute('title')
// eslint-disable-next-line class-methods-use-this
setValue = (node: Node, value: string) => { setValue = (node: Node, value: string) => {
;(node as Element).setAttribute('title', value) ;(node as Element).setAttribute('title', value)
} }
} }
export class PlaceholderTranslator extends Translator { export class PlaceholderTranslator extends Translator {
// eslint-disable-next-line class-methods-use-this
getValue = (node: Node) => (node as Element).getAttribute('placeholder') getValue = (node: Node) => (node as Element).getAttribute('placeholder')
// eslint-disable-next-line class-methods-use-this
setValue = (node: Node, value: string) => { setValue = (node: Node, value: string) => {
;(node as Element).setAttribute('placeholder', value) ;(node as Element).setAttribute('placeholder', value)
} }

View File

@ -1,4 +1,3 @@
/* eslint-disable class-methods-use-this */
import { select } from '@/core/spin-query' import { select } from '@/core/spin-query'
import { raiseEvent } from '@/core/utils' import { raiseEvent } from '@/core/utils'
import { import {

View File

@ -68,7 +68,6 @@ export class VideoInfo {
} }
/** @deprecated */ /** @deprecated */
// eslint-disable-next-line class-methods-use-this
get subtitles(): { get subtitles(): {
id: number id: number
languageCode: string languageCode: string

View File

@ -407,7 +407,6 @@ export class DoubleClickEvent {
singleClickHandler: (e: MouseEvent) => void = none singleClickHandler: (e: MouseEvent) => void = none
private clickedOnce = false private clickedOnce = false
// eslint-disable-next-line class-methods-use-this
private readonly stopPropagationHandler = (e: MouseEvent) => { private readonly stopPropagationHandler = (e: MouseEvent) => {
e.stopImmediatePropagation() e.stopImmediatePropagation()
} }