Skip to content

Commit

Permalink
chore: lint for unused arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jun 12, 2020
1 parent 825ec15 commit 91fa528
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 62 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ module.exports = {
sourceType: 'module'
},
rules: {
'no-unused-vars': [
'error',
// we are only using this rule to check for unused arguments since TS
// catches unused variables but not args.
{ varsIgnorePattern: '.*', args: 'after-used' }
],
// most of the codebase are expected to be env agnostic
'no-restricted-globals': ['error', ...DOMGlobals, ...NodeGlobals],
// since we target ES2015 for baseline support, we need to forbid object
Expand Down
49 changes: 0 additions & 49 deletions packages/compiler-core/src/transforms/validateExpression.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/compiler-dom/src/transforms/transformStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { parseStringStyle } from '@vue/shared'
// style="color: red" -> :style='{ "color": "red" }'
// It is then processed by `transformElement` and included in the generated
// props.
export const transformStyle: NodeTransform = (node, context) => {
export const transformStyle: NodeTransform = node => {
if (node.type === NodeTypes.ELEMENT) {
node.props.forEach((p, i) => {
if (p.type === NodeTypes.ATTRIBUTE && p.name === 'style' && p.value) {
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-sfc/src/templateTransformSrcset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const transformSrcset: NodeTransform = (
if (options.base) {
const base = options.base
const set: string[] = []
imageCandidates.forEach(({ url, descriptor }, index) => {
imageCandidates.forEach(({ url, descriptor }) => {
descriptor = descriptor ? ` ${descriptor}` : ``
if (isRelativeUrl(url)) {
set.push((path.posix || path).join(base, url) + descriptor)
Expand Down
1 change: 0 additions & 1 deletion packages/runtime-core/src/componentRenderUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ const isElementRoot = (vnode: VNode) => {
export function shouldUpdateComponent(
prevVNode: VNode,
nextVNode: VNode,
parentComponent: ComponentInternalInstance | null,
optimized?: boolean
): boolean {
const { props: prevProps, children: prevChildren } = prevVNode
Expand Down
4 changes: 2 additions & 2 deletions packages/runtime-core/src/hmr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function registerHMR(instance: ComponentInternalInstance) {
const id = instance.type.__hmrId!
let record = map.get(id)
if (!record) {
createRecord(id, instance.type as ComponentOptions)
createRecord(id)
record = map.get(id)!
}
record.add(instance)
Expand All @@ -58,7 +58,7 @@ export function unregisterHMR(instance: ComponentInternalInstance) {
map.get(instance.type.__hmrId!)!.delete(instance)
}

function createRecord(id: string, comp: ComponentOptions): boolean {
function createRecord(id: string): boolean {
if (map.has(id)) {
return false
}
Expand Down
11 changes: 3 additions & 8 deletions packages/runtime-core/src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ function baseCreateRenderer(
)
}
} else {
updateComponent(n1, n2, parentComponent, optimized)
updateComponent(n1, n2, optimized)
}
}

Expand Down Expand Up @@ -1185,14 +1185,9 @@ function baseCreateRenderer(
}
}

const updateComponent = (
n1: VNode,
n2: VNode,
parentComponent: ComponentInternalInstance | null,
optimized: boolean
) => {
const updateComponent = (n1: VNode, n2: VNode, optimized: boolean) => {
const instance = (n2.component = n1.component)!
if (shouldUpdateComponent(n1, n2, parentComponent, optimized)) {
if (shouldUpdateComponent(n1, n2, optimized)) {
if (
__FEATURE_SUSPENSE__ &&
instance.asyncDep &&
Expand Down

0 comments on commit 91fa528

Please sign in to comment.