-
Notifications
You must be signed in to change notification settings - Fork 0
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
v0.15.0: Migrate to ESLint Flat config #90
Conversation
WalkthroughThe recent changes enhance project configuration and dependencies across several files. Key updates include improved file nesting in Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Editor
participant ESLint
participant Yarn
participant SpellChecker
User->>Editor: Edit files
Editor->>Yarn: Check dependencies
Yarn->>Editor: Install/update packages
User->>ESLint: Run linting
ESLint->>Editor: Validate code
User->>SpellChecker: Check spelling
SpellChecker->>Editor: Highlight issues
TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (2)
packages/eslint-config-base/src/style.mts (1)
6-22
: Review custom ESLint rule for arrow functions.The rule
'arrow-body-style': 'warn'
is set to warn when arrow functions have unnecessary blocks. Ensure this rule aligns with the project's style guidelines and that the warning level is appropriate.Consider documenting the rationale for this rule in the project's style guide to ensure consistency across the team.
packages/eslint-config-base/src/index.mts (1)
1-10
: Missing Configuration FilesThe configuration files (
airbnb.mjs
,data.mjs
,ignore.mjs
,import.mjs
,jsdoc.mjs
,markdown.mjs
,node.mjs
,style.mjs
,ts.mjs
) referenced in the imports are missing from the repository. These files are necessary for the ESLint configuration to function correctly. Please ensure these files are added to the repository.
- Missing files:
airbnb.mjs
,data.mjs
,ignore.mjs
,import.mjs
,jsdoc.mjs
,markdown.mjs
,node.mjs
,style.mjs
,ts.mjs
Analysis chain
Ensure imports are valid and necessary.
The imported configurations seem to cover various aspects of linting. Ensure that each imported module is necessary and correctly implemented. If any of these configurations are not used or needed, consider removing them to keep the file clean.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify the existence and usage of imported modules to ensure they are necessary. fd airbnb.mjs && fd data.mjs && fd ignore.mjs && fd import.mjs && fd jsdoc.mjs && fd markdown.mjs && fd node.mjs && fd style.mjs && fd ts.mjsLength of output: 135
Script:
#!/bin/bash # Check for the existence of the configuration files. fd airbnb.mjs fd data.mjs fd ignore.mjs fd import.mjs fd jsdoc.mjs fd markdown.mjs fd node.mjs fd style.mjs fd ts.mjsLength of output: 135
Script:
#!/bin/bash # Check for the usage of the imported configurations in the codebase. rg "airbnbConfig" --context 5 rg "dataConfig" --context 5 rg "ignoreConfig" --context 5 rg "importConfig" --context 5 rg "additionalImportConfig" --context 5 rg "jsdocConfig" --context 5 rg "additionalJsdocConfig" --context 5 rg "markdownConfig" --context 5 rg "nodeConfig" --context 5 rg "additionalNodeConfig" --context 5 rg "styleConfig" --context 5 rg "additionalStyleConfig" --context 5 rg "tsConfig" --context 5 rg "additionalTsConfig" --context 5Length of output: 35461
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files ignored due to path filters (2)
.yarn/sdks/eslint/package.json
is excluded by!**/.yarn/**
,!.yarn/**/*
yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
Files selected for processing (32)
- .vscode/settings.json (2 hunks)
- .yarnrc.yml (2 hunks)
- cspell.config.yml (1 hunks)
- eslint.config.mjs (1 hunks)
- package.json (3 hunks)
- packages/commitlint-config/package.json (1 hunks)
- packages/cspell-config/package.json (1 hunks)
- packages/eslint-config-base/README.md (1 hunks)
- packages/eslint-config-base/package.json (2 hunks)
- packages/eslint-config-base/src/airbnb.mts (1 hunks)
- packages/eslint-config-base/src/data.mts (1 hunks)
- packages/eslint-config-base/src/ignore.mts (1 hunks)
- packages/eslint-config-base/src/import.mts (1 hunks)
- packages/eslint-config-base/src/index.mts (1 hunks)
- packages/eslint-config-base/src/jsdoc.mts (1 hunks)
- packages/eslint-config-base/src/markdown.mts (1 hunks)
- packages/eslint-config-base/src/node.mts (1 hunks)
- packages/eslint-config-base/src/style.mts (1 hunks)
- packages/eslint-config-base/src/ts.mts (1 hunks)
- packages/eslint-config-base/src/utils.mts (1 hunks)
- packages/eslint-config-base/tsconfig.json (1 hunks)
- packages/eslint-config-react/README.md (2 hunks)
- packages/eslint-config-react/package.json (3 hunks)
- packages/eslint-config-react/src/index.mts (1 hunks)
- packages/eslint-config-react/src/react.mts (1 hunks)
- packages/eslint-config-react/src/storybook.mts (1 hunks)
- packages/eslint-config-react/src/utils.mts (1 hunks)
- packages/eslint-config-react/tsconfig.json (1 hunks)
- packages/lint-staged-config/package.json (1 hunks)
- packages/markdownlint-config/package.json (1 hunks)
- packages/prettier-config/package.json (1 hunks)
- packages/typescript-config/package.json (2 hunks)
Files skipped from review due to trivial changes (9)
- cspell.config.yml
- eslint.config.mjs
- packages/commitlint-config/package.json
- packages/cspell-config/package.json
- packages/eslint-config-base/src/data.mts
- packages/eslint-config-react/tsconfig.json
- packages/lint-staged-config/package.json
- packages/markdownlint-config/package.json
- packages/prettier-config/package.json
Additional comments not posted (53)
packages/eslint-config-base/tsconfig.json (1)
1-10
: TSConfig file looks good.The TypeScript configuration is well-structured and follows best practices by extending a shared configuration. The use of
skipLibCheck
is a good choice for improving build performance.packages/eslint-config-base/src/airbnb.mts (1)
1-13
: ESLint configuration is well-structured.The configuration effectively uses the Airbnb style guide and a compatibility layer for ESLint's flat config. This modular approach enhances maintainability and flexibility.
packages/eslint-config-base/src/utils.mts (1)
1-13
: Utility functions are well-implemented.The utility functions, including the compatibility layer for ESLint's flat config, are well-implemented and enhance the flexibility of configuration management.
packages/eslint-config-react/src/utils.mts (1)
1-13
: LGTM! Utilities for ESLint configuration are well-implemented.The utilities for determining the directory name and setting up the compatibility layer are correctly implemented using modern JavaScript features.
packages/eslint-config-base/src/ignore.mts (1)
1-13
: LGTM! Efficient setup for ESLint ignore configuration.The code correctly handles the inclusion of ignore files and specific patterns for Yarn-related files.
packages/eslint-config-base/src/markdown.mts (1)
1-17
: LGTM! Well-structured ESLint configuration for Markdown files.The configuration effectively uses
eslint-plugin-mark
and includes necessary overrides for Markdown files.packages/eslint-config-react/src/index.mts (2)
1-5
: Verify import paths and module availability.Ensure that the modules
@kurone-kito/eslint-config-base
,typescript-eslint
, and others are correctly installed and available. The import paths should be verified for correctness, especially for local modules like./react.mjs
,./storybook.mjs
, and./utils.mjs
.
7-16
: Ensure compatibility with TypeScript ESLint configuration.The
tsEslint.config
function is used to merge various configurations. Ensure that all configurations are compatible with TypeScript ESLint and that theConfigWithExtends
type is correctly used..yarnrc.yml (3)
36-38
: Verify peer dependencies fortypescript-eslint
.Ensure that the specified ESLint versions (
^8.57.0 || ^9.0.0
) are correct and compatible withtypescript-eslint
.Verification successful
Peer dependencies for
typescript-eslint
are correct.The specified ESLint versions (
^8.57.0 || ^9.0.0
) in the.yarnrc.yml
file are compatible with the peer dependencies found in thetypescript-eslint
package files, which support ESLint versions>=8.x.x
and>=9.x.x
. No changes are needed.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the peer dependencies for typescript-eslint. # Test: Check if the specified ESLint versions are compatible. Expect: Versions should match the specified range. npm info eslint versions --json | jq '.[] | select(. | test("8\\.57\\.0|9\\.0\\.0"))'Length of output: 158
Script:
#!/bin/bash # Find package.json files related to typescript-eslint and check peer dependencies fd package.json -x jq -r '.peerDependencies | select(. != null) | to_entries[] | select(.key == "eslint") | "\(.key): \(.value)"' {}Length of output: 184
21-23
: Verify peer dependencies for@eslint/compat
.Ensure that
@types/eslint
is correctly specified as a peer dependency and that this aligns with the project's requirements.Verification successful
Peer dependency for
@eslint/compat
is correctly specified.The
@types/eslint
package is consistently specified as a dependency with version^9.6.0
across the codebase, aligning with the project's requirements.
yarn.lock
: References@eslint/compat
and@types/eslint
with the correct versions.packages/eslint-config-base/package.json
: Lists@eslint/compat
and@types/eslint
with the expected versions.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the peer dependency for @eslint/compat. # Test: Check if @types/eslint is installed and compatible. Expect: Version should match the project's requirements. npm ls @types/eslintLength of output: 93
Script:
#!/bin/bash # Search for references to @eslint/compat in the codebase rg '@eslint/compat' -A 5 # Search for references to @types/eslint in the codebase rg '@types/eslint' -A 5Length of output: 6706
24-26
: Verify peer dependencies for@typescript-eslint/type-utils
.Ensure that the specified ESLint versions (
^8.57.0 || ^9.0.0
) are correct and compatible with@typescript-eslint/type-utils
.packages/eslint-config-base/src/style.mts (2)
24-28
: Ensure correct configuration for style language files.The
styleConfig
array combines plugins and additional configurations. Verify that the setup is consistent with the project's requirements for style language files.Verification successful
Verification Successful:
styleConfig
is used consistently.The
styleConfig
is correctly imported and used in the ESLint configuration setup inindex.mts
, ensuring it aligns with the project's requirements for managing style language files.
packages/eslint-config-base/src/style.mts
: Definition ofstyleConfig
.packages/eslint-config-base/src/index.mts
: Import and usage ofstyleConfig
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the ESLint configuration for style language files. # Test: Check for the presence of styleConfig usage. Expect: Consistent usage across the codebase. rg --type typescript 'styleConfig' -A 5Length of output: 74
Script:
#!/bin/bash # Description: Verify the ESLint configuration for style language files. # Test: Check for the presence of styleConfig usage in TypeScript files. rg 'styleConfig' --glob '*.ts' --glob '*.mts' -A 5Length of output: 1181
1-4
: Verify import paths and module availability.Ensure that the modules
@cspell/eslint-plugin/recommended
,eslint-config-prettier
, and./utils.mjs
are correctly installed and available. The import paths should be verified for correctness.packages/eslint-config-base/src/index.mts (1)
12-29
: Review the configuration combination logic.The use of
tsEslint.config
to combine configurations is a good approach for modularity. Ensure that all configurations are compatible with each other and that their order does not introduce any conflicts.packages/eslint-config-react/src/storybook.mts (1)
4-33
: Validate Storybook-specific ESLint rules.The configuration allows anonymous default exports and specific devDependencies, which are common in Storybook setups. Ensure these rules align with your project's Storybook usage and do not inadvertently allow undesirable patterns.
Verification successful
No Storybook files found using 'export default'. The search did not identify any Storybook files matching the pattern '**/.stories.' that use 'export default'. This suggests that the ESLint rules for Storybook-specific configurations are not currently affecting any files in the repository. Please ensure that your Storybook files follow the expected naming conventions or review the ESLint configuration if this is unexpected.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify the usage of Storybook-specific rules in the project. rg --type js --type ts --files-with-matches 'stories' | xargs rg 'export default'Length of output: 379
Script:
#!/bin/bash # Find all files matching the Storybook pattern and search for 'export default' within them. fd --type f --extension js --extension jsx --extension ts --extension tsx --glob '**/*.stories.*' | xargs rg 'export default'Length of output: 276
packages/eslint-config-base/src/node.mts (2)
37-41
: Ensure Node.js configuration aligns with project needs.The configuration extends the recommended script settings and includes additional configurations. Verify that these settings align with the project's Node.js usage.
5-35
: Review Node.js-specific ESLint rules.The configuration includes rules for missing imports and unsupported syntax. The TODO comment suggests future changes. Ensure these rules are necessary and consider documenting the rationale for temporary measures.
packages/eslint-config-base/src/jsdoc.mts (1)
1-35
: LGTM! Consider verifying the impact of disabled JSDoc rules.The configurations look good and align with TypeScript's capabilities. However, ensure that disabling
jsdoc/require-param-type
andjsdoc/require-returns-type
does not negatively impact documentation quality..vscode/settings.json (1)
6-6
: LGTM! Verify new file associations and nesting patterns.The changes enhance file organization and handling. Ensure that the new nesting pattern for
*.d.mts
files and the JSON association for*.map
files work as intended in your development environment.Also applies to: 23-23
packages/eslint-config-base/README.md (1)
7-20
: LGTM! Ensure users are informed about the migration path.The documentation updates effectively guide users towards the flat configuration and clearly mark the legacy configuration as deprecated. Ensure that users are aware of the upcoming changes and the migration path to avoid disruptions.
Also applies to: 22-39
packages/typescript-config/package.json (4)
3-3
: Version update to 0.15.0 is appropriate.The version increment aligns with the introduction of new features or improvements. Ensure that the changelog reflects these updates.
43-43
: Peer dependency update for@typescript-eslint/parser
to>=7.17.x
.This change may affect projects using this package. Ensure that it is documented in the release notes.
35-35
: Update to@typescript-eslint/parser
version^8.1.0
.This update may include bug fixes or improvements. Verify compatibility with other dependencies.
38-38
: Update toeslint
version^9.9.0
.This major version update likely introduces new features or changes in linting behavior. Ensure that all ESLint plugins and configurations are compatible with this version.
packages/eslint-config-react/README.md (2)
7-8
: Introduction of flat config (recommended).The new section clearly introduces the flat config as the recommended approach. Ensure users are aware of the benefits of this new configuration style.
22-24
: Deprecation notice for legacy configuration.The deprecation notice is clear and prominently placed. Ensure that users are aware of the timeline for the removal of legacy support.
packages/eslint-config-react/src/react.mts (2)
5-42
: Additional React configuration rules.The rules provide warnings for JSX boolean values, string value notation, and self-closing components, which can improve code readability. Ensure these align with your project's coding standards.
44-48
: Base React configuration usingreact-hooks/recommended
.The use of
plugin:react-hooks/recommended
ensures best practices for React hooks. Verify that this configuration is compatible with existing code.packages/eslint-config-base/src/ts.mts (2)
9-38
: Well-documented TypeScript ESLint rules.The
additionalTsConfig
provides clear and concise comments explaining the rationale behind each rule, which aids in understanding and maintainability.
41-47
: Extensible TypeScript ESLint configuration.The
tsConfig
effectively combines recommended configurations with custom rules, providing a robust and flexible linting setup for TypeScript projects.package.json (7)
53-53
: Minor version update for@commitlint/cli
.The update from
19.3.0
to19.4.0
is a minor version change, indicating backward-compatible improvements or features.
55-55
: Patch update for@cspell/cspell-types
.The update from
8.13.1
to8.13.3
is a patch change, indicating bug fixes or minor improvements.
65-65
: Minor version update for@typescript-eslint/parser
.The update from
8.0.0
to8.1.0
is a minor change, likely adding new features or improvements that are backward-compatible.
72-72
: Patch update forlint-staged
.The update from
15.2.8
to15.2.9
is a patch change, indicating bug fixes or minor improvements.
74-74
: Minor version update foroxlint
.The update from
0.6.1
to0.7.2
is a minor change, likely adding new features or improvements that are backward-compatible.
80-80
: Minor version update for Yarn package manager.The update from
4.3.1
to4.4.0
is a minor change, indicating backward-compatible improvements or features.
69-69
: Major version update foreslint
.The update from
8.57.0
to9.9.0
is a major change and may include breaking changes. Ensure compatibility with the project's codebase.packages/eslint-config-base/src/import.mts (2)
5-99
: Well-justified import plugin rules for JavaScript.The
additionalImportConfig
provides clear justifications for disabling certain TypeScript rules and allowingrequire
syntax in specific scenarios, enhancing flexibility and maintainability.
103-107
: Extensible import plugin configuration.The
importConfig
effectively combines recommended configurations with custom rules, providing a robust and flexible linting setup for handling imports.packages/eslint-config-react/package.json (7)
3-3
: Version update approved.The version update to
0.15.0
is consistent with the PR's objectives for introducing breaking changes.
23-27
: Exports and main fields update approved.The update to use
./dist/index.mjs
aligns with modern practices for modular JavaScript projects.
28-28
: Types field addition approved.Adding TypeScript definitions improves type safety and usability for TypeScript projects.
30-31
: Files array update approved.Including the
dist
directory ensures all necessary compiled files are distributed with the package.
43-56
: Dependency updates approved.Updating dependencies ensures compatibility with the latest tools and supports the migration to ESLint's flat config.
58-68
: DevDependency updates approved.The addition and update of TypeScript-related packages enhance TypeScript support in development.
74-94
: PeerDependency updates approved.Updating peer dependencies ensures compatibility with the latest versions of ESLint and related plugins.
packages/eslint-config-base/package.json (7)
3-3
: Version update approved.The version update to
0.15.0
is consistent with the PR's objectives for introducing breaking changes.
22-27
: Exports and main fields update approved.The update to use
./dist/index.mjs
aligns with modern practices for modular JavaScript projects.
28-28
: Types field addition approved.Adding TypeScript definitions improves type safety and usability for TypeScript projects.
30-31
: Files array update approved.Including the
dist
directory ensures all necessary compiled files are distributed with the package.
42-64
: Dependency updates approved.Updating dependencies ensures compatibility with the latest tools and supports the migration to ESLint's flat config.
66-78
: DevDependency updates approved.The addition and update of TypeScript-related packages enhance TypeScript support in development.
84-100
: PeerDependency updates approved.Updating peer dependencies ensures compatibility with the latest versions of ESLint and related plugins.
The ESLint configuration has been migrated to the flat config.
When you prefer to use the legacy configuration, you can import directly JSON/YAML files.
However, we no longer update legacy settings. And we plan to remove them in the next
v0.16.0
.Features
Other updates
Summary by CodeRabbit
New Features
Bug Fixes
Version Updates
Configuration Enhancements