{"record":{"id":"04ea2206398ddcb1","repo":"oxc-project/oxc","slug":"identifier-name-is-restricted-04ea22","errorCode":null,"errorMessage":"Identifier '#{name}' is restricted.","messagePattern":"Identifier '#(.+?)' is restricted\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/eslint/id_denylist.rs","lineNumber":35,"sourceCode":"use oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\n\nuse crate::{\n    AstNode,\n    context::{ContextHost, LintContext},\n    rule::{Rule, TupleRuleConfig},\n    rules::eslint::id_match::{\n        is_dynamic_import_attribute_object_property, is_known_external_global,\n        transparent_reference_parent,\n    },\n};\n\nfn id_denylist_diagnostic(span: Span, name: &str) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"Identifier '{name}' is restricted.\")).with_label(span)\n}\n\nfn id_denylist_private_diagnostic(span: Span, name: &str) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"Identifier '#{name}' is restricted.\")).with_label(span)\n}\n\n#[derive(Debug, Default, Clone, Deserialize, Serialize)]\npub struct IdDenylist(Box<FxHashSet<String>>);\n\nimpl JsonSchema for IdDenylist {\n    fn schema_name() -> String {\n        \"IdDenylist\".to_string()\n    }\n\n    fn json_schema(r#gen: &mut SchemaGenerator) -> Schema {\n        Schema::Object(SchemaObject {\n            instance_type: Some(InstanceType::Array.into()),\n            array: Some(Box::new(ArrayValidation {\n                additional_items: Some(Box::new(r#gen.subschema_for::<String>())),\n                unique_items: Some(true),\n                ..Default::default()\n            })),","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/eslint/id_denylist.rs#L17-L53","documentation":"The private-class-member variant of the `id-denylist` diagnostic. It is produced by `id_denylist_private_diagnostic` (crates/oxc_linter/src/rules/eslint/id_denylist.rs:35) when a private class field or method whose name (without the `#`) matches a configured denylist entry is declared, e.g. `#data`. The message renders the name with the `#` prefix so it is clear the private member, not a public one, is restricted.","triggerScenarios":"Rule configured with a denylist containing a name such as `\"internal\"` or `\"data\"`, plus a class declaring `#data = ...;`, `#internal() {}`, or a private accessor `get #value()`. Note that the matched name is the bare identifier: denylisting `\"data\"` also bans `#data`.","commonSituations":"Migrating a class from TypeScript `private` modifiers to native `#private` fields while a denylist rule is active; the denylist was written for public API names and authors did not realize private members with the same name are also covered; shared configs adding common words like `data`/`temp` that collide with internal private fields.","solutions":["Rename the private member to be specific: `#data` → `#cachedRows`, `#internal` → `#revalidateInternalState`.","If the bare name should only be banned publicly, remove it from the denylist or rename just the public usages and keep the private one out of the list.","Suppress the single declaration with `oxlint-disable-next-line id-denylist` when the private name mirrors an external protocol or spec."],"exampleFix":"// before\nclass Store {\n  #data = new Map();\n  read(key) { return this.#data.get(key); }\n}\n\n// after\nclass Store {\n  #rowsById = new Map();\n  read(key) { return this.#rowsById.get(key); }\n}","handlingStrategy":"validation","validationCode":"// Remember the denylist matches the bare name: 'data' bans both `data` and `#data`.\n// Validate with: oxlint --rule id-denylist='[\"data\"]' src/","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When migrating classes to native #private fields, re-run lint — private members hit the same denylist as public names.","Name private fields after their role (cache, indexes, subscribers) rather than generic words likely to be denylisted.","Document the denylist in the contributing guide so authors choose compliant names up front."],"tags":["eslint","oxlint","style","naming","private-class-fields","denylist"],"backgroundTag":"identifier-denylist","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"}