{"record":{"id":"4cc1a04ad8d7acdc","repo":"oxc-project/oxc","slug":"identifier-name-is-restricted","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":31,"sourceCode":"        ModuleExportName, PrivateIdentifier,\n    },\n};\nuse oxc_diagnostics::OxcDiagnostic;\nuse 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 {","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/eslint/id_denylist.rs#L13-L49","documentation":"Diagnostic from the `id-denylist` rule (ESLint id-denylist port). The rule takes a list of forbidden identifier names; when any variable, function, parameter, or other binding is declared with (or, depending on configuration semantics, references) one of the denylisted names, this message reports it with the name substituted. The default configuration is an empty set, so the rule only fires once you supply a denylist.","triggerScenarios":"Configure the rule with names, e.g. `{ \"id-denylist\": [\"error\", \"data\", \"response\", \"e\"] }`, then declare or use an identifier with a matching name: `function handle(data) {}`, `const response = await fetch(url);`, `catch (e) {}`. The diagnostic function at crates/oxc_linter/src/rules/eslint/id_denylist.rs:31 formats the identifier into the message.","commonSituations":"Teams banning vague names like `data`, `result`, `item`, `err`, `e` to improve readability; monorepos sharing one lint config where a new denylist entry breaks many files at once; upgrading a shared config package that added new denylisted words; the rule reporting catch parameters (`catch (e)`) which is a frequent friction point.","solutions":["Rename the identifier to something specific to its purpose (`response` → `userResponse`, `e` → `fetchError`, `data` → `userData`).","Review the denylist in `.oxlintrc.json` and remove entries that are too broad for the codebase, or keep the list intentionally small and domain-driven.","If the name is legitimate in context (e.g. a well-known API shape), add an inline `oxlint-disable-next-line id-denylist` with a justification comment."],"exampleFix":"// before\nfunction save(data) {\n  return api.post('/items', data);\n}\n\n// after\nfunction save(itemDraft) {\n  return api.post('/items', itemDraft);\n}","handlingStrategy":"validation","validationCode":"// Keep the denylist intentional and small; check new names against it mechanically:\n// .oxlintrc.json -> \"id-denylist\": [\"error\", \"data\", \"err\", \"foo\", \"bar\"]\n// CI: oxlint src/ fails before merge when a denied name appears.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When adding a denylist entry, grep the repo first (`git grep -w data`) to size the blast radius before committing the config change.","Prefer renaming to domain-specific names at authoring time rather than suppressing; that is the rule's whole point.","Review shared-config upgrades for denylist additions, which are silent breaking changes for consuming repos."],"tags":["eslint","oxlint","style","naming","identifier","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"}