Skip to content

Commit

Permalink
chore: eslint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
BBboy01 committed Aug 28, 2024
1 parent ec2d5cc commit 34c72cb
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 25 deletions.
1 change: 0 additions & 1 deletion projects/ngx-quill/config/src/quill-editor.interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { InjectionToken } from '@angular/core'

import { defaultModules } from './quill-defaults'
Expand Down
9 changes: 1 addition & 8 deletions projects/ngx-quill/src/lib/quill-editor.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import {Component, Renderer2, ViewChild} from '@angular/core'
import {ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/testing'
import {defer} from 'rxjs'
Expand All @@ -15,7 +14,6 @@ window.setTimeout = ((cb) => {
return 0
}) as any

// eslint-disable-next-line @typescript-eslint/no-var-requires
// const Quill = require('quill')

class CustomModule {
Expand Down Expand Up @@ -217,11 +215,9 @@ describe('Basic QuillEditorComponent', () => {

expect(spy).toHaveBeenCalledTimes(3)
const quillEditor: any = fixture.componentInstance.quillEditor
/* eslint-disable no-underscore-dangle */
expect(quillEditor.emitter._events['editor-change'].length).toBe(4)
expect(quillEditor.emitter._events['selection-change']).toBeInstanceOf(Object)
expect(quillEditor.emitter._events['text-change']).toBeFalsy()
/* eslint-enable no-underscore-dangle */
})

it('should render toolbar', async () => {
Expand Down Expand Up @@ -1355,7 +1351,6 @@ describe('QuillEditor - base config', () => {
jasmine.objectContaining({attrName: 'size', keyName: 'font-size', scope: 5, whitelist: ['14']}), true, true
)

// eslint-disable-next-line @typescript-eslint/dot-notation
expect(fixture.componentInstance.editorComponent.quillEditor['options'].modules.toolbar)
.toEqual(jasmine.objectContaining({
container: [
Expand Down Expand Up @@ -1383,7 +1378,7 @@ describe('QuillEditor - customModules', () => {
await fixture.whenStable()

expect(spy).toHaveBeenCalled()
// eslint-disable-next-line @typescript-eslint/dot-notation

expect(fixture.componentInstance.editor.quillEditor['options'].modules.custom).toBeDefined()
})
})
Expand All @@ -1406,7 +1401,6 @@ describe('QuillEditor - customModules (asynchronous)', () => {
await fixture.whenStable()

expect(spy).toHaveBeenCalled()
// eslint-disable-next-line @typescript-eslint/dot-notation
expect(fixture.componentInstance.editor.quillEditor['options'].modules.custom).toBeDefined()
})
})
Expand Down Expand Up @@ -1436,7 +1430,6 @@ describe('QuillEditor - defaultEmptyValue', () => {
fixture.detectChanges()
await fixture.whenStable()

// eslint-disable-next-line @typescript-eslint/dot-notation
expect(fixture.componentInstance.editor.defaultEmptyValue).toBeDefined()
})
})
Expand Down
11 changes: 2 additions & 9 deletions projects/ngx-quill/src/lib/quill-editor.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { DOCUMENT, isPlatformServer } from '@angular/common'
import { DomSanitizer } from '@angular/platform-browser'

Expand Down Expand Up @@ -78,7 +77,6 @@ export type EditorChangeContent = ContentChange & { event: 'text-change' }
export type EditorChangeSelection = SelectionChange & { event: 'selection-change' }

@Directive()
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export abstract class QuillEditorBase implements AfterViewInit, ControlValueAccessor, OnChanges, OnInit, OnDestroy, Validator {
readonly format = input<'object' | 'html' | 'text' | 'json' | undefined>(
undefined
Expand Down Expand Up @@ -185,7 +183,7 @@ export abstract class QuillEditorBase implements AfterViewInit, ControlValueAcce
} else if (format === 'json') {
try {
modelValue = JSON.stringify(quillEditor.getContents())
} catch (e) {
} catch {
modelValue = quillEditor.getText()
}
}
Expand All @@ -204,7 +202,7 @@ export abstract class QuillEditorBase implements AfterViewInit, ControlValueAcce
} else if (format === 'json') {
try {
return JSON.parse(value)
} catch (e) {
} catch {
return [{ insert: value }]
}
}
Expand Down Expand Up @@ -449,7 +447,6 @@ export abstract class QuillEditorBase implements AfterViewInit, ControlValueAcce
})
}

// eslint-disable-next-line max-len
editorChangeHandler = (
event: 'text-change' | 'selection-change',
current: any | Range | null, old: any | Range | null, source: string
Expand Down Expand Up @@ -509,7 +506,6 @@ export abstract class QuillEditorBase implements AfterViewInit, ControlValueAcce
if (!this.quillEditor) {
return
}
/* eslint-disable @typescript-eslint/dot-notation */
if (changes.readOnly) {
this.quillEditor.enable(!changes.readOnly.currentValue)
}
Expand Down Expand Up @@ -549,7 +545,6 @@ export abstract class QuillEditorBase implements AfterViewInit, ControlValueAcce
if (changes.debounceTime) {
this.addQuillEventListeners()
}
/* eslint-enable @typescript-eslint/dot-notation */
}

addClasses(classList: string): void {
Expand Down Expand Up @@ -743,13 +738,11 @@ export abstract class QuillEditorBase implements AfterViewInit, ControlValueAcce
{
multi: true,
provide: NG_VALUE_ACCESSOR,
// eslint-disable-next-line @typescript-eslint/no-use-before-define
useExisting: forwardRef(() => QuillEditorComponent)
},
{
multi: true,
provide: NG_VALIDATORS,
// eslint-disable-next-line @typescript-eslint/no-use-before-define
useExisting: forwardRef(() => QuillEditorComponent)
}
],
Expand Down
2 changes: 0 additions & 2 deletions projects/ngx-quill/src/lib/quill-view.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable max-classes-per-file */
import { Component, ViewChild } from '@angular/core'
import { ComponentFixture, TestBed } from '@angular/core/testing'

Expand Down
3 changes: 1 addition & 2 deletions projects/ngx-quill/src/lib/quill-view.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { isPlatformServer } from '@angular/common'
import type QuillType from 'quill'

Expand Down Expand Up @@ -92,7 +91,7 @@ export class QuillViewComponent implements AfterViewInit, OnChanges, OnDestroy {
} else if (format === 'json') {
try {
content = JSON.parse(value)
} catch (e) {
} catch {
content = [{ insert: value }]
}
}
Expand Down
3 changes: 0 additions & 3 deletions projects/ngx-quill/src/lib/quill.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { DOCUMENT } from '@angular/common'
import { Injectable, Inject, Injector, Optional } from '@angular/core'
import { defer, firstValueFrom, isObservable, Observable } from 'rxjs'
Expand All @@ -15,7 +14,6 @@ import {
providedIn: 'root',
})
export class QuillService {
// eslint-disable-next-line @typescript-eslint/naming-convention
private Quill!: any
private document: Document
private quill$: Observable<any> = defer(async () => {
Expand All @@ -34,7 +32,6 @@ export class QuillService {
// The `__zone_symbol__addEventListener` is basically a native DOM API, which is not patched by zone.js, thus not even going
// through the `zone.js` task lifecycle. You can also access the native DOM API as follows `target[Zone.__symbol__('methodName')]`.
this.document.addEventListener =
// eslint-disable-next-line @typescript-eslint/dot-notation
this.document['__zone_symbol__addEventListener'] ||
this.document.addEventListener
const quillImport = await import('quill')
Expand Down

0 comments on commit 34c72cb

Please sign in to comment.