Skip to content

Commit c033b58

Browse files
committed
fix linter errors
1 parent 80f0e51 commit c033b58

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

src/babel/core/get-hot-identifier.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { StateContext } from './types';
21
import * as t from '@babel/types';
2+
import type { StateContext } from './types';
33

44
export function getHotIdentifier(state: StateContext): t.MemberExpression {
55
switch (state.bundler) {

src/babel/core/is-valid-callee.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import type * as babel from '@babel/core';
2+
import * as t from '@babel/types';
13
import type {
24
ImportIdentifierSpecifier,
35
ImportIdentifierType,
46
StateContext,
57
} from './types';
68
import { unwrapNode } from './unwrap';
7-
import type * as babel from '@babel/core';
8-
import * as t from '@babel/types';
99

1010
function isIdentifierValidCallee(
1111
state: StateContext,

src/babel/core/transform-jsx.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ function convertJSXOpeningToExpression(
188188
);
189189
}
190190

191+
const COMPONENT_PATTERN = /^[A-Z_]/;
192+
191193
function extractJSXExpressionsFromJSXElement(
192194
state: JSXState,
193195
path: babel.NodePath<t.JSXElement>,
@@ -196,7 +198,7 @@ function extractJSXExpressionsFromJSXElement(
196198
const openingName = openingElement.get('name');
197199
if (
198200
(isPathValid(openingName, t.isJSXIdentifier) &&
199-
/^[A-Z_]/.test(openingName.node.name)) ||
201+
COMPONENT_PATTERN.test(openingName.node.name)) ||
200202
isPathValid(openingName, t.isJSXMemberExpression)
201203
) {
202204
if (isPathValid(openingName, t.isJSXIdentifier)) {

src/babel/core/xxhash32.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @ts-nocheck
12
/**
23
* Copyright (c) 2019 Jason Dent
34
* https://github.com/Jason3S/xxhash

src/babel/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ function wrapContext(
176176
return context;
177177
}
178178

179+
const SKIP_PATTERN = /^\s*@refresh skip\s*$/;
180+
const RELOAD_PATTERN = /^\s*@refresh reload\s*$/;
181+
179182
function setupProgram(
180183
state: StateContext,
181184
path: babel.NodePath<t.Program>,
@@ -185,12 +188,12 @@ function setupProgram(
185188
let isDone = false;
186189
if (comments) {
187190
for (const { value: comment } of comments) {
188-
if (/^\s*@refresh skip\s*$/.test(comment)) {
191+
if (SKIP_PATTERN.test(comment)) {
189192
isDone = true;
190193
shouldSkip = true;
191194
break;
192195
}
193-
if (/^\s*@refresh reload\s*$/.test(comment)) {
196+
if (RELOAD_PATTERN.test(comment)) {
194197
isDone = true;
195198
path.pushContainer('body', getHMRDeclineCall(state, path));
196199
break;

0 commit comments

Comments
 (0)