fix more linting errors
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
export default function capitalize(value: string = ''): string {
|
||||
return value.charAt(0).toUpperCase() + value.slice(1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export default function elementFromString(value: string): HTMLElement {
|
||||
const htmlString = `<div>${value}</div>`
|
||||
const parser = new window.DOMParser
|
||||
const parser = new window.DOMParser()
|
||||
const element = parser.parseFromString(htmlString, 'text/html').body
|
||||
|
||||
return element
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Node } from 'prosemirror-model'
|
||||
import getSchema from './getSchema'
|
||||
import getHtmlFromFragment from './getHtmlFromFragment'
|
||||
import { Node } from 'prosemirror-model'
|
||||
import { Extensions } from '../types'
|
||||
|
||||
export default function generateHtml(doc: object, extensions: Extensions): string {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
export default function getAllMethodNames(obj: Object) {
|
||||
let methods = new Set()
|
||||
const methods = new Set()
|
||||
|
||||
while (obj = Reflect.getPrototypeOf(obj)) {
|
||||
let keys = Reflect.ownKeys(obj)
|
||||
keys.forEach((k) => methods.add(k))
|
||||
const keys = Reflect.ownKeys(obj)
|
||||
keys.forEach(k => methods.add(k))
|
||||
}
|
||||
|
||||
return Array.from(methods)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Node, DOMSerializer } from 'prosemirror-model'
|
||||
import { Schema } from 'prosemirror-model'
|
||||
import { Node, DOMSerializer, Schema } from 'prosemirror-model'
|
||||
|
||||
export default function getHtmlFromFragment(doc: Node, schema: Schema): string {
|
||||
const fragment = DOMSerializer
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Mark from '../Mark'
|
||||
import collect from 'collect.js'
|
||||
import Mark from '../Mark'
|
||||
import { Extensions } from '../types'
|
||||
|
||||
export default function getMarksFromExtensions(extensions: Extensions): any {
|
||||
@@ -7,4 +7,4 @@ export default function getMarksFromExtensions(extensions: Extensions): any {
|
||||
.where('type', 'mark')
|
||||
.mapWithKeys((extension: Mark) => [extension.config.name, extension.config.schema])
|
||||
.all()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Node from '../Node'
|
||||
import collect from 'collect.js'
|
||||
import Node from '../Node'
|
||||
import { Extensions } from '../types'
|
||||
|
||||
export default function getNodesFromExtensions(extensions: Extensions): any {
|
||||
@@ -7,4 +7,4 @@ export default function getNodesFromExtensions(extensions: Extensions): any {
|
||||
.where('type', 'node')
|
||||
.mapWithKeys((extension: Node) => [extension.config.name, extension.config.schema])
|
||||
.all()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ export default function getSchema(extensions: Extensions): Schema {
|
||||
resolveExtensionConfig(extension, 'defaults')
|
||||
resolveExtensionConfig(extension, 'topNode')
|
||||
|
||||
const name = extension.config.name
|
||||
const { name } = extension.config
|
||||
const options = deepmerge(extension.config.defaults, extension.options)
|
||||
|
||||
resolveExtensionConfig(extension, 'schema', { name, options })
|
||||
|
||||
@@ -10,4 +10,4 @@ export default function getSchemaTypeByName(name: string, schema: Schema) {
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,4 @@ export default function getTopNodeFromExtensions(extensions: Extensions): any {
|
||||
if (topNode) {
|
||||
return topNode.config.name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
export default function magicMethods(clazz: any) {
|
||||
export default function magicMethods(Clazz: any) {
|
||||
const classHandler = Object.create(null)
|
||||
|
||||
classHandler.construct = (target: any, args: any) => {
|
||||
const instance = new clazz(...args)
|
||||
classHandler.construct = (_, args: any) => {
|
||||
const instance = new Clazz(...args)
|
||||
const instanceHandler = Object.create(null)
|
||||
const get = Object.getOwnPropertyDescriptor(clazz.prototype, '__get')
|
||||
const get = Object.getOwnPropertyDescriptor(Clazz.prototype, '__get')
|
||||
|
||||
if (get) {
|
||||
instanceHandler.get = (target: any, name: any) => {
|
||||
@@ -18,9 +18,9 @@ export default function magicMethods(clazz: any) {
|
||||
|
||||
if (exists) {
|
||||
return target[name]
|
||||
} else {
|
||||
return get.value.call(target, name)
|
||||
}
|
||||
|
||||
return get.value.call(target, name)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,5 +30,5 @@ export default function magicMethods(clazz: any) {
|
||||
return instance.proxy
|
||||
}
|
||||
|
||||
return new Proxy(clazz, classHandler)
|
||||
}
|
||||
return new Proxy(Clazz, classHandler)
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export default function minMax(value: number = 0, min: number = 0, max: number = 0): number {
|
||||
return Math.min(Math.max(value, min), max)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,4 +2,4 @@ export default function removeElement(element: HTMLElement) {
|
||||
if (element && element.parentNode) {
|
||||
element.parentNode.removeChild(element)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,4 +32,4 @@ export default function resolveExtensionConfig(
|
||||
|
||||
return accumulator
|
||||
}, undefined)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export default function sleep(milliseconds: number): Promise<void> {
|
||||
return new Promise(resolve => setTimeout(resolve, milliseconds))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user