Skip to content

Conversation

@riatzukiza
Copy link
Owner

@riatzukiza riatzukiza commented Oct 30, 2025

This PR contains changes for Eslint Config.

Summary by CodeRabbit

  • Chores
    • Enhanced ESLint configuration to enforce stricter type-safety checks, functional programming best practices, and improved import validation across the codebase. Implemented specialized rule sets for test files and script utilities, along with custom code restrictions, to strengthen quality standards and maintain consistency throughout the development and testing workflow.

@coderabbitai
Copy link

coderabbitai bot commented Oct 30, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

A comprehensive ESLint configuration file is added for TypeScript projects, defining global ignores, parser settings, plugin integrations, and rule sets with file-specific overrides to enforce code quality, functional programming patterns, and import hygiene.

Changes

Cohort / File(s) Summary
ESLint Configuration
eslint.config.mjs
Adds default export of ESLint config array with global ignores, TypeScript-aware parsing (ts-eslint), plugin integrations (typescript-eslint, functional, import, sonarjs, promise, ava), strict type rules, functional programming constraints, custom import restrictions, and specialized overrides for scripts and test files.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–30 minutes

Areas requiring attention:

  • Verification that each ESLint rule aligns with project coding standards and intent
  • Cross-plugin rule conflicts or redundancies (e.g., overlapping restrictions from multiple plugins)
  • File-scoped overrides for src/scripts/* and test files to ensure appropriateness and consistency
  • Custom no-restricted-imports rules to confirm they correctly steer module usage patterns
  • Balance between strict enforcement (rules set to error) and warnings for experimental constraints (e.g., no-try-statements as warning)

Poem

🐰 A rabbit hops through ESLint's rules,
With TypeScript as the guiding jewels,
Plugins dance in functional grace,
No let-bindings in this place!
Clean code hops far, so code review stays bright,
Configuration brings order to the night.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Eslint Config" is directly related to the main change in this pull request, which introduces a new comprehensive ESLint configuration module (eslint.config.mjs). The title accurately conveys that the PR is about ESLint configuration and successfully communicates the core subject matter to a teammate scanning through the repository history. However, the title is somewhat generic and overly broad—it describes what is being added at a high level but doesn't specify that this is a new configuration file or highlight the key aspects of the setup (such as TypeScript support, multiple plugins, or strict rules). While not as vague as terms like "misc updates" or "stuff," the title could be more specific and descriptive about the nature of the change.
✨ 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 add/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.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 65 to 92
// Validate and resolve cwd parameter
let workingDirectory = Instance.directory
if (params.cwd) {
const resolvedCwd = await $`realpath ${params.cwd}`
.quiet()
.nothrow()
.text()
.then((x) => x.trim())

if (!resolvedCwd) {
throw new Error(`Invalid working directory: ${params.cwd}`)
}

if (!Filesystem.contains(Instance.directory, resolvedCwd)) {
throw new Error(
`Working directory ${resolvedCwd} is outside of project directory ${Instance.directory}`,
)
}

workingDirectory = resolvedCwd
}

const tree = await parser().then((p) => p.parse(params.command))
if (!tree) {
throw new Error("Failed to parse command")
}
const permissions = await Agent.get(ctx.agent).then((x) => x.permission.bash)

Choose a reason for hiding this comment

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

P0 Badge Restore missing dependencies in Bash tool

The bash tool now calls parser(), $\realpath`, Filesystem.contains, and Agent.get, but the commit commented out the parserinitializer and removed the imports for$, Filesystem, Agent, and Wildcard`. As written these identifiers are undefined, so TypeScript compilation (or runtime execution) will fail before any command runs. Re‑introduce the relevant imports/definition or remove the references.

Useful? React with 👍 / 👎.

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 485135c and 9ef2ac1.

📒 Files selected for processing (1)
  • eslint.config.mjs (1 hunks)

Comment on lines +149 to +164
files: ['**/*.test.{ts,tsx,js}', '**/*.spec.{ts,tsx,js}', '**/tests/**/*.{ts,tsx,js}'],
plugins: { ava },
rules: {
'ava/no-only-test': 'error',
'ava/no-identical-title': 'error',
'ava/test-title': 'warn',
// your existing no-restricted-syntax for setTimeout
'no-restricted-syntax': [
'error',
{
selector: "CallExpression[callee.name='setTimeout'][arguments.0.type='Identifier']",
message:
'Use sleep from @promethean/test-utils instead of setTimeout for sleeps in tests.',
},
],
},
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Restore base no-restricted-syntax restrictions in test overrides

This override replaces the earlier no-restricted-syntax settings, so test files now permit require, module.exports, and class declarations even though the main config forbids them. Because flat configs merge top-to-bottom and the last matching rule wins, we need to carry over the original selectors when adding the test-specific restriction.(eslint.org)

       'no-restricted-syntax': [
         'error',
+        {
+          selector: "CallExpression[callee.name='require']",
+          message: 'ESM only',
+        },
+        {
+          selector: "MemberExpression[object.name='module'][property.name='exports']",
+          message: 'ESM only',
+        },
+        {
+          selector: 'ClassDeclaration',
+          message: 'Class declarations are not allowed.',
+        },
+        {
+          selector: 'ClassExpression',
+          message: 'Class expressions are not allowed.',
+        },
         {
           selector: "CallExpression[callee.name='setTimeout'][arguments.0.type='Identifier']",
           message:
             'Use sleep from @promethean/test-utils instead of setTimeout for sleeps in tests.',
         },
@@
-      ],
+      ],
📝 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
files: ['**/*.test.{ts,tsx,js}', '**/*.spec.{ts,tsx,js}', '**/tests/**/*.{ts,tsx,js}'],
plugins: { ava },
rules: {
'ava/no-only-test': 'error',
'ava/no-identical-title': 'error',
'ava/test-title': 'warn',
// your existing no-restricted-syntax for setTimeout
'no-restricted-syntax': [
'error',
{
selector: "CallExpression[callee.name='setTimeout'][arguments.0.type='Identifier']",
message:
'Use sleep from @promethean/test-utils instead of setTimeout for sleeps in tests.',
},
],
},
files: ['**/*.test.{ts,tsx,js}', '**/*.spec.{ts,tsx,js}', '**/tests/**/*.{ts,tsx,js}'],
plugins: { ava },
rules: {
'ava/no-only-test': 'error',
'ava/no-identical-title': 'error',
'ava/test-title': 'warn',
// your existing no-restricted-syntax for setTimeout
'no-restricted-syntax': [
'error',
{
selector: "CallExpression[callee.name='require']",
message: 'ESM only',
},
{
selector: "MemberExpression[object.name='module'][property.name='exports']",
message: 'ESM only',
},
{
selector: 'ClassDeclaration',
message: 'Class declarations are not allowed.',
},
{
selector: 'ClassExpression',
message: 'Class expressions are not allowed.',
},
{
selector: "CallExpression[callee.name='setTimeout'][arguments.0.type='Identifier']",
message:
'Use sleep from @promethean/test-utils instead of setTimeout for sleeps in tests.',
},
],
},
🤖 Prompt for AI Agents
In eslint.config.mjs around lines 149 to 164, the test override replaces the
base no-restricted-syntax rule so tests now unintentionally allow constructs
(require, module.exports, class declarations) that the main config forbids;
restore the original selectors by merging them into this override: include the
base selectors for require, module.exports and class declarations alongside the
test-specific setTimeout selector so the override explicitly re‑applies those
restrictions, keeping the test-only setTimeout rule plus the original selectors
and messages so the last matching rule still enforces the base restrictions in
test files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants