oxc-project/oxc · error · OxcDiagnostic

Mixing of `@access` with `@public`, `@private`, `@protected`

Error message

Mixing of `@access` with `@public`, `@private`, `@protected`, or `@package` on the same doc block.

What it means

Fires from jsdoc/check-access when a JSDoc block contains both the general @access tag and one of the specific visibility tags (@public, @private, @protected, @package). The redundant_access_tags helper flags the duplication since @access already conveys the level.

Source

Thrown at crates/oxc_linter/src/rules/jsdoc/check_access.rs:15

use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint;
use oxc_span::Span;
use rustc_hash::FxHashSet;

use crate::{context::LintContext, rule::Rule, utils::should_ignore_as_internal};

fn invalid_access_level(span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn("Invalid access level is specified or missing.")
        .with_help("Valid access levels are `package`, `private`, `protected`, and `public`.")
        .with_label(span)
}

fn redundant_access_tags(span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn(
        "Mixing of `@access` with `@public`, `@private`, `@protected`, or `@package` on the same doc block.",
    )
    .with_help("There should be only one instance of access tag in a JSDoc comment.")
    .with_label(span)
}

#[derive(Debug, Default, Clone)]
pub struct CheckAccess;

declare_oxc_lint!(
    /// ### What it does
    ///
    /// Checks that `@access` tags use one of the following values:
    /// - "package", "private", "protected", "public"
    ///
    /// Also reports:
    /// - Mixing of `@access` with `@public`, `@private`, `@protected`, or `@package` on the same doc block.
    /// - Use of multiple instances of `@access` (or the `@public`, etc) on the same doc block.

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Keep only the @access tag and remove the redundant visibility tag
  2. Or keep the specific tag (@private etc.) and drop @access
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/oxc_linter/src/rules/jsdoc/check_access.rs:15 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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