-
-
Notifications
You must be signed in to change notification settings - Fork 789
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
Migrating from eslintrc.json to eslint.config.js #2660
Migrating from eslintrc.json to eslint.config.js #2660
Conversation
Warning Rate limit exceeded@Suyash878 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 22 minutes and 27 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
WalkthroughThis pull request focuses on migrating the ESLint configuration from the traditional Changes
Assessment against linked issues
Possibly related PRs
Suggested reviewers
Poem
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? 🪧 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 using PR comments)
Other keywords and placeholders
Documentation and Community
|
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
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: 1
🧹 Outside diff range and nitpick comments (3)
eslint.config.mjs (2)
7-9
: Simplify plugin import by removing 'fixupPluginRules'.The use of
fixupPluginRules
from@eslint/compat
may not be necessary in the Flat Configuration. You can importeslint-plugin-import
directly and reference it in theplugins
section without wrapping it.Apply this diff to simplify the import:
- import _import from "eslint-plugin-import"; - import { fixupPluginRules } from "@eslint/compat"; + import importPlugin from "eslint-plugin-import"; ... plugins: { react, "@typescript-eslint": typescriptEslint, jest, - import: fixupPluginRules(_import), + import: importPlugin, tsdoc, prettier, },
61-62
: Update 'ecmaVersion' to the latest version.The
ecmaVersion
is set to2018
. Consider updating it to the latest version (e.g.,2023
) to support the newest ECMAScript features.Apply this diff to update the
ecmaVersion
:parser: tsParser, - ecmaVersion: 2018, + ecmaVersion: "latest", sourceType: "module",package.json (1)
Line range hint
97-101
: Remove the redundant 'eslintConfig' field from 'package.json'.Since the ESLint configuration has moved to
eslint.config.mjs
, theeslintConfig
field inpackage.json
is no longer needed and can be removed to prevent confusion.Apply this diff to remove the redundant configuration:
}, - "eslintConfig": { - "extends": [ - "react-app", - "react-app/jest" - ] - }, "browserslist": {
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.json
is excluded by!**/package-lock.json
📒 Files selected for processing (6)
.eslintignore
(0 hunks).eslintrc.json
(0 hunks)eslint.config.mjs
(1 hunks)package.json
(2 hunks)src/GraphQl/Queries/fundQueries.ts
(0 hunks)src/screens/OrganizationDashboard/OrganizationDashboard.tsx
(0 hunks)
💤 Files with no reviewable changes (4)
- .eslintignore
- .eslintrc.json
- src/screens/OrganizationDashboard/OrganizationDashboard.tsx
- src/GraphQl/Queries/fundQueries.ts
🔇 Additional comments (2)
eslint.config.mjs (1)
24-33
: Verify that all necessary files are properly ignored.
With the migration from .eslintignore
to the ignores
array, ensure that all files and patterns that should be excluded from linting are included. This includes any files previously specified in .eslintignore
.
Review the ignores
array to confirm it reflects all the necessary ignore patterns from your previous configuration.
package.json (1)
119-121
: Re-evaluate the necessity of '@eslint/compat' and '@eslint/eslintrc'.
The packages @eslint/compat
and @eslint/eslintrc
are typically used for compatibility purposes when migrating configurations. Since you're adopting the new Flat Configuration format, these may not be required.
Consider removing these dependencies if they are not essential to your setup.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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: 1
🧹 Outside diff range and nitpick comments (2)
eslint.config.mjs (2)
51-68
: Consider updating ECMAScript version.The current configuration uses ECMAScript 2018. Consider updating to a more recent version (e.g., 2022) to take advantage of newer language features.
- ecmaVersion: 2018, + ecmaVersion: 2022,
112-116
: Consider relaxing interface naming conventions.The current configuration requires all interfaces to have either "Interface" or "TestInterface" prefix, which might lead to verbose and less readable code. Consider removing the prefix requirement while keeping the PascalCase format.
"@typescript-eslint/naming-convention": ["error", { selector: "interface", format: ["PascalCase"], - prefix: ["Interface", "TestInterface"], }, {
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
eslint.config.mjs
(1 hunks)
🔇 Additional comments (6)
eslint.config.mjs (6)
1-14
: LGTM: Import statements are well-organized and complete.
All necessary ESLint plugins and utilities are properly imported.
15-21
: LGTM: Configuration setup follows ESLint flat config best practices.
Proper initialization of FlatCompat with correct base directory and ESM compatibility.
34-41
: Remove redundant Prettier configuration.
Having both 'plugin:prettier/recommended'
and 'prettier'
in the extends array is redundant.
42-49
: LGTM: Plugin configurations are properly set up.
All plugins are correctly registered and the use of fixupPluginRules
for the import plugin is appropriate.
70-74
: LGTM: React settings are properly configured.
Using "detect"
for React version is the recommended approach.
23-33
: Verify the necessity of ignoring specific files.
While the general ignore patterns for CSS/SCSS/JSON files are standard, let's verify if ignoring specific files like src/components/CheckIn/tagTemplate.ts
is still necessary.
✅ Verification successful
Let me gather more information about the tagTemplate.ts
file to understand why it might need to be ignored.
Based on the results, I can now generate the final response:
The specific file ignores are still necessary and valid
The specifically ignored file src/components/CheckIn/tagTemplate.ts
exists and contains a PDF template definition used for tag generation. The file contains base64-encoded PDF data and specific layout configurations, which should be excluded from linting to avoid unnecessary processing of generated/binary content.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if the specific ignored files exist and their content
echo "Checking for existence of specifically ignored files..."
for file in "src/components/CheckIn/tagTemplate.ts" "tsconfig.json"
do
if [ -f "$file" ]; then
echo "Found $file:"
head -n 5 "$file"
else
echo "$file not found"
fi
done
Length of output: 798
Script:
#!/bin/bash
# Check the content and usage of tagTemplate.ts
echo "Content of tagTemplate.ts:"
cat src/components/CheckIn/tagTemplate.ts
echo -e "\nChecking for references to tagTemplate:"
rg "tagTemplate" --type ts -C 2
Length of output: 65728
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: 2
🧹 Outside diff range and nitpick comments (3)
eslint.config.mjs (3)
1-14
: LGTM! Consider organizing imports for better maintainability.The imports are comprehensive and include all necessary plugins. Consider organizing them into groups:
- Node.js built-ins
- ESLint core/compat
- ESLint plugins
- Parsers and utilities
+ // Node.js built-ins import path from 'node:path'; import { fileURLToPath } from 'node:url'; + + // ESLint core/compat import js from '@eslint/js'; import { FlatCompat } from '@eslint/eslintrc'; import { fixupPluginRules } from '@eslint/compat'; import globals from 'globals'; + + // ESLint plugins import react from 'eslint-plugin-react'; import typescriptEslint from '@typescript-eslint/eslint-plugin'; import jest from 'eslint-plugin-jest'; import _import from 'eslint-plugin-import'; import tsdoc from 'eslint-plugin-tsdoc'; import prettier from 'eslint-plugin-prettier'; + + // Parsers and utilities import tsParser from '@typescript-eslint/parser';
25-34
: Consider adding common build and test directories to ignores.The ignore patterns cover most file types but could be enhanced with common build and test output directories.
ignores: [ '**/*.css', '**/*.scss', '**/*.less', '**/*.json', 'src/components/CheckIn/tagTemplate.ts', '**/package.json', '**/package-lock.json', '**/tsconfig.json', + 'build/**', + 'dist/**', + 'coverage/**', + 'node_modules/**', ],
167-191
: Consider adjusting React rule severity levels.Some React rules might be too restrictive or inconsistent in their severity levels:
jsx-equals-spacing
is set to "warn" while most other rules are "error"function-component-definition
is effectively disabled (0) but includes configuration- 'react/jsx-equals-spacing': ['warn', 'never'], + 'react/jsx-equals-spacing': ['error', 'never'], - 'react/function-component-definition': [ - 0, - { - namedComponents: 'function-declaration', - }, - ], + 'react/function-component-definition': ['error', { + namedComponents: ['function-declaration', 'arrow-function'], + unnamedComponents: 'arrow-function' + }],
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
eslint.config.mjs
(1 hunks)
🔇 Additional comments (2)
eslint.config.mjs (2)
36-43
: Remove 'prettier' from the extends array to prevent conflicts.
Using both 'plugin:prettier/recommended'
and 'prettier'
in the extends array is redundant as 'plugin:prettier/recommended'
already includes prettier's recommended configuration.
...compat.extends(
'plugin:react/recommended',
'eslint:recommended',
'plugin:jest/recommended',
'plugin:prettier/recommended',
'plugin:@typescript-eslint/recommended',
- 'prettier',
),
81-113
: Strict TypeScript rules need adjustments before enabling
The enabled TypeScript rules are quite strict and may cause numerous errors in the existing codebase. Consider a gradual approach to enabling these rules.
#!/bin/bash
# Verify impact of strict TypeScript rules
echo "Checking TypeScript files for potential violations..."
# Check for explicit any usage
echo "Files with 'any' type usage:"
rg ":\s*any\b" --type=typescript
# Check for non-null assertions
echo "Files with non-null assertions:"
rg "[!]\." --type=typescript
# Check for type assertions
echo "Files with type assertions:"
rg "as\s+\w+" --type=typescript
Please make sure that coderabbit.ai approves your changes |
Please fix the failing tests and ensure CodeRabbit.ai approves your changes |
|
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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: 1
🧹 Nitpick comments (4)
eslint.config.mjs (4)
17-21
: Consider caching FlatCompat configurationThe FlatCompat instance creates new configurations on every run. Consider moving this to a separate configuration file and caching the result for better performance.
+// eslintCompatConfig.mjs const compat = new FlatCompat({ baseDirectory: dirName, recommendedConfig: js.configs.recommended, allConfig: js.configs.all, }); +export default compat;
25-34
: Group ignore patterns by typeConsider grouping ignore patterns by their type for better maintainability:
ignores: [ + // Style files '**/*.css', '**/*.scss', '**/*.less', + // Config files '**/*.json', - 'src/components/CheckIn/tagTemplate.ts', '**/package.json', '**/package-lock.json', '**/tsconfig.json', + // Special cases + 'src/components/CheckIn/tagTemplate.ts', ],
124-164
: Simplify naming conventionsThe current naming conventions are quite restrictive. Consider:
- Removing the strict PascalCase requirement for interfaces
- Allowing more flexibility in variable naming
- Reconsidering the mandatory underscore prefix for private members
'@typescript-eslint/naming-convention': [ 'error', { selector: 'interface', - format: ['PascalCase'], + format: ['PascalCase', 'StrictPascalCase'], }, // ... other rules ... { selector: 'memberLike', modifiers: ['private'], format: ['camelCase'], - leadingUnderscore: 'require', + leadingUnderscore: 'allow', }, ],
174-190
: Standardize React rule severity levelsThe React rules mix different severity levels ('error', 'warn', 0). Consider standardizing them:
-'react/jsx-equals-spacing': ['warn', 'never'], +'react/jsx-equals-spacing': ['error', 'never'], 'react/no-this-in-sfc': 'error', -'jest/expect-expect': 0, +'jest/expect-expect': 'error', -'react/function-component-definition': [0, +'react/function-component-definition': ['error',
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
eslint.config.mjs
(1 hunks)
🔇 Additional comments (2)
eslint.config.mjs (2)
36-43
: Remove redundant prettier configuration
The configuration includes both 'plugin:prettier/recommended'
and 'prettier'
, which is redundant.
81-81
:
Consider gradual adoption of strict TypeScript rules
The configuration enables several strict TypeScript rules that might cause numerous errors in the existing codebase. Consider:
- Enabling these rules gradually
- Starting with 'warn' instead of 'error'
- Creating a migration plan for existing code
Particularly challenging rules include:
@typescript-eslint/explicit-module-boundary-types
@typescript-eslint/no-explicit-any
@typescript-eslint/no-non-null-assertion
Also applies to: 99-113
@Suyash878 Please fix the failed tests and address coderabbit's comments. |
This PR will need the ignore-sensitive-files tag, since as one of the necessary steps of the migration involves- |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop-postgres #2660 +/- ##
=====================================================
+ Coverage 26.46% 88.80% +62.33%
=====================================================
Files 300 323 +23
Lines 7568 8422 +854
Branches 1652 1836 +184
=====================================================
+ Hits 2003 7479 +5476
+ Misses 5434 701 -4733
- Partials 131 242 +111 ☔ View full report in Codecov by Sentry. |
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
🧹 Nitpick comments (3)
eslint.config.mjs (3)
16-16
: Remove trailing spacesThere are trailing spaces at the end of these lines that should be removed.
-const fileName = fileURLToPath(import.meta.url); +const fileName = fileURLToPath(import.meta.url); -const dirName = path.dirname(fileName); +const dirName = path.dirname(fileName);Also applies to: 18-18
🧰 Tools
🪛 eslint
[error] 16-16: Delete
··
(prettier/prettier)
🪛 GitHub Check: Performs linting, formatting, type-checking, checking for different source and target branch
[failure] 16-16:
Delete··
32-32
: Document reason for ignoring tagTemplate.tsConsider adding a comment explaining why this specific file needs to be ignored from linting.
126-166
: Consider simplifying naming convention rulesThe naming convention rules are quite complex. Consider simplifying them by:
- Combining similar selectors
- Using more permissive formats where appropriate
'@typescript-eslint/naming-convention': [ 'error', { selector: ['interface', 'typeAlias', 'typeLike', 'enum'], format: ['PascalCase'], }, - { - selector: ['typeAlias', 'typeLike', 'enum'], - format: ['PascalCase'], - }, { selector: 'typeParameter', format: ['PascalCase'], prefix: ['T'], }, { - selector: 'variable', - format: ['camelCase', 'UPPER_CASE', 'PascalCase'], - leadingUnderscore: 'allow', - }, - { selector: ['variable', 'parameter'], format: ['camelCase', 'UPPER_CASE', 'PascalCase'], leadingUnderscore: 'allow', }, { - selector: 'parameter', - format: ['camelCase'], - leadingUnderscore: 'allow', - }, - { selector: ['function', 'memberLike'], format: ['camelCase', 'PascalCase'], }, { selector: 'memberLike', modifiers: ['private'], format: ['camelCase'], leadingUnderscore: 'require', }, { selector: 'variable', modifiers: ['exported'], format: null, }, ],
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.json
is excluded by!**/package-lock.json
📒 Files selected for processing (1)
eslint.config.mjs
(1 hunks)
🧰 Additional context used
🪛 eslint
eslint.config.mjs
[error] 16-16: Delete ··
(prettier/prettier)
[error] 18-18: Delete ··
(prettier/prettier)
🪛 GitHub Check: Performs linting, formatting, type-checking, checking for different source and target branch
eslint.config.mjs
[failure] 16-16:
Delete ··
[failure] 18-18:
Delete ··
🔇 Additional comments (4)
eslint.config.mjs (4)
47-54
: LGTM!
The plugin configuration is well-structured and correctly uses fixupPluginRules
for the import plugin.
56-74
: LGTM!
The language options are well-configured for a modern TypeScript/React project with appropriate globals and parser settings.
75-80
: LGTM!
Using 'detect' for React version is the recommended approach.
42-44
: 🛠️ Refactor suggestion
Remove redundant prettier configuration
Having both 'plugin:prettier/recommended'
and 'prettier'
is redundant as 'plugin:prettier/recommended'
already includes prettier's recommended configuration.
...compat.extends(
'plugin:react/recommended',
'eslint:recommended',
'plugin:jest/recommended',
'plugin:prettier/recommended',
'plugin:@typescript-eslint/recommended',
- 'prettier',
),
Likely invalid or redundant comment.
Please fix the failing tests. Our test code coverage system will fail if any of these conditions occur:
Here are some steps to take:
We do this to ensure the overall reliability of the code base is maintained. This is a prerequisite for getting your PR approved. Assigned reviewers regularly review the PR queue and tend to focus on PRs that are passing. Additional notes:
|
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: 3
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
eslint.config.mjs
(1 hunks)
🧰 Additional context used
🪛 GitHub Actions: PR Workflow
eslint.config.mjs
[error] File not found. ESLint could not find the specified configuration file.
🔇 Additional comments (4)
eslint.config.mjs (4)
1-14
: LGTM! All necessary ESLint plugins are imported.The imports are well-organized and include all required plugins for React, TypeScript, Jest, and other necessary functionalities.
🧰 Tools
🪛 GitHub Actions: PR Workflow
[error] File not found. ESLint could not find the specified configuration file.
47-55
: Remove redundant prettier configurations.Using both
'eslint-config-prettier'
and'prettier'
in the extends array is redundant as you're already using'plugin:prettier/recommended'
....compat.extends( 'plugin:react/recommended', 'eslint:recommended', 'plugin:jest/recommended', 'plugin:prettier/recommended', - 'eslint-config-prettier', - 'prettier', ),🧰 Tools
🪛 GitHub Actions: PR Workflow
[error] File not found. ESLint could not find the specified configuration file.
74-76
: Update ECMAVersion to support modern JavaScript features.The current ECMAVersion (2018) is outdated. Consider updating to a more recent version.
parser: tsParser, - ecmaVersion: 2018, + ecmaVersion: 2022, sourceType: 'module',🧰 Tools
🪛 GitHub Actions: PR Workflow
[error] File not found. ESLint could not find the specified configuration file.
136-142
: Reconsider restrictive interface naming convention.The current configuration requires interfaces to be prefixed with either 'Interface' or 'TestInterface', which deviates from common TypeScript practices.
{ selector: 'interface', format: ['PascalCase'], - prefix: ['Interface', 'TestInterface'], },
🧰 Tools
🪛 GitHub Actions: PR Workflow
[error] File not found. ESLint could not find the specified configuration file.
eslint.config.mjs
Outdated
ignores: [ | ||
'**/*.css', | ||
'**/*.scss', | ||
'**/*.less', | ||
'**/*.json', | ||
'**/*.svg', | ||
'docs/docusaurus.config.ts', | ||
'docs/sidebars.ts', | ||
'docs/src/**/*', | ||
'docs/blog/**/*', | ||
'src/components/CheckIn/tagTemplate.ts', | ||
'**/package.json', | ||
'**/package-lock.json', | ||
'**/tsconfig.json', | ||
'docs/**/*', | ||
'eslint.config.mjs' | ||
], |
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.
🛠️ Refactor suggestion
Remove eslint.config.mjs from ignores.
The ESLint configuration file should follow the same code quality standards. Instead of ignoring it completely, use specific rule overrides as suggested in the previous comment.
ignores: [
// ... other ignores
- 'eslint.config.mjs'
],
📝 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.
ignores: [ | |
'**/*.css', | |
'**/*.scss', | |
'**/*.less', | |
'**/*.json', | |
'**/*.svg', | |
'docs/docusaurus.config.ts', | |
'docs/sidebars.ts', | |
'docs/src/**/*', | |
'docs/blog/**/*', | |
'src/components/CheckIn/tagTemplate.ts', | |
'**/package.json', | |
'**/package-lock.json', | |
'**/tsconfig.json', | |
'docs/**/*', | |
'eslint.config.mjs' | |
], | |
ignores: [ | |
'**/*.css', | |
'**/*.scss', | |
'**/*.less', | |
'**/*.json', | |
'**/*.svg', | |
'docs/docusaurus.config.ts', | |
'docs/sidebars.ts', | |
'docs/src/**/*', | |
'docs/blog/**/*', | |
'src/components/CheckIn/tagTemplate.ts', | |
'**/package.json', | |
'**/package-lock.json', | |
'**/tsconfig.json', | |
'docs/**/*' | |
], |
🧰 Tools
🪛 GitHub Actions: PR Workflow
[error] File not found. ESLint could not find the specified configuration file.
eslint.config.mjs
Outdated
export function createESLintCompat(){ | ||
const _filename = fileURLToPath(import.meta.url); | ||
const _dirname = path.dirname(_filename); | ||
|
||
return new FlatCompat({ | ||
baseDirectory: _dirname, | ||
recommendedConfig: js.configs.recommended, | ||
allConfig: js.configs.all, | ||
}); | ||
} |
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.
🛠️ Refactor suggestion
Disable return type rule for this file.
Since this is an .mjs
file and TypeScript syntax isn't directly available, consider disabling the return type rule specifically for this file by adding it to the ignores section.
ignores: [
// ... other ignores
- 'eslint.config.mjs'
],
And add a new configuration object specifically for this file:
// ... other configs
+ {
+ files: ['eslint.config.mjs'],
+ rules: {
+ '@typescript-eslint/explicit-function-return-type': 'off',
+ '@typescript-eslint/explicit-module-boundary-types': 'off'
+ }
+ },
{
plugins: {
Committable suggestion skipped: line range outside the PR's diff.
🧰 Tools
🪛 GitHub Actions: PR Workflow
[error] File not found. ESLint could not find the specified 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
🧹 Nitpick comments (2)
eslint.config.mjs (2)
1-14
: Consider organizing imports by type for better maintainability.Group imports into categories:
- ESLint core and compatibility
- ESLint plugins
- Node.js built-ins
- TypeScript related
+ // ESLint core and compatibility import { fixupPluginRules } from '@eslint/compat'; import { FlatCompat } from '@eslint/eslintrc'; import js from '@eslint/js'; + + // ESLint plugins import react from 'eslint-plugin-react'; import jest from 'eslint-plugin-jest'; import _import from 'eslint-plugin-import'; import tsdoc from 'eslint-plugin-tsdoc'; import prettier from 'eslint-plugin-prettier'; + + // Node.js built-ins import path from 'node:path'; import { fileURLToPath } from 'node:url'; import globals from 'globals'; + + // TypeScript related import typescriptEslint from '@typescript-eslint/eslint-plugin'; import tsParser from '@typescript-eslint/parser';🧰 Tools
🪛 GitHub Actions: PR Workflow
[error] File not found. ESLint could not find the specified configuration file.
29-45
: Remove commented code.The commented line for ignoring 'eslint.config.mjs' should be removed as it's handled by the override configuration in lines 209-214.
'docs/**/*', - // 'eslint.config.mjs'
🧰 Tools
🪛 GitHub Actions: PR Workflow
[error] File not found. ESLint could not find the specified configuration file.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
eslint.config.mjs
(1 hunks)package.json
(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- package.json
🧰 Additional context used
🪛 GitHub Actions: PR Workflow
eslint.config.mjs
[error] File not found. ESLint could not find the specified configuration file.
🔇 Additional comments (5)
eslint.config.mjs (5)
15-24
: Implementation looks good!The function correctly:
- Resolves the base directory using import.meta.url
- Initializes FlatCompat with proper configuration
🧰 Tools
🪛 GitHub Actions: PR Workflow
[error] File not found. ESLint could not find the specified configuration file.
47-55
: 🛠️ Refactor suggestionRemove redundant prettier configurations.
The configuration includes multiple prettier-related extends that are redundant:
- 'plugin:prettier/recommended' already includes prettier configuration
- 'eslint-config-prettier' and 'prettier' are not needed when using 'plugin:prettier/recommended'
...compat.extends( 'plugin:react/recommended', 'eslint:recommended', 'plugin:jest/recommended', 'plugin:prettier/recommended', 'plugin:@typescript-eslint/recommended', - 'eslint-config-prettier', - 'prettier', ),Likely invalid or redundant comment.
🧰 Tools
🪛 GitHub Actions: PR Workflow
[error] File not found. ESLint could not find the specified configuration file.
136-142
: 🛠️ Refactor suggestionReconsider restrictive interface naming convention.
The current configuration requires interfaces to be prefixed with either 'Interface' or 'TestInterface', which:
- Deviates from common TypeScript practices
- Makes the code unnecessarily verbose
{ selector: 'interface', format: ['PascalCase'], - prefix: ['Interface', 'TestInterface'], },
Likely invalid or redundant comment.
🧰 Tools
🪛 GitHub Actions: PR Workflow
[error] File not found. ESLint could not find the specified configuration file.
74-76
: 🛠️ Refactor suggestionUpdate ECMAVersion to support modern JavaScript features.
The current ECMAVersion (2018) is outdated. Consider updating to a more recent version (2022) to support modern JavaScript features.
parser: tsParser, - ecmaVersion: 2018, + ecmaVersion: 2022, sourceType: 'module',Likely invalid or redundant comment.
🧰 Tools
🪛 GitHub Actions: PR Workflow
[error] File not found. ESLint could not find the specified configuration file.
1-215
:⚠️ Potential issueFix ESLint configuration to resolve pipeline failure.
The pipeline failure indicates that ESLint cannot find the configuration file. This could be due to:
- Dual ESLint configurations (both in package.json and eslint.config.mjs)
- Build process not handling .mjs files correctly
To resolve this:
- Remove the
eslintConfig
field from package.json- Ensure the build process is configured to handle .mjs files
🧰 Tools
🪛 GitHub Actions: PR Workflow
[error] File not found. ESLint could not find the specified 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: 1
♻️ Duplicate comments (2)
eslint.config.mjs (2)
45-53
: 🛠️ Refactor suggestionRemove redundant prettier configurations.
Having both
'eslint-config-prettier'
and'prettier'
in the extends array is redundant since you're already using'plugin:prettier/recommended'
. This could potentially cause conflicts.Apply this diff to fix the issue:
...compat.extends( 'plugin:react/recommended', 'eslint:recommended', 'plugin:jest/recommended', 'plugin:prettier/recommended', - 'eslint-config-prettier', - 'prettier', ),🧰 Tools
🪛 GitHub Actions: PR Workflow
[error] 45-45: ReferenceError: compat is not defined. ESLint configuration error due to undefined 'compat' variable.
72-74
: 🛠️ Refactor suggestionUpdate ECMAVersion to support modern JavaScript features.
The current ECMAVersion (2018) is outdated. Consider updating to a more recent version to support modern JavaScript features.
Apply this diff to fix the issue:
parser: tsParser, - ecmaVersion: 2018, + ecmaVersion: 2022, sourceType: 'module',
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
eslint.config.mjs
(1 hunks)
🧰 Additional context used
🪛 GitHub Actions: PR Workflow
eslint.config.mjs
[error] 45-45: ReferenceError: compat is not defined. ESLint configuration error due to undefined 'compat' variable.
🔇 Additional comments (3)
eslint.config.mjs (3)
1-14
: LGTM! All necessary imports are present.The imports section is well-organized and includes all required ESLint plugins and utilities.
207-212
: LGTM! Good solution for type annotations.The configuration correctly disables TypeScript return type rules for this
.mjs
file, which is a good solution to the type annotation discussion from previous reviews.
134-140
: Reconsider restrictive interface naming convention.The current configuration requires interfaces to be prefixed with either 'Interface' or 'TestInterface', which deviates from common TypeScript practices and may make the code more verbose.
Apply this diff to make the naming convention more flexible:
{ selector: 'interface', format: ['PascalCase'], - prefix: ['Interface', 'TestInterface'], },
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
I have made the changes, please review. And let me know the next course of action |
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: 1
🧹 Nitpick comments (3)
eslint.config.mjs (3)
76-78
: Update ECMAVersion for modern JavaScript featuresThe current ECMAVersion (2018) is outdated and may not support modern JavaScript features used in the project.
Apply this diff to update to a more recent version:
parser: tsParser, - ecmaVersion: 2018, + ecmaVersion: 2022, sourceType: 'module',🧰 Tools
🪛 GitHub Actions: PR Workflow
[error] SyntaxError: Unexpected token 'export'. ESLint configuration file contains invalid syntax.
138-144
: Reconsider restrictive interface naming conventionThe current configuration requires interfaces to be prefixed with either 'Interface' or 'TestInterface', which deviates from common TypeScript practices and may make the code more verbose.
Apply this diff to simplify the naming convention:
{ selector: 'interface', format: ['PascalCase'], - prefix: ['Interface', 'TestInterface'], },
🧰 Tools
🪛 GitHub Actions: PR Workflow
[error] SyntaxError: Unexpected token 'export'. ESLint configuration file contains invalid syntax.
32-47
: Consider using .gitignore patterns for ignored filesThe
ignores
array contains many patterns that might already be covered by.gitignore
. ESLint can be configured to read from.gitignore
to avoid duplication.Consider adding this configuration to use
.gitignore
patterns:{ ignores: [ + // Read from .gitignore + ...compat.extends('eslint:recommended').ignores, // Keep only specific overrides not in .gitignore 'docs/docusaurus.config.ts', 'docs/sidebars.ts', 'src/components/CheckIn/tagTemplate.ts', ], },🧰 Tools
🪛 GitHub Actions: PR Workflow
[error] SyntaxError: Unexpected token 'export'. ESLint configuration file contains invalid syntax.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
eslint.config.mjs
(1 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
eslint.config.mjs
[error] 29-30: Expected a property, an expression, or a method but instead found 'export default'.
Expected a property, an expression, or a method here.
(parse)
[error] 30-30: expected ,
but instead found [
Remove [
(parse)
[error] 217-217: expected ,
but instead found ;
Remove ;
(parse)
[error] 217-217: expected ]
but instead the file ends
the file ends here
(parse)
🪛 GitHub Actions: PR Workflow
eslint.config.mjs
[error] SyntaxError: Unexpected token 'export'. ESLint configuration file contains invalid syntax.
🔇 Additional comments (3)
eslint.config.mjs (3)
211-216
: LGTM: Appropriate rule overrides for config fileThe configuration correctly disables TypeScript return type rules for the ESLint config file itself, which is appropriate since it's an
.mjs
file.🧰 Tools
🪛 GitHub Actions: PR Workflow
[error] SyntaxError: Unexpected token 'export'. ESLint configuration file contains invalid syntax.
54-56
: 🛠️ Refactor suggestionRemove redundant ESLint configurations
The configuration includes both
'plugin:prettier/recommended'
and'eslint-config-prettier'
, which is redundant and may cause conflicts.Apply this diff to remove the redundant configuration:
'plugin:jest/recommended', 'plugin:prettier/recommended', 'plugin:@typescript-eslint/recommended', - 'eslint-config-prettier', 'prettier',
Likely invalid or redundant comment.
🧰 Tools
🪛 GitHub Actions: PR Workflow
[error] SyntaxError: Unexpected token 'export'. ESLint configuration file contains invalid syntax.
93-208
: Verify impact of strict TypeScript rulesThe configuration enables several strict TypeScript rules that might impact the existing codebase:
@typescript-eslint/no-explicit-any
@typescript-eslint/explicit-function-return-type
@typescript-eslint/no-non-null-assertion
Run this script to assess the impact:
🧰 Tools
🪛 GitHub Actions: PR Workflow
[error] SyntaxError: Unexpected token 'export'. ESLint configuration file contains invalid syntax.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@Suyash878 It looks like some tests are still failing. |
the linting test(failing test) is a false positive so it can be ignored for the scope of this PR as discussed with @palisadoes |
Can I merge this then? |
You'll need to create another PR immediately afterwards to test |
1104967
into
PalisadoesFoundation:develop-postgres
Please open another PR immediately to test. We can't have this breaking our workflows |
Merged |
Please open another PR immediately to test. We can't have this breaking our workflows |
|
This reverts commit 1104967.
What kind of change does this PR introduce?
Feature
Issue Number:
Fixes #2645
Did you add tests for your changes?
Not required.
Snapshots/Videos:
None.
If relevant, did you update the documentation?
Not required.
Summary
Successfully migrating from the deprecated
.eslintrc.json
to the newly supportedeslint.config.js
configuration.Does this PR introduce a breaking change?
No.
Other information
None.
Have you read the contributing guide?
Yes
Summary by CodeRabbit
Configuration Updates
Removed Configuration Files
.eslintignore
and.eslintrc.json
files.GraphQL Queries
Testing Improvements
Component Updates