• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#  ``import`` statements after other statements are not allowed
2
3Rule ``arkts-no-misplaced-imports``
4
5**Severity: error**
6
7In ArkTS, all ``import`` statements should go before all other statements
8in the program.
9
10
11## TypeScript
12
13
14```
15
16    class C {
17        s: string = ""
18        n: number = 0
19    }
20
21    import foo from "module1"
22
23```
24
25## ArkTS
26
27
28```
29
30    import foo from "module1"
31
32    class C {
33        s: string = ""
34        n: number = 0
35    }
36
37```
38
39
40