Skip to content

Conversation

@Dagdon
Copy link

@Dagdon Dagdon commented Jun 2, 2025

Fixed the eslint bug.

Summary by CodeRabbit

  • Chores
    • Improved linting configuration for better TypeScript support, including enhanced handling of unused variables and type-only imports.
    • Updated linting rules for story and test files to better accommodate TypeScript variants.
    • Minor formatting adjustments to linting rules for improved readability.
    • Updated development dependencies for TypeScript ESLint tooling and ESLint.
    • Added a new npm script to automate build before publishing.
    • Reformatted color token exports for consistent styling.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 2, 2025

"""

Walkthrough

The ESLint configuration was updated to introduce TypeScript-specific overrides, including parser, parserOptions, plugins, extends, and rules for .ts and .tsx files. Story and test file overrides were expanded to cover TypeScript variants, with adjustments to TypeScript-specific rule enforcement. Minor formatting changes were also applied to the main rules section. The package.json was updated with a new prepublishOnly script, build script environment variable handling was changed to use cross-env, and ESLint and TypeScript ESLint plugin dependencies were upgraded. The tsconfig.json file had a trailing newline removed and added a compiler option. The colors.tokens.js file was reformatted for consistent quoting and key style without changing content.

Changes

File(s) Change Summary
.eslintrc.cjs Added TypeScript override with parser, parserOptions, plugins, extends, and rules. Extended story/test overrides to include .ts/.tsx files with specific rule disables. Reformatted some rules and removed a comment.
package.json Added prepublishOnly script, updated build script to use cross-env for NODE_OPTIONS, upgraded ESLint and TypeScript ESLint plugin versions, added @typescript-eslint/parser dependency.
tsconfig.json Added "verbatimModuleSyntax": false compiler option, removed trailing newline, and added trailing comma after "types" array.
styles/jsTokens/colors.tokens.js Reformatted export object keys to quoted style and string values to double quotes; no changes to data or logic.

Sequence Diagram(s)

sequenceDiagram
    participant ESLint
    participant TypeScriptFile
    participant TypeScriptParser
    participant TypeScriptPlugin

    ESLint->>TypeScriptFile: Detects .ts/.tsx file
    ESLint->>TypeScriptParser: Uses @typescript-eslint/parser
    ESLint->>TypeScriptPlugin: Applies @typescript-eslint rules
    TypeScriptPlugin-->>ESLint: Enforces TypeScript-specific linting
    ESLint-->>TypeScriptFile: Reports results with custom rule handling
Loading

Possibly related PRs

  • Refactor Token Gen #1059: Reformats colors.tokens.js export object similarly, indicating a direct relation in modifying the color tokens file's syntax style.

Suggested labels

automerge

Suggested reviewers

  • kotAPI

Poem

In the warren where TypeScript hops,
ESLint now knows all the stops.
With plugins and rules, so tidy and neat,
No unused vars hide under our feet.
Stories and tests in TS join the fun—
Linting for everybun! 🐇✨
"""

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error https://github.com/npm/cli/issues
npm error A complete log of this run can be found in: /.npm/_logs/2025-06-06T11_55_31_082Z-debug-0.log


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 81ae8ef and 2d0370d.

📒 Files selected for processing (2)
  • .eslintrc.cjs (4 hunks)
  • tsconfig.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • tsconfig.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • .eslintrc.cjs
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f1480f2 and 41146d7.

📒 Files selected for processing (1)
  • .eslintrc.cjs (4 hunks)
🔇 Additional comments (3)
.eslintrc.cjs (3)

47-47: Good extension of story files configuration for TypeScript support.

The changes appropriately:

  • Extend the file patterns to include TypeScript story files (.stories.ts, .stories.tsx)
  • Disable TypeScript-specific rules that might be too restrictive for story files
  • Maintain consistency with the existing JavaScript story file configuration

This ensures TypeScript story files have the same linting flexibility as JavaScript ones.

Also applies to: 50-51


59-59: Proper extension of test files configuration for TypeScript.

The changes correctly:

  • Include TypeScript test file patterns (.test.ts, .test.tsx)
  • Disable the TypeScript-specific no-unused-vars rule for test files where unused variables are common
  • Maintain parity with the existing JavaScript test file configuration

This provides appropriate linting flexibility for TypeScript test files.

Also applies to: 63-63


119-119: Minor formatting improvements applied.

The formatting changes improve code consistency:

  • The semi rule is now in a more concise single-line format
  • Removed an unnecessary comment from the jsx-a11y/no-autofocus rule
  • Minor formatting cleanup

These changes don't affect functionality but improve readability.

Also applies to: 139-139, 152-152

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: 2

🧹 Nitpick comments (1)
package.json (1)

105-107: ESLint & TypeScript ESLint dependency updates
You’ve added @typescript-eslint/eslint-plugin/@typescript-eslint/parser and bumped eslint to match your .eslintrc.cjs overrides. Ensure your ESLint config points to the new parser/plugin versions.

Consider using more constrained version ranges (e.g., "~8.33.1") or documenting the minimum required versions for reproducible CI builds.

Also applies to: 110-110

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 41146d7 and 674ae6a.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • package.json (5 hunks)
  • tsconfig.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • tsconfig.json
🔇 Additional comments (2)
package.json (2)

3-3: Version bump is correct
The package version has been updated from 0.0.43 to 0.0.44, aligning with the new release.


41-41: Reordered Theme export for consistency
Moving Theme to follow TextArea is a harmless, stylistic adjustment and maintains alphabetical or logical grouping.

@kotAPI
Copy link
Collaborator

kotAPI commented Jun 3, 2025

merge conflicts

@Dagdon
Copy link
Author

Dagdon commented Jun 3, 2025

merge conflicts

I will look into it.

@Dagdon
Copy link
Author

Dagdon commented Jun 3, 2025

merge conflicts

@kotAPI resolved. Please, look into it and give me feedback, thank you.

@Dagdon
Copy link
Author

Dagdon commented Jun 5, 2025

@kotAPI
Hello, please, what's the update on this?

.eslintrc.cjs Outdated
files: ['**/*.test.js', '**/*.test.jsx', '**/*.test.ts', '**/*.test.tsx'],
rules: {
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'off', // Add this for TS test files
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe let this rule be?

.eslintrc.cjs Outdated
files: ['**/*.stories.js', '**/*.stories.jsx', '**/*.stories.ts', '**/*.stories.tsx'],
rules: {
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'off', // Add this for TS story files
Copy link
Collaborator

Choose a reason for hiding this comment

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

lets not update any of the rules?
we want to keep these on

Copy link
Author

Choose a reason for hiding this comment

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

@kotAPI I have fixed it.

@kotAPI
Copy link
Collaborator

kotAPI commented Jun 5, 2025

@kotAPI Hello, please, what's the update on this?

Hello, the issue that we got on storybook regarding the Meta still stands right?
#686

From the PR, you've just updated a couple of rules and turned off rules - we're looking for a more permanent solution/better code quality. We don't want the problem to disappear. I hope I'm clear.

@Dagdon
Copy link
Author

Dagdon commented Jun 5, 2025

@kotAPI Hello, please, what's the update on this?

Hello, the issue that we got on storybook regarding the Meta still stands right? #686

From the PR, you've just updated a couple of rules and turned off rules - we're looking for a more permanent solution/better code quality. We don't want the problem to disappear. I hope I'm clear.

I actually updated some rules to avoid giving that error, but you just asked me to turn it off "no unused var in story".

Does my code have an issue? Isn't the fix enough?

@kotAPI
Copy link
Collaborator

kotAPI commented Jun 5, 2025

@kotAPI Hello, please, what's the update on this?

Hello, the issue that we got on storybook regarding the Meta still stands right? #686
From the PR, you've just updated a couple of rules and turned off rules - we're looking for a more permanent solution/better code quality. We don't want the problem to disappear. I hope I'm clear.

I actually updated some rules to avoid giving that error, but you just asked me to turn it off "no unused var in story".

Does my code have an issue? Isn't the fix enough?

What about the original Meta issue?

@Dagdon
Copy link
Author

Dagdon commented Jun 5, 2025

@kotAPI Hello, please, what's the update on this?

Hello, the issue that we got on storybook regarding the Meta still stands right? #686
From the PR, you've just updated a couple of rules and turned off rules - we're looking for a more permanent solution/better code quality. We don't want the problem to disappear. I hope I'm clear.

I actually updated some rules to avoid giving that error, but you just asked me to turn it off "no unused var in story".
Does my code have an issue? Isn't the fix enough?

What about the original Meta issue?

Okay, I am understanding you now. I will figure a way around it and get back to you on it after it's fixed.

Dagdon added 2 commits June 6, 2025 12:45
Merge branch 'eslint-bug' of github.com:Dagdon/ui into eslint-bug
@kotAPI
Copy link
Collaborator

kotAPI commented Jun 6, 2025

@Dagdon sorry, I dont think you understood the issue - we are looking for code to be updated - not ignore issues on eslint config

One Q - Can you find a solution to use storybook files without making changes to eslint config?

Only core contributors to the library are allowed to make eslint changes

@Dagdon
Copy link
Author

Dagdon commented Jun 6, 2025

@Dagdon sorry, I dont think you understood the issue - we are looking for code to be updated - not ignore issues on eslint config

One Q - Can you find a solution to use storybook files without making changes to eslint config?

Only core contributors to the library are allowed to make eslint changes

This is a much better explanation, all my thoughts was that you didn't want me to turn off the unused vars rules. So, am I udating just the code of the file with meta issues or together with other files? If there are other files, what files?

@kotAPI
Copy link
Collaborator

kotAPI commented Jun 6, 2025

@Dagdon sorry, I dont think you understood the issue - we are looking for code to be updated - not ignore issues on eslint config
One Q - Can you find a solution to use storybook files without making changes to eslint config?
Only core contributors to the library are allowed to make eslint changes

This is a much better explanation, all my thoughts was that you didn't want me to turn off the unused vars rules. So, am I udating just the code of the file with meta issues or together with other files? If there are other files, what files?

As I mentioned, we are going off-track here. Maintainers reserve the access to update eslint config - for someone's first contribution - an eslint config change is probably not in good faith. You haven't understood the exact issue to solve and I feel this is not good use of everyone's time. Will be closing the PR

@kotAPI kotAPI closed this Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants