Skip to content

Commit ff10b69

Browse files
author
Yifeng Wang
authored
refactor: use moduleResolution: "NodeNext" (#395)
1 parent bc796f8 commit ff10b69

File tree

123 files changed

+441
-372
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+441
-372
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "blocksuite",
33
"private": true,
4+
"type": "module",
45
"scripts": {
56
"serve": "pnpm --filter @blocksuite/store serve",
67
"dev": "run-p serve dev:playground",
@@ -30,7 +31,7 @@
3031
"@changesets/cli": "^2.25.0",
3132
"@playwright/test": "^1.28.1",
3233
"@types/node": "^18.7.16",
33-
"@types/quill": "^2.0.9",
34+
"@types/quill": "^1.3.7",
3435
"@types/react": "^18.0.19",
3536
"@types/react-dom": "^18.0.6",
3637
"@typescript-eslint/eslint-plugin": "^5.36.2",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import './rich-text/rich-text';
22

3-
export * from './utils';
3+
export * from './utils/index.js';

packages/blocks/src/__internal__/rich-text/keyboard.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
matchFlavours,
1010
noop,
1111
PREVENT_DEFAULT,
12-
} from '../utils';
12+
} from '../utils/index.js';
1313
import {
1414
handleLineStartBackspace,
1515
handleUnindent,
@@ -20,8 +20,8 @@ import {
2020
handleKeyDown,
2121
handleKeyUp,
2222
tryMatchSpaceHotkey,
23-
} from './rich-text-operations';
24-
import { Shortcuts } from './shortcuts';
23+
} from './rich-text-operations.js';
24+
import { Shortcuts } from './shortcuts.js';
2525

2626
interface QuillRange {
2727
index: number;

packages/blocks/src/__internal__/rich-text/link-node/create-link.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import type { Page } from '@blocksuite/store';
2-
import { showLinkPopover } from '../../../components/link-popover';
2+
import { showLinkPopover } from '../../../components/link-popover/index.js';
33
import {
44
assertExists,
55
getRichTextByModel,
66
getStartModelBySelection,
77
hotkey,
88
isRangeSelection,
9-
} from '../../utils';
9+
} from '../../utils/index.js';
1010
import './link-node';
11-
import { MockSelectNode } from './mock-select-node';
11+
import { MockSelectNode } from './mock-select-node.js';
1212

1313
// Disable hotkey to fix common hotkey(ctrl+c, ctrl+v, etc) not working at edit link popover
1414
export const createLink = hotkey.withDisabledHotkeyFn(async (page: Page) => {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import './link-node';
22

3-
export { LinkNodeComponent } from './link-node';
4-
export { createLink } from './create-link';
3+
export { LinkNodeComponent } from './link-node.js';
4+
export { createLink } from './create-link.js';

packages/blocks/src/__internal__/rich-text/link-node/link-node.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
import { css, html, LitElement } from 'lit';
22
import { customElement, property, state } from 'lit/decorators.js';
3-
import Quill from 'quill';
3+
import type { Quill as QuillType } from 'quill';
4+
import Q from 'quill';
45
import {
56
ALLOWED_SCHEMES,
67
showLinkPopover,
7-
} from '../../../components/link-popover';
8+
} from '../../../components/link-popover/index.js';
89
import {
910
assertExists,
1011
getDefaultPageBlock,
1112
getModelByElement,
1213
hotkey,
13-
} from '../../utils';
14-
import { LinkIcon } from './link-icon';
14+
} from '../../utils/index.js';
15+
import { LinkIcon } from './link-icon.js';
16+
17+
const Quill = Q as unknown as typeof QuillType;
1518

1619
// TODO fix Blot types
1720
type Blot = {

packages/blocks/src/__internal__/rich-text/link-node/mock-select-node.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import Quill from 'quill';
1+
import type { Quill as QuillType } from 'quill';
2+
import Q from 'quill';
3+
const Quill = Q as unknown as typeof QuillType;
24

35
const Inline = Quill.import('blots/inline');
46
export class MockSelectNode extends Inline {

packages/blocks/src/__internal__/rich-text/rich-text-operations.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// operations used in rich-text level
22

33
import { Page, Text } from '@blocksuite/store';
4-
import type Quill from 'quill';
4+
import type { Quill } from 'quill';
55
import {
66
ExtendedModel,
77
assertExists,
@@ -21,7 +21,7 @@ import {
2121
getDefaultPageBlock,
2222
getBlockElementByModel,
2323
resetNativeSelection,
24-
} from '../utils';
24+
} from '../utils/index.js';
2525

2626
export function handleBlockEndEnter(page: Page, model: ExtendedModel) {
2727
const parent = page.getParent(model);

packages/blocks/src/__internal__/rich-text/rich-text.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import { LitElement, html, css, unsafeCSS } from 'lit';
22
import { customElement, property, query } from 'lit/decorators.js';
3-
import Quill from 'quill';
3+
import type { Quill as QuillType } from 'quill';
4+
import Q from 'quill';
45
import QuillCursors from 'quill-cursors';
56
import type { BaseBlockModel } from '@blocksuite/store';
6-
import type { BlockHost } from '../utils';
7-
import { createKeyboardBindings } from './keyboard';
7+
import type { BlockHost } from '../utils/index.js';
8+
import { createKeyboardBindings } from './keyboard.js';
89

910
import style from './styles.css';
10-
import Syntax from '../../code-block/components/syntax-code-block';
11+
import Syntax from '../../code-block/components/syntax-code-block.js';
12+
13+
const Quill = Q as unknown as typeof QuillType;
1114

1215
Quill.register('modules/cursors', QuillCursors);
1316
const Clipboard = Quill.import('modules/clipboard');
@@ -39,7 +42,7 @@ export class RichText extends LitElement {
3942
@query('.affine-rich-text.quill-container')
4043
private _textContainer!: HTMLDivElement;
4144

42-
quill!: Quill;
45+
quill!: QuillType;
4346

4447
@property({
4548
hasChanged() {
@@ -98,7 +101,8 @@ export class RichText extends LitElement {
98101
// If you type a character after the code or link node,
99102
// the character should not be inserted into the code or link node.
100103
// So we check and remove the corresponding format manually.
101-
this.quill.on('text-change', delta => {
104+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
105+
this.quill.on('text-change', (delta: any) => {
102106
const selectorMap = {
103107
code: 'code',
104108
link: 'link-node',

packages/blocks/src/__internal__/rich-text/shortcuts.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import type { BaseBlockModel } from '@blocksuite/store';
2-
import type Quill from 'quill';
2+
import type { Quill } from 'quill';
33
import type { RangeStatic } from 'quill';
44
import {
55
ALLOW_DEFAULT,
66
assertExists,
77
getDefaultPageBlock,
88
PREVENT_DEFAULT,
9-
} from '..';
9+
} from '../index.js';
1010

1111
type Match = {
1212
name: string;

0 commit comments

Comments
 (0)