Skip to content

Commit 9ecee16

Browse files
authored
chore: add no-debugger eslint rule (#5906)
1 parent 8a123ac commit 9ecee16

File tree

9 files changed

+23
-29
lines changed

9 files changed

+23
-29
lines changed

.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module.exports = {
77
sourceType: 'module'
88
},
99
rules: {
10+
'no-debugger': 'error',
1011
'no-unused-vars': [
1112
'error',
1213
// we are only using this rule to check for unused arguments since TS

packages/compiler-dom/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const DOMNodeTransforms: NodeTransform[] = [
2929
]
3030

3131
export const DOMDirectiveTransforms: Record<string, DirectiveTransform> = {
32-
cloak: noopDirectiveTransform,
32+
cloak: noopDirectiveTransform,
3333
html: transformVHtml,
3434
text: transformVText,
3535
model: transformModel, // override compiler-core

packages/runtime-core/__tests__/componentPublicInstance.spec.ts

-2
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ describe('component: proxy', () => {
257257
expect(instanceProxy.isDisplayed).toBe(true)
258258
})
259259

260-
261260
test('allow jest spying on proxy methods with Object.defineProperty', () => {
262261
// #5417
263262
let instanceProxy: any
@@ -426,7 +425,6 @@ describe('component: proxy', () => {
426425
expect(instanceProxy.fromProp).toBe(false)
427426
})
428427

429-
430428
// #864
431429
test('should not warn declared but absent props', () => {
432430
const Comp = {

packages/runtime-core/__tests__/rendererTemplateRef.spec.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -443,10 +443,8 @@ describe('api: template refs', () => {
443443
expect(mapRefs()).toMatchObject(['2', '3', '4'])
444444
})
445445

446-
447-
448446
test('named ref in v-for', async () => {
449-
const show = ref(true);
447+
const show = ref(true)
450448
const list = reactive([1, 2, 3])
451449
const listRefs = ref([])
452450
const mapRefs = () => listRefs.value.map(n => serializeInner(n))
@@ -495,6 +493,4 @@ describe('api: template refs', () => {
495493
await nextTick()
496494
expect(mapRefs()).toMatchObject(['2', '3', '4'])
497495
})
498-
499-
500496
})

packages/runtime-core/src/componentProps.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ const enum BooleanFlags {
135135

136136
// extract props which defined with default from prop options
137137
export type ExtractDefaultPropTypes<O> = O extends object
138-
// use `keyof Pick<O, DefaultKeys<O>>` instead of `DefaultKeys<O>` to support IDE features
139-
? { [K in keyof Pick<O, DefaultKeys<O>>]: InferPropType<O[K]> }
138+
? // use `keyof Pick<O, DefaultKeys<O>>` instead of `DefaultKeys<O>` to support IDE features
139+
{ [K in keyof Pick<O, DefaultKeys<O>>]: InferPropType<O[K]> }
140140
: {}
141141

142142
type NormalizedProp =
@@ -226,7 +226,7 @@ export function updateProps(
226226
for (let i = 0; i < propsToUpdate.length; i++) {
227227
let key = propsToUpdate[i]
228228
// skip if the prop key is a declared emit event listener
229-
if (isEmitListener(instance.emitsOptions, key)){
229+
if (isEmitListener(instance.emitsOptions, key)) {
230230
continue
231231
}
232232
// PROPS flag guarantees rawProps to be non-null

packages/runtime-core/src/hydration.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export function createHydrationFunctions(
113113
nextNode = onMismatch()
114114
} else {
115115
if ((node as Text).data !== vnode.children) {
116-
hasMismatch = true; debugger
116+
hasMismatch = true
117117
__DEV__ &&
118118
warn(
119119
`Hydration text mismatch:` +
@@ -351,7 +351,7 @@ export function createHydrationFunctions(
351351
)
352352
let hasWarned = false
353353
while (next) {
354-
hasMismatch = true; debugger
354+
hasMismatch = true
355355
if (__DEV__ && !hasWarned) {
356356
warn(
357357
`Hydration children mismatch in <${vnode.type as string}>: ` +
@@ -366,7 +366,7 @@ export function createHydrationFunctions(
366366
}
367367
} else if (shapeFlag & ShapeFlags.TEXT_CHILDREN) {
368368
if (el.textContent !== vnode.children) {
369-
hasMismatch = true; debugger
369+
hasMismatch = true
370370
__DEV__ &&
371371
warn(
372372
`Hydration text content mismatch in <${
@@ -411,7 +411,7 @@ export function createHydrationFunctions(
411411
} else if (vnode.type === Text && !vnode.children) {
412412
continue
413413
} else {
414-
hasMismatch = true; debugger
414+
hasMismatch = true
415415
if (__DEV__ && !hasWarned) {
416416
warn(
417417
`Hydration children mismatch in <${container.tagName.toLowerCase()}>: ` +
@@ -465,7 +465,7 @@ export function createHydrationFunctions(
465465
} else {
466466
// fragment didn't hydrate successfully, since we didn't get a end anchor
467467
// back. This should have led to node/children mismatch warnings.
468-
hasMismatch = true; debugger
468+
hasMismatch = true
469469
// since the anchor is missing, we need to create one and insert it
470470
insert((vnode.anchor = createComment(`]`)), container, next)
471471
return next
@@ -480,7 +480,7 @@ export function createHydrationFunctions(
480480
slotScopeIds: string[] | null,
481481
isFragment: boolean
482482
): Node | null => {
483-
hasMismatch = true; debugger
483+
hasMismatch = true
484484
__DEV__ &&
485485
warn(
486486
`Hydration node mismatch:\n- Client vnode:`,

packages/runtime-dom/__tests__/createApp.spec.ts

+7-9
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ describe('createApp for dom', () => {
1515

1616
// #4398
1717
test('should not mutate original root component options object', () => {
18-
19-
const originalObj = {
18+
const originalObj = {
2019
data() {
2120
return {
2221
counter: 0
@@ -28,17 +27,16 @@ describe('createApp for dom', () => {
2827
expect(msg).toMatch(`Component is missing template or render function`)
2928
})
3029

31-
const Root = { ...originalObj}
32-
30+
const Root = { ...originalObj }
31+
3332
const app = createApp(Root)
3433
app.config.warnHandler = handler
35-
app.mount(document.createElement('div'))
36-
37-
// ensure mount is based on a copy of Root object rather than Root object itself
34+
app.mount(document.createElement('div'))
35+
36+
// ensure mount is based on a copy of Root object rather than Root object itself
3837
expect(app._component).not.toBe(Root)
39-
38+
4039
// ensure no mutation happened to Root object
4140
expect(originalObj).toMatchObject(Root)
42-
4341
})
4442
})

packages/server-renderer/src/helpers/ssrRenderAttrs.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ import {
1212
} from '@vue/shared'
1313

1414
// leading comma for empty string ""
15-
const shouldIgnoreProp = makeMap(`,key,ref,innerHTML,textContent,ref_key,ref_for`)
15+
const shouldIgnoreProp = makeMap(
16+
`,key,ref,innerHTML,textContent,ref_key,ref_for`
17+
)
1618

1719
export function ssrRenderAttrs(
1820
props: Record<string, unknown>,

packages/shared/src/typeUtils.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export type UnionToIntersection<U> = (
77
// make keys required but keep undefined values
88
export type LooseRequired<T> = { [P in string & keyof T]: T[P] }
99

10-
1110
// If the the type T accepts type "any", output type Y, otherwise output type N.
1211
// https://stackoverflow.com/questions/49927523/disallow-call-with-any/49928360#49928360
13-
export type IfAny<T, Y, N> = 0 extends (1 & T) ? Y : N
12+
export type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N

0 commit comments

Comments
 (0)