Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
MellowCo committed Oct 4, 2024
1 parent 55894b4 commit 078e739
Show file tree
Hide file tree
Showing 43 changed files with 72 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .eslintcache

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Theme, ThemeAnimation } from './theme'
import { definePreset, type PresetOptions } from '@unocss/core'
import { extractorArbitraryVariants } from '@unocss/extractor-arbitrary-variants'
import { cacheTransformEscapESelector, defaultRules } from 'unplugin-transform-class/utils'
Expand All @@ -6,9 +7,8 @@ import { taroCssPxTransform, taroH5CssRemTransform, uniAppVue2CssRpxTransform }
import { rules } from './rules'
import { shorthands } from './shorthands'
import { theme } from './theme'
import { variants } from './variants'

import type { Theme, ThemeAnimation } from './theme'
import { variants } from './variants'

export { colors, theme } from './theme'
export { parseColor } from './utils'
Expand Down
2 changes: 1 addition & 1 deletion src/preflights.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { entriesToCss, toArray } from '@unocss/core'
import type { Preflight, PreflightContext } from '@unocss/core'
import type { Theme } from './theme'
import { entriesToCss, toArray } from '@unocss/core'

const wxPrefix = ['page,root-portal-content,::before,::after']
const taroPrefix = ['*,::before,::after']
Expand Down
4 changes: 2 additions & 2 deletions src/rules/animation.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import type { Rule } from '@unocss/core'
import { globalKeywords, handler as h, makeGlobalStaticRules } from '../utils'
import type { Theme } from '../'
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import { globalKeywords, handler as h, makeGlobalStaticRules } from '../utils'

export const animations: Rule<Theme>[] = [
[/^(?:animate-)?keyframes-(.+)$/, ([, name], { theme }) => {
Expand Down
4 changes: 2 additions & 2 deletions src/rules/background.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { colorOpacityToString, colorToString } from '@unocss/rule-utils'
import type { Rule, RuleContext } from '@unocss/core'
import type { CSSColorValue } from '@unocss/rule-utils'
import { globalKeywords, handler as h, makeGlobalStaticRules, parseColor, positionMap } from '../utils'
import type { Theme } from '../'
import { colorOpacityToString, colorToString } from '@unocss/rule-utils'
import { globalKeywords, handler as h, makeGlobalStaticRules, parseColor, positionMap } from '../utils'

function bgGradientToValue(cssColor: CSSColorValue | undefined) {
if (cssColor)
Expand Down
2 changes: 1 addition & 1 deletion src/rules/behaviors.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { CSSObject, Rule, RuleContext } from '@unocss/core'
import { colorResolver, globalKeywords, handler as h, isCSSMathFn } from '../utils'
import type { Theme } from '../theme'
import { colorResolver, globalKeywords, handler as h, isCSSMathFn } from '../utils'

export const outline: Rule<Theme>[] = [
// size
Expand Down
6 changes: 3 additions & 3 deletions src/rules/border.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { colorOpacityToString, colorToString } from '@unocss/rule-utils'
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import type { CSSEntries, CSSObject, Rule, RuleContext } from '@unocss/core'
import type { CSSColorValue } from '@unocss/rule-utils'
import { cornerMap, directionMap, globalKeywords, handler as h, hasParseableColor, isCSSMathFn, parseColor } from '../utils'
import type { Theme } from '../theme'
import { colorOpacityToString, colorToString } from '@unocss/rule-utils'
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import { cornerMap, directionMap, globalKeywords, handler as h, hasParseableColor, isCSSMathFn, parseColor } from '../utils'

export const borderStyles = ['solid', 'dashed', 'dotted', 'double', 'hidden', 'none', 'groove', 'ridge', 'inset', 'outset', ...globalKeywords]

Expand Down
4 changes: 2 additions & 2 deletions src/rules/color.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import type { Rule } from '@unocss/core'
import { colorResolver, handler as h, isSize } from '../utils'
import type { Theme } from '../theme'
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import { colorResolver, handler as h, isSize } from '../utils'

/**
* @param root0
Expand Down
2 changes: 1 addition & 1 deletion src/rules/container.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { warnOnce } from '@unocss/core'
import type { Rule } from '@unocss/core'
import { warnOnce } from '@unocss/core'

export const containerParent: Rule[] = [
[/^@container(?:\/(\w+))?(?:-(normal))?$/, ([, l, v]) => {
Expand Down
2 changes: 1 addition & 1 deletion src/rules/decoration.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { CSSObject, Rule, RuleContext } from '@unocss/core'
import { colorResolver, globalKeywords, handler as h, isCSSMathFn } from '../utils'
import type { Theme } from '../theme'
import { colorResolver, globalKeywords, handler as h, isCSSMathFn } from '../utils'

const decorationStyles = ['solid', 'double', 'dotted', 'dashed', 'wavy', ...globalKeywords]

Expand Down
2 changes: 1 addition & 1 deletion src/rules/divide.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { CSSEntries, Rule, RuleContext } from '@unocss/core'
import type { Theme } from '../theme'
import { borderStyles } from '../rules/border'
import { colorResolver, directionMap, handler as h } from '../utils'
import type { Theme } from '../theme'

export const divides: Rule[] = [
// divides
Expand Down
2 changes: 1 addition & 1 deletion src/rules/filters.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { CSSValues, Rule, RuleContext } from '@unocss/core'
import type { Theme } from '../theme'
import { colorableShadows, colorResolver, globalKeywords, h } from '../utils'
import { varEmpty } from './constant'
import type { Theme } from '../theme'

export const filterBase = {
'--un-blur': varEmpty,
Expand Down
4 changes: 2 additions & 2 deletions src/rules/flex.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import type { Rule } from '@unocss/core'
import { handler as h } from '../utils'
import type { Theme } from '../theme'
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import { handler as h } from '../utils'

export const flex: Rule<Theme>[] = [
// display
Expand Down
2 changes: 1 addition & 1 deletion src/rules/gap.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Rule, RuleContext } from '@unocss/core'
import { handler as h } from '../utils'
import type { Theme } from '../theme'
import { handler as h } from '../utils'

const directions: Record<string, string> = {
'': '',
Expand Down
2 changes: 1 addition & 1 deletion src/rules/grid.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Rule } from '@unocss/core'
import { handler as h } from '../utils'
import type { Theme } from '../theme'
import { handler as h } from '../utils'

const rowCol = (s: string) => s.replace('col', 'column')
const rowColTheme = (s: string) => s[0] === 'r' ? 'Row' : 'Column'
Expand Down
4 changes: 2 additions & 2 deletions src/rules/position.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import type { CSSEntries, Rule, RuleContext, StaticRule } from '@unocss/core'
import { globalKeywords, handler as h, insetMap, makeGlobalStaticRules } from '../utils'
import type { Theme } from '../theme'
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import { globalKeywords, handler as h, insetMap, makeGlobalStaticRules } from '../utils'

export const positions: Rule[] = [
[/^(?:position-|pos-)?(relative|absolute|fixed|sticky)$/, ([, v]) => ({ position: v }), {
Expand Down
2 changes: 1 addition & 1 deletion src/rules/ring.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { CSSObject, Rule, RuleContext } from '@unocss/core'
import type { Theme } from '../theme'
import { colorResolver, handler as h, isCSSMathFn } from '../utils'
import { varEmpty } from './constant'
import type { Theme } from '../theme'

export const ringBase = {
'--un-ring-inset': varEmpty,
Expand Down
4 changes: 2 additions & 2 deletions src/rules/shadow.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import type { Rule } from '@unocss/core'
import type { Theme } from '../theme'
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import { colorableShadows, colorResolver, handler as h, hasParseableColor } from '../utils'
import { varEmpty } from './constant'
import type { Theme } from '../theme'

export const boxShadowsBase = {
'--un-ring-offset-shadow': '0 0 rgb(0 0 0 / 0)',
Expand Down
4 changes: 2 additions & 2 deletions src/rules/size.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import type { Rule, RuleContext } from '@unocss/core'
import { handler as h, resolveBreakpoints } from '../utils'
import type { Theme } from '../theme'
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import { handler as h, resolveBreakpoints } from '../utils'

const sizeMapping: Record<string, string> = {
h: 'height',
Expand Down
2 changes: 1 addition & 1 deletion src/rules/spacing.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { CSSEntries, Rule, RuleContext } from '@unocss/core'
import { directionMap, directionSize, handler as h } from '../utils'
import type { Theme } from '../theme'
import { directionMap, directionSize, handler as h } from '../utils'

export const paddings: Rule[] = [
[/^pa?()-?(.+)$/, directionSize('padding'), { autocomplete: ['(m|p)<num>', '(m|p)-<num>'] }],
Expand Down
4 changes: 2 additions & 2 deletions src/rules/static.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import type { Rule } from '@unocss/core'
import { globalKeywords, handler as h, makeGlobalStaticRules, positionMap } from '../utils'
import type { Theme } from '../theme'
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import { globalKeywords, handler as h, makeGlobalStaticRules, positionMap } from '../utils'

const cursorValues = ['auto', 'default', 'none', 'context-menu', 'help', 'pointer', 'progress', 'wait', 'cell', 'crosshair', 'text', 'vertical-text', 'alias', 'copy', 'move', 'no-drop', 'not-allowed', 'grab', 'grabbing', 'all-scroll', 'col-resize', 'row-resize', 'n-resize', 'e-resize', 's-resize', 'w-resize', 'ne-resize', 'nw-resize', 'se-resize', 'sw-resize', 'ew-resize', 'ns-resize', 'nesw-resize', 'nwse-resize', 'zoom-in', 'zoom-out']
const containValues = ['none', 'strict', 'content', 'size', 'inline-size', 'layout', 'style', 'paint']
Expand Down
4 changes: 2 additions & 2 deletions src/rules/svg.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import type { CSSObject, Rule, RuleContext } from '@unocss/core'
import { colorResolver, handler as h, isCSSMathFn } from '../utils'
import type { Theme } from '../theme'
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import { colorResolver, handler as h, isCSSMathFn } from '../utils'

export const svgUtilities: Rule<Theme>[] = [
// fills
Expand Down
4 changes: 2 additions & 2 deletions src/rules/transform.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import type { CSSValues, Rule, RuleContext } from '@unocss/core'
import { handler as h, makeGlobalStaticRules, positionMap, transformXYZ } from '../utils'
import type { Theme } from '../theme'
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import { handler as h, makeGlobalStaticRules, positionMap, transformXYZ } from '../utils'

const transformValues = [
'translate',
Expand Down
2 changes: 1 addition & 1 deletion src/rules/transition.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Rule } from '@unocss/core'
import { globalKeywords, h, makeGlobalStaticRules } from '../utils'
import type { Theme } from '../theme'
import { globalKeywords, h, makeGlobalStaticRules } from '../utils'

function resolveTransitionProperty(prop: string, theme: Theme): string | undefined {
let p: string | undefined
Expand Down
4 changes: 2 additions & 2 deletions src/rules/typography.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { CSSObject, Rule, RuleContext } from '@unocss/core'
import type { Theme } from '../theme'
import { toArray } from '@unocss/core'
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import type { CSSObject, Rule, RuleContext } from '@unocss/core'
import { colorableShadows, colorResolver, globalKeywords, handler as h, isCSSMathFn, splitShorthand } from '../utils'
import type { Theme } from '../theme'

export const fonts: Rule<Theme>[] = [
// size
Expand Down
2 changes: 1 addition & 1 deletion src/theme/default.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Theme } from './types'
import { animation } from './animation'
import { aria } from './aria'
import { colors } from './colors'
Expand All @@ -7,7 +8,6 @@ import { borderRadius, boxShadow, breakpoints, duration, lineWidth, media, ringW
import { preflightBase } from './preflight'
import { containers, height, maxHeight, maxWidth, width } from './size'
import { easing, transitionProperty } from './transition'
import type { Theme } from './types'

export const theme: Theme = {
width,
Expand Down
4 changes: 2 additions & 2 deletions src/transformer/transformerAttributify/transformer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createFilter } from '@rollup/pluginutils'
import { extractorAttributify } from 'unplugin-attributify-to-class/utils'
import type { SourceCodeTransformer } from '@unocss/core'
import type { Options } from 'unplugin-attributify-to-class/types'
import { createFilter } from '@rollup/pluginutils'
import { extractorAttributify } from 'unplugin-attributify-to-class/utils'

export default function (options: Options = {}): SourceCodeTransformer {
const idFilter = createFilter(
Expand Down
4 changes: 2 additions & 2 deletions src/transformer/transformerClass/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createFilter } from '@rollup/pluginutils'
import { getClass, transformCode } from 'unplugin-transform-class/utils'
import type { FilterPattern } from '@rollup/pluginutils'
import type { SourceCodeTransformer } from '@unocss/core'
import { createFilter } from '@rollup/pluginutils'
import { getClass, transformCode } from 'unplugin-transform-class/utils'

interface Options {
/**
Expand Down
8 changes: 4 additions & 4 deletions src/utils/utilities.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { CSSEntries, CSSObject, DynamicMatcher, RuleContext, StaticRule, VariantContext } from '@unocss/core'
import type { ParsedColorValue } from '@unocss/rule-utils'
import type { Theme } from '../theme'
import { toArray } from '@unocss/core'
import { colorOpacityToString, colorToString, getStringComponent, getStringComponents, parseCssColor } from '@unocss/rule-utils'
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import type { CSSEntries, CSSObject, DynamicMatcher, RuleContext, StaticRule, VariantContext } from '@unocss/core'
import type { ParsedColorValue } from '@unocss/rule-utils'
import { handler as h } from './handlers'

import { handler as h } from './handlers'
import { bracketTypeRe, numberWithUnitRE, splitComma } from './handlers/regex'
import { cssMathFnRE, cssVarFnRE, directionMap, globalKeywords, xyzArray, xyzMap } from './mappings'
import type { Theme } from '../theme'

export const CONTROL_MINI_NO_NEGATIVE = '$$mini-no-negative'

Expand Down
2 changes: 1 addition & 1 deletion src/utils/variants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { VariantHandlerContext, VariantObject } from '@unocss/core'
import { escapeRegExp } from '@unocss/core'
import { cacheRestoreSelector, defaultRules } from 'unplugin-transform-class/utils'
import type { VariantHandlerContext, VariantObject } from '@unocss/core'

export function variantMatcher(name: string, handler: (input: VariantHandlerContext) => Record<string, any>, transformRules: Record<string, string> = defaultRules): VariantObject {
let re: RegExp
Expand Down
4 changes: 2 additions & 2 deletions src/variants/aria.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { variantGetParameter } from '@unocss/rule-utils'
import type { Variant, VariantContext, VariantObject } from '@unocss/core'
import { h } from '../utils'
import type { Theme } from '../theme'
import { variantGetParameter } from '@unocss/rule-utils'
import { h } from '../utils'

export const variantAria: VariantObject = {
name: 'aria',
Expand Down
2 changes: 1 addition & 1 deletion src/variants/combinators.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { variantGetBracket } from '@unocss/rule-utils'
import type { Variant, VariantObject } from '@unocss/core'
import { variantGetBracket } from '@unocss/rule-utils'
import { h } from '../utils'

function scopeMatcher(name: string, combinator: string): VariantObject {
Expand Down
4 changes: 2 additions & 2 deletions src/variants/container.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { VariantContext, VariantObject } from '@unocss/core'
import type { Theme } from '../theme'
import { warnOnce } from '@unocss/core'
import { variantGetParameter } from '@unocss/rule-utils'
import type { VariantContext, VariantObject } from '@unocss/core'
import { h } from '../utils'
import type { Theme } from '../theme'

export const variantContainerQuery: VariantObject = {
name: '@',
Expand Down
2 changes: 1 addition & 1 deletion src/variants/dark.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Variant } from '@unocss/core'
import { variantMatcher, variantParentMatcher } from '../utils'
import type { PresetWeappOptions } from '..'
import { variantMatcher, variantParentMatcher } from '../utils'

export function variantColorsMediaOrClass(options: PresetWeappOptions = {}): Variant[] {
const { transformRules } = options
Expand Down
4 changes: 2 additions & 2 deletions src/variants/data.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { variantGetParameter } from '@unocss/rule-utils'
import type { Variant, VariantContext, VariantObject } from '@unocss/core'
import { h } from '../utils'
import type { Theme } from '../theme'
import { variantGetParameter } from '@unocss/rule-utils'
import { h } from '../utils'

export const variantDataAttribute: VariantObject = {
name: 'data',
Expand Down
4 changes: 2 additions & 2 deletions src/variants/default.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import type { Variant } from '@unocss/core'
import type { PresetWeappOptions } from '..'
import type { Theme } from '../theme'
import { variantAria, variantTaggedAriaAttributes } from './aria'
import { variantBreakpoints } from './breakpoints'
import { variantChildren } from './children'
Expand All @@ -14,8 +16,6 @@ import { variantNegative } from './negative'
import { variantPartClasses, variantPseudoClassesAndElements, variantPseudoClassFunctions, variantTaggedPseudoClasses } from './pseudo'
import { variantStartingStyle } from './startingstyle'
import { variantSupports } from './supports'
import type { PresetWeappOptions } from '..'
import type { Theme } from '../theme'

export function variants(options: PresetWeappOptions): Variant<Theme>[] {
return [
Expand Down
2 changes: 1 addition & 1 deletion src/variants/important.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import type { VariantObject } from '@unocss/core'
import type { Theme } from '../theme'
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'

export function variantImportant(): VariantObject<Theme> {
let re: RegExp
Expand Down
4 changes: 2 additions & 2 deletions src/variants/media.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { variantGetParameter } from '@unocss/rule-utils'
import type { VariantContext, VariantObject } from '@unocss/core'
import { h, variantParentMatcher } from '../utils'
import type { Theme } from '../theme'
import { variantGetParameter } from '@unocss/rule-utils'
import { h, variantParentMatcher } from '../utils'

export const variantPrint: VariantObject = variantParentMatcher('print', '@media print')

Expand Down
4 changes: 2 additions & 2 deletions src/variants/misc.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Variant } from '@unocss/core'
import type { Theme } from '../theme'
import { getBracket, hasThemeFn, transformThemeFn, variantGetBracket, variantGetParameter } from '@unocss/rule-utils'
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import type { Variant } from '@unocss/core'
import { h } from '../utils'
import type { Theme } from '../theme'

export const variantSelector: Variant = {
name: 'selector',
Expand Down
2 changes: 1 addition & 1 deletion src/variants/negative.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getStringComponent } from '@unocss/rule-utils'
import type { Variant } from '@unocss/core'
import { getStringComponent } from '@unocss/rule-utils'
import { CONTROL_MINI_NO_NEGATIVE, cssMathFnRE, cssVarFnRE } from '../utils'

const anchoredNumberRE = /^-?[0-9.]+(?:[a-z]+|%)?$/
Expand Down
Loading

0 comments on commit 078e739

Please sign in to comment.