Skip to content

Chore: update eslint config as consist#276

Merged
github-actions[bot] merged 1 commit intomainfrom
eslint-config
Nov 10, 2025
Merged

Chore: update eslint config as consist#276
github-actions[bot] merged 1 commit intomainfrom
eslint-config

Conversation

@black7375
Copy link
Contributor

@black7375 black7375 commented Nov 10, 2025

Description

Fix eslint setting.

Related Issue

Summary by CodeRabbit

  • Chores
    • Updated ESLint setups in example projects to modernize configuration structure and initialization.
    • Added TypeScript parser support and improved per-file parser/option handling for mixed JS/TS code.
    • Enabled recommended React Hooks and fast-refresh linting rules across examples.
    • Added ignores for build artifacts and disabled type-checking for plain JS files to speed local linting.

Additional context

Checklist

@changeset-bot
Copy link

changeset-bot bot commented Nov 10, 2025

⚠️ No Changeset found

Latest commit: 26546b1

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 Nov 10, 2025

Walkthrough

Refactors examples/react-babel/eslint.config.js to compose multiple configuration fragments via defineConfig, adds TypeScript parser options and ignores, and updates plugin usage; examples/react-swc/eslint.config.js merges react-hooks recommended rules; examples/react-babel/package.json adds @typescript-eslint/parser devDependency.

Changes

Cohort / File(s) Summary
React-babel ESLint restructuring
examples/react-babel/eslint.config.js
Replaces single-object export with multiple configuration fragments passed to defineConfig (presets like eslint.configs.recommended, tseslint.configs.recommended, plugin configs such as reactHooksPlugin.configs.flat.recommended, reactRefreshPlugin), defines PACKAGE_ROOT via resolve(cwd()), moves top-level languageOptions to include tsconfigRootDir and projectService, adds per-file languageOptions using tsParser with detailed parserOptions (project, tsconfigRootDir, ecmaVersion, sourceType, merged globals), adds JS override disabling type-checked rules (tseslint.configs.disableTypeChecked), and adds ignores for dist/**.
React-babel package deps
examples/react-babel/package.json
Adds devDependency @typescript-eslint/parser at ^8.46.2.
React-swc ESLint rules addition
examples/react-swc/eslint.config.js
Spreads reactHooksPlugin.configs.recommended.rules into the rules object to include React Hooks recommended rules alongside existing rules.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant DevConfig as "Config fragments"
  participant Define as "defineConfig()"
  participant ESLint as "ESLint engine"

  DevConfig->>Define: pass presets (eslint.configs.recommended, tseslint.configs.recommended)
  DevConfig->>Define: pass plugin configs (reactHooksPlugin..., reactRefreshPlugin)
  DevConfig->>Define: pass file-specific fragments (tsParser parserOptions, ignores, overrides)
  Define->>ESLint: produce merged ESLint configuration
  ESLint-->>Define: resolved config (rules, parsers, languageOptions)
  note over Define,ESLint `#DDFFDD`: New composition order: presets -> plugins -> per-file fragments -> ignores
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Areas to focus:
    • examples/react-babel/eslint.config.js: verify fragment composition order, tsconfigRootDir and projectService usage, and that per-file parserOptions map correctly to TypeScript files.
    • Ensure dist/** ignore and JS override for disabling type-checked rules behave as intended.
    • examples/react-babel/package.json: confirm parser package version compatibility.

Possibly related PRs

Poem

🐰 I hopped through configs, stitched rules in a row,
Hooks tucked neatly where linters will know.
Parsers aligned, ignores tucked away,
A tidy lint garden to nibble and play. 🥕

Pre-merge checks and finishing touches

❌ Failed checks (2 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Chore: update eslint config as consist' uses the word 'consist' which appears incomplete or unclear, making the primary change ambiguous. Clarify the title to be more specific and complete (e.g., 'Chore: update ESLint config to be consistent' or 'Chore: update ESLint config for consistency').
Description check ❓ Inconclusive The description is minimal and vague, stating only 'Fix eslint setting' without explaining what was fixed, why, or what changed. Expand the description with specific details about what ESLint settings were fixed, why the changes were needed, and how they improve the configuration.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch eslint-config

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

Triggered from #276 by @​black7375.

Checking if we can fast forward main (1bb5010) to eslint-config (44eef59).

Target branch (main):

commit 1bb50106844d162d26f1f470ef0cae0565461708 (HEAD -> main, origin/main)
Author: JeongJun <rgfdds98@gmail.com>
Date:   Wed Oct 15 00:00:00 2025 +0900

    Refactor: restrict `rules()` to function-style compoundVariants #245

Pull request (eslint-config):

commit 44eef594861456dac2fda5a5faed0e3b0fb09a33 (pull_request/eslint-config)
Author: alstjr7375 <alstjr7375@daum.net>
Date:   Thu Oct 16 00:00:00 2025 +0900

    Chore: update eslint config as consist

It is possible to fast forward main (1bb5010) to eslint-config (44eef59). If you have write access to the target repository, you can add a comment with /fast-forward to fast forward main to eslint-config.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
examples/react-babel/eslint.config.js (1)

26-26: Consider consistent file pattern syntax.

The file patterns use different glob depths:

  • Line 26: '**/*.{ts,tsx}' (matches recursively)
  • Line 52: "*.js" (matches only root level)

If JavaScript files in subdirectories should also use disableTypeChecked, consider using **/*.js for consistency. Otherwise, this appears intentional.

Also applies to: 52-52

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1bb5010 and 44eef59.

📒 Files selected for processing (2)
  • examples/react-babel/eslint.config.js (1 hunks)
  • examples/react-swc/eslint.config.js (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
examples/react-swc/eslint.config.js (1)
configs/eslint-config-custom/eslint.config.typescript.js (1)
  • eslintConfig (19-71)
examples/react-babel/eslint.config.js (2)
examples/react-swc/eslint.config.js (1)
  • PACKAGE_ROOT (11-11)
configs/eslint-config-custom/eslint.config.typescript.js (1)
  • eslintConfig (19-71)
🔇 Additional comments (3)
examples/react-babel/eslint.config.js (2)

17-24: Clarify inconsistent parserOptions configurations.

There are two separate parserOptions configurations with different values:

  1. Lines 20-21: Uses PACKAGE_ROOT (which resolves to resolve(cwd())), no project array
  2. Lines 30-32: Uses cwd() directly, includes project: ["tsconfig.json"]

This inconsistency is confusing. The top-level config (lines 17-24) applies to all files, then gets overridden for TypeScript files (lines 25-50). However:

  • Why use PACKAGE_ROOT in one place and cwd() in another when they're functionally equivalent?
  • Why does only the file-specific config include project: ["tsconfig.json"]?

Please clarify the intended behavior or align both configurations for consistency.

Also applies to: 29-32


44-44: Verify potential duplication of react-hooks rules.

This config spreads reactHooksPlugin.configs.recommended.rules on line 44, but line 16 already includes reactHooksPlugin.configs.flat.recommended at the top level. This might duplicate rules or cause conflicts depending on the plugin's structure.

Run the verification script from the react-swc config review to check if these configs overlap.

examples/react-swc/eslint.config.js (1)

43-43: Remove redundant react-hooks rules spread on line 43.

flat.recommended is a config object packaged for ESLint's flat config system, while recommended.rules is just the legacy rules map you manually copy into your flat config's rules property. Since reactHooksPlugin.configs.flat.recommended is already applied at line 16, spreading reactHooksPlugin.configs.recommended.rules again on line 43 duplicates those rules. Remove the spread on line 43:

    rules: {
      "react-refresh/only-export-components": [
        "warn",
        { allowConstantExport: true },
      ],
    }
⛔ Skipped due to learnings
Learnt from: black7375
Repo: mincho-js/mincho PR: 113
File: packages/css/src/index.ts:33-33
Timestamp: 2024-10-09T13:00:38.449Z
Learning: `recipe` is properly exported from './rules' in `packages/css/src/rules/index.ts`.

Comment on lines +29 to +37
parserOptions: {
project: ["tsconfig.json"],
tsconfigRootDir: cwd(),
projectService: true,

ecmaVersion: "latest",
sourceType: "module",
globals: { ...globals.browser, ...globals.es2020 },
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix incorrect property nesting in languageOptions.

Lines 34-36 (ecmaVersion, sourceType, globals) are incorrectly nested under parserOptions. These properties belong directly under languageOptions, not within parserOptions.

Apply this diff to fix the nesting:

     languageOptions: {
       parser: tsParser,
       parserOptions: {
         project: ["tsconfig.json"],
         tsconfigRootDir: cwd(),
         projectService: true,
-
-        ecmaVersion: "latest",
-        sourceType: "module",
-        globals: { ...globals.browser, ...globals.es2020 },
-      }
+      },
+      ecmaVersion: "latest",
+      sourceType: "module",
+      globals: { ...globals.browser, ...globals.es2020 },
     },
📝 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
parserOptions: {
project: ["tsconfig.json"],
tsconfigRootDir: cwd(),
projectService: true,
ecmaVersion: "latest",
sourceType: "module",
globals: { ...globals.browser, ...globals.es2020 },
}
languageOptions: {
parser: tsParser,
parserOptions: {
project: ["tsconfig.json"],
tsconfigRootDir: cwd(),
projectService: true,
},
ecmaVersion: "latest",
sourceType: "module",
globals: { ...globals.browser, ...globals.es2020 },
}
🤖 Prompt for AI Agents
In examples/react-babel/eslint.config.js around lines 29 to 37, parserOptions
currently contains ecmaVersion, sourceType and globals which are incorrectly
nested; move ecmaVersion, sourceType and globals out of parserOptions and place
them directly under languageOptions at the same level as parserOptions so
languageOptions directly includes parserOptions plus ecmaVersion, sourceType,
and globals.

@github-actions
Copy link
Contributor

Triggered from #276 by @​black7375.

Checking if we can fast forward main (1bb5010) to eslint-config (26546b1).

Target branch (main):

commit 1bb50106844d162d26f1f470ef0cae0565461708 (HEAD -> main, origin/main)
Author: JeongJun <rgfdds98@gmail.com>
Date:   Wed Oct 15 00:00:00 2025 +0900

    Refactor: restrict `rules()` to function-style compoundVariants #245

Pull request (eslint-config):

commit 26546b1a08cecbbaba4a4895d09657bdc7e7a633 (pull_request/eslint-config)
Author: alstjr7375 <alstjr7375@daum.net>
Date:   Thu Oct 16 00:00:00 2025 +0900

    Chore: update eslint config as consist

It is possible to fast forward main (1bb5010) to eslint-config (26546b1). If you have write access to the target repository, you can add a comment with /fast-forward to fast forward main to eslint-config.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
examples/react-babel/eslint.config.js (1)

44-44: Verify redundancy with flat.recommended config.

Similar to the react-swc configuration, line 16 already includes reactHooksPlugin.configs.flat.recommended, which should provide the react-hooks rules. Spreading ...reactHooksPlugin.configs.recommended.rules (legacy format) here may be redundant and could potentially conflict with the flat config rules already applied.

Consider verifying whether this spread is necessary:

#!/bin/bash
# Check if react-hooks rules are already applied by flat.recommended
echo "=== Checking react-hooks plugin flat config structure ==="
node -e "
import reactHooksPlugin from 'eslint-plugin-react-hooks';
console.log('flat.recommended:', Object.keys(reactHooksPlugin.configs.flat?.recommended || {}));
console.log('flat.recommended.rules:', Object.keys(reactHooksPlugin.configs.flat?.recommended?.rules || {}));
console.log('recommended.rules:', Object.keys(reactHooksPlugin.configs.recommended?.rules || {}));
"

If flat.recommended already includes the rules, you can remove line 44. If not, consider using the flat config's rules format if available.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 44eef59 and 26546b1.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (3)
  • examples/react-babel/eslint.config.js (1 hunks)
  • examples/react-babel/package.json (1 hunks)
  • examples/react-swc/eslint.config.js (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
examples/react-swc/eslint.config.js (1)
configs/eslint-config-custom/eslint.config.typescript.js (1)
  • eslintConfig (19-71)
examples/react-babel/eslint.config.js (2)
examples/react-swc/eslint.config.js (1)
  • PACKAGE_ROOT (11-11)
configs/eslint-config-custom/eslint.config.typescript.js (1)
  • eslintConfig (19-71)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: typecheck
🔇 Additional comments (2)
examples/react-babel/package.json (1)

44-44: Addition of @typescript-eslint/parser dependency is correct.

The parser is properly imported at line 7 of eslint.config.js and actively used at line 27 for TypeScript file linting. Version ^8.46.2 matches the existing typescript-eslint dependency. No issues detected.

examples/react-swc/eslint.config.js (1)

43-43: Remove the redundant react-hooks rules spread.

Line 16 already includes reactHooksPlugin.configs.flat.recommended, which is the recommended way to configure react-hooks rules in flat config format. Spreading ...reactHooksPlugin.configs.recommended.rules at line 43 (a legacy format) is redundant and applies the same rules twice for *.{ts,tsx} files.

Remove line 43 entirely and keep only the global flat config at line 16. The recommended presets automatically include new recommended rules as they are added in future versions, so the manual spread is unnecessary and potentially problematic when the plugin is updated.

parser: tsParser,
parserOptions: {
project: ["tsconfig.json"],
tsconfigRootDir: cwd(),
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Use PACKAGE_ROOT consistently.

Line 20 uses PACKAGE_ROOT for tsconfigRootDir, but line 31 uses cwd() directly. For consistency and clarity, use PACKAGE_ROOT here as well since it's already defined at line 11.

Apply this diff:

       parserOptions: {
         project: ["tsconfig.json"],
-        tsconfigRootDir: cwd(),
+        tsconfigRootDir: PACKAGE_ROOT,
         projectService: true,
📝 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
tsconfigRootDir: cwd(),
parserOptions: {
project: ["tsconfig.json"],
tsconfigRootDir: PACKAGE_ROOT,
projectService: true,
🤖 Prompt for AI Agents
In examples/react-babel/eslint.config.js around line 31, tsconfigRootDir is set
to cwd() while PACKAGE_ROOT (defined at line 11) should be used for consistency;
replace cwd() with PACKAGE_ROOT so tsconfigRootDir: PACKAGE_ROOT.

@black7375
Copy link
Contributor Author

/fast-forward

@github-actions
Copy link
Contributor

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

Trying to fast forward main (1bb5010) to eslint-config (26546b1).

Target branch (main):

commit 1bb50106844d162d26f1f470ef0cae0565461708 (HEAD -> main, origin/main)
Author: JeongJun <rgfdds98@gmail.com>
Date:   Wed Oct 15 00:00:00 2025 +0900

    Refactor: restrict `rules()` to function-style compoundVariants #245

Pull request (eslint-config):

commit 26546b1a08cecbbaba4a4895d09657bdc7e7a633 (pull_request/eslint-config)
Author: alstjr7375 <alstjr7375@daum.net>
Date:   Thu Oct 16 00:00:00 2025 +0900

    Chore: update eslint config as consist

Fast forwarding main (1bb5010) to eslint-config (26546b1).

$ git push origin 26546b1a08cecbbaba4a4895d09657bdc7e7a633:main
To https://github.com/mincho-js/mincho.git
   1bb5010..26546b1  26546b1a08cecbbaba4a4895d09657bdc7e7a633 -> main

@github-actions github-actions bot merged commit 26546b1 into main Nov 10, 2025
12 checks passed
@github-actions github-actions bot deleted the eslint-config branch November 10, 2025 17:21
@coderabbitai coderabbitai bot mentioned this pull request Jan 19, 2026
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