chore: eslint添加no-unset-vars并删除多余的变量

This commit is contained in:
hahaaha 2020-11-17 18:56:56 +08:00
parent e0f900da4e
commit 7760fabe66
21 changed files with 13 additions and 21 deletions

View File

@ -24,5 +24,6 @@ module.exports = {
plugins: ['@typescript-eslint', 'prettier'],
rules: {
'no-unused-vars': 0,
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }]
},
}

View File

@ -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})`
}

View File

@ -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

View File

@ -4,7 +4,6 @@
*/
import $, { DomElement } from '../utils/dom-core'
import { UA } from '../utils/util'
import Editor from './index'
class Command {

View File

@ -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

View File

@ -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()

View File

@ -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) {

View File

@ -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 {

View File

@ -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 {

View File

@ -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'

View File

@ -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

View File

@ -1,4 +1,3 @@
import Editor from '../../editor/index'
import $, { DomElement } from '../../utils/dom-core'
/**

View File

@ -3,7 +3,7 @@
* @author lichunlin
*/
import $, { DomElement } from '../../../../utils/dom-core'
import $ from '../../../../utils/dom-core'
import Editor from '../../../../editor/index'
class getNode {

View File

@ -4,7 +4,7 @@
*/
import Editor from '../../editor/index'
import $, { DomElement } from '../../utils/dom-core'
import $ from '../../utils/dom-core'
/**
* <p><br></p>

View File

@ -4,7 +4,7 @@
*/
import Editor from '../../editor/index'
import $, { DomElement } from '../../utils/dom-core'
import { DomElement } from '../../utils/dom-core'
/**
* img的位置

View File

@ -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) {

View File

@ -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>`)

View File

@ -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'

View File

@ -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'

View File

@ -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('单行引用', () => {

View File

@ -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