SublimeLinter-contrib-oxlint
A SublimeLinter plugin for `oxlint`
Details
Installs
- Total 0
- Win 0
- Mac 0
- Linux 0
| Aug 27 | Aug 26 | Aug 25 | Aug 24 | Aug 23 | Aug 22 | Aug 21 | Aug 20 | Aug 19 | Aug 18 | Aug 17 | Aug 16 | Aug 15 | Aug 14 | Aug 13 | Aug 12 | Aug 11 | Aug 10 | Aug 9 | Aug 8 | Aug 7 | Aug 6 | Aug 5 | Aug 4 | Aug 3 | Aug 2 | Aug 1 | Jul 31 | Jul 30 | Jul 29 | Jul 28 | Jul 27 | Jul 26 | Jul 25 | Jul 24 | Jul 23 | Jul 22 | Jul 21 | Jul 20 | Jul 19 | Jul 18 | Jul 17 | Jul 16 | Jul 15 | Jul 14 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Windows | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
SublimeLinter-oxlint
This linter plugin for SublimeLinter provides an interface to oxlint, the Rust-based JavaScript and TypeScript linter from oxc.
It also drives oxlint's fixer and, optionally, oxfmt for formatting — on demand or on save.
Installation
SublimeLinter must be installed in order to use this plugin.
Please install via Package Control.
Linter installation
oxlint must be installed before using this plugin. Adding it as a dev dependency is recommended, and is detected automatically:
npm install --save-dev oxlint
The plugin looks for node_modules/.bin/oxlint starting from the linted file and walking up towards $HOME. In a Yarn project it runs yarn run --silent oxlint instead. Failing that, it falls back to an oxlint on your PATH (npm install -g oxlint, brew install oxlint, …).
Note: GUI applications on macOS and Linux don't inherit the PATH from your shell, so a globally installed oxlint may not be found. See Debugging PATH problems.
Formatting installation
oxfmt is oxc's formatter. If you wish to include formatting install it alongside oxlint:
npm install --save-dev oxfmt
Behaviour
Linting happens on save
oxlint has no stdin mode, and it resolves .oxlintrc.json and tsconfig.json relative to the file being linted. The plugin therefore lints the real file on disk (tempfile_suffix = '-'), which means diagnostics update when you save, not as you type. Unsaved buffers are not linted.
Configuration
oxlint finds its own configuration — .oxlintrc.json (including nested configs) and the relevant tsconfig.json. There is nothing to configure in the plugin for that.
Settings
See SublimeLinter's settings docs for how and where to set these. Common ones:
{
"linters": {
"oxlint": {
"args": ["--type-aware"],
"disable_if_not_dependency": true
}
}
}
| Setting | Description |
|---|---|
args |
Extra arguments passed to oxlint, e.g. ["-D", "correctness"], ["--react-plugin"], ["--type-aware"]. |
disable_if_not_dependency |
Only lint when oxlint is a dependency of the project. Useful if you also run SublimeLinter-eslint, so that each only reports where it belongs. |
executable |
Point at a specific oxlint binary. Disables the node_modules lookup. |
fix_on_save |
Which fixes to apply after saving: "off", "safe", "suggestions" or "dangerously". See Fix on save. |
format_on_save |
Run oxfmt after saving. See Formatting with oxfmt. |
selector |
Which files to lint. Defaults to JS/JSX/TS/TSX plus Vue, Astro and Svelte. |
Do not pass --fix in args: oxlint would rewrite the file behind Sublime Text's back, and fixed problems are omitted from its output. Use the Oxlint: Fix This File command instead.
Fixing problems
SublimeLinter has no “run the linter's fixer” feature of its own, so this plugin provides both halves itself.
Quick actions (silence a rule)
Like the other SublimeLinter plugins, the quick action inserts an // oxlint-disable-next-line <rule> comment above the offending line, merging into an existing comment where there is one. Put the caret on the error (or select several lines) and run SublimeLinter: Quick Action from the command palette, or bind it:
{ "keys": ["super+alt+a"], "command": "sublime_linter_quick_actions" }
Auto-fix (oxlint --fix)
Run Oxlint: Fix This File from the command palette. oxlint rewrites the file on disk, so the command saves the view, runs the fixer, reads the result back into the buffer as a single undoable edit, saves, and re-lints. Bind it with:
{ "keys": ["super+alt+f"], "command": "oxlint_fix" }
A fix is safe: it preserves behaviour, like no-var rewriting var to const. A suggestion may change behaviour, so oxlint will not apply it unless asked — no-console deletes the statement, for example.
oxlint's fix flags are mutually exclusive — passing more than one is an error — and --fix-suggestions applies suggestions instead of safe fixes rather than as well. To apply both, this plugin runs oxlint twice, which composes because each pass writes the file:
| Command palette entry | mode |
Passes | Safe fixes | Suggestions |
|---|---|---|---|---|
| Oxlint: Fix This File | safe |
--fix |
yes | no |
| Oxlint: Fix This File (with suggestions) | suggestions |
--fix, then --fix-suggestions |
yes | yes |
| Oxlint: Fix This File (dangerously) | dangerously |
--fix-dangerously |
yes | yes, plus dangerous ones |
Given var a = 1; console.log(a);, those three produce respectively:
const a = 1; console.log(a); // safe
const a = 1; // suggestions
const a = 1; // dangerously
Pass {"mode": "..."} as the command's args to bind any of them to a key.
The fixer runs in the same environment as the lint: both the global paths setting and the oxlint linter's own env setting are applied, which is what makes the #!/usr/bin/env node shim in node_modules/.bin work in a GUI application that didn't inherit your shell's PATH. Unlike SublimeLinter, an env.PATH is prepended to the inherited PATH rather than replacing it, so pointing it at just a node install is enough:
{
"linters": {
"oxlint": {
"env": { "PATH": "/Users/you/.nvm/versions/node/v24.14.0/bin" }
}
}
}
Only rules that are actually enabled get fixed, so if nothing happens, check that the rule is on in your .oxlintrc.json — and note that many rules have no fix at all.
Fix on save
Set fix_on_save in the oxlint linter settings to the fixes you want applied after every save:
{
"linters": {
"oxlint": {
"fix_on_save": "safe"
}
}
}
| Value | Effect |
|---|---|
"off" (default) |
Never fix on save. |
"safe" |
Safe fixes only. |
"suggestions" |
Safe fixes and suggestions. May change what your code does. |
"dangerously" |
Everything, dangerous fixes included. Rarely what you want on a keystroke. |
true and false are accepted as aliases for "safe" and "off", as is "fix" after oxlint's own flag name. Anything else is ignored, with a note in the console.
Only buffers SublimeLinter actually lints with oxlint are touched, so the setting respects selector and disable_if_not_dependency without repeating them.
Formatting with oxfmt
oxfmt is oxc's formatter. Install it alongside oxlint if you want it:
npm install --save-dev oxfmt
Run Oxfmt: Format This File from the command palette, or bind it:
{ "keys": ["super+alt+p"], "command": "oxfmt_format" }
oxfmt formats standard input, so the command works on an unsaved buffer and does not save afterwards — it only reformats what you are looking at. Your .oxfmtrc.json is still found, from the buffer's path.
To format on every save, set format_on_save:
{
"linters": {
"oxlint": {
"fix_on_save": "safe",
"format_on_save": true
}
}
}
With both set, fixing runs first — fixes can leave code that wants reformatting, never the other way round — and the two share a single save and a single re-lint. Like fix_on_save, this only touches buffers SublimeLinter lints with oxlint, so oxlint needs to be set up even if it is oxfmt you care about. The command itself needs only oxfmt.
License
MIT — see LICENSE.