config :volt, :lint applies plugins and rules to every file in the run. oxlint's own configuration format has overrides, which apply rules to a subset of files. Volt has no equivalent.
A project that needs one rule relaxed in one directory must also install the npm oxlint.
Environment
:volt 0.17.11
:oxc 0.17.8
- Elixir 1.20.4, Erlang/OTP 29
What already maps over
Everything else translates cleanly. Categories go through rules, and discovery is configurable:
config :volt, :lint,
root: ".",
sources: ["assets/js/**/*.js", "assets/colocated/dev/*/*/*.js"],
ignore: ["assets/colocated/*/*/index.js"],
plugins: [:typescript, :unicorn, :oxc],
rules: %{"correctness" => :deny, "style" => :deny}
What is missing
Two cases come up in an ordinary Phoenix project.
Phoenix writes colocated hooks into a directory named after the module. The file name is a number and a hash. unicorn/filename-case flags every one of them, and the project cannot rename them.
The second case is a module that deliberately mirrors a third-party API. A helper around Element.closest/1 returns null on purpose. unicorn/no-null has to be off in that file and on everywhere else.
In .oxlintrc.json each of these is three lines:
"overrides": [
{
"files": ["assets/colocated/**/*.js"],
"rules": { "unicorn/filename-case": "off" }
}
]
With config :volt, :lint the only way to silence these is to turn the rule off everywhere. That also turns it off for the files that should keep it.
Expected
config :volt, :lint,
rules: %{"correctness" => :deny},
overrides: [
%{
files: ["assets/colocated/**/*.js"],
rules: %{"unicorn/filename-case" => :allow}
}
]
OXC.Lint.run/3 already takes rules per call. Volt builds the file list itself, so it could resolve the rules per file.
Related
env has the same shape in .oxlintrc.json and the same need. One build-time script may run in Node while everything else runs in a browser. Volt cannot express that either.
config :volt, :lintappliespluginsandrulesto every file in the run. oxlint's own configuration format hasoverrides, which apply rules to a subset of files. Volt has no equivalent.A project that needs one rule relaxed in one directory must also install the npm
oxlint.Environment
:volt0.17.11:oxc0.17.8What already maps over
Everything else translates cleanly. Categories go through
rules, and discovery is configurable:What is missing
Two cases come up in an ordinary Phoenix project.
Phoenix writes colocated hooks into a directory named after the module. The file name is a number and a hash.
unicorn/filename-caseflags every one of them, and the project cannot rename them.The second case is a module that deliberately mirrors a third-party API. A helper around
Element.closest/1returnsnullon purpose.unicorn/no-nullhas to be off in that file and on everywhere else.In
.oxlintrc.jsoneach of these is three lines:With
config :volt, :lintthe only way to silence these is to turn the rule off everywhere. That also turns it off for the files that should keep it.Expected
OXC.Lint.run/3already takes rules per call. Volt builds the file list itself, so it could resolve the rules per file.Related
envhas the same shape in.oxlintrc.jsonand the same need. One build-time script may run in Node while everything else runs in a browser. Volt cannot express that either.