Skip to content

chore: update dev deps and fix lint errors #380

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

Merged
merged 2 commits into from
Apr 4, 2025
Merged

Conversation

ota-meshi
Copy link
Owner

@ota-meshi ota-meshi commented Apr 4, 2025

Summary by CodeRabbit

  • Refactor
    • Streamlined code structure and type handling for improved maintainability.
    • Adjusted component binding behavior to standardize interactions.
  • Chore
    • Revamped the linting configuration for clearer, more direct setup.
    • Upgraded developer dependencies to incorporate the latest improvements.
  • Tests
    • Cleaned up test annotations to enhance clarity during development.

These improvements bolster overall consistency and tooling reliability, contributing to a smoother development experience.

Copy link

changeset-bot bot commented Apr 4, 2025

⚠️ No Changeset found

Latest commit: 0c64a29

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

coderabbitai bot commented Apr 4, 2025

Walkthrough

This pull request refactors several parts of the codebase. It removes the usage of Vue’s v-model by deleting the model property in a component, updates the ESLint configuration by replacing the compatibility layer with direct plugin calls, and revises type imports across multiple files to consistently use the AST namespace. Additionally, dependency versions in package.json have been updated and some extraneous ESLint disable comments in tests have been removed.

Changes

File(s) Change Summary
docs/.vitepress/theme/components/.../EslintPluginEditor.vue Removed the model property, discontinuing the use of v-model on the code prop.
eslint.config.mjs, package.json Replaced the FlatCompat approach with myPlugin.config() and tseslint.config(); updated plugin versions and added the typescript-eslint dependency.
src/rules/no-invalid.ts, src/types.ts, src/utils/ast/js/index.ts, src/utils/ast/js/utils.ts Updated type imports and function signatures to use the AST namespace instead of individual ESLint types.
tests/src/utils/ast/js.ts Modified type imports and parameter types to use the AST namespace for ESLint types.
tests/src/rules/no-invalid.ts, tests/utils/utils.ts Removed or simplified ESLint disable comments related to extraneous require/import rules.

Poem

I'm a rabbit of code, hopping with glee,
Nibbling away bugs so gracefully.
I cleaned out the model and refactored the type,
Updated configs so they’re now just right.
With plugins and dependencies all set anew,
I celebrate these changes with a joyful "woo-hoo!"
Hop on, and let the clean code bloom!

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.

src/types.ts

Oops! Something went wrong! :(

ESLint: 9.23.0

Error: Cannot find module '/node_modules/eslint-plugin-json-schema-validator/lib/index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (node:internal/modules/cjs/loader:493:19)
at Module._findPath (node:internal/modules/cjs/loader:794:18)
at Module._resolveFilename (node:internal/modules/cjs/loader:1234:27)
at Module._load (node:internal/modules/cjs/loader:1074:27)
at TracingChannel.traceSync (node:diagnostics_channel:315:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
at Module.require (node:internal/modules/cjs/loader:1339:12)
at require (node:internal/modules/helpers:135:16)
at requireFromCwd (/node_modules/@ota-meshi/eslint-plugin/lib/utils/module.js:23:12)
at files.files (/node_modules/@ota-meshi/eslint-plugin/lib/config-builder/plugins/json-schema.js:10:80)

eslint.config.mjs

Oops! Something went wrong! :(

ESLint: 9.23.0

Error: Cannot find module '/node_modules/eslint-plugin-json-schema-validator/lib/index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (node:internal/modules/cjs/loader:493:19)
at Module._findPath (node:internal/modules/cjs/loader:794:18)
at Module._resolveFilename (node:internal/modules/cjs/loader:1234:27)
at Module._load (node:internal/modules/cjs/loader:1074:27)
at TracingChannel.traceSync (node:diagnostics_channel:315:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
at Module.require (node:internal/modules/cjs/loader:1339:12)
at require (node:internal/modules/helpers:135:16)
at requireFromCwd (/node_modules/@ota-meshi/eslint-plugin/lib/utils/module.js:23:12)
at files.files (/node_modules/@ota-meshi/eslint-plugin/lib/config-builder/plugins/json-schema.js:10:80)

src/utils/ast/js/index.ts

Oops! Something went wrong! :(

ESLint: 9.23.0

Error: Cannot find module '/node_modules/eslint-plugin-json-schema-validator/lib/index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (node:internal/modules/cjs/loader:493:19)
at Module._findPath (node:internal/modules/cjs/loader:794:18)
at Module._resolveFilename (node:internal/modules/cjs/loader:1234:27)
at Module._load (node:internal/modules/cjs/loader:1074:27)
at TracingChannel.traceSync (node:diagnostics_channel:315:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
at Module.require (node:internal/modules/cjs/loader:1339:12)
at require (node:internal/modules/helpers:135:16)
at requireFromCwd (/node_modules/@ota-meshi/eslint-plugin/lib/utils/module.js:23:12)
at files.files (/node_modules/@ota-meshi/eslint-plugin/lib/config-builder/plugins/json-schema.js:10:80)

  • 4 others

📜 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 a7a54b5 and 0c64a29.

📒 Files selected for processing (10)
  • docs/.vitepress/theme/components/components/EslintPluginEditor.vue (0 hunks)
  • eslint.config.mjs (6 hunks)
  • package.json (2 hunks)
  • src/rules/no-invalid.ts (4 hunks)
  • src/types.ts (3 hunks)
  • src/utils/ast/js/index.ts (17 hunks)
  • src/utils/ast/js/utils.ts (8 hunks)
  • tests/src/rules/no-invalid.ts (0 hunks)
  • tests/src/utils/ast/js.ts (3 hunks)
  • tests/utils/utils.ts (1 hunks)
💤 Files with no reviewable changes (2)
  • tests/src/rules/no-invalid.ts
  • docs/.vitepress/theme/components/components/EslintPluginEditor.vue
🧰 Additional context used
🧬 Code Definitions (2)
src/utils/ast/js/utils.ts (1)
src/types.ts (1)
  • RuleContext (67-85)
src/utils/ast/js/index.ts (1)
src/types.ts (1)
  • RuleContext (67-85)
🔇 Additional comments (25)
tests/utils/utils.ts (1)

307-307: Great cleanup of unnecessary ESLint directives.

The removal of the n/no-extraneous-require rule from the disable directive helps to clean up the codebase while maintaining the needed exception for typescript's no-require-imports rule.

package.json (3)

102-102: Approve eslint-plugin-vue version update.

Updating to the latest major version (v10) is a good practice to stay current with bug fixes and new features.


119-119: Appropriate addition of typescript-eslint dependency.

Adding typescript-eslint v8.29.0 is consistent with the general dependency updates in this PR and likely supports the updated ESLint configuration mentioned in the PR summary.


122-122: Approve vue-eslint-parser version update.

Updating to v9.4.3 is beneficial for keeping dependencies current and aligns with the type changes implemented across multiple files.

tests/src/utils/ast/js.ts (3)

7-7: Improve type imports using AST namespace.

Good refactoring to use the consolidated AST namespace import instead of individual type imports from vue-eslint-parser.


32-32: Consistent type usage with AST namespace.

This change correctly updates the parameter type to use the AST namespace, consistent with the new import style.


51-52: Clean up of unnecessary ESLint directive.

Similar to other changes in this PR, removing the unnecessary n/no-extraneous-require rule from the disable directive helps maintain a clean codebase.

src/types.ts (3)

9-9: Standardize type imports with AST namespace.

Good refactoring to use the consolidated AST namespace import instead of individual type imports, making the code more maintainable.


76-76: Consistent type usage with AST namespace.

The property type has been correctly updated to use the AST namespace, consistent with the import changes.


91-95: Improve type definition with AST namespace.

The Node type definition has been properly updated to use the AST namespace for ESLintNode, maintaining consistency throughout the codebase.

eslint.config.mjs (3)

2-3: Updated imports for new ESLint flat config approach

The change from using the FlatCompat compatibility layer to direct plugin configuration is a good modernization approach. This aligns with ESLint's move toward flat config format.


26-37: Cleaner configuration with consolidated plugin setup

Replacing multiple compat.extends() calls with a single myPlugin.config() call makes the configuration more maintainable. This approach provides a more structured way to declare which plugins are being used.


173-180: Improved type-checking configuration with typescript-eslint

The migration to tseslint.config() with explicit disableTypeChecked extensions for test fixtures, docs, and markdown files is a good practice. This ensures proper type-checking behavior across different file types.

Also applies to: 209-218, 258-271

src/rules/no-invalid.ts (4)

20-20: Standardized AST type imports

Using the consolidated AST namespace import from vue-eslint-parser instead of individual type imports improves code organization and consistency.


202-203: Updated parameter type for validateJSExport function

Type updated from ESLintExpression to AST.ESLintExpression to align with the new type import approach.


272-285: Updated parameter type for ExportDefaultDeclaration visitor

Type updated from ESLintExportDefaultDeclaration to AST.ESLintExportDefaultDeclaration for consistency with the new type import structure.


286-300: Updated parameter type for AssignmentExpression visitor

Type updated from ESLintAssignmentExpression to AST.ESLintAssignmentExpression for consistency with the new type import structure.

src/utils/ast/js/utils.ts (4)

3-3: Simplified type imports with AST namespace

Consolidating individual ESLint type imports under the AST namespace from vue-eslint-parser improves code organization and reduces import clutter.


14-15: Updated parameter type for getStaticPropertyName function

Parameter type properly updated to use the AST namespace, maintaining consistency with the new type import pattern.


57-58: Updated parameter type for getStringLiteralValue function

Parameter type updated to use the AST namespace, maintaining type consistency throughout the file.


80-81: Consistently updated all parameter types with AST namespace

All parameter types in the file have been properly updated to use the AST namespace pattern, ensuring consistency throughout the codebase.

Also applies to: 90-91, 100-101, 113-117, 138-138

src/utils/ast/js/index.ts (4)

3-3: Standardized AST type imports

Consolidating multiple ESLint type imports into a single AST namespace import simplifies imports and improves code organization.


26-26: Simplified AnalyzedJsAST type declaration

The type declaration has been condensed to a single line without changing its functionality, making the code more concise.


32-33: Updated analyzeJsAST function parameter type

Parameter type updated from ESLintExpression to AST.ESLintExpression to maintain consistency with the new type import pattern.


117-118: Consistently updated all visitor function parameter types

All visitor function parameter types have been properly updated to use the AST namespace, ensuring type consistency throughout the codebase.

Also applies to: 156-157, 210-211, 290-291, 297-299, 316-318, 342-344, 369-371, 376-378, 406-408, 419-421, 440-442, 453-455, 459-462, 479-481, 541-542

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

@ota-meshi ota-meshi merged commit e5f2619 into main Apr 4, 2025
12 checks passed
@ota-meshi ota-meshi deleted the update-dev-deps branch April 4, 2025 00:55
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.

1 participant