{"record":{"id":"696f711d95afa53b","repo":"oxc-project/oxc","slug":"invalid-access-level-is-specified-or-missing","errorCode":null,"errorMessage":"Invalid access level is specified or missing.","messagePattern":"Invalid access level is specified or missing\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/jsdoc/check_access.rs","lineNumber":9,"sourceCode":"use oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::Span;\nuse rustc_hash::FxHashSet;\n\nuse crate::{context::LintContext, rule::Rule, utils::should_ignore_as_internal};\n\nfn invalid_access_level(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Invalid access level is specified or missing.\")\n        .with_help(\"Valid access levels are `package`, `private`, `protected`, and `public`.\")\n        .with_label(span)\n}\n\nfn redundant_access_tags(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\n        \"Mixing of `@access` with `@public`, `@private`, `@protected`, or `@package` on the same doc block.\",\n    )\n    .with_help(\"There should be only one instance of access tag in a JSDoc comment.\")\n    .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct CheckAccess;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/jsdoc/check_access.rs#L1-L27","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Correct the value to one of the four allowed levels: /** @access private */.","If the tag has no value, either supply a valid level or delete the @access tag (access then defaults per JSDoc rules).","For Closure-style 'internal', model it as @package or use the @internal tag instead of @access internal.","Run oxlint --fix if tooling supports correction, or add a spellcheck/regex gate for @access values in CI."],"exampleFix":"/**\n * @access internal\n */\nfunction helper() {}\n\n// after\n/**\n * @package\n */\nfunction helper() {}","handlingStrategy":"validation","validationCode":"// flag invalid or empty @access tags before linting\nconst { execSync } = require('node:child_process');\nconsole.log(execSync(\"rg -n '@access\\\\s*(\\\\*|$|[^\\\\s]*(?<!package|private|protected|public)\\\\b)' src/\", { encoding: 'utf8' }));","typeGuard":"// JSDoc tooling: validate the tag value against the allowed set\nconst ACCESS_LEVELS = new Set(['package', 'private', 'protected', 'public']);\nfunction isValidAccess(value /* string | undefined */) {\n  return value !== undefined && ACCESS_LEVELS.has(value.toLowerCase());\n}","tryCatchPattern":null,"preventionTips":["Remember the only four JSDoc access levels: package, private, protected, public.","Use @internal for Closure-style internal markers instead of @access internal.","Delete rather than empty an @access tag whose value you are unsure about."],"tags":["lint","jsdoc","documentation","access-modifier","oxlint"],"backgroundTag":"jsdoc-access-tag","analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}