@@ -137,21 +137,37 @@ for (const [linterName, Linter] of Object.entries(linters)) {
137
137
const source = 'This is an test.' ;
138
138
139
139
const firstRound = await linter . lint ( source ) ;
140
- for ( const lint of firstRound ) {
141
- console . log ( lint . message ( ) ) ;
142
- }
143
140
144
141
expect ( firstRound . length ) . toBeGreaterThanOrEqual ( 1 ) ;
145
142
146
143
await linter . ignoreLint ( firstRound [ 0 ] ) ;
147
144
148
145
const secondRound = await linter . lint ( source ) ;
149
146
150
- for ( const lint of secondRound ) {
151
- console . log ( lint . message ( ) ) ;
147
+ expect ( secondRound . length ) . toBeLessThan ( firstRound . length ) ;
148
+ } ) ;
149
+
150
+ test ( `${ linterName } can reimport ignored lints.` , async ( ) => {
151
+ const source = 'This is an test of xporting lints.' ;
152
+
153
+ const firstLinter = new Linter ( ) ;
154
+
155
+ const firstLints = await firstLinter . lint ( source ) ;
156
+
157
+ for ( const lint of firstLints ) {
158
+ await firstLinter . ignoreLint ( lint ) ;
152
159
}
153
160
154
- expect ( secondRound . length ) . toBeLessThan ( firstRound . length ) ;
161
+ const exported = await firstLinter . exportIgnoredLints ( ) ;
162
+
163
+ /// Create a new instance and reimport the lints.
164
+ const secondLinter = new Linter ( ) ;
165
+ await secondLinter . importIgnoredLints ( exported ) ;
166
+
167
+ const secondLints = await secondLinter . lint ( source ) ;
168
+
169
+ expect ( firstLints . length ) . toBeGreaterThan ( secondLints . length ) ;
170
+ expect ( secondLints . length ) . toBe ( 0 ) ;
155
171
} ) ;
156
172
}
157
173
0 commit comments