Skip to content

fix: use file icon for LICENSE files#2563

Open
gioboa wants to merge 1 commit intonpmx-dev:mainfrom
gioboa:fix/2558
Open

fix: use file icon for LICENSE files#2563
gioboa wants to merge 1 commit intonpmx-dev:mainfrom
gioboa:fix/2558

Conversation

@gioboa
Copy link
Copy Markdown

@gioboa gioboa commented Apr 18, 2026

🔗 Linked issue

Close #2558

📚 Description

Use file icon for LICENSE files.

Before:

Screenshot 2026-04-18 at 15 15 08

After:

Screenshot 2026-04-18 at 15 14 15

Before creating the pull request, please make sure you do the following:

  • Check that there isn't already a PR that solves the problem the same way. If you find a duplicate, please help us reviewing it.
  • Ensure that PR title follows conventional commits (https://www.conventionalcommits.org)
  • Update the corresponding documentation if needed.
  • Include relevant tests that fail without this PR but pass with it.
  • Add any additional context, tradeoffs, follow-ups, or things reviewers should be aware of.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Apr 18, 2026 1:19pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Apr 18, 2026 1:19pm
npmx-lunaria Ignored Ignored Apr 18, 2026 1:19pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 18, 2026

📝 Walkthrough

Summary by CodeRabbit

  • Style

    • Updated the visual icon displayed for LICENSE files to use the standard default file icon.
  • Tests

    • Added test coverage for LICENSE file icon mappings.

Walkthrough

The icon mapping for the LICENSE family of filenames (including LICENSE, LICENSE.md, LICENSE.txt, and their lowercase variants) is updated from vscode-icons-file-type-license to vscode-icons-default-file. Test coverage is expanded to validate these mappings.

Changes

Cohort / File(s) Summary
Icon mapping updates
app/utils/file-icons.ts
Updated FILENAME_ICONS entries for LICENSE files (LICENSE, LICENSE.md, LICENSE.txt, and lowercase variants) to use the default file icon instead of the specialised license icon.
Test coverage expansion
test/unit/app/utils/file-icons.spec.ts
Added test assertions for exact-filename matching of LICENSE files across common casing and extension combinations, verifying all variants resolve to vscode-icons-default-file.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: use file icon for LICENSE files' clearly and concisely describes the main change in the changeset.
Description check ✅ Passed The description is directly related to the changeset, explaining the icon change for LICENSE files with before/after screenshots.
Linked Issues check ✅ Passed The PR successfully addresses the requirement in #2558 by implementing file icon display for extensionless LICENSE files and variants with extensions.
Out of Scope Changes check ✅ Passed All changes are scoped to the requirements in #2558: updating LICENSE file icon mappings and corresponding unit tests.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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
Contributor

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/utils/file-icons.ts`:
- Around line 267-272: The FILENAME_ICONS mapping currently forces all LICENSE
variants to the generic icon; change it to only override extensionless LICENSE
names so extension-based fallbacks still apply: remove the keys 'LICENSE.md',
'LICENSE.txt', 'license.md', and 'license.txt' from the mapping in
app/utils/file-icons.ts (leave 'LICENSE' and 'license' if you want to target
only extensionless files), so getFileIcon's extension-based logic will return
markdown/text icons for .md/.txt files.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 53cb6251-b574-440a-bb23-eb800880cce9

📥 Commits

Reviewing files that changed from the base of the PR and between d9f8d56 and 64afe72.

📒 Files selected for processing (2)
  • app/utils/file-icons.ts
  • test/unit/app/utils/file-icons.spec.ts

Comment thread app/utils/file-icons.ts
Comment on lines +267 to +272
'LICENSE': 'vscode-icons-default-file',
'LICENSE.md': 'vscode-icons-default-file',
'LICENSE.txt': 'vscode-icons-default-file',
'license': 'vscode-icons-default-file',
'license.md': 'vscode-icons-default-file',
'license.txt': 'vscode-icons-default-file',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Consider whether LICENSE.md / LICENSE.txt should still use their extension-based icons.

Issue #2558 specifically asks for an icon on extensionless LICENSE files. With the current change, LICENSE.md and LICENSE.txt (and lowercase variants) also lose their previous icon and now resolve to the generic default file icon, even though, without any FILENAME_ICONS entry, the extension-based fallback in getFileIcon would naturally give them the markdown and text icons respectively — which is arguably more informative than the blank default.

Two alternatives worth considering:

  1. Only override the extensionless variants and let .md / .txt fall through to their extension icons:
♻️ Proposed change
-  'LICENSE': 'vscode-icons-default-file',
-  'LICENSE.md': 'vscode-icons-default-file',
-  'LICENSE.txt': 'vscode-icons-default-file',
-  'license': 'vscode-icons-default-file',
-  'license.md': 'vscode-icons-default-file',
-  'license.txt': 'vscode-icons-default-file',
+  'LICENSE': 'vscode-icons-default-file',
+  'license': 'vscode-icons-default-file',
  1. Keep the explicit entries as-is if the intent is to deliberately strip the license-branded ribbon icon from every LICENSE variant across the board.

Note that the six explicit LICENSE entries are functionally equivalent to the default fallback for the extensionless names, so keeping them is only useful if you want to force the default for the .md/.txt variants too (overriding the extension rules). Worth confirming the intended behaviour with the issue author; the tests should then follow whichever decision is made.

📝 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
'LICENSE': 'vscode-icons-default-file',
'LICENSE.md': 'vscode-icons-default-file',
'LICENSE.txt': 'vscode-icons-default-file',
'license': 'vscode-icons-default-file',
'license.md': 'vscode-icons-default-file',
'license.txt': 'vscode-icons-default-file',
'LICENSE': 'vscode-icons-default-file',
'license': 'vscode-icons-default-file',
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/utils/file-icons.ts` around lines 267 - 272, The FILENAME_ICONS mapping
currently forces all LICENSE variants to the generic icon; change it to only
override extensionless LICENSE names so extension-based fallbacks still apply:
remove the keys 'LICENSE.md', 'LICENSE.txt', 'license.md', and 'license.txt'
from the mapping in app/utils/file-icons.ts (leave 'LICENSE' and 'license' if
you want to target only extensionless files), so getFileIcon's extension-based
logic will return markdown/text icons for .md/.txt files.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

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.

Show icon for extensionless LICENSE files

1 participant