oxc-project/oxc · error

Comments should not begin with

Error message

Comments should not begin with {article} {wrong_case} letter

What it means

Lint diagnostic from eslint/capitalized-comments: a comment's first letter case does not match the configured convention (uppercase by default, lowercase with the 'lowercase' option; the article an/a is chosen accordingly). Directives like oxlint-disable, jshint, and prettier-ignore are exempted before this check.

Solutions

  1. Capitalize (or lowercase, per config) the first letter of the comment
  2. Add an ignore pattern for words or comment styles that must keep their case
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/oxc_linter/src/rules/eslint/capitalized_comments.rs:36 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of oxc-project/oxc@12cb547351 (2026-08-20). Data as JSON: /api/errors/9eb1b0780d8fe936. Report an issue: GitHub.

Appendix: source

Thrown at crates/oxc_linter/src/rules/eslint/capitalized_comments.rs:36

    "oxlint-disable",
    "oxlint-enable",
    "jshint",
    "jscs",
    "istanbul",
    "global ",
    "globals ",
    "exported",
    "prettier-ignore",
    "oxfmt-ignore",
];

fn capitalized_comments_diagnostic(
    span: Span,
    wrong_case: &str,
    correct_case: &str,
) -> OxcDiagnostic {
    let article = if wrong_case == "uppercase" { "an" } else { "a" };
    OxcDiagnostic::warn(format!("Comments should not begin with {article} {wrong_case} letter"))
        .with_help(format!("Change the first letter of the comment to {correct_case}"))
        .with_label(span)
}

/// Configuration for either line or block comments
#[derive(Debug, Clone, Default)]
#[expect(clippy::struct_field_names)]
struct CommentConfig {
    ignore_pattern: Option<Regex>,
    ignore_inline_comments: bool,
    ignore_consecutive_comments: bool,
}

/// Internal configuration structure (boxed for size optimization)
#[derive(Debug, Clone, Default)]
pub struct CapitalizedCommentsConfig {
    capitalize: AlwaysNever,
    line_config: CommentConfig,

View on GitHub (pinned to 12cb547351)