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

feat: add eslint plugin @stylistic/eslint-plugin #36

Merged
merged 4 commits into from
Sep 2, 2024

Conversation

zzxming
Copy link
Collaborator

@zzxming zzxming commented Sep 1, 2024

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

  • eslint control docs and editor code style
  • vscode will auto fix code on save
  • add vue type in docs

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • New Features

    • Introduced Vue.js as a dependency for enhanced functionality in the application.
  • Bug Fixes

    • Updated ESLint configuration to improve linting processes by ignoring Markdown, JSON, and YAML files.
  • Style

    • Improved code readability through consistent formatting adjustments and the use of quotes in object keys.
    • Enhanced clarity of comments throughout the codebase.
  • Documentation

    • Refined comments for better understanding and consistency across various files.

Copy link

coderabbitai bot commented Sep 1, 2024

Walkthrough

The changes involve updates to configuration files, code formatting, and stylistic adjustments across various components of the project. Notable modifications include the removal of specific ignore patterns in the .eslintignore file, the addition of the vue package to dependencies, and consistent formatting improvements in TypeScript files. These updates aim to enhance code readability and maintainability without altering the underlying functionality of the application.

Changes

File(s) Change Summary
.eslintignore Removed ignore for # Examples; added patterns to ignore **/*.md, **/*.json, and **/*.yaml files.
packages/docs/package.json Removed @types/node from devDependencies; added vue to dependencies.
packages/fluent-editor/src/config.ts Added quotes around keys in ICONS_CONFIG; adjusted formatting in getListValue function.
packages/fluent-editor/src/fluent-editor.ts Added parentheses around arrow function parameters; modified object keys to use quotes consistently.

Sequence Diagram(s)

sequenceDiagram
    participant A as User
    participant B as Editor
    participant C as Linter
    participant D as VSCode

    A->>B: Type code
    B->>C: Run ESLint
    C->>B: Check for stylistic issues
    B->>D: Format on save
    D-->>B: Apply formatting
    B-->>A: Display formatted code
Loading

🐰 In the meadow, I hop with glee,
Changes abound, oh what a spree!
Semicolons gone, the code flows bright,
With plugins and settings, all feels right.
Hooray for the tweaks, let’s dance and play,
In our code garden, we’ll hop all day! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Tip

Early access features: enabled

We are currently testing the following features in early access:

  • Anthropic claude-3-5-sonnet for code reviews: Anthropic claims that the new Claude model has stronger code understanding and code generation capabilities than their previous models. Note: Our default code review model was also updated late last week. Please compare the quality of the reviews between the two models by toggling the early access feature.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues on the discussion post.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 10

Outside diff range, codebase verification and nitpick comments (2)
packages/fluent-editor/src/global-link/index.ts (1)

13-163: LGTM! The semicolon removal changes are approved. Consider using optional chaining to improve code safety.

The changes in the GlobalLink class primarily involve removing semicolons from the constructor and methods, which is a stylistic change and doesn't affect the functionality.

Regarding the static analysis suggestion:

  • At lines 31 and 35, consider using optional chaining as suggested by the static analysis tool to safely access the querySelector result and globalLinkBtn respectively. This can prevent potential errors when these values are nullish.

Apply this diff to use optional chaining:

-    const globalLinkBtn = toolbar.container && toolbar.container.querySelector('.ql-global-link')
+    const globalLinkBtn = toolbar.container?.querySelector('.ql-global-link')
     toolbar.addHandler('global-link', this.handleGlobalLinkButtonClick.bind(this))
     quill.root.addEventListener('click', this.onEditorClick.bind(this))
     document.body.addEventListener('click', (evt) => {
-      if (!this.wrap.contains(evt.target) && !(globalLinkBtn && globalLinkBtn.contains(evt.target))) {
+      if (!this.wrap.contains(evt.target) && !globalLinkBtn?.contains(evt.target)) {
         this.open = false
         this.wrap.classList.add('global-link-hide')
       }
     })
Tools
Biome

[error] 31-31: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 35-35: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/link/formats/link.ts (1)

16-16: Use the class name instead of this in static methods.

As a best practice, consider using the class name Link instead of this to refer to the class in static methods. This makes it clear that the static methods belong to the class itself and not an instance.

Apply this diff:

-    const href = this.sanitize(value)
+    const href = Link.sanitize(value)

-    return sanitize(url, this.PROTOCOL_WHITELIST) ? url : this.SANITIZED_URL  
+    return sanitize(url, Link.PROTOCOL_WHITELIST) ? url : Link.SANITIZED_URL

Also applies to: 27-27

Tools
Biome

[error] 16-16: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3df3329 and 2189523.

Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing (83)
  • .eslintignore (1 hunks)
  • .eslintrc.js (1 hunks)
  • .vscode/settings.json (1 hunks)
  • jest.config.js (1 hunks)
  • package.json (1 hunks)
  • packages/docs/fluent-editor/demos/basic-usage.spec.ts (2 hunks)
  • packages/docs/playwright.config.ts (2 hunks)
  • packages/fluent-editor/scripts/pre-release.js (1 hunks)
  • packages/fluent-editor/src/config.ts (4 hunks)
  • packages/fluent-editor/src/config/editor.utils.ts (7 hunks)
  • packages/fluent-editor/src/config/i18n/en-us.ts (2 hunks)
  • packages/fluent-editor/src/config/i18n/zh-cn.ts (2 hunks)
  • packages/fluent-editor/src/config/types/additional-toolbar-item.interface.ts (1 hunks)
  • packages/fluent-editor/src/config/types/counter-option.interface.ts (1 hunks)
  • packages/fluent-editor/src/config/types/editor-modules.interface.ts (1 hunks)
  • packages/fluent-editor/src/config/types/file-operation.interface.ts (1 hunks)
  • packages/fluent-editor/src/config/types/image-upload.interface.ts (1 hunks)
  • packages/fluent-editor/src/config/types/paste-change.interface.ts (1 hunks)
  • packages/fluent-editor/src/config/types/type.ts (1 hunks)
  • packages/fluent-editor/src/counter/index.ts (1 hunks)
  • packages/fluent-editor/src/custom-clipboard.ts (21 hunks)
  • packages/fluent-editor/src/custom-image/BlotFormatter.ts (2 hunks)
  • packages/fluent-editor/src/custom-image/Options.ts (2 hunks)
  • packages/fluent-editor/src/custom-image/actions/Action.ts (1 hunks)
  • packages/fluent-editor/src/custom-image/actions/CustomResizeAction.ts (1 hunks)
  • packages/fluent-editor/src/custom-image/actions/DeleteAction.ts (1 hunks)
  • packages/fluent-editor/src/custom-image/image.ts (1 hunks)
  • packages/fluent-editor/src/custom-image/specs/BlotSpec.ts (1 hunks)
  • packages/fluent-editor/src/custom-image/specs/CustomImageSpec.ts (2 hunks)
  • packages/fluent-editor/src/custom-image/specs/ImageSpec.ts (1 hunks)
  • packages/fluent-editor/src/custom-uploader.ts (6 hunks)
  • packages/fluent-editor/src/emoji/emoji-list.ts (1 hunks)
  • packages/fluent-editor/src/emoji/emoji-list/index.ts (1 hunks)
  • packages/fluent-editor/src/emoji/emoji-list/people.ts (2 hunks)
  • packages/fluent-editor/src/emoji/emoji-map.ts (1 hunks)
  • packages/fluent-editor/src/emoji/formats/emoji-blot.ts (1 hunks)
  • packages/fluent-editor/src/emoji/index.ts (1 hunks)
  • packages/fluent-editor/src/emoji/modules/emoji.ts (3 hunks)
  • packages/fluent-editor/src/emoji/modules/toolbar-emoji.ts (1 hunks)
  • packages/fluent-editor/src/emoji/utils.ts (1 hunks)
  • packages/fluent-editor/src/file/formats/file.ts (1 hunks)
  • packages/fluent-editor/src/file/index.ts (1 hunks)
  • packages/fluent-editor/src/file/modules/file-bar.ts (4 hunks)
  • packages/fluent-editor/src/fluent-editor.ts (3 hunks)
  • packages/fluent-editor/src/global-link/constants.ts (1 hunks)
  • packages/fluent-editor/src/global-link/formats/customer-widget-link.ts (1 hunks)
  • packages/fluent-editor/src/global-link/formats/doc-link.ts (1 hunks)
  • packages/fluent-editor/src/global-link/formats/wiki-link.ts (1 hunks)
  • packages/fluent-editor/src/global-link/formats/work-item-link.ts (1 hunks)
  • packages/fluent-editor/src/global-link/global-link-panel.ts (1 hunks)
  • packages/fluent-editor/src/global-link/index.ts (1 hunks)
  • packages/fluent-editor/src/global-link/utils/createTable.ts (1 hunks)
  • packages/fluent-editor/src/index.ts (1 hunks)
  • packages/fluent-editor/src/lineheight.ts (1 hunks)
  • packages/fluent-editor/src/link/formats/link.ts (1 hunks)
  • packages/fluent-editor/src/link/index.ts (1 hunks)
  • packages/fluent-editor/src/link/modules/tooltip.ts (3 hunks)
  • packages/fluent-editor/src/mention/Mention.ts (4 hunks)
  • packages/fluent-editor/src/mention/MentionLink.ts (1 hunks)
  • packages/fluent-editor/src/mention/constants.ts (1 hunks)
  • packages/fluent-editor/src/quick-menu/index.ts (1 hunks)
  • packages/fluent-editor/src/screenshot/index.ts (3 hunks)
  • packages/fluent-editor/src/soft-break/index.ts (1 hunks)
  • packages/fluent-editor/src/strike/index.ts (1 hunks)
  • packages/fluent-editor/src/syntax/index.ts (2 hunks)
  • packages/fluent-editor/src/table/better-table.ts (9 hunks)
  • packages/fluent-editor/src/table/formats/header.ts (2 hunks)
  • packages/fluent-editor/src/table/formats/list.ts (2 hunks)
  • packages/fluent-editor/src/table/formats/table.ts (6 hunks)
  • packages/fluent-editor/src/table/modules/table-column-tool.ts (3 hunks)
  • packages/fluent-editor/src/table/modules/table-operation-menu.ts (10 hunks)
  • packages/fluent-editor/src/table/modules/table-scroll-bar.ts (1 hunks)
  • packages/fluent-editor/src/table/modules/table-selection.ts (1 hunks)
  • packages/fluent-editor/src/table/table-config.ts (1 hunks)
  • packages/fluent-editor/src/table/utils/index.ts (4 hunks)
  • packages/fluent-editor/src/table/utils/node-matchers.ts (2 hunks)
  • packages/fluent-editor/src/toolbar/better-picker.ts (2 hunks)
  • packages/fluent-editor/src/toolbar/index.ts (1 hunks)
  • packages/fluent-editor/src/utils/debounce.ts (1 hunks)
  • packages/fluent-editor/src/utils/method.ts (2 hunks)
  • packages/fluent-editor/src/video/index.ts (1 hunks)
  • packages/fluent-editor/vite.config.ts (1 hunks)
  • verifyCommit.js (1 hunks)
Files skipped from review due to trivial changes (53)
  • .eslintignore
  • .vscode/settings.json
  • jest.config.js
  • packages/docs/fluent-editor/demos/basic-usage.spec.ts
  • packages/docs/playwright.config.ts
  • packages/fluent-editor/scripts/pre-release.js
  • packages/fluent-editor/src/config.ts
  • packages/fluent-editor/src/config/editor.utils.ts
  • packages/fluent-editor/src/config/i18n/en-us.ts
  • packages/fluent-editor/src/config/i18n/zh-cn.ts
  • packages/fluent-editor/src/config/types/additional-toolbar-item.interface.ts
  • packages/fluent-editor/src/config/types/counter-option.interface.ts
  • packages/fluent-editor/src/config/types/editor-modules.interface.ts
  • packages/fluent-editor/src/config/types/file-operation.interface.ts
  • packages/fluent-editor/src/config/types/image-upload.interface.ts
  • packages/fluent-editor/src/config/types/paste-change.interface.ts
  • packages/fluent-editor/src/config/types/type.ts
  • packages/fluent-editor/src/counter/index.ts
  • packages/fluent-editor/src/custom-clipboard.ts
  • packages/fluent-editor/src/custom-image/BlotFormatter.ts
  • packages/fluent-editor/src/custom-image/Options.ts
  • packages/fluent-editor/src/custom-image/actions/Action.ts
  • packages/fluent-editor/src/custom-image/actions/DeleteAction.ts
  • packages/fluent-editor/src/custom-image/specs/BlotSpec.ts
  • packages/fluent-editor/src/custom-image/specs/CustomImageSpec.ts
  • packages/fluent-editor/src/custom-image/specs/ImageSpec.ts
  • packages/fluent-editor/src/emoji/emoji-list.ts
  • packages/fluent-editor/src/emoji/emoji-list/index.ts
  • packages/fluent-editor/src/emoji/emoji-list/people.ts
  • packages/fluent-editor/src/emoji/emoji-map.ts
  • packages/fluent-editor/src/emoji/index.ts
  • packages/fluent-editor/src/emoji/modules/emoji.ts
  • packages/fluent-editor/src/emoji/modules/toolbar-emoji.ts
  • packages/fluent-editor/src/emoji/utils.ts
  • packages/fluent-editor/src/file/index.ts
  • packages/fluent-editor/src/file/modules/file-bar.ts
  • packages/fluent-editor/src/fluent-editor.ts
  • packages/fluent-editor/src/global-link/constants.ts
  • packages/fluent-editor/src/global-link/global-link-panel.ts
  • packages/fluent-editor/src/global-link/utils/createTable.ts
  • packages/fluent-editor/src/index.ts
  • packages/fluent-editor/src/lineheight.ts
  • packages/fluent-editor/src/mention/constants.ts
  • packages/fluent-editor/src/quick-menu/index.ts
  • packages/fluent-editor/src/syntax/index.ts
  • packages/fluent-editor/src/table/table-config.ts
  • packages/fluent-editor/src/table/utils/index.ts
  • packages/fluent-editor/src/toolbar/better-picker.ts
  • packages/fluent-editor/src/toolbar/index.ts
  • packages/fluent-editor/src/utils/debounce.ts
  • packages/fluent-editor/src/utils/method.ts
  • packages/fluent-editor/vite.config.ts
  • verifyCommit.js
Additional context used
Biome
packages/fluent-editor/src/strike/index.ts

[error] 4-12: Avoid classes that contain only static members.

Prefer using simple functions instead of classes with only static members.

(lint/complexity/noStaticOnlyClass)

packages/fluent-editor/src/soft-break/index.ts

[error] 15-15: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

packages/fluent-editor/src/global-link/formats/customer-widget-link.ts

[error] 12-12: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 27-29: This constructor is unnecessary.

Unsafe fix: Remove the unnecessary constructor.

(lint/complexity/noUselessConstructor)

packages/fluent-editor/src/link/index.ts

[error] 14-16: This constructor is unnecessary.

Unsafe fix: Remove the unnecessary constructor.

(lint/complexity/noUselessConstructor)

packages/fluent-editor/src/global-link/formats/wiki-link.ts

[error] 15-15: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

packages/fluent-editor/src/link/formats/link.ts

[error] 15-15: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 16-16: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 27-27: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 27-27: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

packages/fluent-editor/src/global-link/formats/work-item-link.ts

[error] 15-15: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

packages/fluent-editor/src/mention/MentionLink.ts

[error] 15-15: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 16-16: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/global-link/formats/doc-link.ts

[error] 15-15: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

packages/fluent-editor/src/emoji/formats/emoji-blot.ts

[error] 6-49: Avoid classes that contain only static members.

Prefer using simple functions instead of classes with only static members.

(lint/complexity/noStaticOnlyClass)


[error] 14-14: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 37-37: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 38-38: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

packages/fluent-editor/src/video/index.ts

[error] 18-18: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 18-18: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 22-22: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 29-29: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.

The declaration is defined in this switch clause:

Unsafe fix: Wrap the declaration in a block.

(lint/correctness/noSwitchDeclarations)

packages/fluent-editor/src/file/formats/file.ts

[error] 16-16: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 59-59: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

packages/fluent-editor/src/table/formats/header.ts

[error] 28-28: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 47-47: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

packages/fluent-editor/src/custom-image/image.ts

[error] 18-18: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 21-21: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 62-62: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

packages/fluent-editor/src/global-link/index.ts

[error] 31-31: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 35-35: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/screenshot/index.ts

[error] 31-31: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/custom-uploader.ts

[error] 104-104: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/custom-image/actions/CustomResizeAction.ts

[error] 151-151: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

packages/fluent-editor/src/table/formats/list.ts

[error] 59-59: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 133-133: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 160-163: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 163-166: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 212-212: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)

packages/fluent-editor/src/table/modules/table-scroll-bar.ts

[error] 127-128: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/link/modules/tooltip.ts

[error] 80-80: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 93-93: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 175-175: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/table/utils/node-matchers.ts

[error] 53-54: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 314-314: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 325-326: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/table/modules/table-selection.ts

[error] 31-31: The constructor should not return a value.

The constructor is here:

Returning a value from a constructor is ignored.

(lint/correctness/noConstructorReturn)


[error] 350-350: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)

packages/fluent-editor/src/mention/Mention.ts

[error] 202-203: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 211-211: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 214-214: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

packages/fluent-editor/src/table/modules/table-column-tool.ts

[error] 18-18: The constructor should not return a value.

The constructor is here:

Returning a value from a constructor is ignored.

(lint/correctness/noConstructorReturn)


[error] 163-163: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 301-304: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 452-453: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/table/modules/table-operation-menu.ts

[error] 305-306: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 309-310: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 365-365: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)

packages/fluent-editor/src/table/better-table.ts

[error] 199-200: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 534-536: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/table/formats/table.ts

[error] 33-33: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 38-38: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 77-77: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 172-172: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 302-312: This case is falling through to the next case.

Add a break or return statement to the end of this case to prevent fallthrough.

(lint/suspicious/noFallthroughSwitchClause)


[error] 323-324: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 388-389: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 412-412: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 478-479: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 482-489: Avoid classes that contain only static members.

Prefer using simple functions instead of classes with only static members.

(lint/complexity/noStaticOnlyClass)


[error] 497-497: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 639-640: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 654-654: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 670-671: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 960-961: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

Additional comments not posted (99)
packages/fluent-editor/src/link/index.ts (12)

11-11: LGTM!

The removal of the semicolon is a stylistic change that doesn't affect the functionality.


13-13: LGTM!

The removal of the blank line is a stylistic change that doesn't affect the functionality.


15-15: LGTM!

The removal of the semicolon is a stylistic change that doesn't affect the functionality.


19-19: LGTM!

The removal of the semicolon is a stylistic change that doesn't affect the functionality.


20-20: LGTM!

The removal of the semicolon is a stylistic change that doesn't affect the functionality.


21-21: LGTM!

The removal of the semicolon is a stylistic change that doesn't affect the functionality.


22-22: LGTM!

The removal of the semicolon is a stylistic change that doesn't affect the functionality.


23-23: LGTM!

The removal of the semicolon is a stylistic change that doesn't affect the functionality.


28-28: LGTM!

The removal of the semicolon is a stylistic change that doesn't affect the functionality.


30-30: LGTM!

The removal of the semicolon is a stylistic change that doesn't affect the functionality.


32-32: LGTM!

The removal of the semicolon is a stylistic change that doesn't affect the functionality.


34-34: LGTM!

The removal of the semicolon is a stylistic change that doesn't affect the functionality.

packages/fluent-editor/src/global-link/formats/work-item-link.ts (12)

1-1: LGTM!

The code change is approved.


2-2: LGTM!

The code change is approved.


3-3: LGTM!

The code change is approved.


8-8: LGTM!

The code change is approved.


9-9: LGTM!

The code change is approved.


10-10: LGTM!

The code change is approved.


11-11: LGTM!

The code change is approved.


12-12: LGTM!

The code change is approved.


15-15: LGTM!

The code change is approved.

Tools
Biome

[error] 15-15: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


28-28: LGTM!

The code change is approved.


32-32: LGTM!

The code change is approved.


33-33: LGTM!

The code change is approved.

package.json (3)

36-36: LGTM!

The code change is approved.


39-39: LGTM!

The code change is approved.


40-40: LGTM!

The code change is approved.

packages/fluent-editor/src/mention/MentionLink.ts (5)

1-1: LGTM!

The code change is approved.


2-2: LGTM!

The code change is approved.


4-4: LGTM!

The code change is approved.


8-8: LGTM!

The code change is approved.


9-9: LGTM!

The code change is approved.

packages/fluent-editor/src/global-link/formats/doc-link.ts (1)

6-55: LGTM!

The code changes in the DocumentLink class are approved. The removal of semicolons is a stylistic change that doesn't impact the functionality.

The static analysis warning about using super in a static context can be ignored as it's a false positive. The create method is an instance method, not a static method.

Tools
Biome

[error] 15-15: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

packages/fluent-editor/src/emoji/formats/emoji-blot.ts (1)

6-54: LGTM!

The code changes in the EmojiBlot class are approved. The removal of semicolons is a stylistic change that doesn't impact the functionality.

The static analysis warnings can be ignored as they are false positives:

  • The class extends the Embed class from Quill and has instance properties. Therefore, the warning about the class containing only static members is a false positive.
  • The usage of this in the static buildSpan method refers to the class itself and is valid. The warning about using this in a static context is a false positive.
Tools
Biome

[error] 6-49: Avoid classes that contain only static members.

Prefer using simple functions instead of classes with only static members.

(lint/complexity/noStaticOnlyClass)


[error] 14-14: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 37-37: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 38-38: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

packages/fluent-editor/src/video/index.ts (1)

7-60: LGTM!

The code changes in the Video class are approved. The removal of semicolons and the arrow function syntax update are stylistic changes that don't impact the functionality.

The static analysis warnings can be ignored as they are false positives:

  • The usage of this in the static sanitize method refers to the class itself and is valid.
  • The usage of super in the static create method is valid as it calls the parent class's create method.
  • The switch declaration warning is a false positive as the src variable is not accessed outside the switch case.
Tools
Biome

[error] 18-18: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 18-18: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 22-22: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 29-29: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.

The declaration is defined in this switch clause:

Unsafe fix: Wrap the declaration in a block.

(lint/correctness/noSwitchDeclarations)

.eslintrc.js (2)

1-8: LGTM!

The integration of the @stylistic/eslint-plugin and the customized configuration looks good. The default values for indent, quotes, and semi rules are reasonable and align with common stylistic preferences.


28-29: LGTM!

Spreading the rules from the customized configuration into the rules object is the correct approach. This change leverages the centralized management of stylistic rules provided by the @stylistic plugin, enhancing maintainability and flexibility.

packages/fluent-editor/src/file/formats/file.ts (2)

8-11: LGTM!

The removal of semicolons from the static property declarations is a valid stylistic change that aligns with the project's coding style preferences. It does not impact the functionality of the File class.


67-67: LGTM!

The removal of the semicolon from the export statement is a valid stylistic change that aligns with the project's coding style preferences. It does not impact the functionality of the code.

packages/fluent-editor/src/table/formats/header.ts (3)

9-10: LGTM!

The removal of semicolons from the static property declarations is a valid stylistic change that aligns with the project's coding style preferences. It does not impact the functionality of the Header class.


30-34: LGTM!

The change to use an arrow function in the forEach loop for CELL_IDENTITY_KEYS enhances readability while maintaining the same functionality. It is a valid stylistic improvement that does not impact the logic of the code.


129-129: LGTM!

The removal of the semicolon from the export statement is a valid stylistic change that aligns with the project's coding style preferences. It does not impact the functionality of the code.

packages/fluent-editor/src/custom-image/image.ts (2)

10-116: LGTM! The semicolon removal changes are approved.

The changes in the CustomImage class primarily involve removing semicolons, which is a stylistic change and doesn't affect the functionality.

Regarding the static analysis suggestions:

  • The usage of super in the static create method is valid as it is calling the parent class's static method.
  • The usage of this in static methods sanitize and value refers to the class itself and is a common pattern.

Therefore, the static analysis suggestions can be ignored as false positives.

Tools
Biome

[error] 18-18: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 21-21: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 62-62: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


103-116: LGTM! The semicolon removal changes are approved.

The changes in the CustomImageContainer class involve removing semicolons from static properties and the constructor, which is a stylistic change and doesn't affect the functionality.

packages/fluent-editor/src/screenshot/index.ts (1)

Line range hint 9-161: LGTM! The semicolon removal changes are approved.

The changes in the Screenshot class primarily involve removing semicolons from the constructor and methods, which is a stylistic change and doesn't affect the functionality.

Regarding the static analysis suggestion:

  • At line 31, the suggestion to use optional chaining is a false positive because the forEach loop already handles the case when item is nullish. Therefore, this suggestion can be ignored.
Tools
Biome

[error] 31-31: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/custom-uploader.ts (6)

10-17: LGTM!

The code changes are approved. The removal of semicolons in the InsertFileData type declaration is a stylistic change that does not affect the functionality.


34-39: LGTM!

The code changes are approved. The modification of the acceptObj variable declaration to enhance readability by separating the assignment from the declaration is a stylistic change that does not affect the functionality.


42-52: LGTM!

The code changes are approved. The modification of the fileFlag variable declaration to enhance readability by separating the assignment from the declaration and the reformatting of the else statement to improve visual structure are stylistic changes that do not affect the functionality.


77-78: LGTM!

The code changes are approved. The reformatting of the else statement to improve visual structure is a stylistic change that does not affect the functionality.


103-111: LGTM!

The code changes are approved. The reformatting of the else statement to improve visual structure is a stylistic change that does not affect the functionality.

Tools
Biome

[error] 104-104: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


104-104: Skipping the static analysis suggestion.

The suggestion to change the property access to an optional chain is a false positive. The property access is safe because the uploadOption property is checked for existence before accessing its isVideoPlay property.

Tools
Biome

[error] 104-104: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/table/modules/table-scroll-bar.ts (1)

1-248: LGTM!

The code changes are approved. The changes are purely cosmetic, focused on removing semicolons and adjusting control flow without altering the logic or functionality.

Tools
Biome

[error] 127-128: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/link/modules/tooltip.ts (1)

Line range hint 1-319: LGTM!

The code changes are approved. The changes are purely cosmetic, focused on removing semicolons and adjusting control flow without altering the logic or functionality.

Tools
Biome

[error] 80-80: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 93-93: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 175-175: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/table/utils/node-matchers.ts (14)

12-14: LGTM!

The change to remove the inline style attribute when it contains 'pt' is a good fix to avoid issues caused by height averaging when inserting rows.


23-25: LGTM!

Assigning a new cell ID when it is undefined ensures that each cell has a unique identifier, even when inserting new rows or columns.


29-35: LGTM!

Inserting a new line with the appropriate table cell attributes when the delta is empty prevents unexpected removal of empty table cells copied from other sources.


64-66: LGTM!

Storing the background color attribute in the 'table-cell-line' attribute when it exists ensures that the background color is correctly applied to the table cell.


82-95: LGTM!

The changes to handle edge cases when the delta contains a single operation with only newline characters and 'table-cell-line' attributes ensure that the table cell height is not unnecessarily increased.


113-118: LGTM!

Inserting a new line with the appropriate table cell attributes when the delta is empty prevents unexpected removal of empty table header cells copied from other sources.


125-127: LGTM!

Adding a newline character to the end of the lines array when it doesn't exist ensures that the table header cells are correctly formatted.


194-196: LGTM!

Returning an empty delta when the table is empty or contains only an empty row prevents invalid table structures from being displayed.


212-227: LGTM!

The changes to fill the missing columns based on the maximum number of cells in a row ensure that the table structure remains valid and consistent.


240-246: LGTM!

Filling empty rows with the appropriate number of cells ensures that the table structure remains valid and consistent.


257-264: LGTM!

Inserting newline characters before and after the table when necessary prevents adjacent tables from sticking together and ensures that pressing the Enter key functions correctly.


274-277: LGTM!

Handling empty <tr> tags by inserting a newline character with the 'notFilled' attribute ensures that empty rows are not ignored.


325-329: LGTM!

Appending a newline character to the delta when the next sibling is not an inline blot or is a <p> tag with non-text content ensures that the table cell content is correctly formatted.

Tools
Biome

[error] 325-326: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


53-54: Avoid using the delete operator.

The delete operator can impact performance.

Consider using an undefined assignment instead:

-delete op.attributes.table
+op.attributes.table = undefined

Likely invalid or redundant comment.

Tools
Biome

[error] 53-54: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)

packages/fluent-editor/src/table/modules/table-selection.ts (2)

Line range hint 1-388: LGTM!

The code changes are approved. The removal of semicolons and formatting adjustments enhance code readability without altering the functionality.

Tools
Biome

[error] 31-31: The constructor should not return a value.

The constructor is here:

Returning a value from a constructor is ignored.

(lint/correctness/noConstructorReturn)


[error] 350-350: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


31-31: Skipping hint: Constructor return is used for early exit.

The hint from Biome about avoiding constructor return can be skipped in this case. The return statement is used for an early exit from the constructor, which is an acceptable practice. The linter warning is also suppressed using an eslint-disable comment.

Tools
Biome

[error] 31-31: The constructor should not return a value.

The constructor is here:

Returning a value from a constructor is ignored.

(lint/correctness/noConstructorReturn)

packages/fluent-editor/src/mention/Mention.ts (2)

Line range hint 1-410: LGTM!

The code changes are approved. The removal of semicolons and formatting adjustments enhance code readability without altering the functionality.

Tools
Biome

[error] 202-203: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 211-211: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 214-214: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


202-214: Skipping hints: Assignments in expressions are used intentionally.

The hints from Biome about avoiding assignments in expressions can be skipped in this case. The assignments are used intentionally to accumulate the newText variable in a reduce function. The linter warnings are also suppressed using eslint-disable comments.

Tools
Biome

[error] 202-203: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 211-211: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 214-214: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

packages/fluent-editor/src/table/modules/table-column-tool.ts (3)

Line range hint 1-494: LGTM!

The code changes are approved. The removal of semicolons and formatting adjustments enhance code readability without altering the functionality.

Tools
Biome

[error] 18-18: The constructor should not return a value.

The constructor is here:

Returning a value from a constructor is ignored.

(lint/correctness/noConstructorReturn)


[error] 163-163: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 301-304: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


18-18: Skipping hint: Constructor return is used for early exit.

The hint from Biome about avoiding constructor return can be skipped in this case. The return statement is used for an early exit from the constructor, which is an acceptable practice. The linter warning is also suppressed using an eslint-disable comment.

Tools
Biome

[error] 18-18: The constructor should not return a value.

The constructor is here:

Returning a value from a constructor is ignored.

(lint/correctness/noConstructorReturn)


301-304: Skipping hints: Existence checks are necessary before adding event listeners.

The hints from Biome about using optional chaining at lines 301-304 and 452-453 can be skipped in this case. The code is intentionally checking for the existence of this.quill.root.parentNode before adding event listeners. These checks are necessary to ensure that the event listeners are added only when the parent node exists. Using optional chaining here would change the behavior of the code and may lead to errors if the parent node does not exist.

Also applies to: 452-453

Tools
Biome

[error] 301-304: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/table/modules/table-operation-menu.ts (4)

305-306: The code segment is already using optional chaining to safely access the nested property options.color.text. No changes needed.

Tools
Biome

[error] 305-306: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


309-310: The code segment is already using optional chaining to safely access the nested property options.color.colors. No changes needed.

Tools
Biome

[error] 309-310: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


365-365: Using the delete operator to remove a property from an object is a valid JavaScript operation. The performance impact is negligible in this context. No changes needed.

Tools
Biome

[error] 365-365: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


Line range hint 1-588: LGTM!

The code changes in the TableOperationMenu class are approved. The class is well-structured, modular, and follows good coding practices. No major issues or code smells were identified.

Tools
Biome

[error] 305-306: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 309-310: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/table/better-table.ts (3)

199-200: The code segment is already using optional chaining to safely access the tables property. No changes needed.

Tools
Biome

[error] 199-200: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


534-536: The code segment is already using optional chaining to safely access the lineFormats[name] property. No changes needed.

Tools
Biome

[error] 534-536: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


Line range hint 1-554: LGTM!

The code changes in the BetterTable class are approved. The class extends the Quill module to provide enhanced table functionality and is well-structured and modular. No major issues or code smells were identified.

Tools
Biome

[error] 199-200: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/table/formats/table.ts (9)

33-33: Using super.create in a static method is valid and refers to the parent class's static method. No changes needed.

Tools
Biome

[error] 33-33: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


38-38: Using the delete operator to remove a property from an object is a valid JavaScript operation. The performance impact is negligible in this context. No changes needed.

Tools
Biome

[error] 38-38: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


77-77: The code segment is already using optional chaining to safely access the child.domNode.style property. No changes needed.

Tools
Biome

[error] 77-77: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


172-172: Using super.create in a static method is valid and refers to the parent class's static method. No changes needed.

Tools
Biome

[error] 172-172: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


302-312: Verify the fallthrough behavior in the switch statement.

The case block at line range 302-312 does not have a break or return statement at the end, which will cause the execution to fall through to the next case block. Please verify if this fallthrough behavior is intentional or if a break statement should be added to prevent unintended execution.

Tools
Biome

[error] 302-312: This case is falling through to the next case.

Add a break or return statement to the end of this case to prevent fallthrough.

(lint/suspicious/noFallthroughSwitchClause)


323-324: The code segment is already using optional chaining to safely access the hasBg.getAttribute('data-parent-bg') property. No changes needed.

Tools
Biome

[error] 323-324: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


388-389: The code segment is already using optional chaining to safely access the this.parent property. No changes needed.

Tools
Biome

[error] 388-389: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


412-412: Using super.checkMerge in a non-static method is valid and refers to the parent class's instance method. No changes needed.

Tools
Biome

[error] 412-412: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


478-479: The code segment is already using optional chaining to safely access the this.parent property. No changes needed.

Tools
Biome

[error] 478-479: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/global-link/formats/wiki-link.ts (2)

8-10: LGTM!

The removal of semicolons from the static properties, constructor, and remove method is a valid stylistic change that doesn't affect the functionality.

Also applies to: 31-32, 36-37, 41-43


15-15: Ignore the static analysis warning.

The usage of super in the static create method is a common and valid pattern in JavaScript to call the parent class's static method. The static analysis warning can be ignored as a false positive in this context.

Tools
Biome

[error] 15-15: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

packages/fluent-editor/src/link/formats/link.ts (2)

7-11: LGTM!

The removal of semicolons from the static properties is a valid stylistic change that doesn't affect the functionality.

Also applies to: 39-43


16-16: Ignore the static analysis warnings.

The usage of this in the static create and sanitize methods is referring to the class itself and not an instance. While it's not a recommended pattern, it's not causing any functional issues in this context. The static analysis warnings can be ignored as false positives.

Also applies to: 27-27

Tools
Biome

[error] 16-16: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

packages/fluent-editor/src/custom-image/actions/CustomResizeAction.ts (1)

20-30: LGTM!

The removal of semicolons from various methods is a valid stylistic change that doesn't affect the functionality.

Also applies to: 34-40, 44-48, 52-55, 58-58, 61-62, 66-67, 70-70, 73-73, 77-80, 85-85, 89-89, 91-91, 98-98, 101-102, 105-105, 108-108, 110-110, 112-113, 115-117, 119-120, 123-125, 127-128, 131-132, 134-135, 140-140, 143-143, 145-145, 148-148, 151-152, 154-154, 157-157, 161-161, 164-164, 166-166, 169-170, 173-173, 176-176, 179-179, 182-182, 186-189, 192-192, 194-195, 197-197, 201-203

packages/fluent-editor/src/table/formats/list.ts (4)

1-2: LGTM!

The code changes are approved.


4-5: LGTM!

The code changes are approved.


Line range hint 9-29: LGTM!

The code changes in the ListContainer class are approved. The changes are primarily stylistic, focusing on code readability and consistency without altering the functionality.


35-36: LGTM!

The code changes are approved.

@zzxming zzxming marked this pull request as draft September 1, 2024 07:44
@zzxming zzxming force-pushed the feat-eslint-stylistic branch from 2189523 to 2e6a07a Compare September 1, 2024 11:12
@zzxming zzxming marked this pull request as ready for review September 1, 2024 11:14
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

Outside diff range, codebase verification and nitpick comments (7)
packages/fluent-editor/src/global-link/index.ts (1)

26-45: LGTM! Consider using optional chaining in the future.

The code changes are approved. The removal of semicolons is a stylistic change that does not affect the functionality.

Consider using optional chaining for the following lines in the future to improve code readability and safety:

-const globalLinkBtn = toolbar.container && toolbar.container.querySelector('.ql-global-link')
+const globalLinkBtn = toolbar.container?.querySelector('.ql-global-link')

-if (!this.wrap.contains(evt.target) && !(globalLinkBtn && globalLinkBtn.contains(evt.target))) {
+if (!this.wrap.contains(evt.target)

<details>
<summary>Tools</summary>

<details>
<summary>Biome</summary><blockquote>

[error] 31-31: Change to an optional chain.

Unsafe fix: Change to an optional chain.


(lint/complexity/useOptionalChain)

---

[error] 35-35: Change to an optional chain.

Unsafe fix: Change to an optional chain.


(lint/complexity/useOptionalChain)

</blockquote></details>

</details>

</blockquote></details>
<details>
<summary>packages/fluent-editor/src/table/utils/node-matchers.ts (1)</summary><blockquote>

`299-300`: **Partially addressed the performance hint, but complete the fix.**

The changes partially address the performance hint from the static analysis tool by removing one usage of the `delete` operator. This is a good optimization. 

However, the `delete` operator is still used in another code segment:

```typescript
else if (typeof op.attributes.list === 'object' && !op.attributes.list['value']) {
  delete op.attributes.list['value']
}

To complete the fix, replace the remaining delete usage with an undefined assignment:

else if (typeof op.attributes.list === 'object' && !op.attributes.list['value']) {
- delete op.attributes.list['value']
+ op.attributes.list['value'] = undefined
}

Also applies to: 302-302

packages/fluent-editor/src/table/modules/table-selection.ts (1)

350-350: Avoid using the delete operator.

The delete operator can impact performance.

Consider using an undefined assignment instead:

- delete this.editTd
+ this.editTd = undefined

This achieves the same result without using the delete operator.

Tools
Biome

[error] 350-350: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)

packages/fluent-editor/src/mention/Mention.ts (1)

202-203: Avoid assignments within expressions.

There are multiple instances where assignments are used within expressions:

  1. Line 202-203:
return (newText += op.insert)
  1. Line 211:
return (newText += ' ')
  1. Line 214:
return (newText += ' ')

Assignments within expressions can be confusing and make the code harder to understand.

Separate the assignments from the expressions for better clarity:

- return (newText += op.insert)
+ newText += op.insert
+ return newText
- return (newText += ' ')
+ newText += ' '
+ return newText

Apply this change to all the identified instances.

Also applies to: 211-211, 214-214

Tools
Biome

[error] 202-203: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

packages/fluent-editor/src/table/modules/table-operation-menu.ts (1)

Line range hint 347-395: Avoid the delete operator.

The delete operator can impact performance. Consider using an undefined assignment instead:

- delete cssContent.top
+ cssContent.top = undefined
Tools
Biome

[error] 365-365: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)

packages/fluent-editor/src/table/formats/table.ts (2)

68-84: LGTM! Consider optional chaining in a future refactoring.

The code changes are approved:

  • Removing semicolons and adjusting line breaks are valid stylistic changes that enhance code consistency without impacting functionality.

Regarding the static analysis hint for line 77:

  • The current null check on child.domNode.style is valid and works in all browsers.
  • Using an optional chain (child.domNode.style?.backgroundColor) could simplify the code. However, it would require transpiling for older browser support.
  • Since the scope of this PR is stylistic changes, introducing optional chaining might be better suited for a future refactoring PR.
Tools
Biome

[error] 77-77: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


Line range hint 123-1270: LGTM with a few nitpicks! Please address the switch fallthrough.

The code changes are largely approved:

  • Removing semicolons and adjusting line breaks are valid stylistic changes that enhance code consistency without impacting functionality.

Regarding the static analysis hints:

  • The super usage in static methods is valid and appropriate. Those hints can be ignored.
  • The delete operator hint can be ignored in this PR. While delete can impact performance in hot code paths, a single usage in a cold path like this is unlikely to have any noticeable impact. Suggesting an alternative might be better suited for a future refactoring PR.
  • The optional chaining suggestions have the same trade-offs as previously discussed. Consider them in a future refactoring PR.

However, please address this valid hint:

  • The potential switch fallthrough is a concern. Each case should have a break or return to prevent unintended fallthrough.

Add a break statement at the end of each case:

case name === 'size': {
  const start = quill.getIndex(this.children.head)
  const total = quill.getIndex(this.children.tail) + this.children.tail.length()
  const length = total - start > 0 ? total - start : 0
  quill.setSelection(start, length, Quill.sources.USER)
  quill.format(name, value, Quill.sources.USER)
  // 设置选区后需清除选区,否则会固定处理选区内容
  quill.setSelection(start)
+ break
}
case name === 'cell-bg': {
  this.toggleAttribute('data-cell-bg', value)
  this.toggleAttribute('data-parent-bg', value)
  this.formatChildren(name, value)
  this.setCellBg(value)
+ break  
}

Lastly, this non-critical hint can be addressed in a future refactoring PR:

  • The TableCol class contains only static members. Consider converting it to a simple object with functions in a future refactoring PR to improve readability and performance.
Tools
Biome

[error] 302-312: This case is falling through to the next case.

Add a break or return statement to the end of this case to prevent fallthrough.

(lint/suspicious/noFallthroughSwitchClause)


[error] 323-324: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 388-389: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 412-412: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 478-479: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 482-489: Avoid classes that contain only static members.

Prefer using simple functions instead of classes with only static members.

(lint/complexity/noStaticOnlyClass)


[error] 497-497: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 639-640: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 654-654: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 670-671: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 960-961: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2189523 and 2e6a07a.

Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing (95)
  • .eslintignore (1 hunks)
  • .eslintrc.js (1 hunks)
  • .vscode/settings.json (1 hunks)
  • jest.config.js (1 hunks)
  • package.json (1 hunks)
  • packages/docs/fluent-editor/.vitepress/theme/index.ts (1 hunks)
  • packages/docs/fluent-editor/demos/basic-usage.spec.ts (2 hunks)
  • packages/docs/fluent-editor/demos/basic-usage.vue (1 hunks)
  • packages/docs/fluent-editor/demos/code-block-highlight.vue (2 hunks)
  • packages/docs/fluent-editor/demos/custom-toolbar.vue (2 hunks)
  • packages/docs/fluent-editor/demos/emoji.vue (2 hunks)
  • packages/docs/fluent-editor/demos/file-upload.vue (2 hunks)
  • packages/docs/fluent-editor/demos/image-upload.vue (2 hunks)
  • packages/docs/fluent-editor/demos/mention-custom-list.vue (3 hunks)
  • packages/docs/fluent-editor/demos/mention.vue (2 hunks)
  • packages/docs/fluent-editor/demos/table.vue (3 hunks)
  • packages/docs/package.json (1 hunks)
  • packages/docs/playwright.config.ts (2 hunks)
  • packages/fluent-editor/scripts/pre-release.js (1 hunks)
  • packages/fluent-editor/src/config.ts (4 hunks)
  • packages/fluent-editor/src/config/editor.utils.ts (7 hunks)
  • packages/fluent-editor/src/config/i18n/en-us.ts (2 hunks)
  • packages/fluent-editor/src/config/i18n/zh-cn.ts (2 hunks)
  • packages/fluent-editor/src/config/types/additional-toolbar-item.interface.ts (1 hunks)
  • packages/fluent-editor/src/config/types/counter-option.interface.ts (1 hunks)
  • packages/fluent-editor/src/config/types/editor-modules.interface.ts (1 hunks)
  • packages/fluent-editor/src/config/types/file-operation.interface.ts (1 hunks)
  • packages/fluent-editor/src/config/types/image-upload.interface.ts (1 hunks)
  • packages/fluent-editor/src/config/types/paste-change.interface.ts (1 hunks)
  • packages/fluent-editor/src/config/types/type.ts (1 hunks)
  • packages/fluent-editor/src/counter/index.ts (1 hunks)
  • packages/fluent-editor/src/custom-clipboard.ts (21 hunks)
  • packages/fluent-editor/src/custom-image/BlotFormatter.ts (2 hunks)
  • packages/fluent-editor/src/custom-image/Options.ts (2 hunks)
  • packages/fluent-editor/src/custom-image/actions/Action.ts (1 hunks)
  • packages/fluent-editor/src/custom-image/actions/CustomResizeAction.ts (1 hunks)
  • packages/fluent-editor/src/custom-image/actions/DeleteAction.ts (1 hunks)
  • packages/fluent-editor/src/custom-image/image.ts (1 hunks)
  • packages/fluent-editor/src/custom-image/specs/BlotSpec.ts (1 hunks)
  • packages/fluent-editor/src/custom-image/specs/CustomImageSpec.ts (2 hunks)
  • packages/fluent-editor/src/custom-image/specs/ImageSpec.ts (1 hunks)
  • packages/fluent-editor/src/custom-uploader.ts (6 hunks)
  • packages/fluent-editor/src/emoji/emoji-list.ts (1 hunks)
  • packages/fluent-editor/src/emoji/emoji-list/index.ts (1 hunks)
  • packages/fluent-editor/src/emoji/emoji-list/people.ts (2 hunks)
  • packages/fluent-editor/src/emoji/emoji-map.ts (1 hunks)
  • packages/fluent-editor/src/emoji/formats/emoji-blot.ts (1 hunks)
  • packages/fluent-editor/src/emoji/index.ts (1 hunks)
  • packages/fluent-editor/src/emoji/modules/emoji.ts (3 hunks)
  • packages/fluent-editor/src/emoji/modules/toolbar-emoji.ts (1 hunks)
  • packages/fluent-editor/src/emoji/utils.ts (1 hunks)
  • packages/fluent-editor/src/file/formats/file.ts (1 hunks)
  • packages/fluent-editor/src/file/index.ts (1 hunks)
  • packages/fluent-editor/src/file/modules/file-bar.ts (4 hunks)
  • packages/fluent-editor/src/fluent-editor.ts (3 hunks)
  • packages/fluent-editor/src/global-link/constants.ts (1 hunks)
  • packages/fluent-editor/src/global-link/formats/customer-widget-link.ts (1 hunks)
  • packages/fluent-editor/src/global-link/formats/doc-link.ts (1 hunks)
  • packages/fluent-editor/src/global-link/formats/wiki-link.ts (1 hunks)
  • packages/fluent-editor/src/global-link/formats/work-item-link.ts (1 hunks)
  • packages/fluent-editor/src/global-link/global-link-panel.ts (1 hunks)
  • packages/fluent-editor/src/global-link/index.ts (1 hunks)
  • packages/fluent-editor/src/global-link/utils/createTable.ts (1 hunks)
  • packages/fluent-editor/src/index.ts (1 hunks)
  • packages/fluent-editor/src/lineheight.ts (1 hunks)
  • packages/fluent-editor/src/link/formats/link.ts (1 hunks)
  • packages/fluent-editor/src/link/index.ts (1 hunks)
  • packages/fluent-editor/src/link/modules/tooltip.ts (3 hunks)
  • packages/fluent-editor/src/mention/Mention.ts (4 hunks)
  • packages/fluent-editor/src/mention/MentionLink.ts (1 hunks)
  • packages/fluent-editor/src/mention/constants.ts (1 hunks)
  • packages/fluent-editor/src/quick-menu/index.ts (1 hunks)
  • packages/fluent-editor/src/screenshot/index.ts (3 hunks)
  • packages/fluent-editor/src/soft-break/index.ts (1 hunks)
  • packages/fluent-editor/src/strike/index.ts (1 hunks)
  • packages/fluent-editor/src/syntax/index.ts (2 hunks)
  • packages/fluent-editor/src/table/better-table.ts (9 hunks)
  • packages/fluent-editor/src/table/formats/header.ts (2 hunks)
  • packages/fluent-editor/src/table/formats/list.ts (2 hunks)
  • packages/fluent-editor/src/table/formats/table.ts (6 hunks)
  • packages/fluent-editor/src/table/modules/table-column-tool.ts (3 hunks)
  • packages/fluent-editor/src/table/modules/table-operation-menu.ts (10 hunks)
  • packages/fluent-editor/src/table/modules/table-scroll-bar.ts (1 hunks)
  • packages/fluent-editor/src/table/modules/table-selection.ts (1 hunks)
  • packages/fluent-editor/src/table/table-config.ts (1 hunks)
  • packages/fluent-editor/src/table/utils/index.ts (4 hunks)
  • packages/fluent-editor/src/table/utils/node-matchers.ts (2 hunks)
  • packages/fluent-editor/src/toolbar/better-picker.ts (2 hunks)
  • packages/fluent-editor/src/toolbar/index.ts (1 hunks)
  • packages/fluent-editor/src/utils/debounce.ts (1 hunks)
  • packages/fluent-editor/src/utils/method.ts (2 hunks)
  • packages/fluent-editor/src/video/index.ts (1 hunks)
  • packages/fluent-editor/vite.config.ts (1 hunks)
  • pnpm-workspace.yaml (1 hunks)
  • verifyCommit.js (1 hunks)
Files skipped from review due to trivial changes (54)
  • .vscode/settings.json
  • packages/docs/fluent-editor/demos/basic-usage.vue
  • packages/docs/fluent-editor/demos/code-block-highlight.vue
  • packages/docs/fluent-editor/demos/custom-toolbar.vue
  • packages/docs/fluent-editor/demos/emoji.vue
  • packages/docs/fluent-editor/demos/file-upload.vue
  • packages/docs/fluent-editor/demos/image-upload.vue
  • packages/docs/fluent-editor/demos/mention-custom-list.vue
  • packages/docs/fluent-editor/demos/mention.vue
  • packages/docs/fluent-editor/demos/table.vue
  • packages/docs/playwright.config.ts
  • packages/fluent-editor/scripts/pre-release.js
  • packages/fluent-editor/src/config.ts
  • packages/fluent-editor/src/config/editor.utils.ts
  • packages/fluent-editor/src/config/types/additional-toolbar-item.interface.ts
  • packages/fluent-editor/src/config/types/counter-option.interface.ts
  • packages/fluent-editor/src/config/types/file-operation.interface.ts
  • packages/fluent-editor/src/config/types/image-upload.interface.ts
  • packages/fluent-editor/src/config/types/paste-change.interface.ts
  • packages/fluent-editor/src/config/types/type.ts
  • packages/fluent-editor/src/counter/index.ts
  • packages/fluent-editor/src/custom-clipboard.ts
  • packages/fluent-editor/src/custom-image/BlotFormatter.ts
  • packages/fluent-editor/src/custom-image/Options.ts
  • packages/fluent-editor/src/custom-image/actions/Action.ts
  • packages/fluent-editor/src/custom-image/actions/DeleteAction.ts
  • packages/fluent-editor/src/custom-image/specs/BlotSpec.ts
  • packages/fluent-editor/src/custom-image/specs/CustomImageSpec.ts
  • packages/fluent-editor/src/custom-image/specs/ImageSpec.ts
  • packages/fluent-editor/src/emoji/emoji-list.ts
  • packages/fluent-editor/src/emoji/emoji-list/index.ts
  • packages/fluent-editor/src/emoji/emoji-list/people.ts
  • packages/fluent-editor/src/emoji/emoji-map.ts
  • packages/fluent-editor/src/emoji/index.ts
  • packages/fluent-editor/src/emoji/utils.ts
  • packages/fluent-editor/src/file/index.ts
  • packages/fluent-editor/src/file/modules/file-bar.ts
  • packages/fluent-editor/src/fluent-editor.ts
  • packages/fluent-editor/src/global-link/constants.ts
  • packages/fluent-editor/src/global-link/global-link-panel.ts
  • packages/fluent-editor/src/global-link/utils/createTable.ts
  • packages/fluent-editor/src/index.ts
  • packages/fluent-editor/src/lineheight.ts
  • packages/fluent-editor/src/mention/constants.ts
  • packages/fluent-editor/src/quick-menu/index.ts
  • packages/fluent-editor/src/syntax/index.ts
  • packages/fluent-editor/src/table/table-config.ts
  • packages/fluent-editor/src/table/utils/index.ts
  • packages/fluent-editor/src/toolbar/better-picker.ts
  • packages/fluent-editor/src/toolbar/index.ts
  • packages/fluent-editor/src/utils/debounce.ts
  • packages/fluent-editor/src/utils/method.ts
  • packages/fluent-editor/vite.config.ts
  • verifyCommit.js
Files skipped from review as they are similar to previous changes (10)
  • .eslintignore
  • .eslintrc.js
  • jest.config.js
  • package.json
  • packages/docs/fluent-editor/demos/basic-usage.spec.ts
  • packages/fluent-editor/src/config/i18n/en-us.ts
  • packages/fluent-editor/src/config/i18n/zh-cn.ts
  • packages/fluent-editor/src/config/types/editor-modules.interface.ts
  • packages/fluent-editor/src/emoji/modules/emoji.ts
  • packages/fluent-editor/src/emoji/modules/toolbar-emoji.ts
Additional context used
yamllint
pnpm-workspace.yaml

[error] 2-2: no new line character at the end of file

(new-line-at-end-of-file)

Biome
packages/fluent-editor/src/strike/index.ts

[error] 4-12: Avoid classes that contain only static members.

Prefer using simple functions instead of classes with only static members.

(lint/complexity/noStaticOnlyClass)

packages/fluent-editor/src/soft-break/index.ts

[error] 15-15: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

packages/fluent-editor/src/global-link/formats/customer-widget-link.ts

[error] 12-12: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 27-29: This constructor is unnecessary.

Unsafe fix: Remove the unnecessary constructor.

(lint/complexity/noUselessConstructor)

packages/fluent-editor/src/link/index.ts

[error] 14-16: This constructor is unnecessary.

Unsafe fix: Remove the unnecessary constructor.

(lint/complexity/noUselessConstructor)

packages/fluent-editor/src/global-link/formats/wiki-link.ts

[error] 15-15: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

packages/fluent-editor/src/link/formats/link.ts

[error] 15-15: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 16-16: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 27-27: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 27-27: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

packages/fluent-editor/src/global-link/formats/work-item-link.ts

[error] 15-15: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

packages/fluent-editor/src/mention/MentionLink.ts

[error] 15-15: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 16-16: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/global-link/formats/doc-link.ts

[error] 15-15: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

packages/fluent-editor/src/emoji/formats/emoji-blot.ts

[error] 6-49: Avoid classes that contain only static members.

Prefer using simple functions instead of classes with only static members.

(lint/complexity/noStaticOnlyClass)


[error] 14-14: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 37-37: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 38-38: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

packages/fluent-editor/src/video/index.ts

[error] 18-18: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 18-18: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 22-22: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 29-29: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.

The declaration is defined in this switch clause:

Unsafe fix: Wrap the declaration in a block.

(lint/correctness/noSwitchDeclarations)

packages/fluent-editor/src/file/formats/file.ts

[error] 16-16: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 59-59: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

packages/fluent-editor/src/table/formats/header.ts

[error] 28-28: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 47-47: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

packages/fluent-editor/src/custom-image/image.ts

[error] 18-18: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 21-21: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 62-62: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

packages/fluent-editor/src/global-link/index.ts

[error] 31-31: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 35-35: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/screenshot/index.ts

[error] 31-31: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/custom-uploader.ts

[error] 104-104: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/custom-image/actions/CustomResizeAction.ts

[error] 151-151: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

packages/fluent-editor/src/table/formats/list.ts

[error] 59-59: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 133-133: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 160-163: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 163-166: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 212-212: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)

packages/fluent-editor/src/table/modules/table-scroll-bar.ts

[error] 127-128: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/link/modules/tooltip.ts

[error] 80-80: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 93-93: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 175-175: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/table/utils/node-matchers.ts

[error] 53-54: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 314-314: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 325-326: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/table/modules/table-selection.ts

[error] 31-31: The constructor should not return a value.

The constructor is here:

Returning a value from a constructor is ignored.

(lint/correctness/noConstructorReturn)


[error] 350-350: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)

packages/fluent-editor/src/mention/Mention.ts

[error] 202-203: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 211-211: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 214-214: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

packages/fluent-editor/src/table/modules/table-column-tool.ts

[error] 18-18: The constructor should not return a value.

The constructor is here:

Returning a value from a constructor is ignored.

(lint/correctness/noConstructorReturn)


[error] 163-163: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 301-304: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 452-453: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/table/modules/table-operation-menu.ts

[error] 305-306: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 309-310: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 365-365: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)

packages/fluent-editor/src/table/better-table.ts

[error] 199-200: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 534-536: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/table/formats/table.ts

[error] 33-33: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 38-38: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 77-77: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 172-172: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 302-312: This case is falling through to the next case.

Add a break or return statement to the end of this case to prevent fallthrough.

(lint/suspicious/noFallthroughSwitchClause)


[error] 323-324: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 388-389: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 412-412: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 478-479: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 482-489: Avoid classes that contain only static members.

Prefer using simple functions instead of classes with only static members.

(lint/complexity/noStaticOnlyClass)


[error] 497-497: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 639-640: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 654-654: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 670-671: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 960-961: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

Additional comments not posted (104)
pnpm-workspace.yaml (1)

2-2: LGTM!

The changes to simplify the package directory specification and remove the docs directory from the workspace configuration are approved.

Tools
yamllint

[error] 2-2: no new line character at the end of file

(new-line-at-end-of-file)

packages/fluent-editor/src/strike/index.ts (2)

6-8: Skipped generating a similar comment. The previous review comment is still valid.

See the existing comment on lines 6-8 for more details.

Also applies to: 11-13


4-12: Convert the StrikeBlot class to a simple object.

Biome reports an error indicating that the StrikeBlot class contains only static members and suggests using simple functions instead.

Apply this diff to convert the class to a simple object:

-// @dynamic
-class StrikeBlot extends Inline {
-  static blotName: string
-  static className: string
-  static tagName: string
-  // 此处删除了formats方法,当前tag非span,则并不需要进行特殊处理去重写formats方法
-}
-StrikeBlot.blotName = 'strike'
-StrikeBlot.tagName = 'u'
-StrikeBlot.className = 'ql-custom-strike'
+const StrikeBlot = {
+  blotName: 'strike',
+  className: 'ql-custom-strike',
+  tagName: 'u',
+}

Likely invalid or redundant comment.

Tools
Biome

[error] 4-12: Avoid classes that contain only static members.

Prefer using simple functions instead of classes with only static members.

(lint/complexity/noStaticOnlyClass)

packages/docs/fluent-editor/.vitepress/theme/index.ts (2)

1-1: LGTM!

The change to import the Theme as a type from 'vitepress' is approved. It improves the type safety of the code.


8-15: LGTM!

The changes to introduce the define function and restructure the default export are approved. They enhance the modularity and maintainability of the theme definition.

packages/fluent-editor/src/soft-break/index.ts (1)

6-8: Semicolon removal changes are approved.

The removal of semicolons from static property declarations, method implementations, and assignments is a valid stylistic change that doesn't affect the functionality.

Skipping the comment on the create method to avoid duplication, as the existing comment is still applicable.

Also applies to: 12-12, 15-16, 22-22, 27-27, 30-32

packages/docs/package.json (1)

23-24: The changes to package.json are approved.

The removal of @types/node from devDependencies and the addition of vue to dependencies are valid changes.

packages/fluent-editor/src/global-link/formats/customer-widget-link.ts (1)

7-9: Semicolon removal changes are approved.

The removal of semicolons from static property declarations, method implementations, and assignments is a valid stylistic change that doesn't affect the functionality.

Skipping the comments on the create method and constructor to avoid duplication, as the existing comments are still applicable.

Also applies to: 12-16, 24-24, 28-28, 32-34

packages/fluent-editor/src/link/index.ts (1)

1-1: Formatting changes look good!

The code changes are primarily formatting related, involving removal of semicolons. The functionality remains unchanged.

Also applies to: 2-2, 3-3, 4-4, 5-5, 11-11, 13-13, 19-19, 20-20, 21-21, 22-22, 23-23, 28-28, 30-30, 32-32, 34-34

packages/fluent-editor/src/global-link/formats/wiki-link.ts (1)

1-1: Formatting changes look good!

The code changes are primarily formatting related, involving removal of semicolons. The functionality remains unchanged.

Also applies to: 2-2, 4-4, 8-8, 9-9, 10-10, 11-11, 12-12, 15-15, 16-16, 17-17, 18-18, 19-19, 20-20, 27-27, 31-31, 32-32, 36-36, 37-37, 41-41, 42-42, 43-43, 45-45

packages/fluent-editor/src/link/formats/link.ts (1)

1-1: Formatting changes look good!

The code changes are primarily formatting related, involving removal of semicolons. The functionality remains unchanged.

Also applies to: 2-2, 3-3, 7-7, 8-8, 9-9, 10-10, 11-11, 12-12, 13-13, 15-15, 16-16, 17-17, 18-18, 19-19, 23-23, 27-27, 32-32, 33-33, 34-34, 35-35, 39-39, 40-40, 41-41, 42-42, 43-43

packages/fluent-editor/src/global-link/formats/work-item-link.ts (1)

1-46: LGTM!

The code changes are approved. The removal of semicolons is a stylistic change and doesn't affect the functionality.

Regarding the static analysis warning about using super in a static context, it can be ignored as a false positive. The super.create call is used correctly within the static create method to invoke the parent class's create method.

Tools
Biome

[error] 15-15: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

packages/fluent-editor/src/mention/MentionLink.ts (1)

1-51: LGTM!

The code changes are approved. The removal of semicolons is a stylistic change and doesn't affect the functionality.

Regarding the static analysis warnings:

  1. The warning about using super in a static context can be ignored as a false positive. The super.create call is used correctly within the static create method to invoke the parent class's create method.

  2. The suggestion to use an optional chain at line 16 is not necessary as the current code is correct and readable.

Tools
Biome

[error] 15-15: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 16-16: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/global-link/formats/doc-link.ts (1)

1-55: LGTM!

The code changes are approved. The removal of semicolons is a stylistic change and doesn't affect the functionality.

Regarding the static analysis warning about using super in a static context, it can be ignored as a false positive. The super.create call is used correctly within the static create method to invoke the parent class's create method.

Tools
Biome

[error] 15-15: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)

packages/fluent-editor/src/table/formats/header.ts (6)

1-3: LGTM!

The code changes are approved.


9-22: LGTM!

The code changes are approved. The removal of semicolons is a stylistic change that does not affect the functionality.


25-42: LGTM!

The code changes are approved. The removal of semicolons and usage of arrow functions are stylistic changes that do not affect the functionality. The usage of super in the static create method is valid.

Tools
Biome

[error] 28-28: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


46-54: LGTM!

The code changes are approved. The removal of semicolons and usage of arrow functions are stylistic changes that do not affect the functionality. The usage of this in the static formats method is valid.

Tools
Biome

[error] 47-47: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


Line range hint 60-89: LGTM!

The code changes are approved. The removal of semicolons and minor structural adjustments are stylistic changes that do not affect the functionality.


94-122: LGTM!

The code changes are approved. The removal of semicolons is a stylistic change that does not affect the functionality.

packages/fluent-editor/src/custom-image/image.ts (6)

1-7: LGTM!

The code changes are approved.


10-16: LGTM!

The code changes are approved. The removal of semicolons is a stylistic change that does not affect the functionality.


18-30: LGTM!

The code changes are approved. The removal of semicolons is a stylistic change that does not affect the functionality. The usage of this in the static create method to call the sanitize method is valid.

Tools
Biome

[error] 18-18: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 21-21: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


56-65: LGTM!

The code changes are approved. The removal of semicolons is a stylistic change that does not affect the functionality. The usage of this in the static value method to call the sanitize method is valid.

Tools
Biome

[error] 62-62: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


69-80: LGTM!

The code changes are approved. The removal of semicolons is a stylistic change that does not affect the functionality.


83-95: LGTM!

The code changes are approved. The removal of semicolons is a stylistic change that does not affect the functionality.

packages/fluent-editor/src/global-link/index.ts (3)

1-11: LGTM!

The code changes are approved.


13-16: LGTM!

The code changes are approved. The removal of semicolons is a stylistic change that does not affect the functionality.


19-22: LGTM!

The code changes are approved. The removal of semicolons is a stylistic change that does not affect the functionality.

packages/fluent-editor/src/screenshot/index.ts (6)

23-25: LGTM!

The code changes are approved.


29-44: LGTM!

The code changes are approved.

Tools
Biome

[error] 31-31: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


56-59: LGTM!

The code changes are approved.


61-89: LGTM!

The code changes are approved.


93-98: LGTM!

The code changes are approved.


Line range hint 101-118: LGTM!

The code changes are approved.

packages/fluent-editor/src/custom-uploader.ts (6)

Line range hint 27-57: LGTM!

The code changes are approved.


Line range hint 60-87: LGTM!

The code changes are approved.


Line range hint 90-98: LGTM!

The code changes are approved.


101-114: LGTM!

The code changes are approved.

Tools
Biome

[error] 104-104: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


Line range hint 117-162: LGTM!

The code changes are approved.


Line range hint 172-181: LGTM!

The code changes are approved.

packages/fluent-editor/src/custom-image/actions/CustomResizeAction.ts (10)

20-30: LGTM!

The code changes are approved.


34-40: LGTM!

The code changes are approved.


44-48: LGTM!

The code changes are approved.


52-62: LGTM!

The code changes are approved.


66-80: LGTM!

The code changes are approved.


83-94: LGTM!

The code changes are approved.


97-136: LGTM!

The code changes are approved.


139-157: Skipping the review.

The code changes are purely stylistic and do not require a review.

Tools
Biome

[error] 151-151: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


160-198: LGTM!

The code changes are approved.


201-204: LGTM!

The code changes are approved.

packages/fluent-editor/src/table/formats/list.ts (3)

18-28: LGTM!

The code changes are approved. The changes are purely stylistic, focusing on code readability and consistency without altering the functionality.


53-66: LGTM!

The code changes are approved. The changes are purely stylistic, focusing on code readability and consistency without altering the functionality.

Tools
Biome

[error] 59-59: Using super in a static context can be confusing.

super refers to a parent class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


154-203: LGTM! But consider the following suggestions:

The code changes in the ListItem.optimize function are approved. The changes are primarily stylistic, focusing on code readability and consistency without altering the functionality.

However, please consider the following suggestions based on the static analysis hints:

  1. Use optional chaining for the code segments at line 133, 160-163, and 163-166 to safely access nested properties and avoid potential errors.
-if (tableCellBlot && tableCellBlot.statics.blotName === 'table') {
+if (tableCellBlot?.statics.blotName === 'table') {

-this.domNode.childNodes.forEach((v, i) => {
-  if (i > 0) {
-    this.prev.domNode.appendChild(v)
-  }
-})
+this.domNode.childNodes.forEach((v, i) => {
+  if (i > 0) {
+    this.prev?.domNode.appendChild(v)
+  }
+})

-this.remove()
+this.remove?.()
  1. Use an undefined assignment instead of the delete operator at line 212 to avoid potential performance impact.
-delete formats['list']
+formats['list'] = undefined
Tools
Biome

[error] 160-163: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 163-166: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/table/modules/table-scroll-bar.ts (10)

28-49: LGTM!

The code changes are approved. The changes are purely stylistic, focusing on code readability and consistency without altering the functionality.


52-79: LGTM!

The code changes are approved. The changes are purely stylistic, focusing on code readability and consistency without altering the functionality.


81-87: LGTM!

The code changes are approved. The changes are purely stylistic, focusing on code readability and consistency without altering the functionality.


89-96: LGTM!

The code changes are approved. The changes are purely stylistic, focusing on code readability and consistency without altering the functionality.


98-119: LGTM!

The code changes are approved. The changes are purely stylistic, focusing on code readability and consistency without altering the functionality.


121-132: LGTM!

The code changes are approved. The changes are purely stylistic, focusing on code readability and consistency without altering the functionality.

The static analysis hint to use optional chaining at line 127-128 is not applicable in this context as the code is not accessing nested properties.

Tools
Biome

[error] 127-128: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


134-138: LGTM!

The code changes are approved. The changes are purely stylistic, focusing on code readability and consistency without altering the functionality.


140-146: LGTM!

The code changes are approved. The changes are purely stylistic, focusing on code readability and consistency without altering the functionality.


148-159: LGTM!

The code changes are approved. The changes are purely stylistic, focusing on code readability and consistency without altering the functionality.


161-169: LGTM!

The code changes are approved. The changes are purely stylistic, focusing on code readability and consistency without altering the functionality.

packages/fluent-editor/src/link/modules/tooltip.ts (2)

29-36: LGTM!

The code changes are approved. The changes are purely stylistic, focusing on code readability and consistency without altering the functionality.


42-46: LGTM!

The code changes are approved. The changes are purely stylistic, focusing on code readability and consistency without altering the functionality.

packages/fluent-editor/src/table/utils/node-matchers.ts (8)

13-13: LGTM!

The changes to matchTableCell improve the handling of table cells by:

  • Removing inline styles to avoid issues with cell height.
  • Assigning cell IDs correctly, even when initially undefined.
  • Handling empty cells to prevent unexpected removal.

The code changes are approved.

Also applies to: 24-24, 33-34


116-117: LGTM!

The changes to matchTableHeader improve the handling of table headers by:

  • Correctly handling empty header cells to prevent unexpected removal.
  • Refactoring the delta reduction logic for better readability.

The code changes are approved.

Also applies to: 144-145


195-195: LGTM!

The changes to matchTable enhance the robustness of table handling by:

  • Correctly handling empty tables to prevent invalid deltas.
  • Calculating the maximum number of columns based on cell spans.
  • Filling missing columns to ensure the table structure remains valid.

The code changes are approved.

Also applies to: 234-239, 244-245


275-275: LGTM!

The changes to matchTableRow fix the issue of empty table rows being ignored by inserting a special attribute. This ensures that empty rows are correctly processed.

The code changes are approved.


290-290: LGTM!

The changes to matchHeader enhance header handling by including the font size in the delta attributes. This preserves the header formatting.

The code changes are approved.


327-327: LGTM!

The changes to matchInline introduce additional logic to handle inline elements and their impact on the delta. The conditions for adding newline characters are well-defined and the implementation looks correct.

The code changes are approved.


337-337: LGTM!

The changes to matchWordShapeImage improve the safety of accessing the src attribute by using optional chaining. This prevents potential errors when the attribute is undefined.

The code changes are approved.


343-357: No changes made.

The matchMentionLink function remains unchanged. The existing logic for handling mention links and triggering the selection callback is preserved.

packages/fluent-editor/src/table/modules/table-selection.ts (1)

1-386: LGTM!

The changes in this file are primarily stylistic, focusing on removing semicolons for a more consistent code style. The core functionality and logic of the TableSelection class remain unchanged.

The stylistic changes enhance the readability of the code without introducing any behavioral differences.

The code changes are approved.

Tools
Biome

[error] 31-31: The constructor should not return a value.

The constructor is here:

Returning a value from a constructor is ignored.

(lint/correctness/noConstructorReturn)


[error] 350-350: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)

packages/fluent-editor/src/mention/Mention.ts (1)

Line range hint 1-406: LGTM!

The changes in this file are primarily stylistic, focusing on removing semicolons and improving code formatting. The core functionality and logic of the Mention class remain unchanged.

The stylistic changes enhance the readability and maintainability of the code without introducing any behavioral differences.

The code changes are approved.

Tools
Biome

[error] 202-203: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 211-211: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 214-214: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

packages/fluent-editor/src/table/modules/table-column-tool.ts (4)

39-71: LGTM!

The code changes are approved.


73-93: LGTM!

The code changes are approved.


163-163: The previous comment suggesting the use of optional chaining is still valid. Skipping the generation of a similar comment.

Tools
Biome

[error] 163-163: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


140-184: LGTM!

The code changes are approved.

Tools
Biome

[error] 163-163: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

packages/fluent-editor/src/table/modules/table-operation-menu.ts (6)

290-315: LGTM!

The code changes are approved.

Tools
Biome

[error] 305-306: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 309-310: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


317-320: LGTM!

The code changes are approved.


Line range hint 322-345: LGTM!

The code changes are approved.

Tools
Biome

[error] 305-306: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 309-310: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


Line range hint 412-448: LGTM!

The code changes are approved.


450-456: LGTM!

The code changes are approved.


458-472: LGTM!

The code changes are approved.

packages/fluent-editor/src/table/better-table.ts (10)

56-69: LGTM!

The code changes are approved.


Line range hint 71-181: LGTM!

The code changes are approved.

Tools
Biome

[error] 199-200: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


223-246: LGTM!

The code changes are approved.


248-266: LGTM!

The code changes are approved.


268-284: LGTM!

The code changes are approved.


286-305: LGTM!

The code changes are approved.


307-317: LGTM!

The code changes are approved.


319-365: LGTM!

The code changes are approved.


367-383: LGTM!

The code changes are approved.


Line range hint 385-410: LGTM!

The code changes are approved.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2e6a07a and d8ae65b.

Files selected for processing (1)
  • .eslintignore (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • .eslintignore

@kagol
Copy link
Member

kagol commented Sep 1, 2024

@zzxming 这个改动有点大,请问是不是只是修改代码格式呢?

@zzxming
Copy link
Collaborator Author

zzxming commented Sep 1, 2024

@zzxming 这个改动有点大,请问是不是只是修改代码格式呢?

是的,基本上是eslint —fix的修复,应该不会出现功能修改。另外往docs里加上了vue依赖,之后docs里引入vue的api就不会有ts-plugin的错误了

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d8ae65b and 261215f.

Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing (3)
  • packages/docs/package.json (2 hunks)
  • packages/fluent-editor/src/config.ts (4 hunks)
  • packages/fluent-editor/src/fluent-editor.ts (4 hunks)
Files skipped from review due to trivial changes (2)
  • packages/fluent-editor/src/config.ts
  • packages/fluent-editor/src/fluent-editor.ts
Files skipped from review as they are similar to previous changes (1)
  • packages/docs/package.json

@kagol kagol merged commit beb90f7 into opentiny:main Sep 2, 2024
1 check passed
@zzxming zzxming deleted the feat-eslint-stylistic branch September 10, 2024 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants