Skip to content

Commit 69c56d2

Browse files
committed
chore: upgrade eslint releated deps and fix eslint errors
1 parent fd5bbe9 commit 69c56d2

22 files changed

+491
-423
lines changed

.vscode/settings.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
"editor.formatOnPaste": true,
99
"editor.formatOnType": true,
1010
"editor.codeActionsOnSave": {
11-
"source.fixAll.eslint": "explicit"
11+
"source.fixAll.eslint": "explicit",
12+
"source.organizeImports": "always"
1213
},
13-
"eslint.experimental.useFlatConfig": true,
14+
"eslint.useFlatConfig": true,
1415
"typescript.tsdk": "node_modules/typescript/lib",
1516
"volar.tsPlugin": true
1617
}

eslint.config.mjs

+25-18
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,10 @@
1-
import globals from 'globals'
21
import js from '@eslint/js'
3-
import ts from 'typescript-eslint'
42
import pritter from 'eslint-config-prettier'
53
import vue from 'eslint-plugin-vue'
4+
import globals from 'globals'
5+
import ts from 'typescript-eslint'
66

77
export default [
8-
// ignore globally
9-
{
10-
ignores: [
11-
'**/dist/**',
12-
'**/fixtures/**',
13-
'**/coverage/**',
14-
'**/.vitepress/**',
15-
'**/.vuepress/**',
16-
'**/test/**',
17-
'**/examples/**',
18-
'shim.d.ts',
19-
'.eslintcache',
20-
'.eslintrc.cjs'
21-
]
22-
},
23-
248
// globals
259
{
2610
// files: ['**/*.js', '**/*.ts', '**/*.vue', '**/*.json'],
@@ -87,10 +71,33 @@ export default [
8771
'@typescript-eslint/no-use-before-define': 'off',
8872
'@typescript-eslint/no-var-requires': 'off',
8973
'@typescript-eslint/no-non-null-assertion': 'off',
74+
'@typescript-eslint/no-empty-object-type': 'off', // FIXME: enable this rule
75+
'@typescript-eslint/no-unused-expressions': 'off',
76+
'@typescript-eslint/only-throw-error': 'off',
77+
'@typescript-eslint/no-unsafe-function-type': 'off',
9078
'vue/one-component-per-file': 'off',
9179
'vue/multi-word-component-names': 'off',
9280
'vue/experimental-script-setup-vars': 'off',
9381
'vue/no-deprecated-props-default-this': 'off'
9482
}
83+
},
84+
85+
// ignore globally
86+
{
87+
ignores: [
88+
'**/dist/**',
89+
'**/fixtures/**',
90+
'**/coverage/**',
91+
'**/.vitepress/**',
92+
'**/.vuepress/**',
93+
'**/test/**',
94+
'**/examples/**',
95+
'shim.d.ts',
96+
'.eslintcache',
97+
'.eslintrc.cjs',
98+
'packages/*/index.js',
99+
'docsgen.config.js',
100+
'scripts/api/*.js'
101+
]
95102
}
96103
]

package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"test:unit": "cross-env TZ=UTC vitest run -c ./vitest.unit.config.ts"
7272
},
7373
"devDependencies": {
74-
"@eslint/js": "^9.0.0",
74+
"@eslint/js": "^9.9.1",
7575
"@intlify/core-base": "workspace:*",
7676
"@intlify/message-compiler": "workspace:*",
7777
"@microsoft/api-extractor": "7.15.2",
@@ -83,24 +83,24 @@
8383
"@secretlint/secretlint-rule-preset-recommend": "^3.1.0",
8484
"@textlint-rule/textlint-rule-no-unmatched-pair": "^2.0.0",
8585
"@types/brotli": "^1.3.4",
86-
"@types/eslint": "^8.56.7",
86+
"@types/eslint": "^9.6.1",
8787
"@types/js-yaml": "^4.0.5",
8888
"@types/jsdom": "^21.1.1",
8989
"@types/minimist": "^1.2.5",
90-
"@types/node": "^20.11.21",
90+
"@types/node": "^22.5.3",
9191
"@types/rc": "^1.2.4",
9292
"@vitest/coverage-v8": "^2.0.0",
9393
"api-docs-gen": "^0.4.0",
9494
"benchmark": "^2.1.4",
9595
"brotli": "^1.3.2",
9696
"bumpp": "^9.3.0",
9797
"cross-env": "^7.0.3",
98-
"eslint": "^9.1.0",
98+
"eslint": "^9.9.1",
9999
"eslint-config-prettier": "^9.1.0",
100-
"eslint-plugin-vue": "^9.25.0",
100+
"eslint-plugin-vue": "^9.28.0",
101101
"execa": "^5.0.0",
102102
"fixpack": "^4.0.0",
103-
"globals": "^15.0.0",
103+
"globals": "^15.9.0",
104104
"globby": "^14.0.1",
105105
"js-yaml": "^4.1.0",
106106
"jsdom": "^24.0.0",
@@ -114,7 +114,7 @@
114114
"picocolors": "^1.0.0",
115115
"pkg-pr-new": "^0.0.20",
116116
"playwright-core": "^1.45.3",
117-
"prettier": "^3.2.5",
117+
"prettier": "^3.3.3",
118118
"rc": "^1.2.8",
119119
"rimraf": "^6.0.0",
120120
"rollup": "^3.29.2",
@@ -144,7 +144,7 @@
144144
"tslib": "^2.6.2",
145145
"tsx": "^4.11.2",
146146
"typescript": "^5.3.3",
147-
"typescript-eslint": "^7.5.0",
147+
"typescript-eslint": "^8.4.0",
148148
"vitepress": "1.3.4",
149149
"vitest": "^2.0.4",
150150
"vue": "3.4.38",

packages/core-base/src/compilation.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
import { warn, format, isObject, isBoolean, isString } from '@intlify/shared'
21
import {
32
baseCompile as baseCompileCore,
43
defaultOnError,
54
detectHtmlTag
65
} from '@intlify/message-compiler'
6+
import { format, isBoolean, isObject, isString, warn } from '@intlify/shared'
77
import { format as formatMessage } from './format'
88

99
import type {
10-
CompileOptions,
1110
CompileError,
11+
CompileOptions,
1212
CompilerResult,
1313
ResourceNode
1414
} from '@intlify/message-compiler'
15-
import type { MessageFunction, MessageFunctions } from './runtime'
1615
import type { MessageCompilerContext } from './context'
16+
import type { MessageFunction, MessageFunctions } from './runtime'
1717

1818
const WARN_MESSAGE = `Detected HTML in '{source}' message. Recommend not using HTML messages to avoid XSS.`
1919

@@ -71,6 +71,7 @@ export function compile<
7171
const warnHtmlMessage = isBoolean(context.warnHtmlMessage)
7272
? context.warnHtmlMessage
7373
: true
74+
7475
__DEV__ && checkHtmlMessage(message, warnHtmlMessage)
7576

7677
// check caches

packages/core-base/src/context.ts

+24-24
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
22

33
import {
4-
warn,
5-
isString,
4+
assign,
65
isArray,
76
isBoolean,
8-
isRegExp,
97
isFunction,
10-
isPlainObject,
11-
assign,
128
isObject,
9+
isPlainObject,
10+
isRegExp,
11+
isString,
12+
warn,
1313
warnOnce
1414
} from '@intlify/shared'
1515
import { initI18nDevTools } from './devtools'
16-
import { CoreWarnCodes, getWarnMessage } from './warnings'
17-
import { resolveWithKeyValue } from './resolver'
1816
import { fallbackWithSimple } from './fallbacker'
17+
import { resolveWithKeyValue } from './resolver'
18+
import { CoreWarnCodes, getWarnMessage } from './warnings'
1919

20-
import type { CompileOptions, ResourceNode } from '@intlify/message-compiler'
2120
import type { VueDevToolsEmitter } from '@intlify/devtools-types'
22-
import type { Path, MessageResolver } from './resolver'
21+
import type { CompileOptions, ResourceNode } from '@intlify/message-compiler'
22+
import type { LocaleFallbacker } from './fallbacker'
23+
import type { MessageResolver, Path } from './resolver'
2324
import type {
24-
Locale,
25-
LocaleDetector,
26-
FallbackLocale,
2725
CoreMissingType,
26+
FallbackLocale,
2827
LinkedModifiers,
29-
PluralizationRules,
30-
MessageProcessor,
28+
Locale,
29+
LocaleDetector,
3130
MessageFunction,
3231
MessageFunctionReturn,
33-
MessageType
32+
MessageProcessor,
33+
MessageType,
34+
PluralizationRules
3435
} from './runtime'
3536
import type {
36-
UnionToTuple,
37+
DateTimeFormat,
38+
DateTimeFormats as DateTimeFormatsType,
39+
FallbackLocales,
40+
IsEmptyObject,
3741
IsNever,
42+
LocaleParams,
3843
LocaleRecord,
3944
NumberFormat,
40-
DateTimeFormat,
41-
DateTimeFormats as DateTimeFormatsType,
4245
NumberFormats as NumberFormatsType,
43-
SchemaParams,
44-
LocaleParams,
4546
PickupLocales,
46-
FallbackLocales,
47-
IsEmptyObject,
48-
RemoveIndexSignature
47+
RemoveIndexSignature,
48+
SchemaParams,
49+
UnionToTuple
4950
} from './types'
50-
import type { LocaleFallbacker } from './fallbacker'
5151

5252
export interface MetaInfo {
5353
[field: string]: unknown

packages/core-base/src/datetime.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
import {
2-
isString,
2+
assign,
33
isBoolean,
4-
isPlainObject,
54
isDate,
6-
isNumber,
75
isEmptyObject,
8-
assign
6+
isNumber,
7+
isPlainObject,
8+
isString
99
} from '@intlify/shared'
1010
import {
1111
handleMissing,
1212
isTranslateFallbackWarn,
13-
NOT_REOSLVED,
14-
MISSING_RESOLVE_VALUE
13+
MISSING_RESOLVE_VALUE,
14+
NOT_REOSLVED
1515
} from './context'
16-
import { CoreWarnCodes, getWarnMessage } from './warnings'
1716
import { CoreErrorCodes, createCoreError } from './errors'
1817
import { getLocale } from './fallbacker'
1918
import { Availabilities } from './intl'
19+
import { CoreWarnCodes, getWarnMessage } from './warnings'
2020

21-
import type { Locale, FallbackLocale } from './runtime'
21+
import type { CoreContext, CoreInternalContext } from './context'
22+
import type { LocaleOptions } from './fallbacker'
23+
import type { FallbackLocale, Locale } from './runtime'
2224
import type {
2325
DateTimeFormat,
24-
DateTimeFormats as DateTimeFormatsType,
2526
DateTimeFormatOptions,
27+
DateTimeFormats as DateTimeFormatsType,
2628
PickupFormatKeys
2729
} from './types/index'
28-
import type { LocaleOptions } from './fallbacker'
29-
import type { CoreContext, CoreInternalContext } from './context'
3030

3131
/**
3232
* # datetime
@@ -345,7 +345,7 @@ export function parseDateTimeArgs(
345345
try {
346346
// This will fail if the date is not valid
347347
value.toISOString()
348-
} catch (e) {
348+
} catch {
349349
throw createCoreError(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT)
350350
}
351351
} else if (isDate(arg1)) {

packages/core-base/src/devtools.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type {
2-
IntlifyDevToolsHooks,
2+
IntlifyDevToolsEmitter,
33
IntlifyDevToolsHookPayloads,
4-
IntlifyDevToolsEmitter
4+
IntlifyDevToolsHooks
55
} from '@intlify/devtools-types'
66

77
let devtools: IntlifyDevToolsEmitter | null = null
@@ -20,6 +20,7 @@ export function initI18nDevTools(
2020
meta?: Record<string, unknown>
2121
): void {
2222
// TODO: queue if devtools is undefined
23+
2324
devtools &&
2425
devtools.emit('i18n:init', {
2526
timestamp: Date.now(),

packages/core-base/src/runtime.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1+
import { HelperNameMap } from '@intlify/message-compiler'
12
import {
23
assign,
3-
isNumber,
4+
isArray,
45
isFunction,
5-
toDisplayString,
6+
isNumber,
67
isObject,
7-
isString,
8-
isArray,
98
isPlainObject,
10-
join
9+
isString,
10+
join,
11+
toDisplayString
1112
} from '@intlify/shared'
12-
import { HelperNameMap } from '@intlify/message-compiler'
1313
import { Path } from './resolver'
1414
import { IsNever } from './types'
1515

@@ -369,6 +369,7 @@ export function createMessageContext<T = string, N = {}>(
369369

370370
// eslint-disable-next-line @typescript-eslint/no-explicit-any
371371
const _named = options.named || ({} as any)
372+
372373
isNumber(options.pluralIndex) && normalizeNamed(pluralIndex, _named)
373374
const named = (key: string): unknown => _named[key]
374375

packages/devtools-types/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface IntlifyRecord {
1212
id: number
1313
i18n: unknown // TODO:
1414
version: string
15-
types: Record<string, string | Symbol> // TODO
15+
types: Record<string, string | symbol> // TODO
1616
}
1717

1818
export type IntlifyDevToolsHooks = 'i18n:init' | 'function:translate'

0 commit comments

Comments
 (0)