chore: eslint添加no-unset-vars并删除多余的变量
This commit is contained in:
parent
e0f900da4e
commit
7760fabe66
|
@ -24,5 +24,6 @@ module.exports = {
|
|||
plugins: ['@typescript-eslint', 'prettier'],
|
||||
rules: {
|
||||
'no-unused-vars': 0,
|
||||
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }]
|
||||
},
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ describe('背景颜色', () => {
|
|||
|
||||
if (result == null) return null
|
||||
|
||||
const [noop, r, g, b] = result.map(i => parseInt(i, 16))
|
||||
const [r, g, b] = result.map(i => parseInt(i, 16))
|
||||
|
||||
return `rgb(${r}, ${g}, ${b})`
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import Editor from '../index'
|
|||
import Mutation from '../../utils/observer/mutation'
|
||||
import { debounce } from '../../utils/util'
|
||||
import { EMPTY_FN } from '../../utils/const'
|
||||
import { UA } from '../../utils/util'
|
||||
|
||||
/**
|
||||
* 剔除编辑区容器的 attribute 变化中的非 contenteditable 变化
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
|
||||
import $, { DomElement } from '../utils/dom-core'
|
||||
import { UA } from '../utils/util'
|
||||
import Editor from './index'
|
||||
|
||||
class Command {
|
||||
|
|
|
@ -65,6 +65,7 @@ function createShowHideFn(editor: Editor) {
|
|||
* @param e
|
||||
* @param editor
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function preEnterListener(e: KeyboardEvent, editor: Editor) {
|
||||
// 获取当前标签元素
|
||||
const $selectionElem = editor.selection.getSelectionContainerElem() as DomElement
|
||||
|
|
|
@ -11,11 +11,8 @@ import isActive from './is-active'
|
|||
|
||||
export default function (editor: editor, text: string, languageType: string): PanelConf {
|
||||
// panel 中需要用到的id
|
||||
const codeId = getRandom('code')
|
||||
const inputIFrameId = getRandom('input-iframe')
|
||||
const languageId = getRandom('select')
|
||||
const inputCodeId = getRandom('input-code')
|
||||
const inputTextId = getRandom('input-text')
|
||||
const btnOkId = getRandom('btn-ok')
|
||||
|
||||
/**
|
||||
|
@ -47,6 +44,7 @@ export default function (editor: editor, text: string, languageType: string): Pa
|
|||
function selectCodeElem(): void {
|
||||
if (!isActive(editor)) return
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
let $selectedCode: DomElement
|
||||
|
||||
const $code = editor.selection.getSelectionStartElem()
|
||||
|
|
|
@ -90,7 +90,6 @@ class Code extends PanelMenu implements MenuActive {
|
|||
*/
|
||||
public clickHandler(): void {
|
||||
const editor = this.editor
|
||||
let $codeElem
|
||||
const selectionText = editor.selection.getSelectionText()
|
||||
|
||||
if (this.isActive) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* @author tonghan
|
||||
*/
|
||||
|
||||
import $, { DomElement } from '../../utils/dom-core'
|
||||
import { DomElement } from '../../utils/dom-core'
|
||||
import { IndentationOptions } from '../../config/menus'
|
||||
|
||||
function decreaseIndentStyle($node: DomElement, options: IndentationOptions): void {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* @author tonghan
|
||||
*/
|
||||
|
||||
import $, { DomElement } from '../../utils/dom-core'
|
||||
import { DomElement } from '../../utils/dom-core'
|
||||
import { IndentationOptions } from '../../config/menus'
|
||||
|
||||
function increaseIndentStyle($node: DomElement, options: IndentationOptions): void {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* @author tonghan
|
||||
*/
|
||||
|
||||
import $, { DomElement } from '../../utils/dom-core'
|
||||
import { DomElement } from '../../utils/dom-core'
|
||||
import Editor from '../../editor/index'
|
||||
import { IndentationOptions } from '../../config/menus'
|
||||
import increaseIndentStyle from './increase-indent-style'
|
||||
|
|
|
@ -124,7 +124,6 @@ class Tooltip {
|
|||
const $targetElem = this.$targetElem
|
||||
const $container = this.$container
|
||||
|
||||
const length = conf.length
|
||||
conf.forEach((item: TooltipConfItemType, index: number) => {
|
||||
// 添加元素
|
||||
const $elem = item.$elem
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import Editor from '../../editor/index'
|
||||
import $, { DomElement } from '../../utils/dom-core'
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* @author lichunlin
|
||||
*/
|
||||
|
||||
import $, { DomElement } from '../../../../utils/dom-core'
|
||||
import $ from '../../../../utils/dom-core'
|
||||
import Editor from '../../../../editor/index'
|
||||
|
||||
class getNode {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
|
||||
import Editor from '../../editor/index'
|
||||
import $, { DomElement } from '../../utils/dom-core'
|
||||
import $ from '../../utils/dom-core'
|
||||
|
||||
/**
|
||||
* 删除时保留 <p><br></p>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
|
||||
import Editor from '../../editor/index'
|
||||
import $, { DomElement } from '../../utils/dom-core'
|
||||
import { DomElement } from '../../utils/dom-core'
|
||||
|
||||
/**
|
||||
* 图片点击后选区更新到img的位置
|
||||
|
|
|
@ -9,7 +9,6 @@ import initEventHooks from './event-hooks/index'
|
|||
import { UA, throttle } from '../utils/util'
|
||||
import getChildrenJSON, { NodeListType } from './getChildrenJSON'
|
||||
import getHtmlByNodeList from './getHtmlByNodeList'
|
||||
import { formatCodeHtml } from '../menus/code'
|
||||
|
||||
/** 按键函数 */
|
||||
type KeyBoardHandler = (event: KeyboardEvent) => unknown
|
||||
|
@ -207,7 +206,6 @@ class Text {
|
|||
public text(val?: string): void | string {
|
||||
const editor = this.editor
|
||||
const $textElem = editor.$textElem
|
||||
const $textContainerElem = editor.$textContainerElem
|
||||
|
||||
// 没有 val ,是获取 text
|
||||
if (val == null) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
|
||||
import createEditor from '../fns/create-editor'
|
||||
import $, { DomElement } from '../../src/utils/dom-core'
|
||||
import $ from '../../src/utils/dom-core'
|
||||
|
||||
const TEXT = '我是一行文字'
|
||||
const $SPAN = $(`<span>${TEXT}</span>`)
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
import createEditor from '../fns/create-editor'
|
||||
import mockCmdFn from '../fns/command-mock'
|
||||
import Command from '../../src/editor/command'
|
||||
import Editor from '../../src/editor'
|
||||
import $ from '../../src/utils/dom-core'
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
* @author tonghan
|
||||
*/
|
||||
|
||||
import $ from '../../src/utils/dom-core'
|
||||
import List from '../../src/menus/list/index'
|
||||
import Editor from '../../src/editor'
|
||||
import mockCmdFn from '../fns/command-mock'
|
||||
|
|
|
@ -7,6 +7,7 @@ import Editor from '../../src/editor'
|
|||
import createQuote from '../../src/menus/quote/create-quote-node'
|
||||
import $, { DomElement } from '../../src/utils/dom-core'
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
let editor: Editor
|
||||
|
||||
test('单行引用', () => {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
import Tooltip from '../../src/menus/menu-constructors/Tooltip'
|
||||
import Editor from '../../src/editor'
|
||||
import createEditor from '../fns/create-editor'
|
||||
import $, { DomElement } from '../../src/utils/dom-core'
|
||||
import $ from '../../src/utils/dom-core'
|
||||
|
||||
let editor: Editor
|
||||
let tooltip: Tooltip
|
||||
|
|
Loading…
Reference in New Issue