Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Sep 10, 2024
1 parent aa5e039 commit 473220b
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 33 deletions.
8 changes: 4 additions & 4 deletions playground/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/// <reference types="vitest" />

import path from 'node:path'
import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite'
import AutoImport from 'unplugin-auto-import/vite'
import UnoCSS from 'unocss/vite'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import VueMacros from 'unplugin-vue-macros/vite'
import VueRouter from 'unplugin-vue-router/vite'
import { VueRouterAutoImports } from 'unplugin-vue-router'
import VueRouter from 'unplugin-vue-router/vite'
import { defineConfig } from 'vite'

export default defineConfig({
resolve: {
Expand Down
2 changes: 1 addition & 1 deletion scripts/bump.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'node:fs/promises'
import process from 'node:process'
import Git from 'simple-git'
import semver from 'semver'
import Git from 'simple-git'

const git = Git()

Expand Down
4 changes: 2 additions & 2 deletions scripts/grammars/cleanup-cli.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { fileURLToPath } from 'node:url'
import { basename } from 'node:path'
import { promises as fs } from 'node:fs'
import { basename } from 'node:path'
import process from 'node:process'
import { fileURLToPath } from 'node:url'
import fg from 'fast-glob'
import stringify from 'json-stable-stringify'
import { cleanupGrammar } from './cleanup'
Expand Down
8 changes: 6 additions & 2 deletions scripts/grammars/detect-cli.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { fileURLToPath } from 'node:url'
import fs from 'node:fs/promises'
import { basename } from 'node:path'
import { fileURLToPath } from 'node:url'
import fg from 'fast-glob'
import { FEATURES_POLYFILLABLE, FEATURES_SUPPORTED_BY_JS, detectRegexFeatures } from 'oniguruma-to-js/detect'
import {
detectRegexFeatures,
FEATURES_POLYFILLABLE,
FEATURES_SUPPORTED_BY_JS,
} from 'oniguruma-to-js/detect'

export function getPatterns(grammar: any) {
const patterns = new Set<string>()
Expand Down
14 changes: 7 additions & 7 deletions scripts/grammars/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import fs from 'node:fs/promises'
import process from 'node:process'
import { fetch } from 'ofetch'
import pLimit from 'p-limit'
import c from 'chalk'
import stringify from 'json-stable-stringify'
import type { GrammarInfo } from '../../packages/tm-grammars/index'
import { downloadFromMarketplace } from '../shared/marketplace'
import { fetch } from 'ofetch'
import pLimit from 'p-limit'
import { sources } from '../../sources-grammars'
import { parseGitHubUrl, resolveSourceGitHub } from '../shared/github'
import { COMMENT_HEAD } from '../shared/head'
import { generateLicense } from '../shared/license'
import { downloadFromMarketplace } from '../shared/marketplace'
import { parseFile } from '../shared/parse'
import { sources } from '../../sources-grammars'

import { fileSizeToHuman } from '../shared/utils'
import { COMMENT_HEAD } from '../shared/head'
import type { GrammarSource } from './types'
import { cleanupGrammar } from './cleanup'
import type { GrammarInfo } from '../../packages/tm-grammars/index'
import type { GrammarSource } from './types'

const badge = c.magenta.bold(' grammar ')

Expand Down
2 changes: 1 addition & 1 deletion scripts/shared/github.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { octokit } from './octokit'
import type { GrammarInfo } from '../../packages/tm-grammars/index'
import type { ThemeInfo } from '../../packages/tm-themes/index'
import type { GrammarSource } from '../grammars/types'
import type { ThemeSource } from '../themes/types'
import { octokit } from './octokit'

interface CommitInfo {
sha: string
Expand Down
4 changes: 2 additions & 2 deletions scripts/shared/license.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pLimit from 'p-limit'
import { fetch } from 'ofetch'
import c from 'chalk'
import { fetch } from 'ofetch'
import pLimit from 'p-limit'
import type { GrammarInfo } from '../../packages/tm-grammars/index'
import type { ThemeInfo } from '../../packages/tm-themes/index'

Expand Down
2 changes: 1 addition & 1 deletion scripts/shared/marketplace.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Buffer } from 'node:buffer'
import { $fetch } from 'ofetch'
import AdmZip from 'adm-zip'
import { $fetch } from 'ofetch'

const cache = new Map<string, ReturnType<typeof _downloadFromMarketplace>>()

Expand Down
2 changes: 1 addition & 1 deletion scripts/shared/octokit.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dotenv/config'
import process from 'node:process'
import { Octokit } from 'octokit'
import 'dotenv/config'

if (!process.env.GITHUB_TOKEN)
throw new Error('GITHUB_TOKEN is required. Get one from https://github.com/settings/tokens, with Fine-grained personal access tokens, the default public repo permissions are enough.')
Expand Down
6 changes: 3 additions & 3 deletions scripts/shared/parse.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { ParseError } from 'jsonc-parser'
import { parse as jsoncParse } from 'jsonc-parser'
import { parse as parsePlist } from 'fast-plist'
import CSON from 'cson'
import { parse as parsePlist } from 'fast-plist'
import YAML from 'js-yaml'
import { parse as jsoncParse } from 'jsonc-parser'
import type { ParseError } from 'jsonc-parser'

export function parseJsonc(jsonc: string) {
const errors: ParseError[] = []
Expand Down
14 changes: 7 additions & 7 deletions scripts/themes/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import fs from 'node:fs/promises'
import process from 'node:process'
import pLimit from 'p-limit'
import stringify from 'json-stable-stringify'
import c from 'chalk'
import stringify from 'json-stable-stringify'
import pLimit from 'p-limit'
import { sources } from '../../sources-themes'
import { parseGitHubUrl, resolveSourceGitHub } from '../shared/github'
import { COMMENT_HEAD } from '../shared/head'
import { generateLicense } from '../shared/license'
import { downloadFromMarketplace } from '../shared/marketplace'
import { parseFile } from '../shared/parse'
import type { ThemeInfo } from '../../packages/tm-themes/index'
import { generateLicense } from '../shared/license'
import { sources } from '../../sources-themes'
import { fileSizeToHuman } from '../shared/utils'
import { COMMENT_HEAD } from '../shared/head'
import type { ThemeSource } from './types'
import { cleanupTheme } from './cleanup'
import type { ThemeInfo } from '../../packages/tm-themes/index'
import type { ThemeSource } from './types'

const badge = c.cyan.bold(' theme ')

Expand Down
4 changes: 2 additions & 2 deletions test/snapshot.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { fileURLToPath } from 'node:url'
import fs from 'node:fs/promises'
import { join } from 'node:path'
import { expect, it } from 'vitest'
import { fileURLToPath } from 'node:url'
import { createHighlighterCore } from '@shikijs/core'
import { expect, it } from 'vitest'
import { grammars } from '../packages/tm-grammars/index'
import theme from '../packages/tm-themes/themes/vitesse-black.json'

Expand Down

0 comments on commit 473220b

Please sign in to comment.