Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Dec 21, 2021
1 parent e7009e0 commit a9a6ffa
Show file tree
Hide file tree
Showing 16 changed files with 31 additions and 24 deletions.
3 changes: 2 additions & 1 deletion packages/config/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import fs from 'fs'
import path from 'path'
import _debug from 'debug'
import _jiti, { JITI } from 'jiti'
import type { JITI } from 'jiti'
import _jiti from 'jiti'
import type { FullConfig as WindiCssOptions } from 'windicss/types/interfaces'

let jiti: JITI
Expand Down
9 changes: 5 additions & 4 deletions packages/plugin-utils/src/createUtils.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import fs from 'fs'
import { StyleSheet, Style } from 'windicss/utils/style'
import type { Style } from 'windicss/utils/style'
import { StyleSheet } from 'windicss/utils/style'
import { CSSParser } from 'windicss/utils/parser'
import { generateCompletions } from 'windicss/utils'
import { createSingletonPromise } from '@antfu/utils'
import fg from 'fast-glob'
import _debug from 'debug'
import micromatch from 'micromatch'
import Processor from 'windicss'
import { preflightTags, htmlTags } from './constants'
import { WindiPluginUtilsOptions, UserOptions, ResolvedOptions } from './options'
import { htmlTags, preflightTags } from './constants'
import type { ResolvedOptions, UserOptions, WindiPluginUtilsOptions } from './options'
import { resolveOptions } from './resolveOptions'
import { kebabCase, include, exclude, slash, partition } from './utils'
import { exclude, include, kebabCase, partition, slash } from './utils'
import { buildAliasTransformer, transformGroups } from './transforms'
import { applyExtractors as _applyExtractors } from './extractors/helper'
import { regexClassSplitter } from './regexes'
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-utils/src/defineConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FullConfig } from 'windicss/types/interfaces'
import type { FullConfig } from 'windicss/types/interfaces'

export function defineConfig(config: FullConfig) {
return config
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-utils/src/extractors/default.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ExtractorResultDetailed } from 'windicss/types/interfaces'
import { regexClassSplitter, validClassName, regexHtmlTag, regexAttributifyItem } from '../regexes'
import { regexAttributifyItem, regexClassSplitter, regexHtmlTag, validClassName } from '../regexes'

export function DefaultExtractor(code: string, id?: string): ExtractorResultDetailed {
if (id?.endsWith('.css') || id?.endsWith('.postcss')) {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-utils/src/extractors/helper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { extname } from 'path'
import { Extractor } from 'windicss/types/interfaces'
import type { Extractor } from 'windicss/types/interfaces'
import { DefaultExtractor } from './default'
import { PugExtractor } from './pug'
import { SvelteExtractor } from './svelte'
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-utils/src/extractors/pug.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ExtractorResultDetailed } from 'windicss/types/interfaces'
import type { ExtractorResultDetailed } from 'windicss/types/interfaces'
import { DefaultExtractor } from '../extractors/default'

const regexTemplate = /<template.*?lang=['"]pug['"][^>]*?>\n([\s\S]*?\n)<\/template>/gm
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-utils/src/merge.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FullConfig } from 'windicss/types/interfaces'
import type { FullConfig } from 'windicss/types/interfaces'

const isObject = (val: any) => toString.call(val) === '[object Object]'

Expand Down
5 changes: 3 additions & 2 deletions packages/plugin-utils/src/resolveOptions.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import path from 'path'
import _debug from 'debug'
import { loadConfiguration } from '@windicss/config'
import type { UserOptions, ResolvedOptions, WindiCssOptions, WindiPluginUtilsOptions } from './options'
import type { ResolvedOptions, UserOptions, WindiCssOptions, WindiPluginUtilsOptions } from './options'
import { defaultAlias } from './constants'
import { Arrayable, kebabCase, mergeArrays, slash, toArray } from './utils'
import type { Arrayable } from './utils'
import { kebabCase, mergeArrays, slash, toArray } from './utils'
import { getDefaultExtractors } from './extractors/helper'

export * from '@windicss/config'
Expand Down
5 changes: 3 additions & 2 deletions packages/rollup-plugin-windicss/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Plugin } from 'rollup'
import type { Plugin } from 'rollup'
import _debug from 'debug'
import { createUtils, UserOptions } from '@windicss/plugin-utils'
import type { UserOptions } from '@windicss/plugin-utils'
import { createUtils } from '@windicss/plugin-utils'
import { createVirtualModuleLoader } from '../../shared/virtual-module'

const NAME = 'rollup-plugin-windicss'
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/virtual-module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { promises as fs, existsSync } from 'fs'
import { LayerName, WindiPluginUtils } from '@windicss/plugin-utils'
import { existsSync, promises as fs } from 'fs'
import type { LayerName, WindiPluginUtils } from '@windicss/plugin-utils'
import type { Plugin } from 'rollup'

export const MODULE_IDS = [/^virtual:windi(.*?)\.css/, /^windi(.*?)\.css/]
Expand Down
5 changes: 3 additions & 2 deletions packages/vite-plugin-windicss/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { resolve } from 'path'
import type { Plugin, ResolvedConfig, ViteDevServer } from 'vite'
import _debug, { log } from 'debug'
import { UserOptions, WindiPluginUtils, createUtils, WindiPluginUtilsOptions } from '@windicss/plugin-utils'
import { createVirtualModuleLoader, MODULE_ID_VIRTUAL_PREFIX } from '../../shared/virtual-module'
import type { UserOptions, WindiPluginUtils, WindiPluginUtilsOptions } from '@windicss/plugin-utils'
import { createUtils } from '@windicss/plugin-utils'
import { MODULE_ID_VIRTUAL_PREFIX, createVirtualModuleLoader } from '../../shared/virtual-module'
import { createDevtoolsPlugin } from './devtools'
import { NAME } from './constants'
import { getCssModules, reloadChangedCssModules } from './modules'
Expand Down
2 changes: 1 addition & 1 deletion packages/vite-plugin-windicss/src/log.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { dim, bold, blue } from 'kolorist'
import { blue, bold, dim } from 'kolorist'

export function log(msg: string) {
console.log(
Expand Down
4 changes: 2 additions & 2 deletions packages/vite-plugin-windicss/src/modules.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { WindiPluginUtils } from '@windicss/plugin-utils'
import { ModuleNode, ViteDevServer, Update } from 'vite'
import type { WindiPluginUtils } from '@windicss/plugin-utils'
import type { ModuleNode, Update, ViteDevServer } from 'vite'
import { MODULE_ID_VIRTUAL_MODULES, MODULE_ID_VIRTUAL_PREFIX } from '../../shared/virtual-module'

export function getChangedModuleNames(utils: WindiPluginUtils) {
Expand Down
3 changes: 2 additions & 1 deletion test/cases.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createUtils, WindiPluginUtils } from '../packages/plugin-utils/src'
import type { WindiPluginUtils } from '../packages/plugin-utils/src'
import { createUtils } from '../packages/plugin-utils/src'

describe('cases', () => {
let utils: WindiPluginUtils
Expand Down
2 changes: 1 addition & 1 deletion test/extract.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SvelteExtractor, DefaultExtractor } from '../packages/plugin-utils/src/extractors'
import { DefaultExtractor, SvelteExtractor } from '../packages/plugin-utils/src/extractors'

describe('extract', () => {
// #162, #193
Expand Down
3 changes: 2 additions & 1 deletion test/hooks.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createUtils, ResolvedOptions } from '../packages/plugin-utils/src'
import type { ResolvedOptions } from '../packages/plugin-utils/src'
import { createUtils } from '../packages/plugin-utils/src'

describe('config hooks', () => {
it('work onOptionsResolved', async() => {
Expand Down

0 comments on commit a9a6ffa

Please sign in to comment.