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

fix: linting issues and rule changes #5681

Merged
merged 11 commits into from
Sep 23, 2024
Merged

Conversation

sriramveeraghanta
Copy link
Contributor

@sriramveeraghanta sriramveeraghanta commented Sep 23, 2024

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced new ESLint configurations for various packages to streamline linting processes.
    • Added new scripts for linting in multiple package package.json files.
  • Refactor

    • Simplified component signatures by removing unnecessary interface declarations in several components, enhancing clarity.
    • Updated type declarations from interface to type for certain props, improving code structure.
  • Bug Fixes

    • Adjusted import statements and organization in various components to improve clarity and maintainability.
  • Chores

    • Downgraded TypeScript version across multiple packages for consistency.
    • Removed unused configuration files and dependencies, optimizing project structure.

Copy link
Contributor

coderabbitai bot commented Sep 23, 2024

Warning

Rate limit exceeded

@sriramveeraghanta has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 35 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between e1bca90 and 8462fb7.

Walkthrough

The changes primarily involve the removal and modification of ESLint configuration files and TypeScript settings across various packages. Several custom ESLint configurations have been replaced with standardized configurations from @plane/eslint-config, streamlining the linting process. Additionally, TypeScript configurations have been updated to extend from @plane/typescript-config, and several interfaces have been converted to type aliases. The changes aim to enhance code consistency and maintainability within the project.

Changes

Files Change Summary
.eslintrc-staged.js, .eslintrc.js, .lintstagedrc.json Removed ESLint configurations and lint-staged settings, which included specific rules and settings for linting staged files and enforcing code quality.
admin/.eslintrc.js, packages/editor/.eslintrc.js, space/.eslintrc.js, web/.eslintrc.js Updated to extend from @plane/eslint-config, removing custom settings and introducing standardized configurations.
admin/core/components/admin-sidebar/root.tsx, admin/core/components/instance/instance-failure-view.tsx, web/app/[workspaceSlug]/(projects)/sidebar.tsx, web/core/components/project/form-loader.tsx Removed empty interface declarations, simplifying component signatures by eliminating explicit props type definitions.
admin/package.json, live/package.json, space/package.json, web/package.json Updated lint scripts to use ESLint directly, replaced dependencies for ESLint and TypeScript configurations, and downgraded TypeScript version.
admin/tsconfig.json, live/tsconfig.json, space/tsconfig.json, web/tsconfig.json Updated to extend from @plane/typescript-config, modifying compiler options and simplifying the configuration structure.
packages/editor/src/core/types/editor.ts, space/core/components/editor/lite-text-read-only-editor.tsx, web/core/components/editor/lite-text-read-only-editor/lite-text-read-only-editor.tsx Converted interfaces to type aliases using Omit, maintaining the same structure while simplifying the type definitions.
packages/ui/src/badge/helper.tsx, packages/ui/src/button/helper.tsx Introduced new enums for styling properties and made minor formatting changes to existing enums.
packages/helpers/hooks/use-outside-click-detector.tsx Modified parameter types for improved flexibility in type handling.
packages/typescript-config/* Introduced new TypeScript configuration files with updated module settings and added plugins for enhanced functionality.

Possibly related PRs

Suggested labels

✍️editor, pages

Suggested reviewers

  • aaryan610
  • SatishGandham

🐰 In the land of code, where changes abound,
New configs emerge, with structure profound.
Type aliases dance, and ESLint takes flight,
Streamlining our paths, making coding feel right.
Hooray for the updates, let’s hop with delight! 🌟


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>, please review it.
    -- 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    -- @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.

Copy link
Contributor

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

Outside diff range and nitpick comments (29)
live/.eslintignore (1)

1-4: LGTM! Good practice for managing linting.

The introduction of this .eslintignore file is a positive step in managing the project's linting process. By excluding build artifacts, generated files, and static assets, you're ensuring that ESLint focuses on the relevant source code, which can lead to faster linting and clearer results.

The ignored directories are appropriate:

  • .turbo/*: Excludes Turborepo build cache
  • out/* and dist/*: Excludes common output directories for built/compiled files
  • public/*: Excludes static assets

This setup will help maintain a cleaner and more efficient linting process.

Consider adding comments to explain the purpose of each ignored directory. This can be helpful for new contributors or as a future reference. For example:

+# Turborepo build cache
 .turbo/*
+# Build output directories
 out/*
 dist/*
+# Static assets
 public/*
packages/typescript-config/react-library.json (1)

7-7: Consider using lowercase for the target option

The target option has been changed from "es6" to "ES6". While this doesn't affect functionality, it's generally recommended to use lowercase for consistency with other TypeScript configurations.

Consider changing it back to lowercase:

-    "target": "ES6",
+    "target": "es6",
packages/editor/tsconfig.json (1)

3-8: LGTM with a suggestion for module and target consistency.

The new compiler options are well-suited for a React-based editor package. However, there's a potential inconsistency between the module and target settings.

Consider aligning the module and target settings for consistency:

-    "module": "ESNext",
+    "module": "ES6",
     "moduleResolution": "Node",
     "target": "ES6",

Alternatively, if you intend to use the latest ECMAScript features:

     "module": "ESNext",
     "moduleResolution": "Node",
-    "target": "ES6",
+    "target": "ESNext",

Choose the option that best aligns with your project's requirements and supported environments.

live/src/core/helpers/error-handler.ts (1)

Line range hint 4-20: Consider using consistent arrow function syntax

For consistency with modern TypeScript practices, consider using the concise arrow function syntax when the function body is a single expression.

You could refactor the function to:

export const errorHandler: ErrorRequestHandler = (err, _req, res, _next) => {
  manualLogger.error(err);

  res.status(err.status || 500).json({
    error: {
      message: process.env.NODE_ENV === "production"
        ? "An unexpected error occurred"
        : err.message,
      ...(process.env.NODE_ENV !== "production" && { stack: err.stack }),
    },
  });
};

This makes the code more concise and easier to read.

packages/eslint-config/package.json (1)

10-20: Standardize dependency versioning and specify eslint version

The dev dependencies look appropriate for an ESLint configuration package. However, there are some inconsistencies in version specifications:

  1. Most packages use caret (^) for minor version updates, but eslint and typescript don't. Consider standardizing this across all dependencies.
  2. The eslint version is set to "8", which is quite broad. It's recommended to specify a more precise version to ensure consistency across different environments.

Here's a suggested update:

 "devDependencies": {
   "@typescript-eslint/eslint-plugin": "^8.6.0",
   "@typescript-eslint/parser": "^8.6.0",
-  "eslint": "8",
+  "eslint": "^8.56.0",
   "eslint-config-next": "^14.1.0",
   "eslint-config-prettier": "^9.1.0",
   "eslint-config-turbo": "^1.12.4",
   "eslint-plugin-import": "^2.29.1",
   "eslint-plugin-react": "^7.33.2",
-  "typescript": "5.3.3"
+  "typescript": "^5.3.3"
 }

This change will help maintain consistency and provide more precise control over the package versions.

space/tsconfig.json (1)

Line range hint 3-26: Consider removing duplicate "plugins" configuration.

The "plugins" array is defined both at the root level and within "compilerOptions". This duplication might be unnecessary.

Consider removing one of the "plugins" configurations, preferably the one at the root level, as the one in "compilerOptions" is more standard. Here's the suggested change:

{
  "extends": "@plane/typescript-config/nextjs.json",
- "plugins": [
-   {
-     "name": "next"
-   }
- ],
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "additional.d.ts", ".next/types/**/*.ts"],
  "exclude": ["node_modules"],
  "compilerOptions": {
    "baseUrl": ".",
    "jsx": "preserve",
    "paths": {
      "@/*": ["core/*"],
      "@/helpers/*": ["helpers/*"],
      "@/public/*": ["public/*"],
      "@/styles/*": ["styles/*"],
      "@/plane-web/*": ["ce/*"]
    },
    "plugins": [
      {
        "name": "next"
      }
    ],
    "strictNullChecks": true
  }
}

This change will maintain the necessary configuration while reducing redundancy.

package.json (1)

Line range hint 1-35: Summary of changes and potential impact

The changes in this package.json file have significant implications:

  1. The workspace configuration has been simplified, which improves maintainability but requires verification.
  2. The addition of the "lint:errors" script aligns with the PR objectives.
  3. The removal of several linting-related packages and tools (ESLint, Husky, lint-staged) seems to contradict the PR objectives and may impact code quality processes.
  4. The formatting script has been slightly modified, which needs verification against project standards.

These changes, while addressing some linting concerns, also introduce potential risks to the project's code quality processes. It's crucial to ensure that linting and code quality checks are still adequately addressed after these changes.

Consider the following recommendations:

  1. Document the new linting strategy if ESLint is being replaced or removed.
  2. If removing pre-commit hooks (Husky) and automated linting (lint-staged), ensure there are alternative measures in place to maintain code quality.
  3. Update the project documentation to reflect these changes in the development workflow.
live/tsconfig.json (1)

11-12: LGTM: Useful path aliases added.

The addition of path aliases @/* and @/plane-live/* can simplify imports and improve code organization. This is a good practice.

Consider adding a comment explaining what "ce" stands for in the @/plane-live/* alias, if it's not obvious to all team members.

packages/helpers/hooks/use-outside-click-detector.tsx (1)

Line range hint 1-28: Overall impact: Type safety compromised to fix linting issues

The changes in this file appear to be attempts to resolve linting issues, but they introduce potential type safety problems. While they might fix immediate linting errors, they compromise on the benefits provided by TypeScript's type system.

Consider the following general approach for improvement:

  1. Review your linting rules and TypeScript configuration. There might be conflicts or overly strict rules that are causing these issues.
  2. Instead of using any or unsafe type assertions, use more specific types or type guards where possible.
  3. If certain linting rules are causing more harm than good, consider disabling them selectively rather than compromising type safety.
  4. If you're dealing with truly dynamic types, consider using generics or union types to maintain type safety while allowing flexibility.

Remember, the goal is to leverage TypeScript's type system to catch errors at compile-time, not to bypass it for the sake of satisfying the linter.

admin/package.json (1)

11-12: LGTM! Consider adding a fix option.

The updated lint scripts look good and align with the PR objectives. The separation of full linting and error-only linting is a good practice.

Consider adding a lint:fix script to automatically fix linting issues where possible:

 "lint": "eslint . --ext .ts,.tsx",
-"lint:errors": "eslint . --ext .ts,.tsx --quiet"
+"lint:errors": "eslint . --ext .ts,.tsx --quiet",
+"lint:fix": "eslint . --ext .ts,.tsx --fix"
packages/ui/src/progress/linear-progress-indicator.tsx (3)

Line range hint 5-8: Consider replacing any with more specific types

The Props type uses any for the data property. It's generally better to avoid any and use more specific types to improve type safety and code clarity.

Consider defining a proper interface for the data structure. For example:

interface DataItem {
  id: string;
  name: string;
  value: number;
  color: string;
}

type Props = {
  data: DataItem[];
  noTooltip?: boolean;
  inPercentage?: boolean;
  size?: "sm" | "md" | "lg";
};

This will provide better type checking and autocompletion throughout the component.


Line range hint 21-22: Remove unused variable and eslint-disable comment

The progress variable is declared but never used, and there's an eslint-disable comment to suppress the warning.

It's better to remove unused variables to improve code clarity. If you don't need the progress variable, you can simply remove these lines:

- // eslint-disable-next-line @typescript-eslint/no-unused-vars
- let progress = 0;

If you do need to calculate the progress, consider using it in the component or removing it if it's not necessary.


Line range hint 44-50: Simplify rendering logic for zero total

The component renders the same content whether total is zero or not. This conditional rendering can be simplified.

You can remove the conditional and just render the content once:

return (
  <div
    className={cn("flex w-full items-center justify-between gap-[1px] rounded-sm", {
      "h-2": size === "sm",
      "h-3": size === "md",
      "h-3.5": size === "lg",
    })}
  >
    <div className="flex h-full w-full gap-[1.5px] p-[2px] bg-custom-background-90 rounded-sm">{bars}</div>
  </div>
);

This simplifies the code without changing its functionality.

packages/eslint-config/library.js (3)

9-21: LGTM: Improved configuration for React and TypeScript

The additions of globals, env, and the updated settings sections provide better configuration for React and TypeScript projects. The import resolver setup is correct and uses the previously defined project constant.

Consider adding es2022: true (or the appropriate ECMAScript version) to the env section to explicitly define the ECMAScript features available to the linter. This can help prevent false positives for newer language features. For example:

 env: {
   node: true,
   browser: true,
+  es2022: true,
 },

48-48: LGTM with suggestion: ignorePatterns addition

The addition of ignorePatterns is good for excluding files and directories that don't need linting. However, the pattern .*.js might be too broad as it ignores all JavaScript files that start with a dot.

Consider refining the .*.js pattern to be more specific. For example, you might want to ignore only specific dot files:

-ignorePatterns: [".*.js", "node_modules/", "dist/"],
+ignorePatterns: [".eslintrc.js", ".prettierrc.js", "node_modules/", "dist/"],

This change ensures that only specific JavaScript configuration files are ignored, rather than all JavaScript files starting with a dot.


Line range hint 1-49: Overall assessment: Improved ESLint configuration with some concerns

The ESLint configuration has been significantly updated to better accommodate TypeScript and React projects. The changes include:

  1. Improved project path resolution
  2. Simplified extends array
  3. Added globals and env sections
  4. Updated settings for TypeScript import resolution
  5. Modified several linting rules
  6. Added ignorePatterns

While these changes generally improve the configuration, there are a few points to consider:

  1. The removal of Next.js specific configuration might impact Next.js projects if they exist in the repository.
  2. Some rule severity changes (from error to warning) might lead to decreased code quality over time.
  3. The broad ignore pattern for .*.js files might unintentionally ignore important files.

To ensure these changes don't negatively impact the project:

  1. Verify that removing Next.js configuration doesn't affect any existing Next.js projects.
  2. Consider keeping stricter linting rules or create a plan to gradually enforce them.
  3. Refine the ignorePatterns to be more specific.
  4. Add the suggested es2022: true (or appropriate version) to the env section.

These refinements will help maintain code quality while providing the flexibility intended by these changes.

admin/core/components/admin-sidebar/root.tsx (1)

12-12: LGTM! Consider adding React. prefix for consistency.

The removal of the IInstanceSidebar interface and the simplification of the component signature to FC is a good change. It aligns with the PR objective of fixing linting issues and simplifies the component's type definition.

For consistency with other parts of the codebase, consider adding the React. prefix to FC:

-export const InstanceSidebar: FC = observer(() => {
+export const InstanceSidebar: React.FC = observer(() => {

This change enhances readability and maintains consistency with React type imports across the project.

packages/ui/src/dropdowns/combo-box.tsx (1)

Line range hint 1-78: Overall feedback on changes

The changes in this PR address linting issues and TypeScript errors as indicated in the PR title. While these modifications improve code compliance with linting rules and make TypeScript errors more explicit, they introduce potential type safety concerns.

  1. The use of as any type assertion, while resolving a TypeScript error, bypasses type checking and may mask underlying issues.
  2. The @ts-expect-error comment, although better than @ts-ignore, indicates an unresolved type mismatch that ideally should be addressed at its root cause.

These changes appear to be quick fixes for immediate issues. For long-term maintainability and type safety, consider:

  1. Investigating and resolving the root causes of TypeScript errors where possible.
  2. Using more specific type assertions or type guards instead of any.
  3. Documenting any necessary type suppressions with clear explanations.

While these changes meet the immediate goal of fixing linting issues, there's room for improvement in terms of type safety and code robustness.

web/package.json (1)

10-11: Approve linting script changes with a suggestion.

The updates to the linting scripts are good improvements:

  1. The lint script now uses ESLint directly, allowing for more customized linting.
  2. The new lint:errors script is useful for focusing on critical issues.

These changes align well with the PR objective of addressing linting issues.

Consider adding a lint:fix script to automatically fix auto-fixable issues:

  "scripts": {
    ...
    "lint": "eslint . --ext .ts,.tsx",
    "lint:errors": "eslint . --ext .ts,.tsx --quiet",
+   "lint:fix": "eslint . --ext .ts,.tsx --fix",
    ...
  },
packages/ui/src/tooltip/tooltip.tsx (1)

Line range hint 40-40: Address the TODO comment and revisit rendering logic

There's a TODO comment indicating that the tooltip should always render on hover, not by default. This suggests that the current implementation might not be ideal.

Consider the following:

  1. Implement the hover-based rendering as suggested by the TODO comment. This would involve removing the renderByDefault prop and always setting shouldRender to true on hover.

  2. If hover-based rendering is implemented, the useEffect hook for adding the "mouseenter" event listener might become unnecessary, simplifying the component.

  3. Ensure that the component's behavior is consistent across different devices, including mobile (where hover might not be applicable).

Please review and update the rendering logic to address these concerns. This will improve the component's behavior and remove the need for the temporary fix.

packages/eslint-config/next.js (1)

14-22: LGTM: Plugins and settings are well-configured

The plugins, import resolver settings, and ignore patterns are appropriately set up for a React TypeScript project.

Consider adding '.eslintrc.js' to the ignore patterns if you have a separate ESLint configuration file:

-  ignorePatterns: [".*.js", "node_modules/"],
+  ignorePatterns: [".*.js", "node_modules/", ".eslintrc.js"],

This ensures that the ESLint configuration file itself is not linted, which can sometimes cause circular dependencies.

web/core/components/analytics/custom-analytics/select-bar.tsx (1)

3-10: Improved import organization, minor suggestion for consistency.

The reorganization of imports with clear comment headers improves code readability and maintainability. Great job on grouping related imports together!

For even better consistency, consider ordering the import groups as follows:

  1. External libraries
  2. Types
  3. UI components
  4. Other components
  5. Constants
  6. Hooks

This order follows a common pattern of moving from external to internal dependencies.

packages/editor/src/core/types/editor.ts (3)

69-69: LGTM! Consider adjusting naming convention.

The change from an interface to a type alias simplifies the definition while maintaining the same functionality. This aligns well with the PR objective of addressing linting issues and rule changes.

Consider renaming ILiteTextEditor to TLiteTextEditor to follow the common TypeScript convention of prefixing type aliases with 'T' instead of 'I'. However, if your team's style guide prefers consistency with existing naming patterns in the codebase over general TypeScript conventions, you can disregard this suggestion.


100-100: LGTM! Consider adjusting naming convention.

The change from an interface to a type alias simplifies the definition while maintaining the same functionality. This aligns well with the PR objective of addressing linting issues and rule changes.

Consider renaming ILiteTextReadOnlyEditor to TLiteTextReadOnlyEditor to follow the common TypeScript convention of prefixing type aliases with 'T' instead of 'I'. However, if your team's style guide prefers consistency with existing naming patterns in the codebase over general TypeScript conventions, you can disregard this suggestion.


102-102: LGTM! Consider adjusting naming convention.

The change from an interface to a type alias simplifies the definition while maintaining the same functionality. This aligns well with the PR objective of addressing linting issues and rule changes.

Consider renaming IRichTextReadOnlyEditor to TRichTextReadOnlyEditor to follow the common TypeScript convention of prefixing type aliases with 'T' instead of 'I'. However, if your team's style guide prefers consistency with existing naming patterns in the codebase over general TypeScript conventions, you can disregard this suggestion.

packages/editor/src/core/hooks/use-read-only-editor.ts (1)

115-115: Simplified getHeadings method

The simplification of getHeadings to a single-line return statement improves code conciseness while maintaining the same functionality. This change aligns well with the PR objectives of addressing linting issues and rule changes.

For consistency with the getDocumentInfo method, consider using parentheses:

-    getHeadings: () => editorRef?.current?.storage.headingList.headings,
+    getHeadings: () => (editorRef?.current?.storage.headingList.headings),

This change would make both methods visually consistent and explicitly show the return value as an object or array.

live/src/core/extensions/index.ts (1)

Line range hint 1-149: Summary of changes and recommendations

This review identified two main areas for improvement:

  1. Refactoring of async Promise executors: The changes at lines 48-49 and 87-88 introduce TODO comments and eslint-disable directives to address linting issues. However, these are temporary solutions. It's recommended to refactor these sections to avoid using async executors in Promise constructors, as suggested in the previous comments.

  2. Code style consistency: Minor formatting changes were made to remove trailing commas, improving overall code consistency.

To further improve the code:

  1. Implement the suggested refactoring for both instances of async Promise executors.
  2. Conduct a broader review of the codebase to identify and refactor similar patterns.
  3. Consider updating your linting rules or running a linter automatically to catch these issues earlier in the development process.

These changes will enhance code quality, maintainability, and adherence to best practices in asynchronous JavaScript/TypeScript programming.

packages/ui/src/badge/helper.tsx (1)

Line range hint 113-124: Update functions if enums are refactored to objects

If you implement the suggested refactors for badgeSizeStyling and badgeIconStyling, remember to update the getBadgeStyling and getIconStyling functions accordingly.

Here are the suggested updates:

export const getBadgeStyling = (variant: TBadgeVariant, size: TBadgeSizes, disabled: boolean = false): string => {
  let tempVariant: string = ``;
  const currentVariant = badgeStyling[variant];

  tempVariant = `${currentVariant.default} ${disabled ? currentVariant.disabled : currentVariant.hover}`;

  const tempSize = size ? Object.values(badgeSizeStyling[size]).join(' ') : '';
  return `${tempVariant} ${tempSize}`;
};

export const getIconStyling = (size: TBadgeSizes): string => {
  return size ? badgeIconStyling[size] : '';
};

These changes assume the implementation of the object-based badgeSizeStyling and badgeIconStyling as suggested in the previous comments.

packages/editor/src/core/hooks/use-editor.ts (1)

264-268: LGTM: Improved getDocumentInfo implementation with a minor suggestion

The getDocumentInfo method has been refactored to use an implicit return with an object literal, which enhances code readability. The use of optional chaining (?.) ensures safe access to potentially undefined properties. This change aligns well with modern JavaScript practices and the PR's objective.

Consider using nullish coalescing (??) instead of logical OR (||) for the fallback values. This would handle cases where the value might be 0 (which is falsy but a valid count) more accurately:

getDocumentInfo: () => ({
  characters: editorRef?.current?.storage?.characterCount?.characters?.() ?? 0,
  paragraphs: getParagraphCount(editorRef?.current?.state) ?? 0,
  words: editorRef?.current?.storage?.characterCount?.words?.() ?? 0,
})
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e143e0a and e1bca90.

Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
Files selected for processing (72)
  • .eslintrc-staged.js (0 hunks)
  • .eslintrc.js (0 hunks)
  • .lintstagedrc.json (0 hunks)
  • admin/.eslintrc.js (1 hunks)
  • admin/core/components/admin-sidebar/root.tsx (1 hunks)
  • admin/core/components/instance/instance-failure-view.tsx (1 hunks)
  • admin/core/services/auth.service.ts (1 hunks)
  • admin/core/services/user.service.ts (1 hunks)
  • admin/package.json (2 hunks)
  • admin/tsconfig.json (1 hunks)
  • live/.eslintignore (1 hunks)
  • live/.eslintrc.json (1 hunks)
  • live/package.json (2 hunks)
  • live/src/ce/types/common.d.ts (1 hunks)
  • live/src/core/extensions/index.ts (4 hunks)
  • live/src/core/helpers/error-handler.ts (1 hunks)
  • live/tsconfig.json (1 hunks)
  • package.json (1 hunks)
  • packages/editor/.eslintrc.js (1 hunks)
  • packages/editor/package.json (2 hunks)
  • packages/editor/src/core/components/menus/ai-menu.tsx (0 hunks)
  • packages/editor/src/core/components/menus/block-menu.tsx (0 hunks)
  • packages/editor/src/core/extensions/code/lowlight-plugin.ts (1 hunks)
  • packages/editor/src/core/extensions/mentions/mention-node-view.tsx (1 hunks)
  • packages/editor/src/core/extensions/table/table/table-view.tsx (1 hunks)
  • packages/editor/src/core/extensions/table/table/table.ts (1 hunks)
  • packages/editor/src/core/hooks/use-editor.ts (3 hunks)
  • packages/editor/src/core/hooks/use-read-only-editor.ts (2 hunks)
  • packages/editor/src/core/types/editor.ts (2 hunks)
  • packages/editor/tsconfig.json (1 hunks)
  • packages/eslint-config-custom/package.json (0 hunks)
  • packages/eslint-config/library.js (2 hunks)
  • packages/eslint-config/next.js (1 hunks)
  • packages/eslint-config/package.json (1 hunks)
  • packages/eslint-config/server.js (1 hunks)
  • packages/helpers/hooks/use-outside-click-detector.tsx (1 hunks)
  • packages/helpers/tsconfig.json (1 hunks)
  • packages/typescript-config/base.json (1 hunks)
  • packages/typescript-config/nextjs.json (2 hunks)
  • packages/typescript-config/package.json (1 hunks)
  • packages/typescript-config/react-library.json (1 hunks)
  • packages/ui/.eslintrc.js (1 hunks)
  • packages/ui/package.json (2 hunks)
  • packages/ui/src/badge/helper.tsx (1 hunks)
  • packages/ui/src/button/helper.tsx (1 hunks)
  • packages/ui/src/dropdown/multi-select.tsx (0 hunks)
  • packages/ui/src/dropdown/single-select.tsx (0 hunks)
  • packages/ui/src/dropdowns/combo-box.tsx (2 hunks)
  • packages/ui/src/emoji/emoji-icon-picker.tsx (2 hunks)
  • packages/ui/src/progress/linear-progress-indicator.tsx (1 hunks)
  • packages/ui/src/tooltip/tooltip.tsx (1 hunks)
  • packages/ui/tsconfig.json (1 hunks)
  • space/.eslintrc.js (1 hunks)
  • space/core/components/editor/lite-text-read-only-editor.tsx (1 hunks)
  • space/core/components/editor/rich-text-read-only-editor.tsx (1 hunks)
  • space/package.json (2 hunks)
  • space/tsconfig.json (1 hunks)
  • web/.eslintrc.js (1 hunks)
  • web/app/[workspaceSlug]/(projects)/sidebar.tsx (1 hunks)
  • web/core/components/analytics/custom-analytics/select-bar.tsx (1 hunks)
  • web/core/components/editor/lite-text-editor/lite-text-read-only-editor.tsx (1 hunks)
  • web/core/components/editor/rich-text-editor/rich-text-read-only-editor.tsx (1 hunks)
  • web/core/components/issues/issue-detail/label/root.tsx (1 hunks)
  • web/core/components/issues/issue-layouts/kanban/roots/cycle-root.tsx (0 hunks)
  • web/core/components/issues/issue-layouts/kanban/roots/draft-issue-root.tsx (0 hunks)
  • web/core/components/issues/issue-layouts/kanban/roots/module-root.tsx (0 hunks)
  • web/core/components/issues/issue-layouts/list/block-root.tsx (1 hunks)
  • web/core/components/issues/issue-layouts/list/roots/cycle-root.tsx (0 hunks)
  • web/core/components/issues/issue-layouts/list/roots/module-root.tsx (0 hunks)
  • web/core/components/project/form-loader.tsx (1 hunks)
  • web/package.json (2 hunks)
  • web/tsconfig.json (1 hunks)
Files not reviewed due to no reviewable changes (13)
  • .eslintrc-staged.js
  • .eslintrc.js
  • .lintstagedrc.json
  • packages/editor/src/core/components/menus/ai-menu.tsx
  • packages/editor/src/core/components/menus/block-menu.tsx
  • packages/eslint-config-custom/package.json
  • packages/ui/src/dropdown/multi-select.tsx
  • packages/ui/src/dropdown/single-select.tsx
  • web/core/components/issues/issue-layouts/kanban/roots/cycle-root.tsx
  • web/core/components/issues/issue-layouts/kanban/roots/draft-issue-root.tsx
  • web/core/components/issues/issue-layouts/kanban/roots/module-root.tsx
  • web/core/components/issues/issue-layouts/list/roots/cycle-root.tsx
  • web/core/components/issues/issue-layouts/list/roots/module-root.tsx
Files skipped from review due to trivial changes (9)
  • admin/core/services/auth.service.ts
  • packages/editor/src/core/extensions/mentions/mention-node-view.tsx
  • packages/editor/src/core/extensions/table/table/table-view.tsx
  • packages/ui/src/button/helper.tsx
  • space/core/components/editor/lite-text-read-only-editor.tsx
  • space/core/components/editor/rich-text-read-only-editor.tsx
  • web/core/components/editor/lite-text-editor/lite-text-read-only-editor.tsx
  • web/core/components/editor/rich-text-editor/rich-text-read-only-editor.tsx
  • web/core/components/issues/issue-layouts/list/block-root.tsx
Additional context used
Biome
live/src/ce/types/common.d.ts

[error] 1-1: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

Additional comments not posted (97)
packages/typescript-config/package.json (1)

2-2: Package name updated to use @plane scope

The package name has been changed from "tsconfig" to "@plane/typescript-config". This change aligns the package with the @plane organization scope, which is good for better organization and reducing potential naming conflicts.

However, please ensure that all references to this package in other parts of the project are updated accordingly. This change might affect:

  1. Import statements in TypeScript/JavaScript files
  2. References in other package.json files (e.g., in dependencies or devDependencies)
  3. Build scripts or configuration files that might reference this package

To verify that all references to this package have been updated, you can run the following script:

If the script returns any results, those locations may need to be updated to use the new package name.

admin/.eslintrc.js (4)

1-8: Summary of ESLint configuration changes

The ESLint configuration has been significantly simplified:

  1. Adopted a standardized configuration (@plane/eslint-config/next.js).
  2. Removed custom settings and rules sections.
  3. Added parserOptions with project: true for enhanced TypeScript support.

These changes align with the PR objective of fixing linting issues and changing rules. While simplification can ease maintenance, it's crucial to verify that all necessary linting rules are still in place and functioning as expected.

To ensure the new configuration maintains the desired code quality standards, please:

  1. Run a full lint check on the project.
  2. Review a sample of files to confirm import ordering and resolution work correctly.
  3. Monitor build times to assess any performance impact from the parserOptions change.

8-8: Verify the impact of removed settings and rules sections.

The removal of the settings and rules sections simplifies the configuration. However, it's crucial to ensure that the new standardized configuration (@plane/eslint-config/next.js) includes equivalent or suitable replacements for these removed settings and rules, especially for import resolution and ordering.

Please run the following commands to check if the import resolution and ordering are still working as expected:

#!/bin/bash
# Description: Verify import resolution and ordering after configuration change.

# Test 1: Check for any unresolved imports
echo "Checking for unresolved imports:"
rg --type typescript --type javascript "import.*from" | rg -v "from '[\.@]" || echo "No potentially unresolved imports found."

# Test 2: Check the order of imports in a few files
echo "Checking import order in a sample file:"
fd -e ts -e tsx -e js -e jsx | head -n 1 | xargs cat

# Note: Review the output manually to ensure imports are ordered correctly

5-7: Approve the addition of parserOptions.

The addition of parserOptions with project: true is beneficial for TypeScript projects. It enables TypeScript-specific linting rules that require type information, leading to more accurate and powerful linting.

Monitor the linting performance after this change, as it may increase linting time due to type checking. Run the following command to check the linting time:

#!/bin/bash
# Description: Check linting time after configuration change.

# Test: Time the ESLint run
time npx eslint . --ext .js,.jsx,.ts,.tsx

3-3: Approve the standardized ESLint configuration.

The shift to a standardized ESLint configuration (@plane/eslint-config/next.js) is a good practice. It can help maintain consistency across projects and reduce the need for custom rules.

Please verify that this new configuration meets all the project's linting requirements. Run the following command to check for any new linting issues:

live/.eslintrc.json (4)

2-2: LGTM: Correct root configuration

Setting "root": true is the correct approach for the main ESLint configuration file. This prevents ESLint from searching for other configuration files in parent directories, ensuring that only this configuration is used for the project.


1-8: Overall, the ESLint configuration looks good

This ESLint configuration file is well-structured and appropriate for a TypeScript project. It extends from a custom configuration, uses the correct parser for TypeScript, and enables TypeScript project-aware linting.

Key points:

  1. Root configuration is correctly set.
  2. Extends from a custom configuration (verify its existence).
  3. Uses the TypeScript parser (verify its installation).
  4. Enables project-aware linting (consider specifying the tsconfig.json path for optimization).

These changes should improve the linting process for your TypeScript code.


4-4: LGTM: Correct parser for TypeScript

Using "@typescript-eslint/parser" is the correct choice for linting TypeScript files. This parser allows ESLint to understand TypeScript syntax.

Let's verify that the parser package is installed:

#!/bin/bash
# Description: Verify the installation of @typescript-eslint/parser

# Test: Check if @typescript-eslint/parser is listed in package.json
if grep -q "@typescript-eslint/parser" package.json; then
    echo "@typescript-eslint/parser is listed in package.json"
else
    echo "@typescript-eslint/parser is not listed in package.json. Please ensure it's installed correctly."
fi

3-3: Verify the extended configuration file

Extending from "@plane/eslint-config/server.js" is a good practice for maintaining consistent linting rules across the project. However, we should verify that this configuration file exists and is accessible.

Let's verify the existence and content of the extended configuration:

packages/editor/.eslintrc.js (3)

3-3: Approve the transition to a standardized ESLint config

The change from a custom ESLint configuration to "@plane/eslint-config/library.js" is a good move towards standardization. This can help maintain consistency across different parts of the project.

To ensure the new configuration is correctly set up, please run the following command:

#!/bin/bash
# Verify the existence and content of the new ESLint config
if [ -f "node_modules/@plane/eslint-config/library.js" ]; then
    echo "Config file exists. Content:"
    cat "node_modules/@plane/eslint-config/library.js"
else
    echo "Config file not found. Please check the package installation."
fi

8-8: Verify that all necessary rules are included in the extended configuration

The removal of all custom rules from the rules object suggests that the project is now relying entirely on the rules defined in "@plane/eslint-config/library.js". While this can help maintain consistency, it's important to ensure that all necessary rules are included in the extended configuration.

To verify the rules included in the extended configuration, please run the following command:

#!/bin/bash
# Check the rules in the extended configuration
if [ -f "node_modules/@plane/eslint-config/library.js" ]; then
    echo "Rules in @plane/eslint-config/library.js:"
    grep -n "rules" -A 50 "node_modules/@plane/eslint-config/library.js"
else
    echo "@plane/eslint-config/library.js not found. Please check the package installation."
fi

5-7: Approve the addition of parserOptions

The addition of parserOptions with project: true is a good configuration for TypeScript projects. This allows the parser to consider the TypeScript project configuration for more accurate linting.

To ensure the TypeScript project is correctly set up, please run the following command:

#!/bin/bash
# Verify TypeScript project setup
if [ -f "tsconfig.json" ]; then
    echo "tsconfig.json exists. Checking for 'include' and 'exclude' properties:"
    grep -E "include|exclude" tsconfig.json
else
    echo "tsconfig.json not found. Please check the TypeScript project setup."
fi
packages/eslint-config/server.js (1)

7-10: LGTM: Parser options are well-configured.

The parserOptions section is correctly configured for a modern Node.js environment. Using ecmaVersion: "latest" allows for the latest ECMAScript features, and sourceType: "module" is appropriate for code using ES modules.

packages/helpers/tsconfig.json (2)

2-2: Verify the new TypeScript configuration extension

The TypeScript configuration has been changed to extend from "@plane/typescript-config/react-library.json". This change might introduce different compiler options or rules that could affect the entire project.

Please confirm:

  1. Is this change intentional and part of a larger update to standardize TypeScript configurations across the project?
  2. Have all necessary dependencies been updated to support this new configuration?
  3. Has this change been tested to ensure it doesn't introduce any unexpected behavior or break existing functionality?

To verify the impact, you can run the following script:

This will help us understand if this change is consistent across the project.

Verification successful

TypeScript Configuration Extension Verified

All tsconfig.json files consistently extend from @plane/typescript-config variants, ensuring standardized and modular TypeScript configurations across the project.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for other tsconfig files and their extensions

echo "Checking for other tsconfig.json files:"
fd tsconfig.json

echo "\nChecking the content of found tsconfig.json files:"
fd tsconfig.json -x cat

Length of output: 3485


4-5: Approve addition of "lib" compiler option with verification

The addition of "lib": ["esnext", "dom"] to the compiler options is a good change. It allows for the use of the latest ECMAScript features and provides DOM types, which is beneficial for a React library.

To ensure this change doesn't introduce any issues, please:

  1. Verify that all developers are using a TypeScript version that supports these lib options.
  2. Check if this change affects the build output or introduces any warnings/errors in the existing codebase.
  3. Confirm that the project's target environments (browsers, Node.js versions) support the features enabled by "esnext".

You can run the following script to check for any new TypeScript errors:

This will help identify any potential issues introduced by this change.

packages/ui/tsconfig.json (3)

4-5: Addition of 'lib' property to compiler options

The lib property has been added to compilerOptions with values ["esnext", "dom"]. This explicitly specifies the library files to be included in the compilation, which can help resolve linting issues related to missing type definitions.

The inclusion of both "esnext" and "dom" is appropriate for a React library, as it provides access to the latest ECMAScript features and DOM types.


Line range hint 1-9: Overall TypeScript configuration update looks good

The changes made to this tsconfig.json file are appropriate and align well with the PR objectives of fixing linting issues and updating rules. The updated configuration provides a more specific base configuration for a React library and explicitly defines the required library files for compilation.

These changes should help improve code consistency and reduce potential linting issues in the UI package.


2-2: Update to TypeScript configuration inheritance

The extends property has been updated to use a more specific configuration: "@plane/typescript-config/react-library.json". This change aligns with the PR objective of addressing linting issues and rule changes.

To ensure consistency across the project, let's verify if similar changes have been made in other tsconfig.json files:

Verification successful

Consistent TypeScript Configuration Verified

The extends property in packages/ui/tsconfig.json correctly aligns with similar configurations in the codebase, ensuring consistency and adherence to project standards.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for consistent TypeScript configuration across the project

# Test: Search for tsconfig.json files and their 'extends' property
fd tsconfig.json --exec grep -H '"extends":'

Length of output: 522

web/.eslintrc.js (4)

1-9: Summary of ESLint configuration changes

The ESLint configuration has been significantly simplified:

  1. It now extends a predefined configuration (@plane/eslint-config/next.js).
  2. Custom settings and rules have been removed.
  3. parserOptions with project: true has been added.

These changes align with the PR objective of fixing linting issues and changing rules. They should promote consistency and reduce maintenance overhead. However, please ensure:

  1. All necessary project-specific linting rules are still enforced.
  2. The new configuration doesn't introduce any unexpected behavior.
  3. Linting performance remains acceptable with the new parserOptions.

Overall, this change appears to be a step in the right direction for maintaining code quality and consistency.


6-8: Approve the addition of parserOptions with a performance note

The addition of parserOptions with project: true is beneficial as it allows for more advanced linting rules that require type information.

However, this may increase linting time. Please monitor the linting performance, especially in large projects or CI/CD pipelines. You can use the following command to measure the linting time:

#!/bin/bash
# Description: Measure ESLint execution time
time npx eslint .

If you notice significant slowdowns, consider using ESLint's caching mechanism or exploring other optimization strategies.


4-4: Verify that critical rules and settings are not lost

The removal of the settings and rules sections suggests that the new predefined configuration might already include these. However, it's crucial to ensure that no critical project-specific rules or settings have been lost in this transition.

Please review the contents of the "@plane/eslint-config/next.js" configuration to confirm it includes all necessary rules, especially those related to import ordering and organization. You can use the following command to inspect the configuration:

#!/bin/bash
# Description: Inspect the contents of the new ESLint configuration
npx eslint --print-config .eslintrc.js

Compare the output with your previous configuration to ensure all critical rules are still in place.


4-4: Approve the use of predefined ESLint configuration

The change to use "@plane/eslint-config/next.js" is a good practice. It can help maintain consistency and reduce the need for custom rules.

Please verify that this new configuration meets all the project's linting requirements. You can run the following command to check for any new linting issues:

space/.eslintrc.js (4)

Line range hint 1-11: Summary of ESLint configuration changes

The changes to .eslintrc.js represent a significant shift towards a more standardized and simplified ESLint configuration:

  1. Adoption of a predefined configuration (@plane/eslint-config/next.js)
  2. Addition of parserOptions with project: true for enhanced TypeScript linting
  3. Removal of custom rules

These changes should lead to more consistent and maintainable linting across your project(s). However, please ensure that:

  1. The new configuration meets all your project's linting requirements
  2. There's no significant performance impact from enabling project: true
  3. No critical project-specific rules have been unintentionally removed

Consider documenting the rationale behind this configuration change for future reference.


9-9: Review the removal of custom ESLint rules

The rules section has been cleared, which aligns with the adoption of the standardized @plane/eslint-config/next.js configuration. This simplifies the ESLint setup and promotes consistency.

However, it's important to ensure that no critical project-specific rules have been unintentionally removed. Please run the following verification script to compare the current ESLint configuration with the previous one:

#!/bin/bash
# Description: Compare current ESLint rules with the previous configuration

# Test: Compare ESLint configurations
echo "Current ESLint configuration:"
npx eslint --print-config . | jq .rules

echo "Please compare these rules with your previous .eslintrc.js file to ensure no critical project-specific rules have been unintentionally removed."
echo "If any important custom rules are missing, consider adding them back to the 'rules' section of .eslintrc.js."

6-8: Approve the addition of parserOptions with project: true

Adding parserOptions with project: true is a good enhancement for TypeScript projects. This enables TypeScript-specific linting rules that require type information, providing more accurate and powerful linting.

However, this change may impact linting performance. To monitor its effect, please run the following verification script:


4-4: Approve the switch to a standardized ESLint configuration

The change to use @plane/eslint-config/next.js is a good move towards standardization. This predefined configuration will likely ensure consistent linting rules across your Next.js projects.

To ensure the new configuration is properly set up, please run the following verification script:

packages/typescript-config/react-library.json (2)

8-8: LGTM: Repositioning of the jsx option

The repositioning of the jsx option within the compilerOptions block is fine. It doesn't affect functionality and might improve the organization of the configuration file.


10-10: Verify if exclude is necessary

Adding "exclude": ["node_modules"] is a good practice to improve compilation performance. However, this might be redundant if it's already specified in the base configuration file that this config extends from.

Please check the base.json file to ensure this exclusion isn't already present. If it's not, then this addition is beneficial. You can use the following script to check the base configuration:

#!/bin/bash
# Description: Check if node_modules is already excluded in base.json

# Test: Look for exclude field in base.json
rg --json '"exclude"' packages/typescript-config/base.json | jq '.data.lines.text'

If the script doesn't return any results, then this addition is necessary and beneficial.

packages/ui/.eslintrc.js (6)

1-1: LGTM: Proper type annotation for ESLint configuration

The JSDoc type annotation is correctly used to specify the type of the exported configuration object. This enhances type checking and provides better IDE support.


2-10: LGTM: Correct module exports syntax

The use of module.exports is appropriate for an ESLint configuration file. The configuration object is properly structured.


3-3: LGTM: Correct root configuration

Setting root: true is correct. This prevents ESLint from searching for configuration files in parent directories, which is important in a monorepo structure to ensure that the UI package has its own isolated ESLint configuration.


5-5: LGTM: Correct parser for TypeScript

The use of "@typescript-eslint/parser" is correct for a TypeScript project. This allows ESLint to properly understand and lint TypeScript syntax.


6-9: LGTM: Correct parser options, but verify tsconfig.json

The parser options are correctly specified for a TypeScript project. The use of a relative path for tsconfig.json and setting tsconfigRootDir to __dirname is appropriate. However, it's important to verify the existence of the tsconfig.json file.

#!/bin/bash
# Description: Verify the existence of tsconfig.json in the UI package

# Test: Check if tsconfig.json exists in the same directory as .eslintrc.js
if [ -f "$(dirname "$0")/tsconfig.json" ]; then
    echo "tsconfig.json found in the UI package directory."
else
    echo "Warning: tsconfig.json not found in the UI package directory."
fi

4-4: LGTM: Configuration extension, but verify the base config

Extending a base configuration is a good practice for maintaining consistency. However, please verify that "@plane/eslint-config/library.js" is the correct configuration to extend for this UI package.

admin/tsconfig.json (4)

4-11: LGTM! Verify TypeScript compilation with the new plugin.

The addition of the Next.js plugin ({ "name": "next" }) is a good improvement. It should provide better integration with Next.js-specific features and optimizations.

To ensure these changes don't affect the project negatively:

  1. Verify that the TypeScript compilation process works as expected, especially for JSX files.
  2. Check that module imports using the defined paths still resolve correctly.

Run the following script to verify the TypeScript compilation:

#!/bin/bash
# Description: Verify TypeScript compilation
# Expected result: No TypeScript errors

echo "Running TypeScript compilation check..."
# Note: Adjust the TypeScript compilation command based on your project setup
npx tsc --noEmit

echo "\nChecking for JSX files:"
fd -e tsx

echo "\nVerifying module imports for defined paths:"
rg -t typescript -n "from ['\"]@/" 

1-15: Summary: Improved TypeScript configuration for Next.js integration

The changes to tsconfig.json appear to be well-considered improvements:

  1. Adoption of a custom TypeScript configuration (@plane/typescript-config/nextjs.json).
  2. Addition of the Next.js plugin for better integration.
  3. Inclusion of next.config.js for type-checking.

These changes should enhance the development experience and catch potential issues earlier in the development process. However, it's important to verify that these changes don't introduce any unexpected behavior or compilation errors.

To ensure a smooth transition with these configuration changes:

  1. Run a full TypeScript compilation of the project.
  2. Perform a test build of the Next.js application.
  3. Review any new TypeScript errors or warnings that may appear in the IDE.

Here's a script to perform these verifications:

#!/bin/bash
# Description: Verify project compilation and build
# Expected result: Successful TypeScript compilation and Next.js build

echo "Running TypeScript compilation..."
npx tsc --noEmit

echo "\nPerforming Next.js build..."
npx next build

echo "\nChecking for TypeScript errors in source files:"
rg -t typescript -n "error TS\d+:" 

2-2: LGTM! Verify the impact of the new TypeScript configuration.

The change to use "@plane/typescript-config/nextjs.json" looks good. This custom configuration likely provides preset options tailored for Next.js projects within the Plane ecosystem.

To ensure this change doesn't introduce unexpected behavior, please verify:

  1. The project builds successfully with the new configuration.
  2. There are no new TypeScript errors or warnings introduced.
  3. The IDE's TypeScript integration works as expected with the new configuration.

Run the following script to check for any TypeScript configuration files that might need updating:


13-14: LGTM! Verify type-checking for next.config.js.

Including "next.config.js" in the include array is a good practice. It allows TypeScript to type-check the Next.js configuration file, which can help catch potential errors early in the development process.

To ensure this change is effective:

  1. Verify that next.config.js exists in the project root.
  2. Check that TypeScript is able to process next.config.js without errors.

Run the following script to verify the Next.js configuration file:

web/tsconfig.json (2)

15-16: Approve the relocation of include and exclude properties.

The include and exclude properties have been moved to the end of the configuration file. This change doesn't affect functionality and might improve readability.


12-14: Approve the simplification of compiler options.

The changes in the compilerOptions section, particularly the simplification of the plugins array and the removal of jsx and esModuleInterop options, appear to streamline the configuration. This aligns with the PR objective of addressing linting issues and rule changes.

To ensure the removed options don't cause any issues, please run the following verification script:

#!/bin/bash
# Description: Verify the impact of removed compiler options

# Test: Check if jsx and esModuleInterop are set in the extended configuration
echo "Checking extended configuration for jsx and esModuleInterop options..."
grep -E "jsx|esModuleInterop" node_modules/@plane/typescript-config/nextjs.json

# Test: Verify if any files rely on the removed options
echo "Checking for potential issues due to removed options..."
rg --type typescript -e "import \* as" -e "export \* from" -e "import React" -l

# If any files are found, they might need to be updated to account for the removed esModuleInterop option
packages/editor/tsconfig.json (3)

17-18: LGTM: Appropriate include and exclude configurations.

The include and exclude arrays are well-configured for a typical TypeScript project structure.


1-19: Overall LGTM with a note on removed extends property.

The changes to the tsconfig.json file generally improve the TypeScript configuration for the editor package. However, there's one important consideration:

The AI summary mentions that the extends property, which previously referenced tsconfig/react-library.json, has been removed. This change isn't visible in the provided diff but could have significant implications. Please verify that:

  1. All necessary compiler options from the previously extended configuration have been explicitly added to this file.
  2. The removal of the extends property doesn't unintentionally diverge from project-wide TypeScript standards.

You can run the following script to compare the current configuration with the previously extended one:

This will help ensure that no critical configurations have been inadvertently omitted.


9-15: LGTM with a note on allowSyntheticDefaultImports.

The paths configuration remains appropriate, and the addition of allowSyntheticDefaultImports can improve compatibility with certain modules.

Note that while allowSyntheticDefaultImports: true can be convenient, it may mask issues with modules that don't have proper default exports. Ensure that this setting aligns with your project's needs and coding standards.

To verify the impact of this change, you can run the following script:

This script will help identify any imports that might be relying on this compiler option.

packages/typescript-config/base.json (1)

12-13: Approved: Module resolution updated to NodeNext

The changes to module and moduleResolution properties to "NodeNext" align with modern TypeScript and Node.js practices. This update enables better compatibility with the latest Node.js ECMAScript module support.

To ensure this change doesn't introduce unexpected issues, please verify:

  1. The project builds successfully with these new settings.
  2. All import/export statements in the codebase are compatible with the new module resolution strategy.
  3. Any third-party libraries used in the project are compatible with this configuration.

You can run the following script to check for potential issues with import/export statements:

This script will help identify import and export statements that might need to be updated to work with the new module resolution strategy.

packages/eslint-config/package.json (3)

1-4: LGTM: Package metadata looks good

The package metadata is well-structured:

  • The scoped package name "@plane/eslint-config" is appropriate for a custom ESLint configuration.
  • Marking the package as private is a good practice to prevent accidental publishing.
  • The version number follows semantic versioning.

1-21: Overall, the new ESLint config package looks good and aligns with PR objectives

This new @plane/eslint-config package is well-structured and aligns with the PR objective of addressing linting issues and rule changes. It provides a centralized location for ESLint configurations, which can help maintain consistency across different parts of the project.

Key points:

  1. The package metadata is correctly set up.
  2. Different configurations for library, Next.js, and server environments are provided.
  3. Appropriate dev dependencies are included for ESLint and related plugins.

The suggested improvements (verifying file existence, adding a README.md, and standardizing dependency versions) will further enhance the package's usability and maintainability.


5-9: Verify the existence of listed files and consider adding README.md

The "files" section lists three JavaScript files: library.js, next.js, and server.js. These likely represent different ESLint configurations for various environments.

Please run the following script to check if these files exist in the package directory:

Consider adding a README.md file to the package and including it in the "files" section. This would provide useful information about the ESLint configurations and how to use them.

 "files": [
   "library.js",
   "next.js",
   "server.js"
+  "README.md"
 ],
Verification successful

Verified the existence of listed files and recommend adding README.md

All listed files (library.js, next.js, server.js) exist in the packages/eslint-config directory.

Consider adding a README.md file to the package and including it in the "files" section. This will provide useful information about the ESLint configurations and usage instructions.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the listed files exist in the package directory

cd packages/eslint-config
for file in library.js next.js server.js; do
  if [ ! -f "$file" ]; then
    echo "Warning: $file does not exist in the package directory"
  fi
done

Length of output: 236

space/tsconfig.json (1)

2-2: ```shell
#!/bin/bash

Description: Display the contents of space/tsconfig.json

cat space/tsconfig.json


```shell
#!/bin/bash
# Description: Check if @plane/typescript-config/nextjs.json exists and display its contents
fd "@plane/typescript-config/nextjs.json" --hidden
#!/bin/bash
# Description: If the extended config exists, display its contents
if fd "@plane/typescript-config/nextjs.json" --hidden | grep -q "@plane/typescript-config/nextjs.json"; then
  cat path/to/@plane/typescript-config/nextjs.json
else
  echo "Extended TypeScript configuration '@plane/typescript-config/nextjs.json' not found."
fi
packages/typescript-config/nextjs.json (3)

6-6: Excellent addition of the Next.js TypeScript plugin!

The inclusion of the "next" plugin in the TypeScript configuration is a valuable improvement. This plugin enhances the development experience by providing:

  1. Improved type checking for Next.js-specific APIs
  2. Better autocompletion for Next.js features
  3. Catch potential errors related to Next.js usage at compile-time

This change aligns with best practices for Next.js projects using TypeScript.


16-16: Approved: Consistent capitalization for module option

The update from "esnext" to "ESNext" for the module compiler option is a good change. While functionally equivalent, this modification:

  1. Aligns with the official TypeScript documentation's capitalization
  2. Improves consistency in the configuration file
  3. May help prevent potential issues with case-sensitive systems or tools

This change contributes to better maintainability and adherence to TypeScript conventions.


Line range hint 1-24: Summary: Excellent TypeScript configuration updates for Next.js

These changes collectively enhance the TypeScript configuration for Next.js projects:

  1. Addition of the Next.js TypeScript plugin improves type checking and autocompletion.
  2. Update to module: "ESNext" maintains consistency with TypeScript documentation.
  3. Introduction of moduleResolution: "Bundler" leverages modern TypeScript features for better bundling support.

These modifications align well with the PR objectives of fixing linting issues and updating rules. They should lead to improved development experience, better type safety, and potentially better build performance for Next.js projects using this configuration.

package.json (4)

18-18: Approve addition of lint:errors script.

The addition of the "lint:errors" script aligns well with the PR objective of addressing linting issues. This will allow for more focused linting, specifically targeting errors.


20-20: Verify impact of format script modification.

The "format" script has been modified to use double quotes instead of single quotes. While this change is minor, it's important to ensure it doesn't conflict with any existing formatting rules or preferences in the project.

Please run the following command to check if this change aligns with the project's prettier configuration:

#!/bin/bash
# Check if the .prettierrc file exists and contains relevant configuration
if [ -f ".prettierrc" ]; then
  echo "Prettier configuration:"
  cat .prettierrc | grep -E "singleQuote|quoteProps"
else
  echo ".prettierrc file not found. Please verify if this change aligns with the project's formatting standards."
fi

23-27: Verify impact of removed linting-related packages.

Several linting-related packages have been removed from the devDependencies, including "eslint-config-custom" and "eslint-plugin-prettier". This seems to contradict the PR objective of addressing linting issues.

Please clarify the reasoning behind removing these packages and how linting will be handled moving forward. Run the following command to check for any remaining ESLint configuration:

#!/bin/bash
# Check for ESLint configuration files
echo "Searching for ESLint configuration files:"
fd -e js -e json -e yaml -e yml --max-depth 1 --glob '*eslint*'

# Check if ESLint is still installed in any workspace
echo "Checking for ESLint in workspaces:"
fd --glob 'package.json' --exec grep -l '"eslint"' {} \;

Additionally, the removal of "husky" and "lint-staged" might affect pre-commit hooks and automated linting. Please ensure that these changes don't negatively impact the project's code quality processes.


11-11: Approve workspace simplification with a verification step.

The simplification of the workspaces array to use a wildcard entry "packages/*" improves maintainability and scalability. This change aligns well with the PR objective of addressing linting issues and rule changes.

To ensure this change doesn't unintentionally include any packages, please run the following command and verify the output:

live/tsconfig.json (5)

6-6: LGTM: Improved readability.

The simplification of the lib property to a single line improves readability without changing functionality.


24-24: LGTM: Including tsup config in TypeScript processing.

Adding "tsup.config.ts" to the include array allows TypeScript to process this configuration file. This can help catch errors in the build configuration early, which is a good practice.


1-26: Overall, the changes improve the TypeScript configuration.

The modifications to tsconfig.json align well with the PR objective of fixing linting issues and changing rules. The new configuration extends a more specific base, adjusts the project structure, adds useful path aliases, and includes the build tool config in TypeScript processing. These changes should lead to better code organization and earlier error detection.

Please ensure to run the suggested verification scripts to confirm that these changes don't introduce any unexpected issues.


8-8: Verify the implications of broadening the root directory.

Changing rootDir to "." allows TypeScript to process files outside the src directory. While this aligns with including "tsup.config.ts", ensure this broader scope is intentional and doesn't lead to unexpected behavior.

Run the following script to check for any unexpected TypeScript files being processed:

Verification successful

Approve the root directory change.

The rootDir has been successfully broadened to ".", and all TypeScript files are within expected directories. No unintended files are being processed, ensuring the change won't lead to unexpected behavior.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: List all TypeScript files that will be processed by the compiler

# Test: Find all .ts files in the project directory, excluding node_modules and dist
fd -e ts -E node_modules -E dist

Length of output: 40292


2-2: Verify the impact of the new TypeScript configuration.

The change to "@plane/typescript-config/base.json" is likely an improvement, as it seems to be a more specific configuration for the Plane project. This change aligns with the PR objective of addressing linting issues and rule changes.

To ensure this change doesn't introduce unexpected issues, please run the following script:

admin/core/services/user.service.ts (1)

3-4: LGTM: Import path updated to use alias

The change from a relative import path to an alias path (@/helpers/common.helper) is a good practice. It makes imports more consistent across the project and easier to manage, especially when refactoring or moving files.

admin/package.json (2)

49-50: Clarify the TypeScript version downgrade.

The addition of @plane/typescript-config is a good move towards standardization.

However, the TypeScript version has been downgraded from 5.4.5 to 5.3.3.

Could you please clarify the reason for this downgrade? Is it due to compatibility issues with other dependencies or to align with a specific version used across the organization?

Let's verify the TypeScript version used in other parts of the project:

#!/bin/bash
# Description: Check TypeScript versions across the project

# Test 1: Find all package.json files and grep for typescript version
echo "TypeScript versions in package.json files:"
fd package.json --type f --exec grep -H '"typescript":' {} +

# Test 2: Check if there's a global TypeScript version specified
echo "Checking for global TypeScript version:"
rg --type yaml --type json '"typescript":' ./*.json

47-47: Verify the new eslint config integration.

The switch to @plane/eslint-config is a good move towards standardization.

Let's verify that the new eslint config is properly integrated:

Verification successful

ESLint Config Integration Verified Successfully.

All ESLint configurations now extend @plane/eslint-config, and there are no remaining references to eslint-config-custom.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the integration of @plane/eslint-config

# Test 1: Check if @plane/eslint-config is referenced in the eslint config file
echo "Checking eslint config file for @plane/eslint-config:"
rg --type yaml --type json "@plane/eslint-config" .eslintrc*

# Test 2: Verify that there are no lingering references to the old eslint-config-custom
echo "Checking for any remaining references to eslint-config-custom:"
rg --type yaml --type json --type typescript --type javascript "eslint-config-custom"

Length of output: 1349


Script:

#!/bin/bash
# Description: Verify the integration of @plane/eslint-config and absence of eslint-config-custom

# Test 1: Check if @plane/eslint-config is referenced in ESLint configuration files
echo "Checking ESLint config files for @plane/eslint-config:"
rg --type yaml --type json "@plane/eslint-config" .eslintrc.*

# Test 2: Ensure there are no references to eslint-config-custom in any relevant files
echo "Checking for any remaining references to eslint-config-custom:"
rg --type yaml --type json --type typescript --type javascript "eslint-config-custom"

Length of output: 490


Script:

#!/bin/bash
# Description: Verify the integration of @plane/eslint-config and absence of eslint-config-custom

# Test 1: Check if @plane/eslint-config is referenced in ESLint configuration files
echo "Checking ESLint config files for @plane/eslint-config:"
rg "@plane/eslint-config" --glob "*.eslintrc.js" --glob "*.eslintrc.json" --glob "*.eslintrc.yaml" --glob "*.eslintrc.yml"

# Test 2: Ensure there are no references to eslint-config-custom in any relevant files
echo "Checking for any remaining references to eslint-config-custom:"
rg "eslint-config-custom" --glob "*.eslintrc.js" --glob "*.eslintrc.json" --glob "*.eslintrc.yaml" --glob "*.eslintrc.yml" --type js --type json --type yaml

Length of output: 942

admin/core/components/instance/instance-failure-view.tsx (1)

10-10: LGTM! Verify usage in other components.

The removal of props from the InstanceFailureView component signature is consistent with its implementation, as it doesn't use any props internally. This change simplifies the component's interface.

To ensure this change doesn't break existing usage, please run the following script to check for any occurrences where props are passed to this component:

If the script returns any results, those occurrences need to be updated to remove the props.

Verification successful

[/run_scripts]


Verified: No occurrences of InstanceFailureView with props found.

The removal of props from the InstanceFailureView component is safe and does not affect other parts of the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for usage of InstanceFailureView component with props

# Search for InstanceFailureView usage with any attributes
rg --type typescript --type typescriptreact '<InstanceFailureView\s+[^>/]*>' -g '!admin/core/components/instance/instance-failure-view.tsx'

Length of output: 176


Script:

#!/bin/bash
# Description: Check for usage of InstanceFailureView component with props

# Search for InstanceFailureView usage with any attributes in .ts and .tsx files, excluding the component's own file
rg '<InstanceFailureView\s+[^>/]*>' -g '*.ts' -g '*.tsx' -g '!admin/core/components/instance/instance-failure-view.tsx'

Length of output: 121

packages/ui/src/progress/linear-progress-indicator.tsx (1)

30-30: LGTM! Good addition of the key prop.

Adding the key prop to the div element when noTooltip is true is a great improvement. This change aligns with React's best practices for list rendering and will enhance the component's performance during updates.

Using item.id as the key is a good choice, assuming that id is unique for each item in the data array. This will help React efficiently identify which items have changed, been added, or been removed in the list of progress bar segments.

packages/eslint-config/library.js (1)

1-3: LGTM: Proper setup for project path resolution

The use of node:path and the resolve function to set up the project path is a good practice. This ensures that the tsconfig.json file is correctly located relative to the current working directory.

live/package.json (2)

11-12: LGTM: Addition of lint scripts

The addition of lint and lint:errors scripts is a good practice for maintaining code quality. These scripts will help catch potential issues in TypeScript and React TypeScript files.


Line range hint 1-62: Please clarify how changes align with PR objectives

The PR title mentions "fix: linting issues and rule changes". While the addition of lint scripts clearly addresses the linting aspect, it's not immediately clear how the TypeScript downgrade relates to the PR objectives.

Could you please provide more context on:

  1. The specific linting issues that were addressed?
  2. The rule changes mentioned in the PR title and how they relate to the TypeScript downgrade?

This information will help ensure that all changes are in line with the intended objectives of this PR.

space/package.json (3)

10-11: Improved linting scripts

The changes to the linting scripts are beneficial:

  1. The lint script now specifically targets TypeScript files (.ts and .tsx), which is more appropriate for a TypeScript project.
  2. The new lint:errors script runs ESLint in quiet mode, which is useful for CI/CD pipelines or when you want to focus only on errors.

These updates align well with the PR objective of addressing linting issues.


62-62: Adoption of custom configurations

The changes to use @plane/eslint-config and @plane/typescript-config are good improvements:

  1. They suggest a move towards standardized configurations across projects.
  2. This can lead to more consistent code style and TypeScript settings across your codebase.

These changes align well with the PR objective of addressing linting issues and improving overall code quality.

Also applies to: 64-64


65-65: Verify the TypeScript version downgrade

The TypeScript version has been downgraded from 5.4.5 to 5.3.3. This is unexpected and could potentially cause compatibility issues or lose access to newer TypeScript features.

Could you please clarify the reason for this downgrade? If it's intentional, consider adding a comment in the PR description explaining the rationale.

To verify the impact, you can run the following script:

web/core/components/project/form-loader.tsx (2)

Line range hint 8-62: Implementation looks good

The component's implementation is well-structured and appropriate for a loading placeholder. It uses a combination of nested divs and Loader components to create a skeleton UI, which is a good practice for improving perceived performance.

The use of Tailwind classes for styling is consistent and provides a responsive layout. The component doesn't rely on props or state, which aligns with its purpose as a static loading indicator.


7-7: Verify the impact of removing props from ProjectDetailsFormLoader

The removal of the IProjectDetailsFormLoader interface simplifies the component's signature. This change suggests that the component doesn't require any props to function, which is consistent with its implementation.

To ensure this change doesn't break existing usage, please run the following script:

If the script returns any results, it indicates that there might be places in the codebase where ProjectDetailsFormLoader is being used with props. In that case, those usages need to be updated to remove the props.

packages/ui/package.json (4)

20-21: LGTM: New scripts for linting and CSS processing

The addition of the lint and postcss scripts enhances the project's development workflow:

  1. The lint script allows for easy linting of TypeScript and TSX files.
  2. The postcss script enables processing of CSS files, which is beneficial for maintaining styles.

These additions align well with the PR's objective of addressing linting issues and improving the overall code quality.


61-61: LGTM: Replaced custom configs with @plane namespace configs

The removal of eslint-config-custom and tsconfig in favor of @plane/eslint-config and @plane/typescript-config is a positive change:

  1. It suggests a move towards more standardized configurations within the @plane namespace.
  2. This can lead to better consistency across different parts of the project.
  3. The change aligns well with the PR's objective of addressing linting issues and rule changes.

This refactoring should make it easier to maintain and update linting and TypeScript configurations across the project.

Also applies to: 68-68


Line range hint 1-72: Summary: Excellent improvements to linting, configuration, and development workflow

Overall, the changes to this package.json file are well-structured and align perfectly with the PR's objectives:

  1. Addition of lint and postcss scripts enhances the development workflow.
  2. Migration to @plane namespace for ESLint and TypeScript configurations promotes standardization.
  3. Updated dependencies reflect the project's evolving needs.

These changes should lead to:

  • Improved code quality through consistent linting.
  • Easier maintenance of configurations across the project.
  • Enhanced CSS processing capabilities.

The only point requiring attention is the TypeScript version downgrade, which should be verified as per the previous comment.

Great job on these improvements!


61-61: LGTM: Updated dev dependencies, but verify TypeScript version

The changes to the dev dependencies look good:

  1. Addition of @plane/eslint-config and @plane/typescript-config suggests a move towards centralized configuration, which can improve consistency across the project.
  2. These changes align with the PR's objective of addressing linting issues and rule changes.

However, there's one point that requires attention:

  • The TypeScript version has been downgraded from 5.4.5 to 5.3.3. While this might be intentional, it's worth verifying if this downgrade is necessary and won't cause any compatibility issues with other dependencies or TypeScript features used in the project.

To ensure the TypeScript version change doesn't introduce any issues, please run the following script:

This script will help identify any potential compatibility issues with the TypeScript version downgrade.

Also applies to: 68-68, 70-70

packages/editor/package.json (4)

29-29: LGTM: Addition of lint script

The addition of a lint script is a good practice for maintaining code quality. The script correctly targets TypeScript files in the src directory.


81-81: Verify the new TypeScript configuration

The change from "tsconfig" to "@plane/typescript-config" is noted. This suggests a move to a more standardized TypeScript configuration within the Plane project.

Please ensure that this change is consistent across the project and that the new TypeScript configuration meets the project's requirements. Run the following script to check for any other occurrences of the old configuration:

#!/bin/bash
# Description: Check for any remaining occurrences of the old TypeScript configuration

# Test: Search for "tsconfig" in all package.json files
rg --type json '"tsconfig"' -g 'package.json'

83-83: Clarify the TypeScript version downgrade

The TypeScript version has been downgraded from 5.4.5 to 5.3.3. This is an unusual change that might have implications on the project.

Could you please provide the rationale for this downgrade? Are there any specific compatibility issues or requirements that necessitated this change?

Also, please run the following script to check if this downgrade is consistent across the project:

#!/bin/bash
# Description: Check for TypeScript version inconsistencies

# Test: Search for TypeScript version declarations in all package.json files
rg --type json '"typescript": "' -g 'package.json'

This will help ensure that all parts of the project are using the same TypeScript version.


78-78: Verify the new eslint configuration

The change from "eslint-config-custom" to "@plane/eslint-config" is noted. This suggests a move to a more standardized eslint configuration within the Plane project.

Please ensure that this change is consistent across the project and that the new eslint configuration meets the project's linting requirements. Run the following script to check for any other occurrences of the old configuration:

Verification successful

Eslint Configuration Successfully Updated

All instances of "eslint-config-custom" have been removed from the project's package.json files and replaced with "@plane/eslint-config". The eslint configuration update is consistent across the entire project and meets the project's linting requirements.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining occurrences of the old eslint configuration

# Test: Search for "eslint-config-custom" in all package.json files
rg --type json '"eslint-config-custom"' -g 'package.json'

Length of output: 139


Script:

#!/bin/bash
# Description: Check for any remaining occurrences of the old eslint configuration

# Test: Search for "eslint-config-custom" in all package.json files
rg --type json '"eslint-config-custom"' -g 'package.json'

Length of output: 57


Script:

#!/bin/bash
# Description: Check for any remaining occurrences of "eslint-config-custom" in dependencies and devDependencies of all package.json files

# Find all package.json files and check for "eslint-config-custom" in dependencies or devDependencies
fd 'package.json' . -x sh -c '
  echo "Checking $1"
  jq -e \'(.dependencies | has("eslint-config-custom")) or (.devDependencies | has("eslint-config-custom"))\' "$1" >/dev/null
  if [ $? -eq 0 ]; then
    echo "Found \"eslint-config-custom\" in $1"
  fi
' sh {}

Length of output: 262


Script:

#!/bin/bash
# Description: Check for any remaining occurrences of "eslint-config-custom" in dependencies and devDependencies of all package.json files

# Find all package.json files and check for "eslint-config-custom" in dependencies or devDependencies
fd 'package.json' . -x sh -c "
  echo \"Checking \$1\"
  jq -e '(.dependencies | has(\"eslint-config-custom\")) or (.devDependencies | has(\"eslint-config-custom\"))' \"\$1\" >/dev/null
  if [ \$? -eq 0 ]; then
    echo \"Found \\\"eslint-config-custom\\\" in \$1\"
  fi
" sh {}

Length of output: 796

web/package.json (2)

84-84: Request clarification on TypeScript version downgrade.

The TypeScript version has been downgraded from 5.4.5 to 5.3.3. This is an unusual change that doesn't seem to align directly with the PR objectives of fixing linting issues and changing rules.

Could you please provide the rationale for this downgrade? There might be potential impacts:

  1. Loss of newer TypeScript features or improvements.
  2. Possible compatibility issues with other dependencies.

To help assess the impact, please run the following script:

This script will help identify any usage of TypeScript 5.4-specific features and check for any new type errors introduced by the downgrade.


80-80: Approve ESLint config change with verification suggestion.

The switch from eslint-config-custom to @plane/eslint-config is a good move towards using a shared, project-specific ESLint configuration. This change aligns with the PR objective of updating linting rules and can help maintain consistency across the project.

To ensure this change is reflected in the ESLint configuration, please run the following script:

This script will help verify that the new ESLint configuration is properly referenced in the project's ESLint setup.

Verification successful

ESLint configuration successfully updated and old config removed.
All instances now use @plane/eslint-config, and eslint-config-custom has been fully removed from the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the ESLint configuration is using @plane/eslint-config

# Test: Search for @plane/eslint-config in ESLint configuration files
rg --type json --type yaml '@plane/eslint-config' .eslintrc*

Length of output: 331


Script:

#!/bin/bash
# Description: Verify the ESLint configuration is using @plane/eslint-config

# Test: Search for @plane/eslint-config in ESLint configuration files
rg --type json --type yaml --type js '"@plane/eslint-config"' .eslintrc.*

Length of output: 129


Script:

#!/bin/bash
# Description: Search for @plane/eslint-config in package.json and other potential ESLint configuration files

# Search in package.json
rg '"@plane/eslint-config"' package.json

# Search in other ESLint configuration files, if any exist
rg '"@plane/eslint-config"' .

Length of output: 430


Script:

#!/bin/bash
# Description: Ensure that eslint-config-custom has been completely removed from the codebase

# Search for any occurrences of "eslint-config-custom" in package.json and ESLint configuration files
rg '"eslint-config-custom"' package.json .eslintrc.* eslintConfig

Length of output: 174

packages/eslint-config/next.js (2)

1-13: LGTM: Initial setup and configuration look good

The initial setup and configuration are well-structured and appropriate for a Next.js TypeScript project. Good practices are followed, such as using 'node:path' for Node.js built-in modules and extending relevant configurations.


34-40: React rules look good, clarification needed on Next.js rules

The React-specific rules are well-configured and promote good practices. Setting 'react-hooks/exhaustive-deps' to 'warn' is a good balance between catching issues and not being too restrictive.

Could you provide the rationale for turning off the Next.js specific rules '@next/next/no-html-link-for-pages' and '@next/next/no-img-element'? These rules are typically recommended for Next.js projects. If there's a specific reason for disabling them, it would be helpful to add comments explaining why. Otherwise, consider enabling them:

-    "@next/next/no-html-link-for-pages": "off",
-    "@next/next/no-img-element": "off",
+    "@next/next/no-html-link-for-pages": "error",
+    "@next/next/no-img-element": "error",

To verify the impact of these rules, you can run the following commands:

#!/bin/bash
# Search for <a> tags with href attributes
rg --type typescript --type javascript '<a\s+[^>]*href\s*=\s*["\'][^"\']*["\']'

# Search for <img> tags
rg --type typescript --type javascript '<img\s+[^>]*>'

This will help identify any instances where these rules might flag issues, allowing you to make an informed decision about whether to keep them disabled or not.

web/app/[workspaceSlug]/(projects)/sidebar.tsx (1)

24-24: LGTM! Verify component usage after prop type removal.

The removal of the IAppSidebar interface and the simplification of the component signature look good. This change suggests that the component no longer expects any props, which can simplify its usage.

To ensure this change doesn't break any existing usage of the component, please run the following script:

If the script returns any results, it means there are places in the codebase where AppSidebar is still being used with props, which may need to be updated.

web/core/components/analytics/custom-analytics/select-bar.tsx (1)

Line range hint 14-93: Component functionality remains intact.

I've verified that the changes in the import section do not affect the functionality or structure of the CustomAnalyticsSelectBar component. All necessary imports are still available and correctly used within the component.

packages/editor/src/core/types/editor.ts (1)

Line range hint 69-102: Verify the impact of interface to type alias changes.

The changes from interfaces to type aliases for ILiteTextEditor, ILiteTextReadOnlyEditor, and IRichTextReadOnlyEditor improve code simplicity and maintainability. However, it's important to ensure that these changes don't have unintended consequences in the broader codebase.

Please run the following script to check for any potential issues:

This script will help identify any potential issues that might arise from changing these interfaces to type aliases. Please review any results carefully to ensure compatibility with the changes.

Verification successful

Verified: No issues found with the interface to type alias changes.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for potential issues related to the interface to type alias changes

# Test 1: Check for any 'implements' clauses using these types
echo "Checking for 'implements' clauses:"
rg --type typescript "implements\s+(ILiteTextEditor|ILiteTextReadOnlyEditor|IRichTextReadOnlyEditor)"

# Test 2: Check for any type assertions or 'instanceof' checks
echo "Checking for type assertions or 'instanceof' checks:"
rg --type typescript "(as\s+(ILiteTextEditor|ILiteTextReadOnlyEditor|IRichTextReadOnlyEditor)|instanceof\s+(ILiteTextEditor|ILiteTextReadOnlyEditor|IRichTextReadOnlyEditor))"

# Test 3: Check for any usage of these types with indexed access
echo "Checking for indexed access on these types:"
rg --type typescript "(ILiteTextEditor|ILiteTextReadOnlyEditor|IRichTextReadOnlyEditor)\[.+\]"

echo "If any of the above checks return results, please review those occurrences to ensure compatibility with the type alias changes."

Length of output: 1050


Script:

#!/bin/bash
# Description: Check for potential issues related to the interface to type alias changes without using --type

# Test 1: Check for any 'implements' clauses using these types
echo "Checking for 'implements' clauses in .ts and .tsx files:"
rg "implements\s+(ILiteTextEditor|ILiteTextReadOnlyEditor|IRichTextReadOnlyEditor)" --glob "*.ts" --glob "*.tsx"

# Test 2: Check for any type assertions or 'instanceof' checks
echo "Checking for type assertions or 'instanceof' checks in .ts and .tsx files:"
rg "(as\s+(ILiteTextEditor|ILiteTextReadOnlyEditor|IRichTextReadOnlyEditor)|instanceof\s+(ILiteTextEditor|ILiteTextReadOnlyEditor|IRichTextReadOnlyEditor))" --glob "*.ts" --glob "*.tsx"

# Test 3: Check for any usage of these types with indexed access
echo "Checking for indexed access on these types in .ts and .tsx files:"
rg "(ILiteTextEditor|ILiteTextReadOnlyEditor|IRichTextReadOnlyEditor)\[.+\]" --glob "*.ts" --glob "*.tsx"

echo "If any of the above checks return results, please review those occurrences to ensure compatibility with the type alias changes."

Length of output: 1110

packages/editor/src/core/hooks/use-read-only-editor.ts (2)

98-102: Improved code conciseness

The refactoring of getDocumentInfo to a single-line arrow function improves code readability while maintaining the same functionality. The use of optional chaining and nullish coalescing operators is preserved, which is excellent for handling potential undefined values.


Line range hint 1-130: Overall assessment: Successful code style improvements

The changes in this file successfully address the PR objectives of fixing linting issues and implementing rule changes. The refactoring of getDocumentInfo and getHeadings methods improves code conciseness and readability without altering functionality. These modifications contribute to a more consistent and maintainable codebase.

No security issues or performance concerns were introduced, and the core functionality remains intact. Great job on improving the code quality!

live/src/core/extensions/index.ts (1)

57-57: Approve minor formatting changes

The removal of trailing commas in function calls and log messages at lines 57, 127, 141, and 146 improves code consistency and likely aligns with the project's coding standards.

These changes are purely stylistic and don't affect the functionality of the code. They contribute to a more uniform code style across the project.

Also applies to: 127-127, 141-141, 146-146

packages/ui/src/emoji/emoji-icon-picker.tsx (2)

105-105: LGTM: Improved closing mechanism

The change from close() to handleToggle(false) is a good improvement. It provides more flexibility and consistency with the component's API, allowing the parent component to have more control over the closing behavior.


124-124: LGTM: Consistent improvement in closing mechanism

This change mirrors the improvement made in the emoji selection, applying the same handleToggle(false) approach to icon selection. This ensures consistent behavior across both emoji and icon selections, which is excellent for maintaining a predictable user experience.

packages/editor/src/core/extensions/table/table/table.ts (1)

247-247: Consider using a more specific type instead of any

While using any as a type assertion may resolve immediate TypeScript errors, it reduces type safety and goes against TypeScript best practices. This change might lead to potential runtime errors if incompatible decoration types are passed, and it reduces TypeScript's ability to catch type-related errors at compile-time.

Consider the following alternatives:

  1. Use the correct specific type for decorations if known. This maintains type safety and helps catch errors early.

  2. If the exact type is unknown or complex, consider using unknown instead of any. This still requires explicit type checking or assertion before use, providing a safer alternative to any.

  3. If decorations can be of multiple specific types, use a union type instead of any.

Example:

return new TableView(node, cellMinWidth, decorations as DecorationSet | undefined, editor, getPos as () => number);

Replace DecorationSet with the actual type or union of types that decorations can be.

To help determine the correct type for decorations, you can run the following script to find its usage and type information:

This will help identify the expected type for the decorations parameter in TableView.

packages/editor/src/core/hooks/use-editor.ts (3)

85-85: LGTM: Simplified mentionHighlights assignment

The direct assignment of mentionHandler.highlights to mentionHighlights improves code clarity by removing unnecessary default value assignment. This change aligns well with the PR's objective of addressing linting issues and rule changes.


173-173: LGTM: Concise getHeadings implementation

The getHeadings method has been refactored to use a more concise arrow function syntax. This change enhances code readability while maintaining the same functionality. It's in line with modern JavaScript best practices and the PR's goal of addressing linting issues.


Line range hint 1-285: Overall assessment: Improvements in code quality and readability

The changes in this file successfully address the PR objectives of fixing linting issues and implementing rule changes. The modifications enhance code readability, maintainability, and align with modern JavaScript best practices. No major issues were identified, and the functionality appears to be preserved.

Great job on these improvements!

Comment on lines +5 to +7
"parserOptions": {
"project": true
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider specifying the tsconfig.json path

Setting "project": true in parserOptions is correct and allows the parser to use TypeScript's project configuration. This is necessary for TypeScript-specific rules that require type information.

However, for larger projects, this can significantly slow down linting. For better performance, consider explicitly specifying the path to your tsconfig.json file.

You could optimize this by changing the configuration to:

"parserOptions": {
  "project": "./tsconfig.json"
}

Replace "./tsconfig.json" with the actual path to your TypeScript configuration file if it's located elsewhere.

},
],
extends: ["@plane/eslint-config/library.js"],
parser: "@typescript-eslint/parser",
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

Missing @plane/eslint-config Dependency

The @plane/eslint-config package is not listed in your package.json and is not installed in node_modules. This is required for the ESLint configuration to function correctly.

  • Add @plane/eslint-config to your package.json dependencies.
  • Run npm install to install the necessary packages.
Analysis chain

Approve the addition of TypeScript parser

The addition of "@typescript-eslint/parser" as the parser is a good step towards supporting TypeScript in the project. This will allow ESLint to understand and lint TypeScript syntax.

To ensure the TypeScript setup is correct, please run the following command:

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify TypeScript configuration
if [ -f "tsconfig.json" ]; then
    echo "tsconfig.json exists. Content:"
    cat tsconfig.json
else
    echo "tsconfig.json not found. Please check the TypeScript setup."
fi

# Check for TypeScript dependencies
npm ls typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin

Length of output: 230


Script:

#!/bin/bash
# Check if @plane/eslint-config is listed in package.json
if grep -q '"@plane/eslint-config"' package.json; then
    echo "@plane/eslint-config is listed in package.json."
else
    echo "@plane/eslint-config is not listed in package.json. Please add it as a dependency."
fi

# Verify if @plane/eslint-config is installed in node_modules
if [ -d "node_modules/@plane/eslint-config" ]; then
    echo "@plane/eslint-config is installed."
    
    # Check if library.js exists within @plane/eslint-config
    if [ -f "node_modules/@plane/eslint-config/library.js" ]; then
        echo "library.js exists within @plane/eslint-config."
    else
        echo "library.js does not exist within @plane/eslint-config."
    fi
else
    echo "@plane/eslint-config is not installed. Please run 'npm install'."
fi

Length of output: 414

Comment on lines +1 to +11
module.exports = {
extends: ["eslint:recommended"],
env: {
node: true,
es6: true,
},
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider enhancing the configuration with additional rules and plugins.

While this configuration provides a good foundation, there are opportunities to enhance it further:

  1. Add more specific rules tailored to your project's coding standards.
  2. Consider using additional plugins for more comprehensive linting.
  3. If applicable, integrate with a code formatter like Prettier.

Here's an example of how you might enhance the configuration:

module.exports = {
  extends: [
    "eslint:recommended",
    "plugin:node/recommended",
    "plugin:prettier/recommended"
  ],
  env: {
    node: true,
    es2022: true,
  },
  parserOptions: {
    ecmaVersion: "latest",
    sourceType: "module",
  },
  rules: {
    // Add any custom rules here
    "no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
    "no-console": ["warn", { allow: ["warn", "error"] }],
  },
};

This example adds the node and prettier plugins, and includes some custom rules. Adjust according to your project's needs.

Comment on lines +3 to +6
env: {
node: true,
es6: true,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Update environment settings for clarity and consistency.

The current env settings are correct, but they can be improved for clarity and consistency with modern ECMAScript versions.

Consider updating the env section as follows:

 env: {
   node: true,
-  es6: true,
+  es2022: true,  // or the latest ECMAScript version you're targeting
 },

This change aligns better with the ecmaVersion: "latest" setting in parserOptions and explicitly states which ECMAScript features are available in the environment.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
env: {
node: true,
es6: true,
},
env: {
node: true,
es2022: true, // or the latest ECMAScript version you're targeting
},

Comment on lines +1 to +2
module.exports = {
extends: ["eslint:recommended"],
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider extending from additional Node.js-specific presets.

While using "eslint:recommended" is a good start, for a server-side configuration, you might want to consider extending from additional presets specific to Node.js environments. This can help catch more Node.js-specific issues and enforce best practices.

Consider adding the following to the extends array:

 module.exports = {
-  extends: ["eslint:recommended"],
+  extends: [
+    "eslint:recommended",
+    "plugin:node/recommended"
+  ],
   // ... rest of the configuration
 };

Note: You'll need to install the eslint-plugin-node package if you haven't already.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
module.exports = {
extends: ["eslint:recommended"],
module.exports = {
extends: [
"eslint:recommended",
"plugin:node/recommended"
],

Comment on lines +48 to +49
// TODO: Fix this lint error.
// eslint-disable-next-line no-async-promise-executor
Copy link
Contributor

Choose a reason for hiding this comment

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

Refactor to address the linting issue properly

The added TODO comment and eslint-disable directive indicate a known linting issue with the use of an async executor in a Promise constructor. While the eslint-disable comment temporarily suppresses the error, it's better to refactor the code to address the underlying issue.

Consider refactoring the code to avoid using an async executor in the Promise constructor. Here's a suggested approach:

return Promise.resolve().then(async () => {
  try {
    let fetchedData = null;
    if (documentType === "project_page") {
      fetchedData = await fetchPageDescriptionBinary(
        params,
        pageId,
        cookie
      );
    } else {
      fetchedData = await fetchDocument({
        cookie,
        documentType,
        pageId,
        params,
      });
    }
    return fetchedData;
  } catch (error) {
    manualLogger.error("Error in fetching document", error);
    throw error; // Re-throw the error to be consistent with Promise rejection
  }
});

This refactoring wraps the async logic in a Promise.resolve().then() chain, which is a more idiomatic way to handle asynchronous operations in Promises. It also properly propagates errors by re-throwing them, ensuring that the Promise is rejected if an error occurs.

Comment on lines +87 to +88
// TODO: Fix this lint error.
// eslint-disable-next-line no-async-promise-executor
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

Refactor multiple async Promise executors and review similar patterns

Two instances of async Promise executors were found in live/src/core/extensions/index.ts:

  1. return new Promise(async (resolve) => {
  2. return new Promise(async () => {

Both instances use async functions within Promise constructors, which violates the no-async-promise-executor ESLint rule. Refactor these to eliminate the use of async executors and ensure proper error handling.

Analysis chain

Refactor to address the linting issue and review similar patterns

Similar to the previous instance, this code segment uses an async executor in a Promise constructor, which is flagged by the linter. The added TODO comment and eslint-disable directive are temporary solutions that should be replaced with a proper refactor.

  1. Refactor this code segment similarly to the previous suggestion:
return Promise.resolve().then(async () => {
  try {
    if (documentType === "project_page") {
      await updatePageDescription(params, pageId, state, cookie);
    } else {
      await updateDocument({
        cookie,
        documentType,
        pageId,
        params,
        updatedDescription: state,
      });
    }
  } catch (error) {
    manualLogger.error("Error in updating document:", error);
    throw error; // Re-throw the error to be consistent with Promise rejection
  }
});
  1. Conduct a broader review of the codebase for similar patterns. This recurring issue suggests that there might be other instances of this anti-pattern that need addressing.

To help identify other instances of this pattern in the codebase, you can run the following command:

This will help locate other occurrences of this pattern that may need refactoring.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for async Promise executors in TypeScript files
rg --type typescript 'new Promise\(async' -C 3

Length of output: 83


Script:

#!/bin/bash
# Search for async Promise executors in TypeScript files
rg --type ts 'new Promise\(async' -C 3

Length of output: 1076

Comment on lines +120 to 132
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
step.from !== undefined &&
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
step.to !== undefined &&
oldNodes.some(
(node) =>
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
node.pos >= step.from &&
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

Improve type safety and code consistency

The addition of undefined checks for step.from and step.to is a good defensive programming practice. However, there are a few points to consider:

  1. The use of @ts-ignore comments is generally discouraged as it masks potential type-related issues. Consider using proper type assertions or fixing the underlying type problems instead.

  2. The indentation of the added lines is inconsistent with the surrounding code, which affects readability.

  3. A more type-safe approach to handling the step object could be beneficial.

Consider refactoring the code as follows:

  1. Replace @ts-ignore with proper type handling:
interface Step {
  from?: number;
  to?: number;
}

// ...

transaction.steps.some((step: Step) =>
  step.from !== undefined &&
  step.to !== undefined &&
  oldNodes.some(
    (node) =>
      node.pos >= step.from &&
      node.pos + node.node.nodeSize <= step.to
  )
)
  1. Adjust the indentation to match the surrounding code:
transaction.steps.some(
  (step: Step) =>
    step.from !== undefined &&
    step.to !== undefined &&
    oldNodes.some(
      (node) =>
        node.pos >= step.from &&
        node.pos + node.node.nodeSize <= step.to
    )
)
  1. Consider using a type guard function for a more robust type-safe approach:
function isValidStep(step: any): step is { from: number; to: number } {
  return typeof step.from === 'number' && typeof step.to === 'number';
}

// ...

transaction.steps.some(
  (step) =>
    isValidStep(step) &&
    oldNodes.some(
      (node) =>
        node.pos >= step.from &&
        node.pos + node.node.nodeSize <= step.to
    )
)

These changes will improve type safety, code consistency, and readability.

Comment on lines +28 to 34
// TODO: convert them to objects instead of enums
enum badgeSizeStyling {
sm = `px-2.5 py-1 font-medium text-xs rounded flex items-center gap-1.5 whitespace-nowrap transition-all justify-center inline`,
md = `px-4 py-1.5 font-medium text-sm rounded flex items-center gap-1.5 whitespace-nowrap transition-all justify-center inline`,
lg = `px-4 py-2 font-medium text-sm rounded flex items-center gap-1.5 whitespace-nowrap transition-all justify-center inline`,
xl = `px-5 py-3 font-medium text-sm rounded flex items-center gap-1.5 whitespace-nowrap transition-all justify-center inline`,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider converting enum to an object and refactor styling

The TODO comment suggests converting this enum to an object, which is a good idea. Objects are more flexible and easier to maintain than enums in TypeScript, especially for storing complex string values.

Additionally, consider breaking down the long styling strings into smaller, reusable classes. This would improve readability and maintainability.

Here's a suggested refactor:

const badgeSizeStyling = {
  sm: {
    padding: 'px-2.5 py-1',
    font: 'font-medium text-xs',
    layout: 'rounded flex items-center gap-1.5 whitespace-nowrap transition-all justify-center inline'
  },
  md: {
    padding: 'px-4 py-1.5',
    font: 'font-medium text-sm',
    layout: 'rounded flex items-center gap-1.5 whitespace-nowrap transition-all justify-center inline'
  },
  // ... similar for lg and xl
} as const;

// Usage
const getBadgeStyle = (size: keyof typeof badgeSizeStyling) => 
  Object.values(badgeSizeStyling[size]).join(' ');

This approach allows for easier modifications and better type inference.

Comment on lines +36 to 42
// TODO: convert them to objects instead of enums
enum badgeIconStyling {
sm = "h-3 w-3 flex justify-center items-center overflow-hidden flex-shrink-0",
md = "h-3.5 w-3.5 flex justify-center items-center overflow-hidden flex-shrink-0",
lg = "h-4 w-4 flex justify-center items-center overflow-hidden flex-shrink-0",
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
xl = "h-4 w-4 flex justify-center items-center overflow-hidden flex-shrink-0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Convert enum to an object and address the duplicate value issue

As with the previous enum, converting this to an object would be beneficial. This would also solve the issue with the duplicate value for 'xl' size, eliminating the need for the eslint-disable comment.

Here's a suggested refactor:

const badgeIconStyling = {
  sm: "h-3 w-3 flex justify-center items-center overflow-hidden flex-shrink-0",
  md: "h-3.5 w-3.5 flex justify-center items-center overflow-hidden flex-shrink-0",
  lg: "h-4 w-4 flex justify-center items-center overflow-hidden flex-shrink-0",
  xl: "h-4 w-4 flex justify-center items-center overflow-hidden flex-shrink-0"
} as const;

// Usage
const getIconStyle = (size: keyof typeof badgeIconStyling) => badgeIconStyling[size];

This approach resolves the duplicate value issue without needing an eslint-disable comment and provides better type safety and flexibility.

@sriramveeraghanta sriramveeraghanta merged commit 83bfca6 into preview Sep 23, 2024
12 of 14 checks passed
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.

4 participants