Skip to content

Commit b1fb269

Browse files
authored
docs(linter): Add configuration docs info for import/namespace rule (#14799)
I can/should probably start batching these changes into larger PRs rather than opening one at a time. Part of #14743. Exported docs result: ```md ## Configuration This rule accepts a configuration object with the following properties: ### allowComputed type: `boolean` default: `false` Whether to allow computed references to an imported namespace. ```
1 parent 6570f36 commit b1fb269

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

crates/oxc_linter/src/rules/import/namespace.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use oxc_diagnostics::OxcDiagnostic;
88
use oxc_macros::declare_oxc_lint;
99
use oxc_semantic::AstNode;
1010
use oxc_span::{GetSpan, Span};
11+
use schemars::JsonSchema;
1112

1213
use crate::{
1314
context::LintContext,
@@ -46,8 +47,10 @@ fn assignment(span: Span, namespace_name: &str) -> OxcDiagnostic {
4647
}
4748

4849
/// <https://github.com/import-js/eslint-plugin-import/blob/v2.29.1/docs/rules/namespace.md>
49-
#[derive(Debug, Default, Clone)]
50+
#[derive(Debug, Default, Clone, JsonSchema)]
51+
#[serde(rename_all = "camelCase", default)]
5052
pub struct Namespace {
53+
/// Whether to allow computed references to an imported namespace.
5154
allow_computed: bool,
5255
}
5356

@@ -103,7 +106,8 @@ declare_oxc_lint!(
103106
/// ```
104107
Namespace,
105108
import,
106-
correctness
109+
correctness,
110+
config = Namespace,
107111
);
108112

109113
impl Rule for Namespace {

0 commit comments

Comments
 (0)