-
-
Notifications
You must be signed in to change notification settings - Fork 877
Description
I use OXLint in a legacy JavaScript project that does not use import/export.
Files are concatenated with Gulp into a single bundle, and symbols are shared globally (for example via window / shared runtime scope).
In this setup, rules like unused-function/unused-vars can report false positives, because semantic cross-file usage is not explicit in module imports.
Current problem
A function declared in one file can be used in another file, but OXLint cannot see this usage semantically.
Example:
- declaration: dmLeitura.js ->
function dataServidor() { ... } - usage: frmContasPagar.js ->
dmLeitura.dataServidor()
Even with real usage in another file, lint may still report it as unused in the declaring file.
Proposal
Add an optional mode to provide textual cross-file reference hints (non-semantic), for example:
- “No semantic usage found, but textual references found in: frmContasPagar.js”
- This would be a hint only, not a strict correctness guarantee.
Something similar to a lightweight workspace search integrated into lint diagnostics.
Why this helps
- Legacy/global-script projects are still common.
- Users would get actionable context instead of only a possibly misleading unused warning.
- Keeps default behavior fast and strict, while enabling an opt-in fallback for non-module codebases.
Possible config idea
{
"unusedSymbolHints": {
"enabled": true,
"mode": "text-search",
"include": ["**/*.js"],
"exclude": ["dist/**", "node_modules/**"]
}
}Notes
I understand this is not a replacement for semantic analysis.
The request is for an optional assistive hint mode, especially useful when module boundaries are absent.