Skip to content

style: format code with ESLint + Prettier Add Prettier configuration and apply code formatting#20

Open
IO-Fire wants to merge 3 commits into
mainfrom
style/prettier
Open

style: format code with ESLint + Prettier Add Prettier configuration and apply code formatting#20
IO-Fire wants to merge 3 commits into
mainfrom
style/prettier

Conversation

@IO-Fire
Copy link
Copy Markdown
Owner

@IO-Fire IO-Fire commented Jan 7, 2026

@coderabbitai

Summary by CodeRabbit

  • Chores

    • Added Prettier configuration and ignore rules to standardise formatting and exclude build, dependency and cache outputs.
    • Integrated Prettier with ESLint and added Prettier-related dev dependencies; minor package version adjustments.
    • Updated workspace trust-policy exclusions.
  • Style

    • Applied formatting and markup clean-ups across configuration, runtime and test fixtures for consistency.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 7, 2026

📝 Walkthrough

Walkthrough

The PR adds Prettier configuration and integrates eslint-plugin-prettier, updates related dev-dependencies and workspace trust policy, and applies formatting changes across source, tests, fixtures and config files to align with the new code style.

Changes

Cohort / File(s) Summary
Prettier configuration
/.prettierignore, /.prettierrc
Adds Prettier ignore patterns and a Prettier config (singleQuote: true, trailingComma: "none", semi: false).
ESLint & package updates
eslint.config.mjs, /package.json
Inserts Prettier plugin into ESLint fluent config, adds eslint-plugin-prettier and eslint-config-prettier to devDependencies, and adjusts a few dependency versions.
Workspace policy
pnpm-workspace.yaml
Adds eslint-config-prettier@9.1.2 to trustPolicyExclude.
Source formatting
src/module.ts, src/runtime/nitro/plugins/nitro-resource-link.ts
Whitespace, import and minor reflow formatting only; no logic changes.
Playground config/markup
playground/app/app.vue, playground/nuxt.config.ts
Condenses template/script markup and removes a trailing comma in config; no behavioural change.
Tests & fixtures formatting
test/basic.test.ts, test/image.test.ts, test/fixtures/basic/*, test/fixtures/image/*
Reflows test strings, object literals, empty tags and arrays for style; no semantic changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Title Check ✅ Passed Title check skipped as CodeRabbit has written the PR title.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch style/prettier

📜 Recent review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 34ade06 and d919a87.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • package.json
🔇 Additional comments (2)
package.json (2)

46-47: LGTM!

The dependency reordering is a cosmetic formatting change with no functional impact, consistent with the PR's formatting objectives.


58-61: Clarify that version differences reflect the feature branch's design, not direct downgrades in this PR.

This merge combines the style/prettier feature branch (which uses eslint@9.39.1 and nuxt@4.2.1) with origin/main (which has eslint@9.39.2 and nuxt@4.2.2). The versions in the final state were already present on the feature branch; they are not downgrades introduced by this change. The actual additions are the new Prettier configuration packages (eslint-config-prettier@9.1.2 and eslint-plugin-prettier@5.5.4), which exist on npm and support the Prettier integration. If the version choices on the feature branch differ intentionally from main for compatibility reasons, that is acceptable; however, ensure any version pins are documented in commit messages or PR descriptions.

Likely an incorrect or invalid review comment.


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
Copy Markdown

@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: 3

🤖 Fix all issues with AI agents
In @.prettierignore:
- Around line 10-13: Update the .prettierignore file to also exclude other
lockfiles so Prettier won’t format alternative package manager files; add
entries for package-lock.json and yarn.lock alongside the existing
pnpm-lock.yaml, node_modules, and .pnpm-store entries so all common lockfiles
are ignored.

In @eslint.config.mjs:
- Around line 1-4: Remove the duplicate @ts-check directive: in the top of the
file where two "// @ts-check" lines appear, keep a single "// @ts-check" and
delete the second one (the second occurrence just above the import of
eslintPluginPrettierRecommended) so the file has only one @ts-check comment.
- Around line 21-30: The rules block is redundantly disabling @stylistic rules
that eslint-config-prettier already turns off via the
eslint-plugin-prettier/recommended preset; remove the six entries
('@stylistic/comma-dangle', '@stylistic/operator-linebreak',
'@stylistic/brace-style', '@stylistic/arrow-parens',
'@stylistic/indent-binary-ops', '@stylistic/indent') from the rules object so
the config is cleaner, then run the suggested check (npx eslint-config-prettier
eslint.config.mjs) to confirm those rules are reported as conflicts and the
manual disables are unnecessary.
📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 87e560e and 34ade06.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (15)
  • .prettierignore
  • .prettierrc
  • eslint.config.mjs
  • package.json
  • playground/app/app.vue
  • playground/nuxt.config.ts
  • pnpm-workspace.yaml
  • src/module.ts
  • src/runtime/nitro/plugins/nitro-resource-link.ts
  • test/basic.test.ts
  • test/fixtures/basic/app.vue
  • test/fixtures/basic/nuxt.config.ts
  • test/fixtures/image/app.vue
  • test/fixtures/image/nuxt.config.ts
  • test/image.test.ts
🔇 Additional comments (16)
test/fixtures/image/nuxt.config.ts (1)

4-10: LGTM! Formatting changes applied correctly.

The Prettier formatting has been applied consistently—modules array collapsed to a single line and trailing commas adjusted per the new style guide. No functional changes detected.

src/module.ts (1)

1-66: LGTM! Consistent formatting applied throughout.

The Prettier formatting has been applied consistently across imports, object literals, and function calls. All changes are cosmetic with no functional impact.

src/runtime/nitro/plugins/nitro-resource-link.ts (1)

1-229: LGTM! Formatting applied consistently.

The Prettier formatting has been applied throughout the file, improving readability of imports, conditionals, and complex expressions. No functional changes detected.

playground/nuxt.config.ts (1)

5-5: LGTM! Trailing comma removed per Prettier configuration.

The removal of the trailing comma aligns with the new Prettier configuration ("trailingComma": "none"). This is a formatting-only change with no functional impact.

.prettierrc (1)

1-5: LGTM! Sensible Prettier configuration.

The Prettier configuration choices are reasonable and widely adopted:

  • singleQuote: true enforces consistent quote usage
  • trailingComma: "none" maintains clean object/array literals
  • semi: false leverages modern JavaScript's Automatic Semicolon Insertion

These settings align with the formatting changes applied throughout the codebase.

playground/app/app.vue (1)

2-2: LGTM! Vue template and script formatting applied.

The template content and empty script setup tag have been collapsed to single lines, which is a formatting-only change with no functional impact. This aligns with Prettier's default Vue formatting style.

Also applies to: 5-5

test/fixtures/basic/nuxt.config.ts (1)

4-4: LGTM! Modules array reformatted to single line.

The modules array has been reformatted from multi-line to single line, which is a formatting-only change consistent with Prettier's handling of short arrays. No functional changes.

test/image.test.ts (4)

7-7: LGTM! Setup configuration formatting adjusted.

The rootDir parameter has been reformatted for consistency. This is a formatting-only change with no functional impact.


22-24: LGTM! Expect statement reformatted for readability.

The expect assertion has been wrapped to multiple lines, improving readability of the long regex pattern. The assertion logic remains unchanged.


35-38: LGTM! Expect statement reformatted for readability.

The expect assertion within the onResponse callback has been wrapped to multiple lines, improving readability of the long regex pattern. The assertion logic remains unchanged.


50-53: LGTM! Expect statement reformatted for readability.

The expect assertion within the onResponse callback has been wrapped to multiple lines, improving readability of the long string assertion. The assertion logic remains unchanged.

test/basic.test.ts (1)

7-7: Formatting changes approved.

The test assertions have been reformatted for consistency with Prettier's line-length rules. All test logic, assertion targets, and string content remain unchanged; this is purely a readability-focused formatting pass aligned with the PR objectives.

Also applies to: 21-23, 33-45, 55-57

test/fixtures/image/app.vue (1)

17-17: Formatting consolidation approved.

Empty <script setup> and <style> blocks have been consolidated to self-closing tags per Prettier's SFC formatting conventions. The template and component functionality remain unchanged.

Also applies to: 19-19

package.json (1)

59-60: Tooling dependencies added appropriately.

The introduction of eslint-config-prettier and eslint-plugin-prettier aligns with the PR objectives and provides the necessary configuration to enforce Prettier formatting via ESLint. Both versions are stable and compatible with the existing ESLint 9.39.1 baseline. These are dev-only dependencies with no runtime impact.

eslint.config.mjs (1)

18-18: LGTM!

The Prettier plugin is correctly inserted before the Nuxt Vue rules, ensuring proper rule precedence and avoiding conflicts.

test/fixtures/basic/app.vue (1)

8-28: LGTM!

The formatting changes improve readability by expanding the link objects to multi-line format. These are purely cosmetic changes with no functional impact, aligning with the Prettier formatting standards introduced in this PR.

Comment thread .prettierignore
Comment on lines +10 to +13
# Node dependencies
node_modules
.pnpm-store
pnpm-lock.yaml
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Consider adding other lockfiles to the ignore list.

Whilst pnpm-lock.yaml is appropriately ignored, consider also adding package-lock.json and yarn.lock to prevent Prettier from formatting these files if different package managers are used in the project.

📝 Suggested addition
 # Node dependencies
 node_modules
 .pnpm-store
+package-lock.json
 pnpm-lock.yaml
+yarn.lock
📝 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
# Node dependencies
node_modules
.pnpm-store
pnpm-lock.yaml
# Node dependencies
node_modules
.pnpm-store
package-lock.json
pnpm-lock.yaml
yarn.lock
🤖 Prompt for AI Agents
In @.prettierignore around lines 10 - 13, Update the .prettierignore file to
also exclude other lockfiles so Prettier won’t format alternative package
manager files; add entries for package-lock.json and yarn.lock alongside the
existing pnpm-lock.yaml, node_modules, and .pnpm-store entries so all common
lockfiles are ignored.

Comment thread eslint.config.mjs
Comment on lines 1 to +4
// @ts-check
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'
// @ts-check
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove duplicate @ts-check directive.

The @ts-check directive appears twice (line 1 and line 3). Remove the duplicate on line 3.

🧹 Proposed fix
 // @ts-check
 import { createConfigForNuxt } from '@nuxt/eslint-config/flat'
-// @ts-check
 import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
📝 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
// @ts-check
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'
// @ts-check
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
// @ts-check
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
🤖 Prompt for AI Agents
In @eslint.config.mjs around lines 1 - 4, Remove the duplicate @ts-check
directive: in the top of the file where two "// @ts-check" lines appear, keep a
single "// @ts-check" and delete the second one (the second occurrence just
above the import of eslintPluginPrettierRecommended) so the file has only one
@ts-check comment.

Comment thread eslint.config.mjs
Comment on lines +21 to +30
{
rules: {
'@stylistic/comma-dangle': 0,
'@stylistic/operator-linebreak': 0,
'@stylistic/brace-style': 0,
'@stylistic/arrow-parens': 0,
'@stylistic/indent-binary-ops': 0,
'@stylistic/indent': 0
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

🧩 Analysis chain

🏁 Script executed:

# Check if eslint-config-prettier exists and the full eslint.config.mjs content
cat package.json | jq '.devDependencies | to_entries[] | select(.key | contains("prettier") or contains("eslint")) | {key: .key, value: .value}'

Repository: IO-Fire/nuxt-resource-hints

Length of output: 285


🏁 Script executed:

# Read the full eslint.config.mjs to understand the configuration structure
cat -n eslint.config.mjs

Repository: IO-Fire/nuxt-resource-hints

Length of output: 1126


🏁 Script executed:

# Check if there's a prettier config file
ls -la | grep prettier

Repository: IO-Fire/nuxt-resource-hints

Length of output: 200


🌐 Web query:

eslint-plugin-prettier/recommended eslint-config-prettier rules disabled

💡 Result:

Short answer

  • plugin:prettier/recommended enables prettier/prettier, turns off eslint-config-prettier’s set of formatting/conflicting rules, and (specifically) disables arrow-body-style and prefer-arrow-callback. [1][2]

Details / how to see the exact list

  • eslint-config-prettier’s job is to “turn off all rules that are unnecessary or might conflict with Prettier” — that includes many core ESLint rules and rules from common plugins (e.g. @typescript-eslint, react, unicorn, vue, etc.). The exact disabled ruleset is maintained in the eslint-config-prettier repo and can change between versions. [2]
  • To get the precise list for your version, run the included CLI helper: npx eslint-config-prettier path/to/file.js — it reports rules in your config that conflict with Prettier. You can also inspect the project’s disabled-rules files on its GitHub. [2]

Sources

  • eslint-plugin-prettier README (recommended config notes). [1]
  • eslint-config-prettier README (what it disables, special rules, CLI helper). [2]

🏁 Script executed:

# Check if we can find more details about what prettier-recommended config includes
# by checking node_modules or package info
npm list eslint-plugin-prettier 2>/dev/null | head -20

Repository: IO-Fire/nuxt-resource-hints

Length of output: 128


🏁 Script executed:

# Let's check the actual prettierrc config
cat .prettierrc

Repository: IO-Fire/nuxt-resource-hints

Length of output: 140


Consider removing redundant @Stylistic rule disables.

eslint-plugin-prettier/recommended is already integrated and extends eslint-config-prettier, which disables all ESLint formatting rules that conflict with Prettier—including the six @stylistic rules manually disabled here. These manual overrides are likely unnecessary and can be removed for cleaner configuration.

To confirm, run: npx eslint-config-prettier eslint.config.mjs and verify that these @stylistic rules are listed in the conflicts. If they are, the manual disables can be safely removed.

🤖 Prompt for AI Agents
In @eslint.config.mjs around lines 21 - 30, The rules block is redundantly
disabling @stylistic rules that eslint-config-prettier already turns off via the
eslint-plugin-prettier/recommended preset; remove the six entries
('@stylistic/comma-dangle', '@stylistic/operator-linebreak',
'@stylistic/brace-style', '@stylistic/arrow-parens',
'@stylistic/indent-binary-ops', '@stylistic/indent') from the rules object so
the config is cleaner, then run the suggested check (npx eslint-config-prettier
eslint.config.mjs) to confirm those rules are reported as conflicts and the
manual disables are unnecessary.

@IO-Fire IO-Fire changed the title style: format code with ESLint + Prettier style: format code with ESLint + Prettier @coderabbitai Jan 7, 2026
@coderabbitai coderabbitai Bot changed the title style: format code with ESLint + Prettier @coderabbitai style: format code with ESLint + Prettier Add Prettier configuration and apply code formatting Jan 10, 2026
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.

1 participant