Skip to content

Commit 18274aa

Browse files
authored
docs(linter): Add configuration option docs for import/no-duplicates rule. (#15137)
Part of #14743. Generated docs: ```md ## Configuration This rule accepts a configuration object with the following properties: ### preferInline type: `boolean` default: `false` When set to `true`, prefer inline type imports instead of separate type import statements for TypeScript code. Examples of **correct** code with this option set to `true`: \```typescript import { Foo, type Bar } from './module'; \``` ```
1 parent d78419f commit 18274aa

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use oxc_diagnostics::{LabeledSpan, OxcDiagnostic};
55
use oxc_macros::declare_oxc_lint;
66
use oxc_span::Span;
77
use rustc_hash::FxHashMap;
8+
use schemars::JsonSchema;
89

910
use crate::{
1011
context::LintContext,
@@ -36,8 +37,16 @@ where
3637
}
3738

3839
/// <https://github.com/import-js/eslint-plugin-import/blob/v2.29.1/docs/rules/no-duplicates.md>
39-
#[derive(Debug, Default, Clone)]
40+
#[derive(Debug, Default, Clone, JsonSchema)]
41+
#[serde(rename_all = "camelCase", default)]
4042
pub struct NoDuplicates {
43+
/// When set to `true`, prefer inline type imports instead of separate type import
44+
/// statements for TypeScript code.
45+
///
46+
/// Examples of **correct** code with this option set to `true`:
47+
/// ```typescript
48+
/// import { Foo, type Bar } from './module';
49+
/// ```
4150
prefer_inline: bool,
4251
}
4352

@@ -76,7 +85,8 @@ declare_oxc_lint!(
7685
/// ```
7786
NoDuplicates,
7887
import,
79-
style
88+
style,
89+
config = NoDuplicates,
8090
);
8191

8292
impl Rule for NoDuplicates {

0 commit comments

Comments
 (0)