Skip to content

Commit f6748d0

Browse files
committed
chore: lint code
1 parent d77f7de commit f6748d0

File tree

23 files changed

+63
-63
lines changed

23 files changed

+63
-63
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Set node
1818
uses: actions/setup-node@v3
1919
with:
20-
node-version: 16.x
20+
node-version: 18.x
2121

2222
- name: Setup
2323
run: npm i -g @antfu/ni
@@ -33,7 +33,7 @@ jobs:
3333

3434
strategy:
3535
matrix:
36-
node: [16.x, 18.x]
36+
node: [18.x]
3737
os: [ubuntu-latest, windows-latest, macos-latest]
3838
fail-fast: false
3939

examples/vite-vue-ts/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { defineConfig } from 'vite'
21
import vue from '@vitejs/plugin-vue'
32
import PreprocessorDirectives from 'unplugin-preprocessor-directives/vite'
3+
import { defineConfig } from 'vite'
44

55
// https://vitejs.dev/config/
66
export default defineConfig({

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,4 +193,4 @@
193193
"vitest": "catalog:vite",
194194
"webpack": "catalog:build"
195195
}
196-
}
196+
}

pnpm-workspace.yaml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,38 @@ packages:
33
- examples/*
44

55
catalogs:
6-
nuxt:
7-
"@nuxt/kit": "^3.9.3"
8-
"@nuxt/schema": "^3.9.3"
9-
106
build:
11-
"@jridgewell/remapping": ^2.3.5
12-
"bumpp": "^9.3.0"
13-
"esno": "^4.0.0"
14-
"nodemon": "^3.0.3"
15-
"rollup": "^4.9.5"
16-
"tsup": "^8.0.1"
17-
"webpack": "^5.89.0"
18-
"typescript": "^5.3.3"
19-
20-
utils:
21-
magic-string: ^0.30.18
22-
unplugin: ^2.3.9
23-
"chalk": "^5.3.0"
24-
"fast-glob": "^3.3.2"
25-
"rimraf": "^5.0.5"
26-
27-
vite:
28-
vite: ^5.0.12
29-
"vitest": "^1.2.1"
30-
vite-plugin-inspect: ^0.8.1
7+
'@jridgewell/remapping': ^2.3.5
8+
bumpp: ^9.3.0
9+
esno: ^4.0.0
10+
nodemon: ^3.0.3
11+
rollup: ^4.9.5
12+
tsup: ^8.0.1
13+
typescript: ^5.3.3
3114

15+
webpack: ^5.89.0
3216
eslint:
33-
"@antfu/eslint-config": ^5.2.1
17+
'@antfu/eslint-config': ^5.2.1
3418
eslint: ^9.34.0
3519
eslint-plugin-antfu: ^3.1.1
3620
eslint-vitest-rule-tester: ^2.2.1
3721
svelte-eslint-parser: ^1.3.1
3822

23+
nuxt:
24+
'@nuxt/kit': ^3.9.3
25+
'@nuxt/schema': ^3.9.3
26+
3927
types:
40-
"@types/node": ^20.11.5
28+
'@types/node': ^20.11.5
29+
utils:
30+
chalk: ^5.3.0
31+
fast-glob: ^3.3.2
32+
magic-string: ^0.30.18
33+
rimraf: ^5.0.5
34+
35+
unplugin: ^2.3.9
36+
vite:
37+
vite: ^5.0.12
38+
vite-plugin-inspect: ^0.8.1
39+
40+
vitest: ^1.2.1

scripts/postbuild.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { basename, dirname, resolve } from 'node:path'
21
import { promises as fs } from 'node:fs'
2+
import { basename, dirname, resolve } from 'node:path'
33
import { fileURLToPath } from 'node:url'
4-
import fg from 'fast-glob'
54
import chalk from 'chalk'
5+
import fg from 'fast-glob'
66

77
async function run() {
88
// fix cjs exports

src/core/context/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import process from 'node:process'
21
import type { Logger } from 'vite'
3-
import { createFilter, createLogger, loadEnv } from 'vite'
4-
import MagicString from 'magic-string'
52
import type { UserOptions } from '../../types'
63
import type { Generate, Lex, ObjectDirective, Parse, Transform } from '../types'
4+
import process from 'node:process'
5+
import MagicString from 'magic-string'
6+
import { createFilter, createLogger, loadEnv } from 'vite'
77
import { Generator } from './generator'
88
import { Lexer } from './lexer'
99
import { Parser } from './parser'

src/core/context/lexer.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
/* eslint-disable no-restricted-syntax */
21
/* eslint-disable no-labels */
3-
import { isComment, parseComment } from '../utils'
42
import type { CodeToken, Lex, SimpleToken } from '../types'
3+
import { isComment, parseComment } from '../utils'
54

65
export class Lexer {
76
current = 0

src/core/directives/define.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
/* eslint-disable curly */
21
/* eslint-disable no-new-func */
2+
import type { DefineStatement, DefineToken } from '../types'
33
import process from 'node:process'
44
import { defineDirective } from '../directive'
5-
import type { DefineStatement, DefineToken } from '../types'
65
import { createProgramNode } from '../utils'
76

87
function resolveDefineNameAndValue(expression: string, env = process.env): [string, boolean] {
@@ -50,8 +49,9 @@ export const theDefineDirective = defineDirective<DefineToken, DefineStatement>(
5049
const [name, value] = resolveDefineNameAndValue(node.value, context.env)
5150
context.env[name] = value
5251
}
53-
else if (node.kind === 'undef')
52+
else if (node.kind === 'undef') {
5453
context.env[node.value] = false
54+
}
5555

5656
return createProgramNode()
5757
}

src/core/directives/if.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import type { IfStatement, IfToken } from '../types'
12
import process from 'node:process'
23
import { defineDirective } from '../directive'
3-
import type { IfStatement, IfToken } from '../types'
44
import { simpleMatchToken } from '../utils'
55

66
export function resolveConditional(test: string, env = process.env) {
@@ -16,7 +16,7 @@ export function resolveConditional(test: string, env = process.env) {
1616
}
1717
catch (error) {
1818
if (error instanceof ReferenceError) {
19-
const match = /(\w*?) is not defined/g.exec(error.message)
19+
const match = /(\w*) is not defined/.exec(error.message)
2020
if (match && match[1]) {
2121
const name = match[1]
2222
// @ts-expect-error ignore

src/core/directives/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export * from './if'
21
export * from './define'
2+
export * from './if'
33
export * from './message'

0 commit comments

Comments
 (0)