You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Other popular linters like ESLint allow to customize the severity of diagnostics - either "warning" or "error". Currently deno_lint treats all diagnostics all "error".
To allow for severity customization there are two major parts that need to happen:
Add severity field to LintDiagnostic struct so it can be properly formatted during printing
Add configuration options that would allow to customize the severity of each lint rule.
To handle point 1 following things need to happen:
Update LintDiagnostic struct and add severity: LintDiagnosticSeverity field to it
Update necessary APIs to accept severity: LintDiagnosticSeverity argument in following order:
Context::create_diagnostic
Context::add_diagnostic_with_fixes
Context::add_diagnostic_with_hint
Context::add_diagnostic
Update LintDiagnostic::level() to convert LintDiagnosticSeverity into deno_ast::DiagnosticLevel.
These changes should be enough to be able to apply different formatting based on severity and can be first applied in examples/dlint/diagnostics.rs in print_compact and print_pretty.
Handling point 2 is more involved and requires further discussion as the current lint configuration is rather bare-bones - it allows to specify a list of lints to run, but not customize them one-by-one.
If someone picks up this issue I can provide more details on how to handle that, but mind that it require changes across several repositories - deno_lint, deno_config and deno itself.
The text was updated successfully, but these errors were encountered:
Other popular linters like ESLint allow to customize the severity of diagnostics - either "warning" or "error". Currently
deno_lint
treats all diagnostics all "error".To allow for severity customization there are two major parts that need to happen:
severity
field toLintDiagnostic
struct so it can be properly formatted during printingTo handle point 1 following things need to happen:
LintDiagnosticSeverity
enum like so:LintDiagnostic
struct and addseverity: LintDiagnosticSeverity
field to itseverity: LintDiagnosticSeverity
argument in following order:Context::create_diagnostic
Context::add_diagnostic_with_fixes
Context::add_diagnostic_with_hint
Context::add_diagnostic
LintDiagnostic::level()
to convertLintDiagnosticSeverity
intodeno_ast::DiagnosticLevel
.These changes should be enough to be able to apply different formatting based on severity and can be first applied in
examples/dlint/diagnostics.rs
inprint_compact
andprint_pretty
.Handling point 2 is more involved and requires further discussion as the current lint configuration is rather bare-bones - it allows to specify a list of lints to run, but not customize them one-by-one.
If someone picks up this issue I can provide more details on how to handle that, but mind that it require changes across several repositories -
deno_lint
,deno_config
anddeno
itself.The text was updated successfully, but these errors were encountered: