oxc-project/oxc · warning · OxcDiagnostic

Invalid access level is specified or missing.

Error message

Invalid access level is specified or missing.

What it means

This is oxlint's 'jsdoc/check-access' diagnostic for the @access tag. It fires when a JSDoc comment uses @access with a value that is not one of package, private, protected, or public — including a missing value entirely. The valid set mirrors JSDoc's official access levels, and the help text lists them.

Source

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

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
    ///

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Correct the value to one of the four allowed levels: /** @access private */.
  2. If the tag has no value, either supply a valid level or delete the @access tag (access then defaults per JSDoc rules).
  3. For Closure-style 'internal', model it as @package or use the @internal tag instead of @access internal.
  4. Run oxlint --fix if tooling supports correction, or add a spellcheck/regex gate for @access values in CI.

Example fix

/**
 * @access internal
 */
function helper() {}

// after
/**
 * @package
 */
function helper() {}
Defensive patterns

Strategy: validation

Validate before calling

// flag invalid or empty @access tags before linting
const { execSync } = require('node:child_process');
console.log(execSync("rg -n '@access\\s*(\\*|$|[^\\s]*(?<!package|private|protected|public)\\b)' src/", { encoding: 'utf8' }));

Type guard

// JSDoc tooling: validate the tag value against the allowed set
const ACCESS_LEVELS = new Set(['package', 'private', 'protected', 'public']);
function isValidAccess(value /* string | undefined */) {
  return value !== undefined && ACCESS_LEVELS.has(value.toLowerCase());
}

Prevention

When it happens

Trigger: Enable the rule (it parses JSDoc tags, skipping @internal-ignored comments via should_ignore_as_internal) and lint a comment like /** @access */ (no value) or /** @access internal */ (unknown value). The diagnostic is attached to the @access tag's span.

Common situations: Typos such as @access privat or @access Protected, copy-pasting JSDoc that used a non-JSDoc tool's vocabulary (e.g. @access internal from Google Closure style), and empty @access tags left after deleting a value during refactoring. Also hit when switching documentation generators whose allowed levels differ from JSDoc's four.

Related errors


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