diff --git a/package.json b/package.json
index c02ce716393..da1229ca382 100644
--- a/package.json
+++ b/package.json
@@ -13,7 +13,8 @@
"size-esm-runtime": "node scripts/build.js vue -f esm-bundler-runtime",
"size-esm": "node scripts/build.js runtime-dom runtime-core reactivity shared -f esm-bundler",
"check": "tsc --incremental --noEmit",
- "lint": "eslint --cache .",
+ "lint": "tsslint --project tsconfig.json",
+ "lint-types": "npm run lint -- --type-aware",
"format": "prettier --write --cache .",
"format-check": "prettier --check --cache .",
"test": "vitest",
@@ -54,7 +55,7 @@
"prettier --write"
],
"*.ts?(x)": [
- "eslint --fix",
+ "npm run lint -- --fix",
"prettier --parser=typescript --write"
]
},
@@ -70,19 +71,22 @@
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-replace": "5.0.4",
"@swc/core": "^1.9.3",
+ "@tsslint/cli": "~1.4.6",
+ "@tsslint/config": "~1.4.6",
+ "@tsslint/eslint": "~1.4.6",
"@types/hash-sum": "^1.0.2",
"@types/node": "^22.10.1",
"@types/semver": "^7.5.8",
"@types/serve-handler": "^6.1.4",
+ "@typescript-eslint/eslint-plugin": "^8.17.0",
"@vitest/coverage-v8": "^2.1.5",
+ "@vitest/eslint-plugin": "^1.1.14",
"@vue/consolidate": "1.0.0",
"conventional-changelog-cli": "^5.0.0",
"enquirer": "^2.4.1",
"esbuild": "^0.24.0",
"esbuild-plugin-polyfill-node": "^0.3.0",
- "eslint": "^9.15.0",
- "eslint-plugin-import-x": "^4.4.2",
- "@vitest/eslint-plugin": "^1.1.10",
+ "eslint-plugin-import-x": "^4.4.3",
"estree-walker": "catalog:",
"jsdom": "^25.0.1",
"lint-staged": "^15.2.10",
@@ -108,19 +112,7 @@
"todomvc-app-css": "^2.4.3",
"tslib": "^2.8.1",
"typescript": "~5.6.2",
- "typescript-eslint": "^8.14.0",
"vite": "catalog:",
"vitest": "^2.1.5"
- },
- "pnpm": {
- "peerDependencyRules": {
- "allowedVersions": {
- "typescript-eslint>eslint": "^9.0.0",
- "@typescript-eslint/eslint-plugin>eslint": "^9.0.0",
- "@typescript-eslint/parser>eslint": "^9.0.0",
- "@typescript-eslint/type-utils>eslint": "^9.0.0",
- "@typescript-eslint/utils>eslint": "^9.0.0"
- }
- }
}
}
diff --git a/packages/compiler-core/__tests__/parse.spec.ts b/packages/compiler-core/__tests__/parse.spec.ts
index 4e5a9616511..d6fbb9df837 100644
--- a/packages/compiler-core/__tests__/parse.spec.ts
+++ b/packages/compiler-core/__tests__/parse.spec.ts
@@ -114,7 +114,7 @@ describe('compiler: parse', () => {
test('text with mix of tags and interpolations', () => {
const ast = baseParse('some {{ foo < bar + foo }} text')
const text1 = ast.children[0] as TextNode
- const text2 = (ast.children[1] as ElementNode).children![1] as TextNode
+ const text2 = (ast.children[1] as ElementNode).children[1] as TextNode
expect(text1).toStrictEqual({
type: NodeTypes.TEXT,
diff --git a/packages/compiler-core/__tests__/transforms/vIf.spec.ts b/packages/compiler-core/__tests__/transforms/vIf.spec.ts
index 2c2fedab0d5..1544b0c40c7 100644
--- a/packages/compiler-core/__tests__/transforms/vIf.spec.ts
+++ b/packages/compiler-core/__tests__/transforms/vIf.spec.ts
@@ -97,8 +97,8 @@ describe('compiler: v-if', () => {
// #2058 since a component may fail to resolve and fallback to a plain
// element, it still needs to be made a block
expect(
- ((node.branches[0].children[0] as ElementNode)!
- .codegenNode as VNodeCall)!.isBlock,
+ ((node.branches[0].children[0] as ElementNode).codegenNode as VNodeCall)
+ .isBlock,
).toBe(true)
})
@@ -702,8 +702,7 @@ describe('compiler: v-if', () => {
expect(b1b1.children[0].type).toBe(NodeTypes.COMMENT)
expect((b1b1.children[0] as CommentNode).content).toBe('comment2')
- const b1b2: IfBranchNode = (b1.children[1] as IfNode)
- .branches[1] as IfBranchNode
+ const b1b2: IfBranchNode = (b1.children[1] as IfNode).branches[1]
expect(b1b2.children[0].type).toBe(NodeTypes.COMMENT)
expect((b1b2.children[0] as CommentNode).content).toBe(`comment3`)
expect(b1b2.children[1].type).toBe(NodeTypes.ELEMENT)
diff --git a/packages/compiler-core/src/codegen.ts b/packages/compiler-core/src/codegen.ts
index 70116cfb61a..a9db4def23a 100644
--- a/packages/compiler-core/src/codegen.ts
+++ b/packages/compiler-core/src/codegen.ts
@@ -768,8 +768,8 @@ function genCompoundExpression(
node: CompoundExpressionNode,
context: CodegenContext,
) {
- for (let i = 0; i < node.children!.length; i++) {
- const child = node.children![i]
+ for (let i = 0; i < node.children.length; i++) {
+ const child = node.children[i]
if (isString(child)) {
context.push(child, NewlineType.Unknown)
} else {
diff --git a/packages/compiler-core/src/parser.ts b/packages/compiler-core/src/parser.ts
index 95c5e129f25..26688baa930 100644
--- a/packages/compiler-core/src/parser.ts
+++ b/packages/compiler-core/src/parser.ts
@@ -324,7 +324,7 @@ const tokenizer = new Tokenizer(stack, {
// assign value
// condense whitespaces in class
- if (currentProp!.name === 'class') {
+ if (currentProp.name === 'class') {
currentAttrValue = condense(currentAttrValue).trim()
}
@@ -332,7 +332,7 @@ const tokenizer = new Tokenizer(stack, {
emitError(ErrorCodes.MISSING_ATTRIBUTE_VALUE, end)
}
- currentProp!.value = {
+ currentProp.value = {
type: NodeTypes.TEXT,
content: currentAttrValue,
loc:
diff --git a/packages/compiler-core/src/transform.ts b/packages/compiler-core/src/transform.ts
index aeb96cc2b4a..9686442ef67 100644
--- a/packages/compiler-core/src/transform.ts
+++ b/packages/compiler-core/src/transform.ts
@@ -318,7 +318,7 @@ export function createTransformContext(
if (identifiers[id] === undefined) {
identifiers[id] = 0
}
- identifiers[id]!++
+ identifiers[id]++
}
function removeId(id: string) {
diff --git a/packages/compiler-core/src/transforms/transformExpression.ts b/packages/compiler-core/src/transforms/transformExpression.ts
index 9ae8897e674..44e6b75a37f 100644
--- a/packages/compiler-core/src/transforms/transformExpression.ts
+++ b/packages/compiler-core/src/transforms/transformExpression.ts
@@ -33,12 +33,7 @@ import {
makeMap,
} from '@vue/shared'
import { ErrorCodes, createCompilerError } from '../errors'
-import type {
- AssignmentExpression,
- Identifier,
- Node,
- UpdateExpression,
-} from '@babel/types'
+import type { Identifier, Node } from '@babel/types'
import { validateBrowserExpression } from '../validateExpression'
import { parseExpression } from '@babel/parser'
import { IS_REF, UNREF } from '../runtimeHelpers'
@@ -169,7 +164,7 @@ export function processExpression(
// let is a local non-ref value, and we need to replicate the
// right hand side value.
// x = y --> isRef(x) ? x.value = y : x = y
- const { right: rVal, operator } = parent as AssignmentExpression
+ const { right: rVal, operator } = parent
const rExp = rawExp.slice(rVal.start! - 1, rVal.end! - 1)
const rExpString = stringifyExpression(
processExpression(
@@ -186,9 +181,9 @@ export function processExpression(
} else if (isUpdateArg) {
// make id replace parent in the code range so the raw update operator
// is removed
- id!.start = parent!.start
- id!.end = parent!.end
- const { prefix: isPrefix, operator } = parent as UpdateExpression
+ id.start = parent.start
+ id.end = parent.end
+ const { prefix: isPrefix, operator } = parent
const prefix = isPrefix ? operator : ``
const postfix = isPrefix ? `` : operator
// let binding.
diff --git a/packages/compiler-core/src/transforms/vFor.ts b/packages/compiler-core/src/transforms/vFor.ts
index 0dca0ba9ab4..652cf25b6a7 100644
--- a/packages/compiler-core/src/transforms/vFor.ts
+++ b/packages/compiler-core/src/transforms/vFor.ts
@@ -18,7 +18,6 @@ import {
type PlainElementNode,
type RenderSlotCall,
type SimpleExpressionNode,
- type SlotOutletNode,
type VNodeCall,
createBlockStatement,
createCallExpression,
@@ -159,7 +158,7 @@ export const transformFor: NodeTransform = createStructuralDirectiveTransform(
: isTemplate &&
node.children.length === 1 &&
isSlotOutlet(node.children[0])
- ? (node.children[0] as SlotOutletNode) // api-extractor somehow fails to infer this
+ ? node.children[0] // api-extractor somehow fails to infer this
: null
if (slotOutlet) {
diff --git a/packages/compiler-core/src/transforms/vIf.ts b/packages/compiler-core/src/transforms/vIf.ts
index 54c505407a3..8f68f40aa06 100644
--- a/packages/compiler-core/src/transforms/vIf.ts
+++ b/packages/compiler-core/src/transforms/vIf.ts
@@ -290,9 +290,7 @@ function createChildrenCodegenNode(
)
}
} else {
- const ret = (firstChild as ElementNode).codegenNode as
- | BlockCodegenNode
- | MemoExpression
+ const ret = firstChild.codegenNode as BlockCodegenNode | MemoExpression
const vnodeCall = getMemoedVNodeCall(ret)
// Change createVNode to createBlock.
if (vnodeCall.type === NodeTypes.VNODE_CALL) {
diff --git a/packages/compiler-dom/__tests__/parse.spec.ts b/packages/compiler-dom/__tests__/parse.spec.ts
index 7418b8e33fb..fad832a0730 100644
--- a/packages/compiler-dom/__tests__/parse.spec.ts
+++ b/packages/compiler-dom/__tests__/parse.spec.ts
@@ -131,7 +131,7 @@ describe('DOM parser', () => {
test('CDATA', () => {
const ast = parse('', parserOptions)
- const text = (ast.children[0] as ElementNode).children![0] as TextNode
+ const text = (ast.children[0] as ElementNode).children[0] as TextNode
expect(text).toStrictEqual({
type: NodeTypes.TEXT,
diff --git a/packages/compiler-dom/src/decodeHtmlBrowser.ts b/packages/compiler-dom/src/decodeHtmlBrowser.ts
index 2e72d0fd1f7..c5f406038d5 100644
--- a/packages/compiler-dom/src/decodeHtmlBrowser.ts
+++ b/packages/compiler-dom/src/decodeHtmlBrowser.ts
@@ -1,9 +1,8 @@
-/* eslint-disable no-restricted-globals */
-
let decoder: HTMLDivElement
export function decodeHtmlBrowser(raw: string, asAttr = false): string {
if (!decoder) {
+ // eslint-disable-next-line no-restricted-globals
decoder = document.createElement('div')
}
if (asAttr) {
diff --git a/packages/compiler-dom/src/transforms/vOn.ts b/packages/compiler-dom/src/transforms/vOn.ts
index 1bb5763188b..c61b2808fa4 100644
--- a/packages/compiler-dom/src/transforms/vOn.ts
+++ b/packages/compiler-dom/src/transforms/vOn.ts
@@ -61,9 +61,7 @@ const resolveModifiers = (
// runtimeModifiers: modifiers that needs runtime guards
if (maybeKeyModifier(modifier)) {
if (isStaticExp(key)) {
- if (
- isKeyboardEvent((key as SimpleExpressionNode).content.toLowerCase())
- ) {
+ if (isKeyboardEvent(key.content.toLowerCase())) {
keyModifiers.push(modifier)
} else {
nonKeyModifiers.push(modifier)
diff --git a/packages/compiler-sfc/__tests__/compileTemplate.spec.ts b/packages/compiler-sfc/__tests__/compileTemplate.spec.ts
index 2ea1eb9d378..2d8214d173a 100644
--- a/packages/compiler-sfc/__tests__/compileTemplate.spec.ts
+++ b/packages/compiler-sfc/__tests__/compileTemplate.spec.ts
@@ -4,7 +4,7 @@ import {
type SFCTemplateCompileOptions,
compileTemplate,
} from '../src/compileTemplate'
-import { type SFCTemplateBlock, parse } from '../src/parse'
+import { parse } from '../src/parse'
import { compileScript } from '../src'
function compile(opts: Omit) {
@@ -52,7 +52,7 @@ body
`,
{ filename: 'example.vue', sourceMap: true },
- ).descriptor.template as SFCTemplateBlock
+ ).descriptor.template!
const result = compile({
filename: 'example.vue',
@@ -76,7 +76,7 @@ test('preprocess pug with indents and blank lines', () => {
`,
{ filename: 'example.vue', sourceMap: true },
- ).descriptor.template as SFCTemplateBlock
+ ).descriptor.template!
const result = compile({
filename: 'example.vue',
@@ -94,7 +94,7 @@ test('warn missing preprocessor', () => {
const template = parse(`hi\n`, {
filename: 'example.vue',
sourceMap: true,
- }).descriptor.template as SFCTemplateBlock
+ }).descriptor.template!
const result = compile({
filename: 'example.vue',
@@ -337,7 +337,7 @@ test('preprocessor errors', () => {
`,
{ filename: 'example.vue', sourceMap: true },
- ).descriptor.template as SFCTemplateBlock
+ ).descriptor.template!
const result = compile({
filename: 'example.vue',
diff --git a/packages/compiler-sfc/__tests__/parse.spec.ts b/packages/compiler-sfc/__tests__/parse.spec.ts
index 87cd05ed0ef..b2e4afa8656 100644
--- a/packages/compiler-sfc/__tests__/parse.spec.ts
+++ b/packages/compiler-sfc/__tests__/parse.spec.ts
@@ -81,7 +81,7 @@ font-weight: bold;
const consumer = new SourceMapConsumer(script!.map!)
consumer.eachMapping(mapping => {
- expect(mapping.originalLine - mapping.generatedLine).toBe(padding)
+ expect(mapping.originalLine! - mapping.generatedLine).toBe(padding)
})
})
@@ -100,8 +100,8 @@ font-weight: bold;
const consumer = new SourceMapConsumer(template.map!)
consumer.eachMapping(mapping => {
- expect(mapping.originalLine - mapping.generatedLine).toBe(padding)
- expect(mapping.originalColumn - mapping.generatedColumn).toBe(2)
+ expect(mapping.originalLine! - mapping.generatedLine).toBe(padding)
+ expect(mapping.originalColumn! - mapping.generatedColumn).toBe(2)
})
})
@@ -111,11 +111,11 @@ font-weight: bold;
`${'\n'.repeat(padding)}\n{\n "greeting": "hello"\n}\n\n`,
).descriptor.customBlocks[0]
- expect(custom!.map).not.toBeUndefined()
+ expect(custom.map).not.toBeUndefined()
- const consumer = new SourceMapConsumer(custom!.map!)
+ const consumer = new SourceMapConsumer(custom.map!)
consumer.eachMapping(mapping => {
- expect(mapping.originalLine - mapping.generatedLine).toBe(padding)
+ expect(mapping.originalLine! - mapping.generatedLine).toBe(padding)
})
})
})
diff --git a/packages/compiler-sfc/src/compileScript.ts b/packages/compiler-sfc/src/compileScript.ts
index fee05beed96..30cbfd0ad54 100644
--- a/packages/compiler-sfc/src/compileScript.ts
+++ b/packages/compiler-sfc/src/compileScript.ts
@@ -1138,7 +1138,7 @@ function walkDeclaration(
isAllLiteral = node.members.every(
member => !member.initializer || isStaticNode(member.initializer),
)
- bindings[node.id!.name] = isAllLiteral
+ bindings[node.id.name] = isAllLiteral
? BindingTypes.LITERAL_CONST
: BindingTypes.SETUP_CONST
} else if (
diff --git a/packages/compiler-sfc/src/compileTemplate.ts b/packages/compiler-sfc/src/compileTemplate.ts
index 322b1570e1a..b043cf813d7 100644
--- a/packages/compiler-sfc/src/compileTemplate.ts
+++ b/packages/compiler-sfc/src/compileTemplate.ts
@@ -289,7 +289,7 @@ function mapLines(oldMap: RawSourceMap, newMap: RawSourceMap): RawSourceMap {
const origPosInOldMap = oldMapConsumer.originalPositionFor({
line: m.originalLine,
- column: m.originalColumn,
+ column: m.originalColumn!,
})
if (origPosInOldMap.source == null) {
@@ -305,7 +305,7 @@ function mapLines(oldMap: RawSourceMap, newMap: RawSourceMap): RawSourceMap {
line: origPosInOldMap.line, // map line
// use current column, since the oldMap produced by @vue/compiler-sfc
// does not
- column: m.originalColumn,
+ column: m.originalColumn!,
},
source: origPosInOldMap.source,
name: origPosInOldMap.name,
diff --git a/packages/compiler-sfc/src/script/context.ts b/packages/compiler-sfc/src/script/context.ts
index 47b6b442a49..86bf819c1dc 100644
--- a/packages/compiler-sfc/src/script/context.ts
+++ b/packages/compiler-sfc/src/script/context.ts
@@ -136,7 +136,7 @@ export class ScriptCompileContext {
this.scriptSetupAst =
descriptor.scriptSetup &&
- parse(descriptor.scriptSetup!.content, this.startOffset!)
+ parse(descriptor.scriptSetup.content, this.startOffset!)
}
getString(node: Node, scriptSetup = true): string {
diff --git a/packages/compiler-sfc/src/script/definePropsDestructure.ts b/packages/compiler-sfc/src/script/definePropsDestructure.ts
index 27b4d445bbe..9f0b026121a 100644
--- a/packages/compiler-sfc/src/script/definePropsDestructure.ts
+++ b/packages/compiler-sfc/src/script/definePropsDestructure.ts
@@ -278,7 +278,7 @@ export function transformDestructuredProps(
if (node.type === 'Identifier') {
if (
- isReferencedIdentifier(node, parent!, parentStack) &&
+ isReferencedIdentifier(node, parent, parentStack) &&
!excludedIds.has(node)
) {
if (currentScope[node.name]) {
diff --git a/packages/compiler-sfc/src/script/resolveType.ts b/packages/compiler-sfc/src/script/resolveType.ts
index 6bb647f11ff..d2cd096b488 100644
--- a/packages/compiler-sfc/src/script/resolveType.ts
+++ b/packages/compiler-sfc/src/script/resolveType.ts
@@ -1349,7 +1349,7 @@ function recordType(
if (existing) {
if (node.type === 'TSModuleDeclaration') {
if (existing.type === 'TSModuleDeclaration') {
- mergeNamespaces(existing as typeof node, node)
+ mergeNamespaces(existing, node)
} else {
attachNamespace(existing, node)
}
diff --git a/packages/compiler-sfc/src/style/preprocessors.ts b/packages/compiler-sfc/src/style/preprocessors.ts
index 8c210ad16d1..8deff84f774 100644
--- a/packages/compiler-sfc/src/style/preprocessors.ts
+++ b/packages/compiler-sfc/src/style/preprocessors.ts
@@ -61,7 +61,7 @@ const scss: StylePreprocessor = (source, map, options, load = require) => {
code: css,
errors: [],
dependencies,
- map: merge(map, sourceMap!),
+ map: merge(map, sourceMap),
}
}
return { code: css, errors: [], dependencies }
diff --git a/packages/reactivity/__tests__/collections/Set.spec.ts b/packages/reactivity/__tests__/collections/Set.spec.ts
index 2aeef198256..ac090e6b3bc 100644
--- a/packages/reactivity/__tests__/collections/Set.spec.ts
+++ b/packages/reactivity/__tests__/collections/Set.spec.ts
@@ -44,7 +44,7 @@ describe('reactivity/collections', () => {
it('should observe for of iteration', () => {
let dummy
- const set = reactive(new Set() as Set)
+ const set = reactive(new Set())
effect(() => {
dummy = 0
for (let num of set) {
@@ -82,7 +82,7 @@ describe('reactivity/collections', () => {
it('should observe values iteration', () => {
let dummy
- const set = reactive(new Set() as Set)
+ const set = reactive(new Set())
effect(() => {
dummy = 0
for (let num of set.values()) {
@@ -102,7 +102,7 @@ describe('reactivity/collections', () => {
it('should observe keys iteration', () => {
let dummy
- const set = reactive(new Set() as Set)
+ const set = reactive(new Set())
effect(() => {
dummy = 0
for (let num of set.keys()) {
diff --git a/packages/reactivity/__tests__/readonly.spec.ts b/packages/reactivity/__tests__/readonly.spec.ts
index 9acd5c6491a..306d2526c02 100644
--- a/packages/reactivity/__tests__/readonly.spec.ts
+++ b/packages/reactivity/__tests__/readonly.spec.ts
@@ -512,7 +512,7 @@ describe('reactivity/readonly', () => {
})
test('setting readonly object to writable nested ref', () => {
- const r = ref()
+ const r = ref()
const obj = reactive({ r })
const ro = readonly({})
obj.r = ro
diff --git a/packages/reactivity/__tests__/watch.spec.ts b/packages/reactivity/__tests__/watch.spec.ts
index 245acfd63be..a7d099fa5c0 100644
--- a/packages/reactivity/__tests__/watch.spec.ts
+++ b/packages/reactivity/__tests__/watch.spec.ts
@@ -107,7 +107,7 @@ describe('watch', () => {
WatchErrorCodes.WATCH_CALLBACK,
])
- effect!.stop()
+ effect.stop()
source.value++
expect(onError.mock.calls.length).toBe(3)
expect(onError.mock.calls[2]).toMatchObject([
diff --git a/packages/reactivity/src/collectionHandlers.ts b/packages/reactivity/src/collectionHandlers.ts
index 048b7f38863..e05b76196bf 100644
--- a/packages/reactivity/src/collectionHandlers.ts
+++ b/packages/reactivity/src/collectionHandlers.ts
@@ -25,7 +25,7 @@ type WeakCollections = (WeakMap | WeakSet) & Target
type MapTypes = (Map | WeakMap) & Target
type SetTypes = (Set | WeakSet) & Target
-const toShallow = (value: T): T => value
+const toShallow = (value: T): T => value
const getProto = (v: T): any =>
Reflect.getPrototypeOf(v)
diff --git a/packages/reactivity/src/reactive.ts b/packages/reactivity/src/reactive.ts
index 729c854965e..6f3cacf42d9 100644
--- a/packages/reactivity/src/reactive.ts
+++ b/packages/reactivity/src/reactive.ts
@@ -23,16 +23,10 @@ export interface Target {
[ReactiveFlags.RAW]?: any
}
-export const reactiveMap: WeakMap = new WeakMap()
-export const shallowReactiveMap: WeakMap = new WeakMap<
- Target,
- any
->()
-export const readonlyMap: WeakMap = new WeakMap()
-export const shallowReadonlyMap: WeakMap = new WeakMap<
- Target,
- any
->()
+export const reactiveMap: WeakMap = new WeakMap()
+export const shallowReactiveMap: WeakMap = new WeakMap()
+export const readonlyMap: WeakMap = new WeakMap()
+export const shallowReadonlyMap: WeakMap = new WeakMap()
enum TargetType {
INVALID = 0,
@@ -418,7 +412,7 @@ export function markRaw(value: T): Raw {
*
* @param value - The value for which a reactive proxy shall be created.
*/
-export const toReactive = (value: T): T =>
+export const toReactive = (value: T): T =>
isObject(value) ? reactive(value) : value
/**
@@ -428,5 +422,5 @@ export const toReactive = (value: T): T =>
*
* @param value - The value for which a readonly proxy shall be created.
*/
-export const toReadonly = (value: T): DeepReadonly =>
+export const toReadonly = (value: T): DeepReadonly =>
isObject(value) ? readonly(value) : (value as DeepReadonly)
diff --git a/packages/reactivity/src/watch.ts b/packages/reactivity/src/watch.ts
index 094bf226ca8..b05232720e2 100644
--- a/packages/reactivity/src/watch.ts
+++ b/packages/reactivity/src/watch.ts
@@ -84,7 +84,7 @@ let activeWatcher: ReactiveEffect | undefined = undefined
/**
* Returns the current active effect if there is one.
*/
-export function getCurrentWatcher(): ReactiveEffect | undefined {
+export function getCurrentWatcher(): ReactiveEffect | undefined {
return activeWatcher
}
@@ -261,9 +261,9 @@ export function watch(
boundCleanup,
]
call
- ? call(cb!, WatchErrorCodes.WATCH_CALLBACK, args)
+ ? call(cb, WatchErrorCodes.WATCH_CALLBACK, args)
: // @ts-expect-error
- cb!(...args)
+ cb(...args)
oldValue = newValue
} finally {
activeWatcher = currentWatcher
diff --git a/packages/runtime-core/__tests__/apiInject.spec.ts b/packages/runtime-core/__tests__/apiInject.spec.ts
index e5c9267e5bb..ff1cc0256ea 100644
--- a/packages/runtime-core/__tests__/apiInject.spec.ts
+++ b/packages/runtime-core/__tests__/apiInject.spec.ts
@@ -105,7 +105,7 @@ describe('api: provide/inject', () => {
foo: {
from: 'foo',
default() {
- return this!.$options.name
+ return this.$options.name
},
},
},
diff --git a/packages/runtime-core/__tests__/components/BaseTransition.spec.ts b/packages/runtime-core/__tests__/components/BaseTransition.spec.ts
index aaeae3fb4f0..d1c8589c02f 100644
--- a/packages/runtime-core/__tests__/components/BaseTransition.spec.ts
+++ b/packages/runtime-core/__tests__/components/BaseTransition.spec.ts
@@ -520,15 +520,15 @@ describe('BaseTransition', () => {
}
test('w/ elements', async () => {
- await runTestWithElements(testToggleBranches)
+ runTestWithElements(testToggleBranches)
})
test('w/ components', async () => {
- await runTestWithComponents(testToggleBranches)
+ runTestWithComponents(testToggleBranches)
})
test('w/ KeepAlive', async () => {
- await runTestWithKeepAlive(testToggleBranches)
+ runTestWithKeepAlive(testToggleBranches)
})
})
@@ -653,15 +653,15 @@ describe('BaseTransition', () => {
}
test('w/ elements', async () => {
- await runTestWithElements(testToggleBranchesBeforeFinish)
+ runTestWithElements(testToggleBranchesBeforeFinish)
})
test('w/ components', async () => {
- await runTestWithComponents(testToggleBranchesBeforeFinish)
+ runTestWithComponents(testToggleBranchesBeforeFinish)
})
test('w/ KeepAlive', async () => {
- await runTestWithKeepAlive(testToggleBranchesBeforeFinish)
+ runTestWithKeepAlive(testToggleBranchesBeforeFinish)
})
})
@@ -758,15 +758,15 @@ describe('BaseTransition', () => {
}
test('w/ elements', async () => {
- await runTestWithElements(testOutIn)
+ runTestWithElements(testOutIn)
})
test('w/ components', async () => {
- await runTestWithComponents(testOutIn)
+ runTestWithComponents(testOutIn)
})
test('w/ KeepAlive', async () => {
- await runTestWithKeepAlive(testOutIn)
+ runTestWithKeepAlive(testOutIn)
})
})
@@ -840,15 +840,15 @@ describe('BaseTransition', () => {
}
test('w/ elements', async () => {
- await runTestWithElements(testOutIn)
+ runTestWithElements(testOutIn)
})
test('w/ components', async () => {
- await runTestWithComponents(testOutIn)
+ runTestWithComponents(testOutIn)
})
test('w/ KeepAlive', async () => {
- await runTestWithKeepAlive(testOutIn)
+ runTestWithKeepAlive(testOutIn)
})
})
@@ -912,15 +912,15 @@ describe('BaseTransition', () => {
}
test('w/ elements', async () => {
- await runTestWithElements(testOutInBeforeFinish)
+ runTestWithElements(testOutInBeforeFinish)
})
test('w/ components', async () => {
- await runTestWithComponents(testOutInBeforeFinish)
+ runTestWithComponents(testOutInBeforeFinish)
})
test('w/ KeepAlive', async () => {
- await runTestWithKeepAlive(testOutInBeforeFinish)
+ runTestWithKeepAlive(testOutInBeforeFinish)
})
})
@@ -990,15 +990,15 @@ describe('BaseTransition', () => {
}
test('w/ elements', async () => {
- await runTestWithElements(testOutInDoubleToggle)
+ runTestWithElements(testOutInDoubleToggle)
})
test('w/ components', async () => {
- await runTestWithComponents(testOutInDoubleToggle)
+ runTestWithComponents(testOutInDoubleToggle)
})
test('w/ KeepAlive', async () => {
- await runTestWithKeepAlive(testOutInDoubleToggle)
+ runTestWithKeepAlive(testOutInDoubleToggle)
})
})
@@ -1094,15 +1094,15 @@ describe('BaseTransition', () => {
}
test('w/ elements', async () => {
- await runTestWithElements(testInOut)
+ runTestWithElements(testInOut)
})
test('w/ components', async () => {
- await runTestWithComponents(testInOut)
+ runTestWithComponents(testInOut)
})
test('w/ KeepAlive', async () => {
- await runTestWithKeepAlive(testInOut)
+ runTestWithKeepAlive(testInOut)
})
})
@@ -1182,15 +1182,15 @@ describe('BaseTransition', () => {
}
test('w/ elements', async () => {
- await runTestWithElements(testInOutBeforeFinish)
+ runTestWithElements(testInOutBeforeFinish)
})
test('w/ components', async () => {
- await runTestWithComponents(testInOutBeforeFinish)
+ runTestWithComponents(testInOutBeforeFinish)
})
test('w/ KeepAlive', async () => {
- await runTestWithKeepAlive(testInOutBeforeFinish)
+ runTestWithKeepAlive(testInOutBeforeFinish)
})
})
diff --git a/packages/runtime-core/__tests__/hydration.spec.ts b/packages/runtime-core/__tests__/hydration.spec.ts
index 56011d06359..de1c3ec1e02 100644
--- a/packages/runtime-core/__tests__/hydration.spec.ts
+++ b/packages/runtime-core/__tests__/hydration.spec.ts
@@ -799,6 +799,7 @@ describe('SSR hydration', () => {
expect(log).toHaveBeenCalledWith('click')
// 2. child inc click + text interpolation
+ // eslint-disable-next-line @typescript-eslint/non-nullable-type-assertion-style
const count = container.querySelector('.count') as HTMLElement
expect(count.textContent).toBe(`0`)
triggerEvent('click', container.querySelector('.inc')!)
diff --git a/packages/runtime-core/__tests__/rendererOptimizedMode.spec.ts b/packages/runtime-core/__tests__/rendererOptimizedMode.spec.ts
index 958c1274806..e688e8da4d0 100644
--- a/packages/runtime-core/__tests__/rendererOptimizedMode.spec.ts
+++ b/packages/runtime-core/__tests__/rendererOptimizedMode.spec.ts
@@ -399,7 +399,7 @@ describe('renderer: optimized mode', () => {
)
expect(inner(root)).toBe('')
- expect(block!.dynamicChildren!.length).toBe(0)
+ expect(block.dynamicChildren!.length).toBe(0)
render(
(openBlock(),
@@ -413,7 +413,7 @@ describe('renderer: optimized mode', () => {
)
expect(inner(root)).toBe('bar
')
- expect(block!.dynamicChildren).toBe(null)
+ expect(block.dynamicChildren).toBe(null)
})
// #1980
diff --git a/packages/runtime-core/src/apiComputed.ts b/packages/runtime-core/src/apiComputed.ts
index 2ebb2d4e63a..afe4f01504d 100644
--- a/packages/runtime-core/src/apiComputed.ts
+++ b/packages/runtime-core/src/apiComputed.ts
@@ -10,7 +10,7 @@ export const computed: typeof _computed = (
if (__DEV__) {
const i = getCurrentInstance()
if (i && i.appContext.config.warnRecursiveComputed) {
- ;(c as unknown as ComputedRefImpl)._warnRecursive = true
+ ;(c as unknown as ComputedRefImpl)._warnRecursive = true
}
}
return c as any
diff --git a/packages/runtime-core/src/apiWatch.ts b/packages/runtime-core/src/apiWatch.ts
index 8f6168cdf29..f40c41b48d0 100644
--- a/packages/runtime-core/src/apiWatch.ts
+++ b/packages/runtime-core/src/apiWatch.ts
@@ -218,7 +218,7 @@ function doWatch(
job.flags! |= SchedulerJobFlags.PRE
if (instance) {
job.id = instance.uid
- ;(job as SchedulerJob).i = instance
+ job.i = instance
}
}
}
diff --git a/packages/runtime-core/src/compat/global.ts b/packages/runtime-core/src/compat/global.ts
index edc57436a56..1585d335390 100644
--- a/packages/runtime-core/src/compat/global.ts
+++ b/packages/runtime-core/src/compat/global.ts
@@ -495,7 +495,6 @@ function installCompatMount(
let container: Element
if (typeof selectorOrEl === 'string') {
- // eslint-disable-next-line
const result = document.querySelector(selectorOrEl)
if (!result) {
__DEV__ &&
@@ -506,7 +505,6 @@ function installCompatMount(
}
container = result
} else {
- // eslint-disable-next-line
container = selectorOrEl || document.createElement('div')
}
@@ -613,7 +611,7 @@ const methodsToPatch = [
'reverse',
]
-const patched = new WeakSet