Skip to content

Commit 0fde190

Browse files
committed
chore: eslint upgrade and lint fixes
1 parent 6910440 commit 0fde190

File tree

26 files changed

+8398
-6731
lines changed

26 files changed

+8398
-6731
lines changed

benchmark/utils.mjs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import fs from 'fs/promises'
22

3-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
43
export async function readJson(path) {
54
const data = await fs.readFile(path, 'utf8')
65
return JSON.parse(data)

e2e/helper.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ export function getDom(html: string) {
5151
}
5252

5353
export function getDataFromDom(dom: Document, selector: string) {
54-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
5554
return JSON.parse(
5655
dom.querySelector(selector)!.textContent!.replace('"', '"')
5756
)
@@ -66,7 +65,7 @@ export function assertLocaleHeadWithDom(dom: Document, headSelector: string) {
6665
if (key === 'id') {
6766
continue
6867
}
69-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
68+
7069
const v = tag!.getAttribute(key)
7170
if (v !== value) {
7271
throw new Error(`${key} ${v} !== ${value}`)

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@
9595
"bumpp": "^9.3.0",
9696
"cross-env": "^7.0.3",
9797
"esbuild-register": "^3.5.0",
98-
"eslint": "^8.57.0",
98+
"eslint": "^9.1.0",
9999
"eslint-config-prettier": "^9.1.0",
100-
"eslint-plugin-vue": "^9.24.0",
100+
"eslint-plugin-vue": "^9.25.0",
101101
"execa": "^5.0.0",
102102
"fixpack": "^4.0.0",
103103
"globals": "^15.0.0",
@@ -173,7 +173,7 @@
173173
"secretlint"
174174
]
175175
},
176-
"packageManager": "pnpm@8.9.2",
176+
"packageManager": "pnpm@9.0.4",
177177
"pnpm": {
178178
"overrides": {
179179
"vue": "3.4.20",

packages/core-base/src/context.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export type LocaleMessages<
116116
*
117117
* @VueI18nGeneral
118118
*/
119-
export interface DefineCoreLocaleMessage extends LocaleMessage<string> {} // eslint-disable-line @typescript-eslint/no-empty-interface
119+
export interface DefineCoreLocaleMessage extends LocaleMessage<string> {}
120120

121121
export type DefaultCoreLocaleMessageSchema<
122122
Schema = RemoveIndexSignature<{
@@ -252,7 +252,7 @@ export interface CoreOptions<
252252
export interface CoreInternalOptions {
253253
__datetimeFormatters?: Map<string, Intl.DateTimeFormat>
254254
__numberFormatters?: Map<string, Intl.NumberFormat>
255-
__v_emitter?: VueDevToolsEmitter // eslint-disable-line camelcase
255+
__v_emitter?: VueDevToolsEmitter
256256
__meta?: MetaInfo
257257
}
258258

@@ -327,7 +327,7 @@ export interface CoreInternalContext {
327327
__datetimeFormatters: Map<string, Intl.DateTimeFormat>
328328
__numberFormatters: Map<string, Intl.NumberFormat>
329329
__localeChainCache?: Map<Locale, Locale[]>
330-
__v_emitter?: VueDevToolsEmitter // eslint-disable-line camelcase
330+
__v_emitter?: VueDevToolsEmitter
331331
__meta: MetaInfo // for Intlify DevTools
332332
}
333333

packages/core-base/src/fallbacker.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export type LocaleFallbacker = <Message = string>(
8787
export function fallbackWithSimple<Message = string>(
8888
ctx: CoreContext<Message>,
8989
fallback: FallbackLocale,
90-
start: Locale // eslint-disable-line @typescript-eslint/no-unused-vars
90+
start: Locale
9191
): Locale[] {
9292
// prettier-ignore
9393
return [...new Set(

packages/format-explorer/src/shims-vue.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
declare module '*.vue' {
22
import { DefineComponent } from 'vue'
3-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
3+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
44
const component: DefineComponent<{}, {}, any>
55
// @ts-ignore
66
export default component

packages/message-compiler/src/generator.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ function generateNode(generator: CodeGenerator, node: Node): void {
284284
// generate code from AST
285285
export const generate = (
286286
ast: ResourceNode,
287-
options: CodeGenOptions = {} // eslint-disable-line
287+
options: CodeGenOptions = {}
288288
): CodeGenResult => {
289289
const mode = isString(options.mode) ? options.mode : 'normal'
290290
const filename = isString(options.filename)

packages/message-compiler/src/scanner.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export function createScanner(str: string): Scanner {
7979

8080
function skipToPeek(): void {
8181
const target = _index + _peekOffset
82-
// eslint-disable-next-line no-unmodified-loop-condition
82+
8383
while (target !== _index) {
8484
next()
8585
}

packages/message-compiler/src/tokenizer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ export function createTokenizer(
481481

482482
function readText(scnr: Scanner): string {
483483
let buf = ''
484-
// eslint-disable-next-line no-constant-condition
484+
485485
while (true) {
486486
const ch = scnr.currentChar()
487487
if (

packages/shared/src/messages.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { isArray, isObject } from './utils'
22

33
const isNotObjectOrIsArray = (val: unknown) => !isObject(val) || isArray(val)
4-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
4+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
55
export function deepCopy(src: any, des: any): void {
66
// src and des should both be objects, and none of them can be a array
77
if (isNotObjectOrIsArray(src) || isNotObjectOrIsArray(des)) {

packages/size-check-petite-vue-i18n/src/shims-vue.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
declare module '*.vue' {
22
import { DefineComponent } from 'vue'
3-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
3+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
44
const component: DefineComponent<{}, {}, any>
55
// @ts-ignore
66
export default component

packages/size-check-vue-i18n/src/shims-vue.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
declare module '*.vue' {
22
import { DefineComponent } from 'vue'
3-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
3+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
44
const component: DefineComponent<{}, {}, any>
55
// @ts-ignore
66
export default component

packages/vue-i18n-core/src/components/DatetimeFormat.ts

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { DatetimePartsSymbol } from '../symbols'
66
import { renderFormatter } from './formatRenderer'
77
import { baseFormatProps } from './base'
88

9-
/* eslint-enable @typescript-eslint/no-unused-vars */
109
import type { VNodeProps } from 'vue'
1110
import type { DateTimeOptions } from '@intlify/core-base'
1211
import type { Composer, ComposerInternal } from '../composer'

packages/vue-i18n-core/src/components/Translation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const TranslationImpl = /*#__PURE__*/ defineComponent({
3939
},
4040
plural: {
4141
type: [Number, String],
42-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
42+
4343
validator: (val: any): boolean => isNumber(val) || !isNaN(val)
4444
}
4545
},

packages/vue-i18n-core/src/composer.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export type VueMessageType = string | ResourceNode | VNode
150150
*
151151
* @VueI18nGeneral
152152
*/
153-
export interface DefineLocaleMessage extends LocaleMessage<VueMessageType> {} // eslint-disable-line @typescript-eslint/no-empty-interface
153+
export interface DefineLocaleMessage extends LocaleMessage<VueMessageType> {}
154154

155155
/**
156156
* The type definition of datetime format
@@ -177,7 +177,7 @@ export interface DefineLocaleMessage extends LocaleMessage<VueMessageType> {} //
177177
*
178178
* @VueI18nGeneral
179179
*/
180-
export interface DefineDateTimeFormat extends DateTimeFormat {} // eslint-disable-line @typescript-eslint/no-empty-interface
180+
export interface DefineDateTimeFormat extends DateTimeFormat {}
181181

182182
/**
183183
* The type definition of number format
@@ -205,7 +205,7 @@ export interface DefineDateTimeFormat extends DateTimeFormat {} // eslint-disabl
205205
*
206206
* @VueI18nGeneral
207207
*/
208-
export interface DefineNumberFormat extends NumberFormat {} // eslint-disable-line @typescript-eslint/no-empty-interface
208+
export interface DefineNumberFormat extends NumberFormat {}
209209

210210
export type DefaultLocaleMessageSchema<
211211
Schema = RemoveIndexSignature<{
@@ -1196,7 +1196,7 @@ export interface ComposerNumberFormatting<
11961196
*
11971197
* @VueI18nComposition
11981198
*/
1199-
export interface ComposerCustom {} // eslint-disable-line @typescript-eslint/no-empty-interface
1199+
export interface ComposerCustom {}
12001200

12011201
/**
12021202
* Composer interfaces
@@ -1801,9 +1801,9 @@ function defineCoreMissingHandler(missing: MissingHandler): CoreMissingHandler {
18011801
/* #__NO_SIDE_EFFECTS__ */
18021802
const getMetaInfo = (): MetaInfo | null => {
18031803
const instance = getCurrentInstance()
1804-
let meta: any = null // eslint-disable-line @typescript-eslint/no-explicit-any
1804+
let meta: any = null
18051805
return instance && (meta = getComponentOptions(instance)[DEVTOOLS_META])
1806-
? { [DEVTOOLS_META]: meta } // eslint-disable-line @typescript-eslint/no-explicit-any
1806+
? { [DEVTOOLS_META]: meta }
18071807
: null
18081808
}
18091809

@@ -1867,7 +1867,7 @@ export function createComposer<
18671867
*
18681868
* @internal
18691869
*/
1870-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
1870+
18711871
export function createComposer(options: any = {}, VueI18nLegacy?: any): any {
18721872
type Message = VueMessageType
18731873
const { __root, __injectWithOption } = options as ComposerInternalOptions<
@@ -2172,7 +2172,7 @@ export function createComposer(options: any = {}, VueI18nLegacy?: any): any {
21722172

21732173
function isResolvedTranslateMessage(
21742174
type: ComposerWarnType,
2175-
arg: any // eslint-disable-line @typescript-eslint/no-explicit-any
2175+
arg: any
21762176
): boolean {
21772177
return type !== 'translate' || !arg.resolvedMessage
21782178
}
@@ -2337,7 +2337,7 @@ export function createComposer(options: any = {}, VueI18nLegacy?: any): any {
23372337
},
23382338
() => parseTranslateArgs(...args),
23392339
'translate',
2340-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2340+
23412341
root => (root as any)[TranslateVNodeSymbol](...args),
23422342
key => [createTextNode(key as string)],
23432343
val => isArray(val)
@@ -2350,7 +2350,7 @@ export function createComposer(options: any = {}, VueI18nLegacy?: any): any {
23502350
context => Reflect.apply(number, null, [context, ...args]),
23512351
() => parseNumberArgs(...args),
23522352
'number format',
2353-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2353+
23542354
root => (root as any)[NumberPartsSymbol](...args),
23552355
NOOP_RETURN_ARRAY,
23562356
val => isString(val) || isArray(val)
@@ -2365,7 +2365,7 @@ export function createComposer(options: any = {}, VueI18nLegacy?: any): any {
23652365
context => Reflect.apply(datetime, null, [context, ...args]),
23662366
() => parseDateTimeArgs(...args),
23672367
'datetime format',
2368-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2368+
23692369
root => (root as any)[DatetimePartsSymbol](...args),
23702370
NOOP_RETURN_ARRAY,
23712371
val => isString(val) || isArray(val)

packages/vue-i18n-core/src/i18n.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ export function createI18n<
518518
? I18n<Messages, DateTimeFormats, NumberFormats, OptionLocale, false>
519519
: I18n<Messages, DateTimeFormats, NumberFormats, OptionLocale, Legacy>
520520

521-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
521+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
522522
export function createI18n(options: any = {}, VueI18nLegacy?: any): any {
523523
type _I18n = I18n & I18nInternal
524524

@@ -828,7 +828,7 @@ export function useI18n<
828828
NonNullable<Options['numberFormats']>,
829829
Options['locale'] extends unknown ? string : Options['locale']
830830
>
831-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
831+
832832
export function useI18n<
833833
Options extends UseI18nOptions = UseI18nOptions,
834834
Messages extends Record<string, unknown> = NonNullable<Options['messages']>,

packages/vue-i18n-core/src/legacy.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ export type DateTimeFormatResult = string
7777
/** @VueI18nLegacy */
7878
export type NumberFormatResult = string
7979
export interface Formatter {
80-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
8180
interpolate(message: string, values: any, path: string): Array<any> | null
8281
}
8382
export type VueI18nExtender = (vueI18n: VueI18n) => Disposer | undefined
@@ -1465,7 +1464,7 @@ export function createVueI18n<
14651464
*
14661465
* @internal
14671466
*/
1468-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
1467+
14691468
export function createVueI18n(options: any = {}, VueI18nLegacy?: any): any {
14701469
type Message = VueMessageType
14711470

packages/vue-i18n-core/src/mixins/bridge.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import type { I18n } from '../i18n'
1010
*/
1111
export function defineMixin(
1212
i18n: I18n,
13-
VueI18n: any // eslint-disable-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
13+
VueI18n: any // eslint-disable-line @typescript-eslint/no-explicit-any
1414
): ComponentOptions {
1515
return {
1616
beforeCreate(): void {

packages/vue-i18n-core/src/utils.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ declare module 'vue' {
3838
}
3939
}
4040

41-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
4241
export function isLegacyVueI18n(VueI18n: any): boolean {
4342
if (VueI18n == null || VueI18n.version == null) {
4443
return false
@@ -148,15 +147,14 @@ export function getLocaleMessages<Messages = {}>(
148147
return ret as { [K in keyof Messages]: Messages[K] }
149148
}
150149

151-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
152150
export function getComponentOptions(instance: ComponentInternalInstance): any {
153151
return !__BRIDGE__ ? instance.type : instance.proxy!.$options
154152
}
155153

156154
export function adjustI18nResources(
157155
gl: Composer,
158156
options: ComposerOptions,
159-
componentOptions: any // eslint-disable-line @typescript-eslint/no-explicit-any
157+
componentOptions: any
160158
): void {
161159
let messages = isObject(options.messages) ? options.messages : {}
162160
if ('__i18nGlobal' in componentOptions) {

0 commit comments

Comments
 (0)