Skip to content

Chore: EsLint tsconfig project setup#144

Merged
github-actions[bot] merged 1 commit intomainfrom
eslint-error
Feb 8, 2025
Merged

Chore: EsLint tsconfig project setup#144
github-actions[bot] merged 1 commit intomainfrom
eslint-error

Conversation

@black7375
Copy link
Contributor

@black7375 black7375 commented Feb 8, 2025

Description

Resolve parserOptions.project parsing error.

image

Parsing error: ESLint was configured to run on `/home/black7375/Documents/mincho/packages/css/src/rules/types.ts` using `parserOptions.project`:
- <tsconfigRootDir>/tsconfig.json
- <tsconfigRootDir>/tsconfig.node.json
However, none of those TSConfigs include this file. Either:
- Change ESLint's list of included files to not include this file
- Change one of those TSConfigs to include this file
- Create a new TSConfig that includes this file and include it in your parserOptions.project
See the typescript-eslint docs for more info: https://typescript-eslint.io/troubleshooting/typed-linting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file eslint

Related Issue

Summary by CodeRabbit

  • Chores
    • Updated tooling configurations for code linting, formatting, and type checking to support a broader range of files.
  • Refactor
    • Streamlined configuration exports for enhanced flexibility and easier customization.
  • Style
    • Adjusted formatting settings for consistent configuration structure.

Additional context

EXPERIMENTAL_useProjectService -> projectService

Checklist

@changeset-bot
Copy link

changeset-bot bot commented Feb 8, 2025

⚠️ No Changeset found

Latest commit: 6a9135d

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

@coderabbitai
Copy link

coderabbitai bot commented Feb 8, 2025

Walkthrough

The pull request revises how ESLint configuration is exported by replacing static default exports with a named function call in several packages. It adjusts parser options and file inclusions in TypeScript configuration files and updates Prettier’s config style by removing quoted keys and adding a semicolon. The changes centralize configuration logic and expand TypeScript file inclusion, ensuring a more flexible and unified configuration setup across the project.

Changes

File(s) Change Summary
configs/.../eslint.config.typescript.js Replaces default export with a named function (eslintConfig) that accepts optional userConfigs; updates parserOptions to include only tsconfig.json and renames EXPERIMENTAL_useProjectService to projectService; adds *.cjs and *.mjs to files array.
configs/.../prettier.config.js Removes quotation marks around object keys and appends a semicolon to the closing brace; overall configuration remains unchanged.
packages/(css-additional-types, css, debug-log, transform-to-vanilla)/eslint.config.js Replaces direct default export from "eslint-config-custom/typescript" with an imported eslintConfig function invoked to generate and export the configuration.
packages/(css-additional-types, css, debug-log, transform-to-vanilla)/tsconfig.node.json Modifies the "include" array to add eslint.config.js alongside vite.config.ts, expanding the TypeScript compiler’s scope.
packages/debug-log/tsconfig.json Adds "importMeta.d.ts" to the "include" array to include additional type definitions.

Sequence Diagram(s)

sequenceDiagram
    participant ESLint as ESLint Process
    participant Config as eslintConfig Function
    ESLint->>Config: Call eslintConfig(optional userConfigs)
    Config-->>ESLint: Return configuration object
    ESLint->>ESLint: Apply configuration for linting
Loading

Possibly related PRs

Suggested labels

dependencies

Poem

Oh, I hop through config lines with glee,
A rabbit’s dance in the code spree 🐰,
ESLint now sings with a function’s call,
Prettier’s keys stand proud and tall,
With files and tsconfigs coming together,
I celebrate these changes in fair weather!
Happy hops in every byte!

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.

yarn install v1.22.22
[1/4] Resolving packages...
error Couldn't find any versions for "eslint-config-custom" that matches "workspace:^"
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.


📜 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 0c90487 and 6a9135d.

📒 Files selected for processing (11)
  • configs/eslint-config-custom/eslint.config.typescript.js (1 hunks)
  • configs/prettier-config-custom/prettier.config.js (1 hunks)
  • packages/css-additional-types/eslint.config.js (1 hunks)
  • packages/css-additional-types/tsconfig.node.json (1 hunks)
  • packages/css/eslint.config.js (1 hunks)
  • packages/css/tsconfig.node.json (1 hunks)
  • packages/debug-log/eslint.config.js (1 hunks)
  • packages/debug-log/tsconfig.json (1 hunks)
  • packages/debug-log/tsconfig.node.json (1 hunks)
  • packages/transform-to-vanilla/eslint.config.js (1 hunks)
  • packages/transform-to-vanilla/tsconfig.node.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • configs/prettier-config-custom/prettier.config.js
🧰 Additional context used
🪛 Biome (1.9.4)
packages/css-additional-types/tsconfig.node.json

[error] 3-4: Expected a property but instead found '}'.

Expected a property here.

(parse)

packages/css/tsconfig.node.json

[error] 3-4: Expected a property but instead found '}'.

Expected a property here.

(parse)

packages/debug-log/tsconfig.node.json

[error] 3-4: Expected a property but instead found '}'.

Expected a property here.

(parse)

packages/transform-to-vanilla/tsconfig.node.json

[error] 3-4: Expected a property but instead found '}'.

Expected a property here.

(parse)

🔇 Additional comments (12)
configs/eslint-config-custom/eslint.config.typescript.js (3)

9-16: LGTM! Well-documented type definitions and function signature.

The type definitions and JSDoc comments are clear and properly document the function's purpose and parameters.


56-58: LGTM! Expanded JavaScript file patterns.

The inclusion of *.cjs and *.mjs ensures proper handling of all JavaScript module formats.


24-37: Verify the removal of tsconfig.node.json from project array.

The parser options now only include tsconfig.json, removing tsconfig.node.json. This aligns with the PR objective to resolve parsing errors, but we should verify that this doesn't affect Node.js-specific TypeScript files.

Run this script to check for potential impacts:

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Description: Check for .ts files that might be affected by the removal of tsconfig.node.json

# Find all TypeScript files in Node.js-specific contexts
echo "TypeScript files in Node.js contexts:"
fd -e ts -E "*.d.ts" -E "*test*" -E "*spec*" | rg -l "require|import.*node:|process\.|__dirname|Buffer"

Length of output: 190


I'm going to run an additional shell script that searches all TypeScript files—including tests and spec files—for Node.js–specific references (e.g. "node:", "__dirname", "Buffer", "process.") to confirm that no files rely on settings from tsconfig.node.json. This will give us a more complete picture before finalizing our verification.


🏁 Script executed:

#!/bin/bash
echo "Verifying Node.js-specific references in all TypeScript files (including tests/specs)..."
fd -e ts --exec rg -l "(node:|__dirname|Buffer|process\.)" {} \; || echo "No Node.js-specific references found."

Length of output: 371


Verification Outcome: No Impact on Node-Specific Files

Our additional search confirmed that apart from the one instance (./packages/css/vite.config.ts), no other TypeScript files with Node.js–specific references (like __dirname, Buffer, or process.) were flagged. Given that the ESLint config now provides Node globals via globals.nodeBuiltin and that the primary tsconfig.json is expected to adequately cover Node-related type definitions, we can conclude that removing tsconfig.node.json from the parser options does not cause adverse effects for Node.js-specific files.

packages/debug-log/tsconfig.json (1)

6-6: LGTM! Added import.meta type definitions.

Including importMeta.d.ts ensures proper TypeScript support for import.meta operations.

packages/css-additional-types/tsconfig.node.json (1)

3-3: LGTM! Added ESLint config to TypeScript compilation.

Including eslint.config.js in the TypeScript compilation ensures proper type checking of the ESLint configuration.

🧰 Tools
🪛 Biome (1.9.4)

[error] 3-4: Expected a property but instead found '}'.

Expected a property here.

(parse)

packages/debug-log/tsconfig.node.json (1)

3-3: LGTM! Added ESLint config to TypeScript compilation.

Including eslint.config.js in the TypeScript compilation ensures proper type checking of the ESLint configuration.

🧰 Tools
🪛 Biome (1.9.4)

[error] 3-4: Expected a property but instead found '}'.

Expected a property here.

(parse)

packages/css/tsconfig.node.json (1)

3-3: Include Update and Trailing Comma Verification

The update correctly adds "eslint.config.js" to the "include" array, which should help TypeScript recognize the ESLint configuration file and resolve the parserOptions issue. Note that the trailing comma after the array element may trigger parsing warnings in environments expecting strict JSON. Please verify that this file is processed as JSON with comments (JSONC) in your toolchain or consider removing the trailing comma if a strict JSON parser is used.

🧰 Tools
🪛 Biome (1.9.4)

[error] 3-4: Expected a property but instead found '}'.

Expected a property here.

(parse)

packages/transform-to-vanilla/tsconfig.node.json (1)

3-3: Consistent File Inclusion and JSON Trailing Comma Check

This change mirrors the update in the CSS package by adding "eslint.config.js" alongside "vite.config.ts" to the "include" array. This consistency across packages is appreciated. As with the other file, double-check whether the trailing comma might cause issues with any strict JSON parsing tool; if so, you may remove the trailing comma.

🧰 Tools
🪛 Biome (1.9.4)

[error] 3-4: Expected a property but instead found '}'.

Expected a property here.

(parse)

packages/css/eslint.config.js (1)

1-2: LGTM! Consider verifying configuration options.

The change from static to dynamic configuration looks good and aligns with the PR objectives. However, since eslintConfig() accepts optional parameters, verify if any package-specific configuration is needed.

Let's check the available configuration options:

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Description: Check the eslintConfig function definition and its usage
ast-grep --pattern 'export function eslintConfig($_) {
  $$$
}'

Length of output: 4361


LGTM: The call to eslintConfig() with no parameters correctly relies on its default value (an empty array) as implemented in the custom configuration file. The function definition (in configs/eslint-config-custom/eslint.config.typescript.js) shows that it accepts an optional configuration object and merges it accordingly. If no package-specific settings are needed for the css package, leaving the call as-is is valid.

  • packages/css/eslint.config.js uses eslintConfig() without additional options.
  • The definition in configs/eslint-config-custom/eslint.config.typescript.js confirms that userConfigs defaults to an empty array and is merged into the configuration.
packages/css-additional-types/eslint.config.js (1)

1-2: LGTM! Same changes as in packages/css/eslint.config.js.

The changes follow the same pattern of converting static to dynamic configuration.

packages/debug-log/eslint.config.js (1)

1-2: LGTM! Same changes as in packages/css/eslint.config.js.

The changes follow the same pattern of converting static to dynamic configuration.

packages/transform-to-vanilla/eslint.config.js (1)

1-2: LGTM! Same changes as in packages/css/eslint.config.js.

The changes follow the same pattern of converting static to dynamic configuration.

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 8, 2025

Triggered from #144 by @​black7375.

Checking if we can fast forward main (0c90487) to eslint-error (6a9135d).

Target branch (main):

commit 0c904876b01aaaa22d48eaae9aa964630c0ff53c (HEAD -> main, origin/main, origin/HEAD)
Author: alstjr7375 <alstjr7375@daum.net>
Date:   Sun Feb 2 00:50:43 2025 +0900

    Chore(deps): Bump packages

Pull request (eslint-error):

commit 6a9135d5f952bac403fd287099a1614e8024d32d (pull_request/eslint-error)
Author: alstjr7375 <alstjr7375@daum.net>
Date:   Sat Feb 8 19:37:04 2025 +0900

    Chore: EsLint tsconfig project setup

It is possible to fast forward main (0c90487) to eslint-error (6a9135d). If you have write access to the target repository, you can add a comment with /fast-forward to fast forward main to eslint-error.

@black7375
Copy link
Contributor Author

/fast-forward

@github-actions
Copy link
Contributor

github-actions bot commented Feb 8, 2025

Triggered from #144 (comment) by @​black7375.

Trying to fast forward main (0c90487) to eslint-error (6a9135d).

Target branch (main):

commit 0c904876b01aaaa22d48eaae9aa964630c0ff53c (HEAD -> main, origin/main, origin/HEAD)
Author: alstjr7375 <alstjr7375@daum.net>
Date:   Sun Feb 2 00:50:43 2025 +0900

    Chore(deps): Bump packages

Pull request (eslint-error):

commit 6a9135d5f952bac403fd287099a1614e8024d32d (pull_request/eslint-error)
Author: alstjr7375 <alstjr7375@daum.net>
Date:   Sat Feb 8 19:37:04 2025 +0900

    Chore: EsLint tsconfig project setup

Fast forwarding main (0c90487) to eslint-error (6a9135d).

$ git push origin 6a9135d5f952bac403fd287099a1614e8024d32d:main
To https://github.com/mincho-js/mincho.git
   0c90487..6a9135d  6a9135d5f952bac403fd287099a1614e8024d32d -> main

@github-actions github-actions bot merged commit 6a9135d into main Feb 8, 2025
7 checks passed
@github-actions github-actions bot deleted the eslint-error branch February 8, 2025 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant