improve eslint config
This commit is contained in:
@@ -1,4 +0,0 @@
|
|||||||
dist/**
|
|
||||||
tests/**
|
|
||||||
**/*.css
|
|
||||||
**/*.json
|
|
||||||
25
.eslintrc.js
25
.eslintrc.js
@@ -1,27 +1,38 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
plugins: ['html', 'cypress', '@typescript-eslint'],
|
|
||||||
|
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
parser: '@typescript-eslint/parser',
|
parser: '@typescript-eslint/parser',
|
||||||
sourceType: 'module',
|
sourceType: 'module',
|
||||||
},
|
},
|
||||||
|
|
||||||
env: {
|
env: {
|
||||||
es6: true,
|
es6: true,
|
||||||
node: true,
|
node: true,
|
||||||
|
},
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: [
|
||||||
|
'./**/*.ts',
|
||||||
|
'./**/*.js',
|
||||||
|
'./**/*.vue',
|
||||||
|
],
|
||||||
|
excludedFiles: [
|
||||||
|
'dist/**',
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
'html',
|
||||||
|
'cypress',
|
||||||
|
'@typescript-eslint',
|
||||||
|
],
|
||||||
|
env: {
|
||||||
'cypress/globals': true,
|
'cypress/globals': true,
|
||||||
},
|
},
|
||||||
|
|
||||||
globals: {
|
globals: {
|
||||||
document: false,
|
document: false,
|
||||||
window: false,
|
window: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
extends: [
|
extends: [
|
||||||
'plugin:vue/strongly-recommended',
|
'plugin:vue/strongly-recommended',
|
||||||
'airbnb-base',
|
'airbnb-base',
|
||||||
],
|
],
|
||||||
|
|
||||||
rules: {
|
rules: {
|
||||||
semi: ['error', 'never'],
|
semi: ['error', 'never'],
|
||||||
'import/extensions': 'off',
|
'import/extensions': 'off',
|
||||||
@@ -51,4 +62,6 @@ module.exports = {
|
|||||||
'no-use-before-define': 'off',
|
'no-use-before-define': 'off',
|
||||||
'@typescript-eslint/no-use-before-define': ['error'],
|
'@typescript-eslint/no-use-before-define': ['error'],
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
"build:docs": "yarn --cwd ./docs build",
|
"build:docs": "yarn --cwd ./docs build",
|
||||||
"build:packages": "yarn clean:packages && lerna exec --parallel -- microbundle --compress",
|
"build:packages": "yarn clean:packages && lerna exec --parallel -- microbundle --compress",
|
||||||
"clean:packages": "rm -rf ./packages/*/dist",
|
"clean:packages": "rm -rf ./packages/*/dist",
|
||||||
"lint": "eslint --quiet --no-error-on-unmatched-pattern --ext .js,.jsx,.ts,.vue ./docs ./packages",
|
"lint": "eslint --quiet --no-error-on-unmatched-pattern ./",
|
||||||
"test:open": "cypress open --project tests",
|
"test:open": "cypress open --project tests",
|
||||||
"test": "cypress run --project tests",
|
"test": "cypress run --project tests",
|
||||||
"reset": "yarn clean:packages && rm -rf ./**/.cache && rm -rf ./**/node_modules && rm -rf ./yarn.lock && yarn install"
|
"reset": "yarn clean:packages && rm -rf ./**/.cache && rm -rf ./**/node_modules && rm -rf ./yarn.lock && yarn install"
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ export class Editor extends EventEmitter {
|
|||||||
*
|
*
|
||||||
* @param name The name of the command
|
* @param name The name of the command
|
||||||
*/
|
*/
|
||||||
|
// eslint-disable-next-line
|
||||||
private __get(name: string) {
|
private __get(name: string) {
|
||||||
return this.commandManager.runSingleCommand(name)
|
return this.commandManager.runSingleCommand(name)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
export default class EventEmitter {
|
export default class EventEmitter {
|
||||||
|
|
||||||
_callbacks: { [key: string]: Function[] } = {}
|
private callbacks: { [key: string]: Function[] } = {}
|
||||||
|
|
||||||
on(event: string, fn: Function) {
|
public on(event: string, fn: Function) {
|
||||||
if (!this._callbacks[event]) {
|
if (!this.callbacks[event]) {
|
||||||
this._callbacks[event] = []
|
this.callbacks[event] = []
|
||||||
}
|
}
|
||||||
|
|
||||||
this._callbacks[event].push(fn)
|
this.callbacks[event].push(fn)
|
||||||
|
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
emit(event: string, ...args: any) {
|
protected emit(event: string, ...args: any) {
|
||||||
const callbacks = this._callbacks[event]
|
const callbacks = this.callbacks[event]
|
||||||
|
|
||||||
if (callbacks) {
|
if (callbacks) {
|
||||||
callbacks.forEach(callback => callback.apply(this, args))
|
callbacks.forEach(callback => callback.apply(this, args))
|
||||||
@@ -22,21 +22,21 @@ export default class EventEmitter {
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
off(event: string, fn?: Function) {
|
public off(event: string, fn?: Function) {
|
||||||
const callbacks = this._callbacks[event]
|
const callbacks = this.callbacks[event]
|
||||||
|
|
||||||
if (callbacks) {
|
if (callbacks) {
|
||||||
if (fn) {
|
if (fn) {
|
||||||
this._callbacks[event] = callbacks.filter(callback => callback !== fn)
|
this.callbacks[event] = callbacks.filter(callback => callback !== fn)
|
||||||
} else {
|
} else {
|
||||||
delete this._callbacks[event]
|
delete this.callbacks[event]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
removeAllListeners() {
|
protected removeAllListeners() {
|
||||||
this._callbacks = {}
|
this.callbacks = {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,13 @@ import deepmerge from 'deepmerge'
|
|||||||
import collect from 'collect.js'
|
import collect from 'collect.js'
|
||||||
import { Plugin } from 'prosemirror-state'
|
import { Plugin } from 'prosemirror-state'
|
||||||
import { keymap } from 'prosemirror-keymap'
|
import { keymap } from 'prosemirror-keymap'
|
||||||
import { Schema, Node as ProsemirrorNode } from 'prosemirror-model'
|
import { Schema } from 'prosemirror-model'
|
||||||
|
// import { Schema, Node as ProsemirrorNode } from 'prosemirror-model'
|
||||||
import { inputRules } from 'prosemirror-inputrules'
|
import { inputRules } from 'prosemirror-inputrules'
|
||||||
import { EditorView, Decoration } from 'prosemirror-view'
|
// import { EditorView, Decoration } from 'prosemirror-view'
|
||||||
|
|
||||||
import { Editor } from './Editor'
|
import { Editor } from './Editor'
|
||||||
import capitalize from './utils/capitalize'
|
// import capitalize from './utils/capitalize'
|
||||||
import { Extensions } from './types'
|
import { Extensions } from './types'
|
||||||
import getTopNodeFromExtensions from './utils/getTopNodeFromExtensions'
|
import getTopNodeFromExtensions from './utils/getTopNodeFromExtensions'
|
||||||
import getNodesFromExtensions from './utils/getNodesFromExtensions'
|
import getNodesFromExtensions from './utils/getNodesFromExtensions'
|
||||||
|
|||||||
5
shims/vue.d.ts
vendored
5
shims/vue.d.ts
vendored
@@ -1,4 +1,5 @@
|
|||||||
declare module "*.vue" {
|
declare module '*.vue' {
|
||||||
import Vue from "vue"
|
import Vue from 'vue'
|
||||||
|
|
||||||
export default Vue
|
export default Vue
|
||||||
}
|
}
|
||||||
@@ -11,6 +11,7 @@
|
|||||||
// This function is called when a project is opened or re-opened (e.g. due to
|
// This function is called when a project is opened or re-opened (e.g. due to
|
||||||
// the project's config changing)
|
// the project's config changing)
|
||||||
|
|
||||||
|
// eslint-disable-next-line
|
||||||
module.exports = (on, config) => {
|
module.exports = (on, config) => {
|
||||||
// `on` is used to hook into various events Cypress emits
|
// `on` is used to hook into various events Cypress emits
|
||||||
// `config` is the resolved Cypress config
|
// `config` is the resolved Cypress config
|
||||||
|
|||||||
Reference in New Issue
Block a user