Skip to content

Commit 09a0b54

Browse files
committed
fix lint errors
1 parent e39b60b commit 09a0b54

File tree

11 files changed

+26
-16
lines changed

11 files changed

+26
-16
lines changed

.eslintrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ module.exports = {
2929
},
3030
rules: {
3131
'object-curly-spacing': 'off',
32+
'@typescript-eslint/ban-types': 'off',
33+
'@typescript-eslint/ban-ts-ignore': 'off',
34+
'@typescript-eslint/ban-ts-comment': 'off',
3235
'@typescript-eslint/explicit-function-return-type': 'off',
3336
'@typescript-eslint/member-delimiter-style': 'off',
3437
'@typescript-eslint/no-use-before-define': 'off',

src/components/Translation.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
Fragment,
44
defineComponent,
55
SetupContext,
6+
VNodeChild,
67
VNodeArrayChildren
78
} from 'vue'
89
import { Composer, ComposerInternal } from '../composer'
@@ -39,7 +40,7 @@ export const Translation = defineComponent({
3940
ComposerInternal
4041
const keys = Object.keys(slots).filter(key => key !== '_')
4142

42-
return () => {
43+
return (): VNodeChild => {
4344
const options = {} as TranslateOptions
4445
if (props.locale) {
4546
options.locale = props.locale

src/components/formatRenderer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
RenderFunction,
44
Fragment,
55
SetupContext,
6+
VNodeChild,
67
VNodeArrayChildren
78
} from 'vue'
89
import { NumberOptions, DateTimeOptions } from '../core'
@@ -34,7 +35,7 @@ export function renderFormatter<
3435
): RenderFunction {
3536
const { slots, attrs } = context
3637

37-
return () => {
38+
return (): VNodeChild => {
3839
const options = { part: true } as Arg
3940
let orverrides = {} as FormatOverrideOptions
4041

src/core/translate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ function getCompileOptions(
325325
key: string,
326326
source: string,
327327
warnHtmlMessage: boolean,
328-
errorDetector?: Function
328+
errorDetector?: Function // eslint-disable-line @typescript-eslint/ban-types
329329
): CompileOptions {
330330
return {
331331
warnHtmlMessage,

src/legacy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,16 @@ export interface VueI18n {
121121
t(key: Path, locale: Locale, list: unknown[]): TranslateResult
122122
t(key: Path, locale: Locale, named: object): TranslateResult
123123
t(key: Path, list: unknown[]): TranslateResult
124-
t(key: Path, named: object): TranslateResult
124+
t(key: Path, named: Record<string, unknown>): TranslateResult
125125
t(...args: unknown[]): TranslateResult // for $t
126126
tc(key: Path): TranslateResult
127127
tc(key: Path, locale: Locale): TranslateResult
128128
tc(key: Path, list: unknown[]): TranslateResult
129-
tc(key: Path, named: object): TranslateResult
129+
tc(key: Path, named: Record<string, unknown>): TranslateResult
130130
tc(key: Path, choice: number): TranslateResult
131131
tc(key: Path, choice: number, locale: Locale): TranslateResult
132132
tc(key: Path, choice: number, list: unknown[]): TranslateResult
133-
tc(key: Path, choice: number, named: object): TranslateResult
133+
tc(key: Path, choice: number, named: Record<string, unknown>): TranslateResult
134134
tc(...args: unknown[]): TranslateResult // for $tc
135135
te(key: Path, locale?: Locale): boolean
136136
getLocaleMessage(locale: Locale): LocaleMessage

src/message/errors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,6 @@ export function createCompileError<T extends number>(
7878
return error
7979
}
8080

81-
export function defaultOnError(error: CompileError) {
81+
export function defaultOnError(error: CompileError): never {
8282
throw error
8383
}

src/message/location.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,19 @@ export interface Position {
1313
column: number
1414
}
1515

16-
export function createPosition(line: number, column: number, offset: number) {
16+
export function createPosition(
17+
line: number,
18+
column: number,
19+
offset: number
20+
): Position {
1721
return { line, column, offset } as Position
1822
}
1923

2024
export function createLocation(
2125
start: Position,
2226
end: Position,
2327
source?: string
24-
) {
28+
): SourceLocation {
2529
const loc = { start, end } as SourceLocation
2630
if (source != null) {
2731
loc.source = source

src/message/runtime.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export type MessageFunction = {
2424
}
2525
export type MessageFunctions = Record<string, MessageFunction>
2626
export type MessageResolveFunction = (key: string) => MessageFunction
27-
export type NamedValue<T = {}> = T & { [prop: string]: unknown }
27+
export type NamedValue<T = {}> = T & Record<string, unknown>
2828
export type MessageNormalize = (values: unknown[]) => unknown
2929
export type MessageInterpolate = (val: unknown) => unknown
3030

src/message/tokenizer.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,10 @@ export function createTokenizer(
374374
return ret
375375
}
376376

377-
const takeChar = (scnr: Scanner, fn: Function): string | undefined | null => {
377+
const takeChar = (
378+
scnr: Scanner,
379+
fn: (ch: string) => boolean
380+
): string | undefined | null => {
378381
const ch = scnr.currentChar()
379382

380383
if (ch === EOF) {

src/mixin.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export function defineMixin(
144144
i18n: I18nInternal
145145
): ComponentOptions {
146146
return {
147-
beforeCreate() {
147+
beforeCreate(): void {
148148
const instance = getCurrentInstance()
149149
/* istanbul ignore if */
150150
if (!instance) {
@@ -185,11 +185,11 @@ export function defineMixin(
185185
this.$i18n.n(...args)
186186
},
187187

188-
mounted() {
188+
mounted(): void {
189189
this.$el.__intlify__ = this.$i18n.__composer
190190
},
191191

192-
beforeDestroy() {
192+
beforeDestroy(): void {
193193
const instance = getCurrentInstance()
194194
/* istanbul ignore if */
195195
if (!instance) {

0 commit comments

Comments
 (0)