Skip to content

Commit c96d66e

Browse files
authored
Format (#109)
* Format * update
1 parent aa55d1c commit c96d66e

File tree

6 files changed

+26
-24
lines changed

6 files changed

+26
-24
lines changed

Diff for: .github/workflows/CI.yml

+3
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ jobs:
6969
uses: actions/setup-node@v1
7070
with:
7171
node-version: ${{ matrix.node }}
72+
- name: Install @typescript-eslint/parser@3
73+
run: npm install -D @typescript-eslint/parser@3
74+
if: matrix.node == '8.10.0'
7275
- name: Install Packages
7376
run: npm install
7477
- name: Install ESLint v${{ matrix.eslint }}

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"npm-run-all": "^4.1.5",
4343
"nyc": "^14.0.0",
4444
"opener": "^1.5.1",
45-
"prettier": "^2.2.1",
45+
"prettier": "^2.3.1",
4646
"rimraf": "^2.6.3",
4747
"rollup": "^1.1.2",
4848
"rollup-plugin-node-resolve": "^4.0.0",

Diff for: src/parser-services.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ import { isSFCFile } from "./common/parser-options"
3232
// Helpers
3333
//------------------------------------------------------------------------------
3434

35-
type CustomBlockVisitorFactory = (
36-
context: CustomBlockContext,
37-
) =>
35+
type CustomBlockVisitorFactory = (context: CustomBlockContext) =>
3836
| {
3937
[key: string]: (...args: any) => void
4038
}
@@ -229,9 +227,10 @@ export function define(
229227
for (const customBlock of customBlocks) {
230228
const lang = getLang(customBlock)
231229

232-
const activeVisitorFactories = visitorFactories.filter(
233-
(f) => f.test(lang, customBlock),
234-
)
230+
const activeVisitorFactories =
231+
visitorFactories.filter((f) =>
232+
f.test(lang, customBlock),
233+
)
235234
if (!activeVisitorFactories.length) {
236235
continue
237236
}

Diff for: src/script/index.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,15 @@ const DUMMY_PARENT: any = {}
5454
// Like Vue, it judges whether it is a function expression or not.
5555
// https://github.com/vuejs/vue/blob/0948d999f2fddf9f90991956493f976273c5da1f/src/compiler/codegen/events.js#L3
5656
const IS_FUNCTION_EXPRESSION = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/u
57-
const IS_SIMPLE_PATH = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?'\]|\["[^"]*?"\]|\[\d+\]|\[[A-Za-z_$][\w$]*\])*$/u
57+
const IS_SIMPLE_PATH =
58+
/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?'\]|\["[^"]*?"\]|\[\d+\]|\[[A-Za-z_$][\w$]*\])*$/u
5859

5960
/**
6061
* Parse the alias and iterator of 'v-for' directive values.
6162
* @param code The code to parse.
6263
* @returns The parsed result.
6364
*/
64-
function processVForAliasAndIterator(
65-
code: string,
66-
): {
65+
function processVForAliasAndIterator(code: string): {
6766
aliases: string
6867
hasParens: boolean
6968
delimiter: string
@@ -555,9 +554,8 @@ export function parseScriptElement(
555554
? text.range[0]
556555
: node.startTag.range[1]
557556
const code = text != null && text.type === "VText" ? text.value : ""
558-
const locationCalculator = globalLocationCalculator.getSubCalculatorAfter(
559-
offset,
560-
)
557+
const locationCalculator =
558+
globalLocationCalculator.getSubCalculatorAfter(offset)
561559
const result = parseScriptFragment(code, locationCalculator, parserOptions)
562560

563561
// Needs the tokens of start/end tags for `lines-around-*` rules to work
@@ -624,7 +622,8 @@ export function parseExpression(
624622
if (!retB.expression) {
625623
return retB
626624
}
627-
const ret = (retB as unknown) as ExpressionParseResult<VFilterSequenceExpression>
625+
const ret =
626+
retB as unknown as ExpressionParseResult<VFilterSequenceExpression>
628627

629628
ret.expression = {
630629
type: "VFilterSequenceExpression",
@@ -1012,8 +1011,9 @@ function parseVOnExpressionBody(
10121011
).ast
10131012
const references = analyzeExternalReferences(ast, parserOptions)
10141013
const outermostStatement = ast.body[0] as ESLintExpressionStatement
1015-
const functionDecl = (outermostStatement.expression as ESLintUnaryExpression)
1016-
.argument as ESLintFunctionExpression
1014+
const functionDecl = (
1015+
outermostStatement.expression as ESLintUnaryExpression
1016+
).argument as ESLintFunctionExpression
10171017
const block = functionDecl.body
10181018
const body = block.body
10191019
const firstStatement = first(body)

Diff for: src/template/index.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -768,9 +768,8 @@ export function processMustache(
768768

769769
const document = getOwnerDocument(node)
770770
try {
771-
const locationCalculator = globalLocationCalculator.getSubCalculatorAfter(
772-
range[0],
773-
)
771+
const locationCalculator =
772+
globalLocationCalculator.getSubCalculatorAfter(range[0])
774773
const ret = parseExpression(
775774
mustache.value,
776775
locationCalculator,

Diff for: test/define-custom-blocks-visitor.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -395,10 +395,11 @@ describe("parserServices.defineCustomBlocksVisitor tests", () => {
395395
create(ctx) {
396396
return {
397397
Program(node) {
398-
const error = ctx.parserServices.parseCustomBlockElement(
399-
jsonParser,
400-
{ jsonSyntax: "json" }
401-
).error
398+
const error =
399+
ctx.parserServices.parseCustomBlockElement(
400+
jsonParser,
401+
{ jsonSyntax: "json" }
402+
).error
402403
ctx.report({
403404
node,
404405
message: JSON.stringify({

0 commit comments

Comments
 (0)