@@ -24,17 +24,18 @@ describe('EsLint', () => {
24
24
} ) ;
25
25
26
26
it . each ( [
27
- { async : false , webpack : '4.0.0' , absolute : false } ,
28
- { async : true , webpack : '^4.0.0' , absolute : true } ,
29
- { async : false , webpack : '^5.0.0' , absolute : true } ,
30
- { async : true , webpack : '^5.0.0' , absolute : false } ,
31
- ] ) ( 'reports lint error for %p' , async ( { async, webpack, absolute } ) => {
27
+ { async : false , webpack : '4.0.0' , eslint : '^6.0.0' , absolute : false } ,
28
+ { async : true , webpack : '^4.0.0' , eslint : '^7.0.0' , absolute : true } ,
29
+ { async : false , webpack : '^5.0.0' , eslint : '^7.0.0' , absolute : true } ,
30
+ { async : true , webpack : '^5.0.0' , eslint : '^8.0.0' , absolute : false } ,
31
+ ] ) ( 'reports lint error for %p' , async ( { async, webpack, eslint , absolute } ) => {
32
32
await sandbox . load ( [
33
33
await readFixture ( join ( __dirname , 'fixtures/environment/eslint-basic.fixture' ) , {
34
34
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION : JSON . stringify (
35
35
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION
36
36
) ,
37
37
TS_LOADER_VERSION : JSON . stringify ( '^5.0.0' ) ,
38
+ ESLINT_VERSION : JSON . stringify ( eslint ) ,
38
39
TYPESCRIPT_VERSION : JSON . stringify ( '~3.8.0' ) ,
39
40
WEBPACK_VERSION : JSON . stringify ( webpack ) ,
40
41
WEBPACK_CLI_VERSION : JSON . stringify ( WEBPACK_CLI_VERSION ) ,
@@ -61,7 +62,7 @@ describe('EsLint', () => {
61
62
'WARNING in src/authenticate.ts:14:34' ,
62
63
'@typescript-eslint/no-explicit-any: Unexpected any. Specify a different type.' ,
63
64
' 12 | }' ,
64
- ' 13 | ' ,
65
+ ' 13 |' ,
65
66
' > 14 | async function logout(): Promise<any> {' ,
66
67
' | ^^^' ,
67
68
' 15 | const response = await fetch(' ,
@@ -76,7 +77,7 @@ describe('EsLint', () => {
76
77
" > 31 | loginForm.addEventListener('submit', async event => {" ,
77
78
' | ^^^^^' ,
78
79
' 32 | const user = await login(email, password);' ,
79
- ' 33 | ' ,
80
+ ' 33 |' ,
80
81
" 34 | if (user.role === 'admin') {" ,
81
82
] . join ( '\n' ) ,
82
83
] ) ;
@@ -127,22 +128,22 @@ describe('EsLint', () => {
127
128
'WARNING in src/model/User.ts:11:5' ,
128
129
"@typescript-eslint/no-unused-vars: 'temporary' is defined but never used." ,
129
130
' 9 | }' ,
130
- ' 10 | ' ,
131
+ ' 10 |' ,
131
132
' > 11 | let temporary: any;' ,
132
133
' | ^^^^^^^^^^^^^^' ,
133
- ' 12 | ' ,
134
- ' 13 | ' ,
134
+ ' 12 |' ,
135
+ ' 13 |' ,
135
136
' 14 | function getUserName(user: User): string {' ,
136
137
] . join ( '\n' ) ,
137
138
[
138
139
'WARNING in src/model/User.ts:11:16' ,
139
140
'@typescript-eslint/no-explicit-any: Unexpected any. Specify a different type.' ,
140
141
' 9 | }' ,
141
- ' 10 | ' ,
142
+ ' 10 |' ,
142
143
' > 11 | let temporary: any;' ,
143
144
' | ^^^' ,
144
- ' 12 | ' ,
145
- ' 13 | ' ,
145
+ ' 12 |' ,
146
+ ' 13 |' ,
146
147
' 14 | function getUserName(user: User): string {' ,
147
148
] . join ( '\n' ) ,
148
149
] ) ;
@@ -155,6 +156,7 @@ describe('EsLint', () => {
155
156
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION
156
157
) ,
157
158
TS_LOADER_VERSION : JSON . stringify ( '^5.0.0' ) ,
159
+ ESLINT_VERSION : JSON . stringify ( '~6.8.0' ) ,
158
160
TYPESCRIPT_VERSION : JSON . stringify ( '~3.8.0' ) ,
159
161
WEBPACK_VERSION : JSON . stringify ( '^4.0.0' ) ,
160
162
WEBPACK_CLI_VERSION : JSON . stringify ( WEBPACK_CLI_VERSION ) ,
@@ -210,54 +212,61 @@ describe('EsLint', () => {
210
212
await driver . waitForNoErrors ( ) ;
211
213
} ) ;
212
214
213
- it ( 'fixes errors with `fix: true` option' , async ( ) => {
214
- await sandbox . load ( [
215
- await readFixture ( join ( __dirname , 'fixtures/environment/eslint-basic.fixture' ) , {
216
- FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION : JSON . stringify (
217
- FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION
218
- ) ,
219
- TS_LOADER_VERSION : JSON . stringify ( '^5.0.0' ) ,
220
- TYPESCRIPT_VERSION : JSON . stringify ( '~3.8.0' ) ,
221
- WEBPACK_VERSION : JSON . stringify ( '^4.0.0' ) ,
222
- WEBPACK_CLI_VERSION : JSON . stringify ( WEBPACK_CLI_VERSION ) ,
223
- WEBPACK_DEV_SERVER_VERSION : JSON . stringify ( WEBPACK_DEV_SERVER_VERSION ) ,
224
- ASYNC : JSON . stringify ( false ) ,
225
- } ) ,
226
- await readFixture ( join ( __dirname , 'fixtures/implementation/typescript-basic.fixture' ) ) ,
227
- ] ) ;
228
-
229
- // fix initial issues
230
- await sandbox . patch (
231
- 'src/authenticate.ts' ,
232
- 'async function logout(): Promise<any> {' ,
233
- 'async function logout(): Promise<unknown> {'
234
- ) ;
235
- await sandbox . patch (
236
- 'src/index.ts' ,
237
- "loginForm.addEventListener('submit', async event => {" ,
238
- "loginForm.addEventListener('submit', async () => {"
239
- ) ;
215
+ it . each ( [ { eslint : '^6.0.0' } , { eslint : '^7.0.0' } , { eslint : '^8.0.0' } ] ) (
216
+ 'fixes errors with `fix: true` option for %p' ,
217
+ async ( { eslint } ) => {
218
+ await sandbox . load ( [
219
+ await readFixture ( join ( __dirname , 'fixtures/environment/eslint-basic.fixture' ) , {
220
+ FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION : JSON . stringify (
221
+ FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION
222
+ ) ,
223
+ TS_LOADER_VERSION : JSON . stringify ( '^5.0.0' ) ,
224
+ ESLINT_VERSION : JSON . stringify ( eslint ) ,
225
+ TYPESCRIPT_VERSION : JSON . stringify ( '~3.8.0' ) ,
226
+ WEBPACK_VERSION : JSON . stringify ( '^4.0.0' ) ,
227
+ WEBPACK_CLI_VERSION : JSON . stringify ( WEBPACK_CLI_VERSION ) ,
228
+ WEBPACK_DEV_SERVER_VERSION : JSON . stringify ( WEBPACK_DEV_SERVER_VERSION ) ,
229
+ ASYNC : JSON . stringify ( false ) ,
230
+ } ) ,
231
+ await readFixture ( join ( __dirname , 'fixtures/implementation/typescript-basic.fixture' ) ) ,
232
+ ] ) ;
233
+
234
+ // fix initial issues
235
+ await sandbox . patch (
236
+ 'src/authenticate.ts' ,
237
+ 'async function logout(): Promise<any> {' ,
238
+ 'async function logout(): Promise<unknown> {'
239
+ ) ;
240
+ await sandbox . patch (
241
+ 'src/index.ts' ,
242
+ "loginForm.addEventListener('submit', async event => {" ,
243
+ "loginForm.addEventListener('submit', async () => {"
244
+ ) ;
240
245
241
- // set fix option for the eslint
242
- await sandbox . write (
243
- 'fork-ts-checker.config.js' ,
244
- 'module.exports = { eslint: { enabled: true, options: { fix: true } } };'
245
- ) ;
246
+ // set fix option for the eslint
247
+ await sandbox . write (
248
+ 'fork-ts-checker.config.js' ,
249
+ 'module.exports = { eslint: { enabled: true, options: { fix: true } } };'
250
+ ) ;
246
251
247
- // add fixable issue
248
- await sandbox . patch (
249
- 'src/authenticate.ts' ,
250
- 'const response = await fetch(' ,
251
- 'let response = await fetch('
252
- ) ;
252
+ // add fixable issue
253
+ await sandbox . patch (
254
+ 'src/authenticate.ts' ,
255
+ 'const response = await fetch(' ,
256
+ 'let response = await fetch('
257
+ ) ;
253
258
254
- const driver = createWebpackDevServerDriver ( sandbox . spawn ( 'npm run webpack-dev-server' ) , false ) ;
259
+ const driver = createWebpackDevServerDriver (
260
+ sandbox . spawn ( 'npm run webpack-dev-server' ) ,
261
+ false
262
+ ) ;
255
263
256
- // it should be automatically fixed
257
- await driver . waitForNoErrors ( ) ;
264
+ // it should be automatically fixed
265
+ await driver . waitForNoErrors ( ) ;
258
266
259
- // check if issue has been fixed
260
- const content = await sandbox . read ( 'src/authenticate.ts' ) ;
261
- expect ( content ) . not . toContain ( 'let response = await fetch(' ) ;
262
- } ) ;
267
+ // check if issue has been fixed
268
+ const content = await sandbox . read ( 'src/authenticate.ts' ) ;
269
+ expect ( content ) . not . toContain ( 'let response = await fetch(' ) ;
270
+ }
271
+ ) ;
263
272
} ) ;
0 commit comments