Skip to content

Commit 91fa528

Browse files
committed
chore: lint for unused arguments
1 parent 825ec15 commit 91fa528

File tree

7 files changed

+13
-62
lines changed

7 files changed

+13
-62
lines changed

.eslintrc.js

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ module.exports = {
77
sourceType: 'module'
88
},
99
rules: {
10+
'no-unused-vars': [
11+
'error',
12+
// we are only using this rule to check for unused arguments since TS
13+
// catches unused variables but not args.
14+
{ varsIgnorePattern: '.*', args: 'after-used' }
15+
],
1016
// most of the codebase are expected to be env agnostic
1117
'no-restricted-globals': ['error', ...DOMGlobals, ...NodeGlobals],
1218
// since we target ES2015 for baseline support, we need to forbid object

packages/compiler-core/src/transforms/validateExpression.ts

-49
This file was deleted.

packages/compiler-dom/src/transforms/transformStyle.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { parseStringStyle } from '@vue/shared'
1313
// style="color: red" -> :style='{ "color": "red" }'
1414
// It is then processed by `transformElement` and included in the generated
1515
// props.
16-
export const transformStyle: NodeTransform = (node, context) => {
16+
export const transformStyle: NodeTransform = node => {
1717
if (node.type === NodeTypes.ELEMENT) {
1818
node.props.forEach((p, i) => {
1919
if (p.type === NodeTypes.ATTRIBUTE && p.name === 'style' && p.value) {

packages/compiler-sfc/src/templateTransformSrcset.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const transformSrcset: NodeTransform = (
6262
if (options.base) {
6363
const base = options.base
6464
const set: string[] = []
65-
imageCandidates.forEach(({ url, descriptor }, index) => {
65+
imageCandidates.forEach(({ url, descriptor }) => {
6666
descriptor = descriptor ? ` ${descriptor}` : ``
6767
if (isRelativeUrl(url)) {
6868
set.push((path.posix || path).join(base, url) + descriptor)

packages/runtime-core/src/componentRenderUtils.ts

-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ const isElementRoot = (vnode: VNode) => {
239239
export function shouldUpdateComponent(
240240
prevVNode: VNode,
241241
nextVNode: VNode,
242-
parentComponent: ComponentInternalInstance | null,
243242
optimized?: boolean
244243
): boolean {
245244
const { props: prevProps, children: prevChildren } = prevVNode

packages/runtime-core/src/hmr.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export function registerHMR(instance: ComponentInternalInstance) {
4848
const id = instance.type.__hmrId!
4949
let record = map.get(id)
5050
if (!record) {
51-
createRecord(id, instance.type as ComponentOptions)
51+
createRecord(id)
5252
record = map.get(id)!
5353
}
5454
record.add(instance)
@@ -58,7 +58,7 @@ export function unregisterHMR(instance: ComponentInternalInstance) {
5858
map.get(instance.type.__hmrId!)!.delete(instance)
5959
}
6060

61-
function createRecord(id: string, comp: ComponentOptions): boolean {
61+
function createRecord(id: string): boolean {
6262
if (map.has(id)) {
6363
return false
6464
}

packages/runtime-core/src/renderer.ts

+3-8
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,7 @@ function baseCreateRenderer(
11091109
)
11101110
}
11111111
} else {
1112-
updateComponent(n1, n2, parentComponent, optimized)
1112+
updateComponent(n1, n2, optimized)
11131113
}
11141114
}
11151115

@@ -1185,14 +1185,9 @@ function baseCreateRenderer(
11851185
}
11861186
}
11871187

1188-
const updateComponent = (
1189-
n1: VNode,
1190-
n2: VNode,
1191-
parentComponent: ComponentInternalInstance | null,
1192-
optimized: boolean
1193-
) => {
1188+
const updateComponent = (n1: VNode, n2: VNode, optimized: boolean) => {
11941189
const instance = (n2.component = n1.component)!
1195-
if (shouldUpdateComponent(n1, n2, parentComponent, optimized)) {
1190+
if (shouldUpdateComponent(n1, n2, optimized)) {
11961191
if (
11971192
__FEATURE_SUSPENSE__ &&
11981193
instance.asyncDep &&

0 commit comments

Comments
 (0)