deno_lint 0.84.1

lint for deno
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

use std::collections::HashSet;

use super::{Context, LintRule};
use crate::diagnostic::{LintFix, LintFixChange};
use crate::tags::{self, Tags};
use crate::Program;
use deno_ast::swc::ast::{
  BindingIdent, ExportNamedSpecifier, Id, Ident, ImportDecl, ImportSpecifier,
  JSXElementName, ModuleExportName, NamedExport, TsEntityName,
  TsImportEqualsDecl, TsModuleRef,
};
use deno_ast::swc::ecma_visit::{noop_visit_type, Visit, VisitWith};
use deno_ast::view::NodeTrait;
use deno_ast::{
  view as ast_view, SourceRange, SourceRanged, SourceRangedForSpanned,
};
use derive_more::Display;

const CODE: &str = "verbatim-module-syntax";
const FIX_ADD_TYPE_KEYWORD_DESC: &str = "Add a type keyword";
const FIX_USE_IMPORT_DECL_DESC: &str = "Use an import declaration";

#[allow(clippy::enum_variant_names)]
#[derive(Display)]
enum Message {
  #[display(fmt = "All import identifiers are used in types")]
  AllImportIdentsUsedInTypes,
  #[display(fmt = "Import identifier only used in types")]
  ImportIdentUsedInTypes,
  #[display(fmt = "All export identifiers are used in types")]
  AllExportIdentsUsedInTypes,
  #[display(fmt = "Export identifier only used in types")]
  ExportIdentUsedInTypes,
  #[display(
    fmt = "Empty export declaration elided without verbatim-module-syntax"
  )]
  ExportDeclarationElided,
}

#[derive(Display)]
enum Hint {
  #[display(
    fmt = "Change `import` to `import type` and optionally add an explicit side effect import"
  )]
  ChangeImportToImportType,
  #[display(fmt = "Change `export` to `export type`")]
  ChangeExportToExportType,
  #[display(fmt = "Add a `type` keyword before the identifier")]
  AddTypeKeyword,
  #[display(fmt = "Change to side effect import for consistent behavior")]
  ChangeSideEffectImport,
}

#[derive(Debug)]
pub struct VerbatimModuleSyntax;

impl VerbatimModuleSyntax {
  fn analyze_import(
    &self,
    import: &ast_view::ImportDecl,
    ids: &IdCollector,
    context: &mut Context,
    program: Program,
  ) {
    if import.type_only() || import.specifiers.is_empty() {
      return;
    }
    let mut type_only_usage = Vec::with_capacity(import.specifiers.len());
    let mut type_only_named_import =
      Vec::with_capacity(import.specifiers.len());
    for specifier in import.specifiers {
      match specifier {
        ast_view::ImportSpecifier::Named(named) => {
          if named.is_type_only() {
            type_only_named_import.push(named);
          } else if !ids.has_import_ident(&named.local.to_id()) {
            type_only_usage.push(specifier);
          }
        }
        ast_view::ImportSpecifier::Default(default) => {
          if !ids.has_import_ident(&default.local.to_id()) {
            type_only_usage.push(specifier);
          }
        }
        ast_view::ImportSpecifier::Namespace(namespace) => {
          if !ids.has_import_ident(&namespace.local.to_id()) {
            type_only_usage.push(specifier);
          }
        }
      }
    }
    if import.specifiers.len()
      == type_only_usage.len() + type_only_named_import.len()
    {
      let import_token_range = import.tokens_fast(program)[0].range();
      let mut changes = Vec::with_capacity(1 + type_only_named_import.len());
      changes.push(LintFixChange {
        new_text: " type".into(),
        range: import_token_range.end().range(),
      });
      for named_import in type_only_named_import {
        // remove `type` from all these
        let tokens = named_import.tokens_fast(program);
        let range = SourceRange::new(tokens[0].start(), tokens[1].start());
        changes.push(LintFixChange {
          new_text: "".into(),
          range,
        });
      }
      context.add_diagnostic_with_fixes(
        import_token_range,
        CODE,
        Message::AllImportIdentsUsedInTypes,
        Some(Hint::ChangeImportToImportType.to_string()),
        vec![LintFix {
          description: FIX_ADD_TYPE_KEYWORD_DESC.into(),
          changes,
        }],
      );
    } else {
      for specifier in type_only_usage {
        context.add_diagnostic_with_fixes(
          specifier.range(),
          CODE,
          Message::ImportIdentUsedInTypes,
          Some(Hint::AddTypeKeyword.to_string()),
          vec![LintFix {
            description: FIX_ADD_TYPE_KEYWORD_DESC.into(),
            changes: vec![LintFixChange {
              new_text: "type ".into(),
              range: specifier.start().range(),
            }],
          }],
        );
      }
    }
  }

  fn analyze_export(
    &self,
    named_export: &ast_view::NamedExport,
    ids: &IdCollector,
    context: &mut Context,
    program: Program,
  ) {
    if named_export.type_only() {
      return;
    }

    if named_export.specifiers.is_empty() {
      if let Some(src) = &named_export.src {
        let quote_kind = if src.text_fast(program).starts_with("'") {
          '\''
        } else {
          '\"'
        };
        let semicolon = if named_export.text_fast(program).ends_with(';') {
          ";"
        } else {
          ""
        };
        let changes = Vec::from([LintFixChange {
          new_text: format!(
            "import {0}{1}{0}{2}",
            quote_kind,
            src.value().to_string_lossy(),
            semicolon
          )
          .into(),
          range: named_export.range(),
        }]);
        context.add_diagnostic_with_fixes(
          named_export.range(),
          CODE,
          Message::ExportDeclarationElided,
          Some(Hint::ChangeSideEffectImport.to_string()),
          vec![LintFix {
            description: FIX_USE_IMPORT_DECL_DESC.into(),
            changes,
          }],
        );

        return;
      }
    }

    if named_export.specifiers.is_empty() || named_export.src.is_some() {
      return;
    }

    let mut type_only_usage = Vec::with_capacity(named_export.specifiers.len());
    let mut type_only_named_export =
      Vec::with_capacity(named_export.specifiers.len());
    for specifier in named_export.specifiers {
      match specifier {
        ast_view::ExportSpecifier::Named(named) => {
          if named.is_type_only() {
            type_only_named_export.push(named);
          } else if let ast_view::ModuleExportName::Ident(ident) = &named.orig {
            if !ids.has_export_ident(&ident.to_id()) {
              type_only_usage.push(specifier);
            }
          }
        }
        ast_view::ExportSpecifier::Default(_)
        | ast_view::ExportSpecifier::Namespace(_) => {
          // nothing to analyze
        }
      }
    }
    if named_export.specifiers.len()
      == type_only_usage.len() + type_only_named_export.len()
    {
      let export_token_range = named_export.tokens_fast(program)[0].range();
      let mut changes = Vec::with_capacity(1 + type_only_named_export.len());
      changes.push(LintFixChange {
        new_text: " type".into(),
        range: export_token_range.end().range(),
      });
      for named_import in type_only_named_export {
        // remove `type` from all these
        let tokens = named_import.tokens_fast(program);
        let range = SourceRange::new(tokens[0].start(), tokens[1].start());
        changes.push(LintFixChange {
          new_text: "".into(),
          range,
        });
      }
      context.add_diagnostic_with_fixes(
        export_token_range,
        CODE,
        Message::AllExportIdentsUsedInTypes,
        Some(Hint::ChangeExportToExportType.to_string()),
        vec![LintFix {
          description: FIX_ADD_TYPE_KEYWORD_DESC.into(),
          changes,
        }],
      );
    } else {
      for specifier in type_only_usage {
        context.add_diagnostic_with_fixes(
          specifier.range(),
          CODE,
          Message::ExportIdentUsedInTypes,
          Some(Hint::AddTypeKeyword.to_string()),
          vec![LintFix {
            description: FIX_ADD_TYPE_KEYWORD_DESC.into(),
            changes: vec![LintFixChange {
              new_text: "type ".into(),
              range: specifier.start().range(),
            }],
          }],
        );
      }
    }
  }
}

impl LintRule for VerbatimModuleSyntax {
  fn tags(&self) -> Tags {
    &[tags::JSR]
  }

  fn code(&self) -> &'static str {
    CODE
  }

  fn lint_program_with_ast_view(
    &self,
    context: &mut Context,
    program: Program,
  ) {
    let module = match program.program() {
      Program::Module(module) => module,
      Program::Script(_) => return,
    };
    let ids = IdCollector::build(module);

    for child in module.body {
      match child {
        ast_view::ModuleItem::ModuleDecl(module_decl) => match module_decl {
          ast_view::ModuleDecl::Import(import) => {
            self.analyze_import(import, &ids, context, program);
          }
          ast_view::ModuleDecl::ExportNamed(named_export) => {
            self.analyze_export(named_export, &ids, context, program);
          }
          ast_view::ModuleDecl::ExportDefaultDecl(_)
          | ast_view::ModuleDecl::ExportDefaultExpr(_)
          | ast_view::ModuleDecl::ExportAll(_)
          | ast_view::ModuleDecl::TsImportEquals(_)
          | ast_view::ModuleDecl::TsExportAssignment(_)
          | ast_view::ModuleDecl::TsNamespaceExport(_)
          | ast_view::ModuleDecl::ExportDecl(_) => {}
        },
        ast_view::ModuleItem::Stmt(_) => {}
      }
    }
  }
}

/// This struct is partly lifted and adapted from:
/// https://github.com/swc-project/swc/blob/d8186fb94efb150b50d96519f0b8c5740d15b92f/crates/swc_ecma_transforms_typescript/src/strip_import_export.rs#L9C1-L100C2
#[derive(Debug, Default)]
struct IdCollector {
  id_usage: HashSet<Id>,
  export_value_id_usage: HashSet<Id>,
  import_value_id_usage: HashSet<Id>,
}

impl IdCollector {
  pub fn build(module: &ast_view::Module) -> Self {
    let mut ids = Self::default();
    module.inner.visit_with(&mut ids);
    ids
  }

  pub fn has_import_ident(&self, id: &Id) -> bool {
    self.id_usage.contains(id) || self.export_value_id_usage.contains(id)
  }

  pub fn has_export_ident(&self, id: &Id) -> bool {
    self.id_usage.contains(id) || self.import_value_id_usage.contains(id)
  }
}

impl Visit for IdCollector {
  noop_visit_type!();

  fn visit_ident(&mut self, n: &Ident) {
    self.id_usage.insert(n.to_id());
  }

  fn visit_binding_ident(&mut self, id: &BindingIdent) {
    // mark declarations as usages for export declarations
    self.id_usage.insert(id.id.to_id());
  }

  fn visit_import_decl(&mut self, n: &ImportDecl) {
    if n.type_only {
      return;
    }
    n.visit_children_with(self);
  }

  fn visit_import_specifier(&mut self, n: &ImportSpecifier) {
    match n {
      ImportSpecifier::Named(n) => {
        if !n.is_type_only {
          self.import_value_id_usage.insert(n.local.to_id());
        }
      }
      ImportSpecifier::Default(n) => {
        self.import_value_id_usage.insert(n.local.to_id());
      }
      ImportSpecifier::Namespace(n) => {
        self.import_value_id_usage.insert(n.local.to_id());
      }
    }
  }

  fn visit_ts_import_equals_decl(&mut self, n: &TsImportEqualsDecl) {
    if n.is_type_only {
      return;
    }

    // skip id visit

    let TsModuleRef::TsEntityName(ts_entity_name) = &n.module_ref else {
      return;
    };

    get_module_ident(ts_entity_name).visit_with(self);
  }

  fn visit_export_named_specifier(&mut self, n: &ExportNamedSpecifier) {
    if n.is_type_only {
      return;
    }

    match &n.orig {
      ModuleExportName::Ident(ident) => {
        self.export_value_id_usage.insert(ident.to_id());
      }
      ModuleExportName::Str(_) => {}
    }
  }

  fn visit_named_export(&mut self, n: &NamedExport) {
    if n.type_only || n.src.is_some() {
      return;
    }

    n.visit_children_with(self);
  }

  fn visit_jsx_element_name(&mut self, n: &JSXElementName) {
    if matches!(n, JSXElementName::Ident(i) if i.sym.starts_with(|c: char| c.is_ascii_lowercase()) )
    {
      return;
    }

    n.visit_children_with(self);
  }
}

fn get_module_ident(ts_entity_name: &TsEntityName) -> &Ident {
  match ts_entity_name {
    TsEntityName::TsQualifiedName(ts_qualified_name) => {
      get_module_ident(&ts_qualified_name.left)
    }
    TsEntityName::Ident(ident) => ident,
  }
}

#[cfg(test)]
mod tests {
  use super::*;

  #[test]
  fn valid() {
    assert_lint_ok! {
      VerbatimModuleSyntax,
      "import type { Type } from 'module'; type Test = Type;",
      "import type { Type, Other } from 'module'; type Test = Type | Other;",
      "import { type Type, value } from 'module'; type Test = Type; value();",
      "import * as value from 'module'; value();",
      "import type * as value from 'module'; type Test = typeof value;",
      "import value from 'module'; value();",
      "import type value from 'module'; type Test = typeof value;",
      "import { value } from 'module'; export { value };",
      "import type { value } from 'module'; export type { value };",
      "import { value, type Type } from 'module'; console.log(value); export type { Type };",
      "import { value, type Type } from 'module'; export { value, type Type };",
      "export { value } from './value.ts';",
      "export {};",
      "const logger = { setItems }; export { logger };",
      "class Test {} export { Test };",
    };
  }

  #[test]
  fn invalid() {
    assert_lint_err! {
      VerbatimModuleSyntax,
      "import { Type } from 'module'; type Test = Type;": [
        {
          col: 0,
          message: Message::AllImportIdentsUsedInTypes,
          hint: Hint::ChangeImportToImportType,
          fix: (FIX_ADD_TYPE_KEYWORD_DESC, "import type { Type } from 'module'; type Test = Type;"),
        }
      ],
      "import { Type, Other } from 'module'; type Test = Type | Other;": [
        {
          col: 0,
          message: Message::AllImportIdentsUsedInTypes,
          hint: Hint::ChangeImportToImportType,
          fix: (FIX_ADD_TYPE_KEYWORD_DESC, "import type { Type, Other } from 'module'; type Test = Type | Other;"),
        }
      ],
      "import { type Type, Other } from 'module'; type Test = Type | Other;": [
        {
          col: 0,
          message: Message::AllImportIdentsUsedInTypes,
          hint: Hint::ChangeImportToImportType,
          fix: (FIX_ADD_TYPE_KEYWORD_DESC, "import type { Type, Other } from 'module'; type Test = Type | Other;"),
        }
      ],
      "import { Type, value } from 'module'; type Test = Type; value();": [
        {
          col: 9,
          message: Message::ImportIdentUsedInTypes,
          hint: Hint::AddTypeKeyword,
          fix: (FIX_ADD_TYPE_KEYWORD_DESC, "import { type Type, value } from 'module'; type Test = Type; value();"),
        }
      ],
      "import { Type, Other, value } from 'module'; type Test = Type | Other; value();": [
        {
          col: 9,
          message: Message::ImportIdentUsedInTypes,
          hint: Hint::AddTypeKeyword,
          fix: (FIX_ADD_TYPE_KEYWORD_DESC, "import { type Type, Other, value } from 'module'; type Test = Type | Other; value();"),
        },
        {
          col: 15,
          message: Message::ImportIdentUsedInTypes,
          hint: Hint::AddTypeKeyword,
          fix: (FIX_ADD_TYPE_KEYWORD_DESC, "import { Type, type Other, value } from 'module'; type Test = Type | Other; value();"),
        }
      ],
      "import * as value from 'module'; type Test = typeof value;": [
        {
          col: 0,
          message: Message::AllImportIdentsUsedInTypes,
          hint: Hint::ChangeImportToImportType,
          fix: (FIX_ADD_TYPE_KEYWORD_DESC, "import type * as value from 'module'; type Test = typeof value;"),
        }
      ],
      "import value from 'module'; type Test = typeof value;": [
        {
          col: 0,
          message: Message::AllImportIdentsUsedInTypes,
          hint: Hint::ChangeImportToImportType,
          fix: (FIX_ADD_TYPE_KEYWORD_DESC, "import type value from 'module'; type Test = typeof value;"),
        }
      ],
      "type Test = string; export { Test };": [
        {
          col: 20,
          message: Message::AllExportIdentsUsedInTypes,
          hint: Hint::ChangeExportToExportType,
          fix: (FIX_ADD_TYPE_KEYWORD_DESC, "type Test = string; export type { Test };"),
        }
      ],
      "type Test = string; type Test2 = string; export { Test, Test2 };": [
        {
          col: 41,
          message: Message::AllExportIdentsUsedInTypes,
          hint: Hint::ChangeExportToExportType,
          fix: (FIX_ADD_TYPE_KEYWORD_DESC, "type Test = string; type Test2 = string; export type { Test, Test2 };"),
        }
      ],
      "import { type value } from 'module'; export { value };": [
        {
          col: 0,
          message: Message::AllImportIdentsUsedInTypes,
          hint: Hint::ChangeImportToImportType,
          fix: (FIX_ADD_TYPE_KEYWORD_DESC, "import type { value } from 'module'; export { value };"),
        },
        {
          col: 37,
          message: Message::AllExportIdentsUsedInTypes,
          hint: Hint::ChangeExportToExportType,
          fix: (FIX_ADD_TYPE_KEYWORD_DESC, "import { type value } from 'module'; export type { value };"),
        }
      ],
      "import { value } from 'module'; export { type value };": [
        {
          col: 0,
          message: Message::AllImportIdentsUsedInTypes,
          hint: Hint::ChangeImportToImportType,
          fix: (FIX_ADD_TYPE_KEYWORD_DESC, "import type { value } from 'module'; export { type value };"),
        },
        {
          col: 32,
          message: Message::AllExportIdentsUsedInTypes,
          hint: Hint::ChangeExportToExportType,
          fix: (FIX_ADD_TYPE_KEYWORD_DESC, "import { value } from 'module'; export type { value };"),
        }
      ],
      "import type { value } from 'module'; export { value };": [
        {
          col: 37,
          message: Message::AllExportIdentsUsedInTypes,
          hint: Hint::ChangeExportToExportType,
          fix: (FIX_ADD_TYPE_KEYWORD_DESC, "import type { value } from 'module'; export type { value };"),
        }
      ],
      "import { value } from 'module'; export type { value };": [
        {
          col: 0,
          message: Message::AllImportIdentsUsedInTypes,
          hint: Hint::ChangeImportToImportType,
          fix: (FIX_ADD_TYPE_KEYWORD_DESC, "import type { value } from 'module'; export type { value };"),
        }
      ],
      "import { value, type Type } from 'module'; console.log(value); export { Type };": [
        {
          col: 63,
          message: Message::AllExportIdentsUsedInTypes,
          hint: Hint::ChangeExportToExportType,
          fix: (FIX_ADD_TYPE_KEYWORD_DESC, "import { value, type Type } from 'module'; console.log(value); export type { Type };"),
        }
      ],
      "import { value, Type } from 'module'; console.log(value); export { type Type };": [
        {
          col: 16,
          message: Message::ImportIdentUsedInTypes,
          hint: Hint::AddTypeKeyword,
          fix: (FIX_ADD_TYPE_KEYWORD_DESC, "import { value, type Type } from 'module'; console.log(value); export { type Type };"),
        },
        {
          col: 58,
          message: Message::AllExportIdentsUsedInTypes,
          hint: Hint::ChangeExportToExportType,
          fix: (FIX_ADD_TYPE_KEYWORD_DESC, "import { value, Type } from 'module'; console.log(value); export type { Type };"),
        }
      ],
      "import { value, Type } from 'module'; console.log(value); export type { Type };": [
        {
          col: 16,
          message: Message::ImportIdentUsedInTypes,
          hint: Hint::AddTypeKeyword,
          fix: (FIX_ADD_TYPE_KEYWORD_DESC, "import { value, type Type } from 'module'; console.log(value); export type { Type };"),
        }
      ],
      "import { value, type Type } from 'module'; export { value, Type };": [
        {
          col: 59,
          message: Message::ExportIdentUsedInTypes,
          hint: Hint::AddTypeKeyword,
          fix: (FIX_ADD_TYPE_KEYWORD_DESC, "import { value, type Type } from 'module'; export { value, type Type };"),
        }
      ],
      "import { value, Type } from 'module'; export { value, type Type };": [
        {
          col: 16,
          message: Message::ImportIdentUsedInTypes,
          hint: Hint::AddTypeKeyword,
          fix: (FIX_ADD_TYPE_KEYWORD_DESC, "import { value, type Type } from 'module'; export { value, type Type };"),
        }
      ],
      "export { } from 'module';": [
        {
          col: 0,
          message: Message::ExportDeclarationElided,
          hint: Hint::ChangeSideEffectImport,
          fix: (FIX_USE_IMPORT_DECL_DESC, "import 'module';"),
        }
      ],
      "export { } from \"module\";": [
        {
          col: 0,
          message: Message::ExportDeclarationElided,
          hint: Hint::ChangeSideEffectImport,
          fix: (FIX_USE_IMPORT_DECL_DESC, "import \"module\";"),
        }
      ],
      "export { } from \"module\"": [
        {
          col: 0,
          message: Message::ExportDeclarationElided,
          hint: Hint::ChangeSideEffectImport,
          fix: (FIX_USE_IMPORT_DECL_DESC, "import \"module\""),
        }
      ],
      "interface Test {}\nexport { Test };": [
        {
          line: 2,
          col: 0,
          message: Message::AllExportIdentsUsedInTypes,
          hint: Hint::ChangeExportToExportType,
          fix: (FIX_ADD_TYPE_KEYWORD_DESC, "interface Test {}\nexport type { Test };"),
        }
      ],
      "type Test = 'test';\nexport { Test };": [
        {
          line: 2,
          col: 0,
          message: Message::AllExportIdentsUsedInTypes,
          hint: Hint::ChangeExportToExportType,
          fix: (FIX_ADD_TYPE_KEYWORD_DESC, "type Test = 'test';\nexport type { Test };"),
        }
      ],
    };
  }
}