Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable verbatimModuleSyntax for project #3854

Merged
merged 1 commit into from
Aug 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"excludedFiles": "*.d.ts",
"plugins": ["prettier", "@typescript-eslint"],
"rules": {
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/ban-types": "off",
Expand Down
3 changes: 1 addition & 2 deletions blots/block.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import {
AttributorStore,
BlockBlot,
Blot,
EmbedBlot,
LeafBlot,
Parent,
Scope,
} from 'parchment';
import type { Blot, Parent } from 'parchment';
import Delta from 'quill-delta';
import Break from './break';
import Inline from './inline';
Expand Down
7 changes: 4 additions & 3 deletions blots/cursor.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { EmbedBlot, Parent, Scope, ScrollBlot } from 'parchment';
import Selection from '../core/selection';
import { EmbedBlot, Scope } from 'parchment';
import type { Parent, ScrollBlot } from 'parchment';
import type Selection from '../core/selection';
import TextBlot from './text';
import { EmbedContextRange } from './embed';
import type { EmbedContextRange } from './embed';

class Cursor extends EmbedBlot {
static blotName = 'cursor';
Expand Down
3 changes: 2 additions & 1 deletion blots/embed.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { EmbedBlot, ScrollBlot } from 'parchment';
import type { ScrollBlot } from 'parchment';
import { EmbedBlot } from 'parchment';
import TextBlot from './text';

const GUARD_TEXT = '\uFEFF';
Expand Down
3 changes: 2 additions & 1 deletion blots/inline.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BlotConstructor, EmbedBlot, InlineBlot, Scope } from 'parchment';
import { EmbedBlot, InlineBlot, Scope } from 'parchment';
import type { BlotConstructor } from 'parchment';
import Break from './break';
import Text from './text';

Expand Down
16 changes: 4 additions & 12 deletions blots/scroll.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
import {
Blot,
ContainerBlot,
EmbedBlot,
LeafBlot,
Parent,
ParentBlot,
Registry,
Scope,
ScrollBlot,
} from 'parchment';
import { ContainerBlot, LeafBlot, Scope, ScrollBlot } from 'parchment';
import type { Blot, Parent, EmbedBlot, ParentBlot, Registry } from 'parchment';
import Delta, { AttributeMap, Op } from 'quill-delta';
import Emitter, { EmitterSource } from '../core/emitter';
import Emitter from '../core/emitter';
import type { EmitterSource } from '../core/emitter';
import Block, { BlockEmbed } from './block';
import Break from './break';
import Container from './container';
Expand Down
2 changes: 1 addition & 1 deletion core/composition.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Embed from '../blots/embed';
import Scroll from '../blots/scroll';
import type Scroll from '../blots/scroll';
import Emitter from './emitter';

class Composition {
Expand Down
5 changes: 3 additions & 2 deletions core/editor.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import cloneDeep from 'lodash.clonedeep';
import isEqual from 'lodash.isequal';
import merge from 'lodash.merge';
import { LeafBlot, EmbedBlot, Scope, Blot, ParentBlot } from 'parchment';
import { LeafBlot, EmbedBlot, Scope, ParentBlot } from 'parchment';
import type { Blot } from 'parchment';
import Delta, { AttributeMap, Op } from 'quill-delta';
import Block, { BlockEmbed, bubbleFormats } from '../blots/block';
import Break from '../blots/break';
import CursorBlot from '../blots/cursor';
import Scroll from '../blots/scroll';
import type Scroll from '../blots/scroll';
import TextBlot, { escapeText } from '../blots/text';
import { Range } from './selection';

Expand Down
2 changes: 1 addition & 1 deletion core/module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Quill from './quill';
import type Quill from './quill';

abstract class Module<T extends {} = {}> {
static DEFAULTS = {};
Expand Down
32 changes: 20 additions & 12 deletions core/quill.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
import cloneDeep from 'lodash.clonedeep';
import merge from 'lodash.merge';
import * as Parchment from 'parchment';
import Delta, { Op } from 'quill-delta';
import Block, { BlockEmbed } from '../blots/block';
import Scroll, { ScrollConstructor } from '../blots/scroll';
import Clipboard from '../modules/clipboard';
import History from '../modules/history';
import Keyboard from '../modules/keyboard';
import Uploader from '../modules/uploader';
import type { Op } from 'quill-delta';
import Delta from 'quill-delta';
import type { BlockEmbed } from '../blots/block';
import type Block from '../blots/block';
import type Scroll from '../blots/scroll';
import type { ScrollConstructor } from '../blots/scroll';
import type Clipboard from '../modules/clipboard';
import type History from '../modules/history';
import type Keyboard from '../modules/keyboard';
import type Uploader from '../modules/uploader';
import Editor from './editor';
import Emitter, { EmitterSource } from './emitter';
import Emitter from './emitter';
import type { EmitterSource } from './emitter';
import instances from './instances';
import logger, { DebugLevel } from './logger';
import logger from './logger';
import type { DebugLevel } from './logger';
import Module from './module';
import Selection, { Bounds, Range } from './selection';
import Selection, { Range } from './selection';
import type { Bounds } from './selection';
import Composition from './composition';
import Theme, { ThemeConstructor } from './theme';
import scrollRectIntoView, { Rect } from './utils/scrollRectIntoView';
import Theme from './theme';
import type { ThemeConstructor } from './theme';
import scrollRectIntoView from './utils/scrollRectIntoView';
import type { Rect } from './utils/scrollRectIntoView';

const debug = logger('quill');

Expand Down
9 changes: 5 additions & 4 deletions core/selection.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { LeafBlot, Scope } from 'parchment';
import cloneDeep from 'lodash.clonedeep';
import isEqual from 'lodash.isequal';
import Emitter, { EmitterSource } from './emitter';
import Emitter from './emitter';
import type { EmitterSource } from './emitter';
import logger from './logger';
import Cursor from '../blots/cursor';
import Scroll from '../blots/scroll';
import type Cursor from '../blots/cursor';
import type Scroll from '../blots/scroll';

const debug = logger('quill:selection');

Expand Down Expand Up @@ -173,7 +174,7 @@ class Selection {
this.update();
}

getBounds(index: number, length = 0): Bounds | null {
getBounds(index: number, length = 0) {
const scrollLength = this.scroll.length();
index = Math.min(index, scrollLength - 1);
length = Math.min(index + length, scrollLength - 1) - index;
Expand Down
12 changes: 6 additions & 6 deletions core/theme.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Quill from '../core';
import Clipboard from '../modules/clipboard';
import History from '../modules/history';
import Keyboard from '../modules/keyboard';
import { ToolbarProps } from '../modules/toolbar';
import Uploader from '../modules/uploader';
import type Quill from '../core';
import type Clipboard from '../modules/clipboard';
import type History from '../modules/history';
import type Keyboard from '../modules/keyboard';
import type { ToolbarProps } from '../modules/toolbar';
import type Uploader from '../modules/uploader';

export interface ThemeOptions {
modules: Record<string, unknown> & {
Expand Down
3 changes: 2 additions & 1 deletion e2e/history.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Page, expect } from '@playwright/test';
import { expect } from '@playwright/test';
import type { Page } from '@playwright/test';
import { test } from './fixtures';
import { SHORTKEY } from './utils';

Expand Down
2 changes: 1 addition & 1 deletion formats/list.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Block from '../blots/block';
import Container from '../blots/container';
import Scroll from '../blots/scroll';
import type Scroll from '../blots/scroll';
import Quill from '../core/quill';

class ListContainer extends Container {}
Expand Down
2 changes: 1 addition & 1 deletion formats/table.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LinkedList } from 'parchment';
import type { LinkedList } from 'parchment';
import Block from '../blots/block';
import Container from '../blots/container';

Expand Down
6 changes: 3 additions & 3 deletions modules/clipboard.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import type { ScrollBlot } from 'parchment';
import {
Attributor,
BlockBlot,
ClassAttributor,
EmbedBlot,
Scope,
ScrollBlot,
StyleAttributor,
} from 'parchment';
import Delta from 'quill-delta';
import { BlockEmbed } from '../blots/block';
import { EmitterSource } from '../core/emitter';
import type { EmitterSource } from '../core/emitter';
import logger from '../core/logger';
import Module from '../core/module';
import Quill from '../core/quill';
import { Range } from '../core/selection';
import type { Range } from '../core/selection';
import { AlignAttribute, AlignStyle } from '../formats/align';
import { BackgroundStyle } from '../formats/background';
import CodeBlock from '../formats/code';
Expand Down
4 changes: 2 additions & 2 deletions modules/history.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Scope } from 'parchment';
import Delta from 'quill-delta';
import type Delta from 'quill-delta';
import Module from '../core/module';
import Quill from '../core/quill';
import type Scroll from '../blots/scroll';
import { Range } from '../core/selection';
import type { Range } from '../core/selection';

export interface HistoryOptions {
userOnly: boolean;
Expand Down
7 changes: 4 additions & 3 deletions modules/keyboard.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import cloneDeep from 'lodash.clonedeep';
import isEqual from 'lodash.isequal';
import Delta, { AttributeMap } from 'quill-delta';
import { BlockBlot, Blot, EmbedBlot, Scope, TextBlot } from 'parchment';
import { EmbedBlot, Scope, TextBlot } from 'parchment';
import type { Blot, BlockBlot } from 'parchment';
import Quill from '../core/quill';
import logger from '../core/logger';
import Module from '../core/module';
import { BlockEmbed } from '../blots/block';
import { Range } from '../core/selection';
import type { BlockEmbed } from '../blots/block';
import type { Range } from '../core/selection';

const debug = logger('quill:keyboard');

Expand Down
3 changes: 2 additions & 1 deletion modules/syntax.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Delta from 'quill-delta';
import { Blot, ClassAttributor, Scope, ScrollBlot } from 'parchment';
import { ClassAttributor, Scope } from 'parchment';
import type { Blot, ScrollBlot } from 'parchment';
import Inline from '../blots/inline';
import Quill from '../core/quill';
import Module from '../core/module';
Expand Down
4 changes: 2 additions & 2 deletions modules/tableEmbed.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Delta, { AttributeMap, OpIterator } from 'quill-delta';
import Op from 'quill-delta/dist/Op';
import Delta, { OpIterator } from 'quill-delta';
import type { Op, AttributeMap } from 'quill-delta';
import Module from '../core/module';

export type CellData = {
Expand Down
2 changes: 1 addition & 1 deletion modules/toolbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { EmbedBlot, Scope } from 'parchment';
import Quill from '../core/quill';
import logger from '../core/logger';
import Module from '../core/module';
import { Range } from '../core/selection';
import type { Range } from '../core/selection';

const debug = logger('quill:toolbar');

Expand Down
4 changes: 2 additions & 2 deletions modules/uploader.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Delta from 'quill-delta';
import Quill from '../core/quill';
import type Quill from '../core/quill';
import Emitter from '../core/emitter';
import Module from '../core/module';
import { Range } from '../core/selection';
import type { Range } from '../core/selection';

interface UploaderOptions {
mimetypes: string[];
Expand Down
3 changes: 2 additions & 1 deletion test/fuzz/editor.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Delta, { AttributeMap, Op } from 'quill-delta';
import type { Op } from 'quill-delta';
import Delta, { AttributeMap } from 'quill-delta';
import { choose, randomInt, runFuzz } from './__helpers__/utils';
import { AlignClass } from '../../formats/align';
import { FontClass } from '../../formats/font';
Expand Down
6 changes: 4 additions & 2 deletions test/fuzz/tableEmbed.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import Delta, { AttributeMap } from 'quill-delta';
import TableEmbed, {
import type { AttributeMap } from 'quill-delta';
import Delta from 'quill-delta';
import TableEmbed from '../../modules/tableEmbed';
import type {
CellData,
TableData,
TableRowColumnOp,
Expand Down
10 changes: 2 additions & 8 deletions test/unit/core/quill.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import '../../../quill';
import Delta from 'quill-delta';
import {
MockedFunction,
beforeEach,
describe,
expect,
test,
vitest,
} from 'vitest';
import { beforeEach, describe, expect, test, vitest } from 'vitest';
import type { MockedFunction } from 'vitest';
import Emitter from '../../../core/emitter';
import Theme from '../../../core/theme';
import Toolbar from '../../../modules/toolbar';
Expand Down
3 changes: 2 additions & 1 deletion test/unit/modules/history.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import Delta from 'quill-delta';
import { describe, expect, test, vitest } from 'vitest';
import Quill from '../../../core';
import { HistoryOptions, getLastChangeIndex } from '../../../modules/history';
import { getLastChangeIndex } from '../../../modules/history';
import type { HistoryOptions } from '../../../modules/history';
import { createRegistry, createScroll } from '../__helpers__/factory';
import { sleep } from '../__helpers__/utils';
import Bold from '../../../formats/bold';
Expand Down
Loading