Skip to content

Commit 7b1211a

Browse files
committed
refactoring
1 parent 0e0b2bb commit 7b1211a

File tree

5 files changed

+54
-34
lines changed

5 files changed

+54
-34
lines changed

test/composer.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable @typescript-eslint/no-empty-function */
2+
13
// utils
24
jest.mock('../src/utils', () => ({
35
...jest.requireActual('../src/utils'),
@@ -287,7 +289,7 @@ describe('fallbackFormat', () => {
287289

288290
test('interpolation', () => {
289291
const mockWarn = warn as jest.MockedFunction<typeof warn>
290-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
292+
mockWarn.mockImplementation(() => {})
291293

292294
const { t } = createComposer({
293295
locale: 'en',
@@ -344,13 +346,13 @@ describe('getMissingHandler / setMissingHandler', () => {
344346
const { getMissingHandler, setMissingHandler } = createComposer({})
345347
expect(getMissingHandler()).toEqual(null)
346348

347-
const missing = () => {} // eslint-disable-line @typescript-eslint/no-empty-function
349+
const missing = () => {}
348350
setMissingHandler(missing as MissingHandler)
349351
expect(getMissingHandler()).toEqual(missing)
350352
})
351353

352354
test('initialize at composer creating', () => {
353-
const missing = () => {} // eslint-disable-line @typescript-eslint/no-empty-function
355+
const missing = () => {}
354356
const { getMissingHandler } = createComposer({ missing })
355357
expect(getMissingHandler()).toEqual(missing)
356358
})
@@ -713,3 +715,5 @@ describe('__i18n', () => {
713715
})
714716
})
715717
})
718+
719+
/* eslint-enable @typescript-eslint/no-empty-function */

test/legacy.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable @typescript-eslint/no-empty-function */
2+
13
// utils
24
jest.mock('../src/utils', () => ({
35
...jest.requireActual('../src/utils'),
@@ -35,7 +37,7 @@ test('availableLocales', () => {
3537

3638
test('formatter', () => {
3739
const mockWarn = warn as jest.MockedFunction<typeof warn>
38-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
40+
mockWarn.mockImplementation(() => {})
3941

4042
const i18n = createVueI18n({
4143
formatter: {
@@ -407,7 +409,7 @@ test('getNumberFormat / setNumberFormat / mergeNumberFormat', () => {
407409

408410
test('getChoiceIndex', () => {
409411
const mockWarn = warn as jest.MockedFunction<typeof warn>
410-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
412+
mockWarn.mockImplementation(() => {})
411413

412414
const i18n = createVueI18n({})
413415
i18n.getChoiceIndex(1, 2)
@@ -418,7 +420,7 @@ test('getChoiceIndex', () => {
418420

419421
test('warnHtmlInMessage', () => {
420422
const mockWarn = warn as jest.MockedFunction<typeof warn>
421-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
423+
mockWarn.mockImplementation(() => {})
422424

423425
const i18n = createVueI18n({
424426
locale: 'en',
@@ -438,3 +440,5 @@ test('warnHtmlInMessage', () => {
438440
expect(i18n.t('hello')).toEqual('<p>hello</p>')
439441
expect(mockWarn).toHaveBeenCalledTimes(2)
440442
})
443+
444+
/* eslint-enable @typescript-eslint/no-empty-function */

test/runtime/datetime.test.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable @typescript-eslint/no-empty-function */
2+
13
// utils
24
jest.mock('../../src/utils', () => ({
35
...jest.requireActual('../../src/utils'),
@@ -157,7 +159,7 @@ test('override format options with number function options', () => {
157159

158160
test('fallback', () => {
159161
const mockWarn = warn as jest.MockedFunction<typeof warn>
160-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
162+
mockWarn.mockImplementation(() => {})
161163
const mockAvailabilities = Availabilities as jest.Mocked<
162164
typeof Availabilities
163165
>
@@ -182,7 +184,7 @@ test('fallback', () => {
182184

183185
test(`context fallbackWarn 'false' option`, () => {
184186
const mockWarn = warn as jest.MockedFunction<typeof warn>
185-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
187+
mockWarn.mockImplementation(() => {})
186188
const mockAvailabilities = Availabilities as jest.Mocked<
187189
typeof Availabilities
188190
>
@@ -202,7 +204,7 @@ test(`context fallbackWarn 'false' option`, () => {
202204

203205
test(`datetime function fallbackWarn 'false' option`, () => {
204206
const mockWarn = warn as jest.MockedFunction<typeof warn>
205-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
207+
mockWarn.mockImplementation(() => {})
206208
const mockAvailabilities = Availabilities as jest.Mocked<
207209
typeof Availabilities
208210
>
@@ -224,7 +226,7 @@ test(`datetime function fallbackWarn 'false' option`, () => {
224226
describe('context unresolving option', () => {
225227
test('not specify fallbackLocales', () => {
226228
const mockWarn = warn as jest.MockedFunction<typeof warn>
227-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
229+
mockWarn.mockImplementation(() => {})
228230
const mockAvailabilities = Availabilities as jest.Mocked<
229231
typeof Availabilities
230232
>
@@ -244,7 +246,7 @@ describe('context unresolving option', () => {
244246

245247
test('not found key in fallbackLocales', () => {
246248
const mockWarn = warn as jest.MockedFunction<typeof warn>
247-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
249+
mockWarn.mockImplementation(() => {})
248250
const mockAvailabilities = Availabilities as jest.Mocked<
249251
typeof Availabilities
250252
>
@@ -292,7 +294,7 @@ test('part', () => {
292294

293295
test('not available Intl API', () => {
294296
const mockWarn = warn as jest.MockedFunction<typeof warn>
295-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
297+
mockWarn.mockImplementation(() => {})
296298
const mockAvailabilities = Availabilities as jest.Mocked<
297299
typeof Availabilities
298300
>
@@ -309,3 +311,5 @@ test('not available Intl API', () => {
309311
`Cannot format a Date value due to not supported Intl.DateTimeFormat.`
310312
)
311313
})
314+
315+
/* eslint-eable @typescript-eslint/no-empty-function */

test/runtime/number.test.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable @typescript-eslint/no-empty-function */
2+
13
// utils
24
jest.mock('../../src/utils', () => ({
35
...jest.requireActual('../../src/utils'),
@@ -138,7 +140,7 @@ test('override format options with number function options', () => {
138140

139141
test('fallback', () => {
140142
const mockWarn = warn as jest.MockedFunction<typeof warn>
141-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
143+
mockWarn.mockImplementation(() => {})
142144
const mockAvailabilities = Availabilities as jest.Mocked<
143145
typeof Availabilities
144146
>
@@ -163,7 +165,7 @@ test('fallback', () => {
163165

164166
test(`context fallbackWarn 'false' option`, () => {
165167
const mockWarn = warn as jest.MockedFunction<typeof warn>
166-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
168+
mockWarn.mockImplementation(() => {})
167169
const mockAvailabilities = Availabilities as jest.Mocked<
168170
typeof Availabilities
169171
>
@@ -183,7 +185,7 @@ test(`context fallbackWarn 'false' option`, () => {
183185

184186
test(`number function fallbackWarn 'false' option`, () => {
185187
const mockWarn = warn as jest.MockedFunction<typeof warn>
186-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
188+
mockWarn.mockImplementation(() => {})
187189
const mockAvailabilities = Availabilities as jest.Mocked<
188190
typeof Availabilities
189191
>
@@ -205,7 +207,7 @@ test(`number function fallbackWarn 'false' option`, () => {
205207
describe('context unresolving option', () => {
206208
test('not specify fallbackLocales', () => {
207209
const mockWarn = warn as jest.MockedFunction<typeof warn>
208-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
210+
mockWarn.mockImplementation(() => {})
209211
const mockAvailabilities = Availabilities as jest.Mocked<
210212
typeof Availabilities
211213
>
@@ -225,7 +227,7 @@ describe('context unresolving option', () => {
225227

226228
test('not found key in fallbackLocales', () => {
227229
const mockWarn = warn as jest.MockedFunction<typeof warn>
228-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
230+
mockWarn.mockImplementation(() => {})
229231
const mockAvailabilities = Availabilities as jest.Mocked<
230232
typeof Availabilities
231233
>
@@ -268,7 +270,7 @@ test('part', () => {
268270

269271
test('not available Intl API', () => {
270272
const mockWarn = warn as jest.MockedFunction<typeof warn>
271-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
273+
mockWarn.mockImplementation(() => {})
272274
const mockAvailabilities = Availabilities as jest.Mocked<
273275
typeof Availabilities
274276
>
@@ -285,3 +287,5 @@ test('not available Intl API', () => {
285287
`Cannot format a Date value due to not supported Intl.NumberFormat.`
286288
)
287289
})
290+
291+
/* eslint-enable @typescript-eslint/no-empty-function */

test/runtime/translate.test.ts

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable @typescript-eslint/no-empty-function */
2+
13
// utils
24
jest.mock('../../src/utils', () => ({
35
...jest.requireActual('../../src/utils'),
@@ -113,7 +115,7 @@ describe('default option', () => {
113115
describe('context missing option', () => {
114116
test('not specified missing handler', () => {
115117
const mockWarn = warn as jest.MockedFunction<typeof warn>
116-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
118+
mockWarn.mockImplementation(() => {})
117119

118120
const ctx = context({
119121
locale: 'en',
@@ -130,7 +132,7 @@ describe('context missing option', () => {
130132

131133
test('specified missing handler', () => {
132134
const mockWarn = warn as jest.MockedFunction<typeof warn>
133-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
135+
mockWarn.mockImplementation(() => {})
134136

135137
const ctx = context({
136138
locale: 'en',
@@ -151,7 +153,7 @@ describe('context missing option', () => {
151153
describe('context missingWarn option', () => {
152154
test('false', () => {
153155
const mockWarn = warn as jest.MockedFunction<typeof warn>
154-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
156+
mockWarn.mockImplementation(() => {})
155157

156158
const ctx = context({
157159
locale: 'en',
@@ -168,7 +170,7 @@ describe('context missingWarn option', () => {
168170

169171
test('regex', () => {
170172
const mockWarn = warn as jest.MockedFunction<typeof warn>
171-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
173+
mockWarn.mockImplementation(() => {})
172174

173175
const ctx = context({
174176
locale: 'en',
@@ -189,7 +191,7 @@ describe('context missingWarn option', () => {
189191

190192
test('missingWarn option', () => {
191193
const mockWarn = warn as jest.MockedFunction<typeof warn>
192-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
194+
mockWarn.mockImplementation(() => {})
193195

194196
const ctx = context({
195197
locale: 'en',
@@ -207,7 +209,7 @@ describe('context missingWarn option', () => {
207209
describe('context fallbackWarn option', () => {
208210
test('not specify fallbackLocale', () => {
209211
const mockWarn = warn as jest.MockedFunction<typeof warn>
210-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
212+
mockWarn.mockImplementation(() => {})
211213

212214
const ctx = context({
213215
locale: 'en',
@@ -223,7 +225,7 @@ describe('context fallbackWarn option', () => {
223225

224226
test('specify fallbackLocale', () => {
225227
const mockWarn = warn as jest.MockedFunction<typeof warn>
226-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
228+
mockWarn.mockImplementation(() => {})
227229

228230
const ctx = context({
229231
locale: 'en',
@@ -246,7 +248,7 @@ describe('context fallbackWarn option', () => {
246248

247249
test('not found fallback message', () => {
248250
const mockWarn = warn as jest.MockedFunction<typeof warn>
249-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
251+
mockWarn.mockImplementation(() => {})
250252

251253
const ctx = context({
252254
locale: 'en',
@@ -270,7 +272,7 @@ describe('context fallbackWarn option', () => {
270272

271273
test('context option: false', () => {
272274
const mockWarn = warn as jest.MockedFunction<typeof warn>
273-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
275+
mockWarn.mockImplementation(() => {})
274276

275277
const ctx = context({
276278
locale: 'en',
@@ -289,7 +291,7 @@ describe('context fallbackWarn option', () => {
289291

290292
test('context option: regex', () => {
291293
const mockWarn = warn as jest.MockedFunction<typeof warn>
292-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
294+
mockWarn.mockImplementation(() => {})
293295

294296
const ctx = context({
295297
locale: 'en',
@@ -308,7 +310,7 @@ describe('context fallbackWarn option', () => {
308310

309311
test('specify fallbackWarn option to translate function', () => {
310312
const mockWarn = warn as jest.MockedFunction<typeof warn>
311-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
313+
mockWarn.mockImplementation(() => {})
312314

313315
const ctx = context({
314316
locale: 'en',
@@ -331,7 +333,7 @@ describe('context fallbackWarn option', () => {
331333
describe('context fallbackFormat option', () => {
332334
test('specify true', () => {
333335
const mockWarn = warn as jest.MockedFunction<typeof warn>
334-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
336+
mockWarn.mockImplementation(() => {})
335337

336338
const ctx = context({
337339
locale: 'en',
@@ -367,7 +369,7 @@ describe('context fallbackFormat option', () => {
367369

368370
test('overrided with default option', () => {
369371
const mockWarn = warn as jest.MockedFunction<typeof warn>
370-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
372+
mockWarn.mockImplementation(() => {})
371373

372374
const ctx = context({
373375
locale: 'en',
@@ -403,7 +405,7 @@ describe('context fallbackFormat option', () => {
403405

404406
test('fallbackLocales is nothing', () => {
405407
const mockWarn = warn as jest.MockedFunction<typeof warn>
406-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
408+
mockWarn.mockImplementation(() => {})
407409

408410
const ctx = context({
409411
locale: 'en',
@@ -456,7 +458,7 @@ describe('context unresolving option', () => {
456458

457459
test('fallbackFormat is true', () => {
458460
const mockWarn = warn as jest.MockedFunction<typeof warn>
459-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
461+
mockWarn.mockImplementation(() => {})
460462

461463
const ctx = context({
462464
locale: 'en',
@@ -530,7 +532,7 @@ describe('context postTranslation option', () => {
530532
describe('warnHtmlMessage', () => {
531533
test('default', () => {
532534
const mockWarn = warn as jest.MockedFunction<typeof warn>
533-
mockWarn.mockImplementation(() => {}) // eslint-disable-line @typescript-eslint/no-empty-function
535+
mockWarn.mockImplementation(() => {})
534536

535537
const ctx = context({
536538
locale: 'en',
@@ -571,3 +573,5 @@ describe('edge cases', () => {
571573
expect(translate(ctx, 'side.left')).toEqual('Left')
572574
})
573575
})
576+
577+
/* eslint-enable @typescript-eslint/no-empty-function */

0 commit comments

Comments
 (0)