Skip to content

Commit

Permalink
fix(linter): add missing typescript-eslint(_) prefix for some errors (o…
Browse files Browse the repository at this point in the history
…xc-project#2342)

Running latest on one of my projects these warnings jumped out at me
because they were "anonymous" vs the others.

This PR just adds the usual rule-name prefix to the errors where it was
missing
  • Loading branch information
maurice authored and IWANABETHATGUY committed May 29, 2024
1 parent d7afbc8 commit df72938
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 141 deletions.
8 changes: 4 additions & 4 deletions crates/oxc_linter/src/rules/typescript/array_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,24 @@ declare_oxc_lint!(

#[derive(Debug, Diagnostic, Error)]
pub enum ArrayTypeDiagnostic {
#[error("Array type using '{0}{2}[]' is forbidden. Use '{1}<{2}>' instead.")]
#[error("typescript-eslint(array-type): Array type using '{0}{2}[]' is forbidden. Use '{1}<{2}>' instead.")]
#[diagnostic(severity(warning))]
// readonlyPrefix className type
Generic(String, String, String, #[label] Span),

#[error(
"Array type using '{0}{2}[]' is forbidden for non-simple types. Use '{1}<{2}>' instead."
"typescript-eslint(array-type): Array type using '{0}{2}[]' is forbidden for non-simple types. Use '{1}<{2}>' instead."
)]
#[diagnostic(severity(warning))]
// readonlyPrefix className type
GenericSimple(String, String, String, #[label] Span),

#[error("Array type using '{1}<{2}>' is forbidden. Use '{0}{2}[]' instead.")]
#[error("typescript-eslint(array-type): Array type using '{1}<{2}>' is forbidden. Use '{0}{2}[]' instead.")]
#[diagnostic(severity(warning))]
// readonlyPrefix className type
Array(String, String, String, #[label] Span),

#[error("Array type using '{1}<{2}>' is forbidden for simple types. Use '{0}{2}[]' instead.")]
#[error("typescript-eslint(array-type): Array type using '{1}<{2}>' is forbidden for simple types. Use '{0}{2}[]' instead.")]
#[diagnostic(severity(warning))]
// readonlyPrefix className type
ArraySimple(String, String, String, #[label] Span),
Expand Down
8 changes: 5 additions & 3 deletions crates/oxc_linter/src/rules/typescript/ban_ts_comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ use crate::{context::LintContext, rule::Rule};

#[derive(Debug, Error, Diagnostic)]
pub enum BanTsCommentDiagnostic {
#[error("Do not use @ts-{0} because it alters compilation errors.")]
#[error(
"typescript-eslint(ban-ts-comment): Do not use @ts-{0} because it alters compilation errors."
)]
#[diagnostic(severity(warning))]
Comment(String, #[label] Span),

#[error("Include a description after the @ts-{0} directive to explain why the @ts-{0} is necessary. The description must be {1} characters or longer.")]
#[error("typescript-eslint(ban-ts-comment): Include a description after the @ts-{0} directive to explain why the @ts-{0} is necessary. The description must be {1} characters or longer.")]
#[diagnostic(severity(warning))]
CommentRequiresDescription(String, u64, #[label] Span),

#[error("The description for the @ts-{0} directive must match the {1} format.")]
#[error("typescript-eslint(ban-ts-comment): The description for the @ts-{0} directive must match the {1} format.")]
#[diagnostic(severity(warning))]
CommentDescriptionNotMatchPattern(String, String, #[label] Span),
}
Expand Down
Loading

0 comments on commit df72938

Please sign in to comment.