Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
MellowCo committed Sep 7, 2024
1 parent 49981cc commit 7fe6ec0
Show file tree
Hide file tree
Showing 58 changed files with 147 additions and 146 deletions.
2 changes: 1 addition & 1 deletion .eslintcache

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions OLD_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ yarn add -D unocss @unocss/webpack@0.45.8 unplugin-transform-class unocss-preset
// 请使用 @unocss/webpack 0.45.8
// 0.45.8 之前和之后版本 会出现无法及时生成`css`代码,导致打包时没有`css`代码
const UnoCSS = require('@unocss/webpack').default
const transformWeClass = require('unplugin-transform-class/webpack')
const { defaultAttributes, defaultIgnoreNonValuedAttributes, presetAttributifyWechat } = require('unplugin-attributify-to-class/webpack')
const transformWeClass = require('unplugin-transform-class/webpack')

module.exports = {
configureWebpack: {
Expand All @@ -103,8 +103,8 @@ module.exports = {
* [h5兼容说明](https://github.com/MellowCo/unocss-preset-weapp#h5%E5%85%BC%E5%AE%B9)

```js
import presetWeapp from 'unocss-preset-weapp'
import { defineConfig } from 'unocss'
import presetWeapp from 'unocss-preset-weapp'

export default defineConfig({
presets: [
Expand Down Expand Up @@ -167,8 +167,8 @@ yarn add -D unocss unocss-webpack-uniapp2 unplugin-transform-class unocss-preset
// 解决 App平台 v3 模式暂不支持在 js 文件中引用"uno.css" 请改在 style 内引用
const UnoCSS = require('unocss-webpack-uniapp2').default

const transformWeClass = require('unplugin-transform-class/webpack')
const { defaultAttributes, defaultIgnoreNonValuedAttributes, presetAttributifyWechat } = require('unplugin-attributify-to-class/webpack')
const transformWeClass = require('unplugin-transform-class/webpack')

module.exports = {
configureWebpack: {
Expand All @@ -192,8 +192,8 @@ module.exports = {
* [h5兼容说明](https://github.com/MellowCo/unocss-preset-weapp#h5%E5%85%BC%E5%AE%B9)

```js
import presetWeapp from 'unocss-preset-weapp'
import { defineConfig } from 'unocss'
import presetWeapp from 'unocss-preset-weapp'

export default defineConfig({
presets: [
Expand Down Expand Up @@ -292,8 +292,8 @@ yarn add -D unocss @unocss/webpack@0.45.8 unplugin-transform-class unocss-preset
```js
// 导入unocss
import UnoCSS from 'unocss/webpack'
import transformWeClass from 'unplugin-transform-class/webpack'
import { defaultAttributes, defaultIgnoreNonValuedAttributes, presetAttributifyWechat } from 'unplugin-attributify-to-class/webpack'
import transformWeClass from 'unplugin-transform-class/webpack'

const config = {
mini: {
Expand Down Expand Up @@ -486,11 +486,11 @@ pnpm add -D unocss unplugin-transform-class unocss-preset-weapp unplugin-attribu
* vite.config.ts

```ts
import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import Unocss from 'unocss/vite'
import transformWeClass from 'unplugin-transform-class/vite'
import { presetAttributifyWechat } from 'unplugin-attributify-to-class/vite'
import transformWeClass from 'unplugin-transform-class/vite'
import { defineConfig } from 'vite'

// https://vitejs.dev/config/
export default defineConfig({
Expand Down Expand Up @@ -523,8 +523,8 @@ export default defineConfig({
* unocss.config.ts
> 添加unocss.config.js文件,搭配 [unocss vscode](https://marketplace.visualstudio.com/items?itemName=antfu.unocss) 插件,智能提示
```ts
import presetWeapp from 'unocss-preset-weapp'
import { defineConfig } from 'unocss'
import presetWeapp from 'unocss-preset-weapp'

export default defineConfig({
presets: [
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ export default {

* unocss.config.js
```ts
import { defineConfig } from 'unocss'
import presetWeapp from 'unocss-preset-weapp'
import { defaultRules, extractorAttributify, transformerClass } from 'unocss-preset-weapp/transformer'
import { defineConfig } from 'unocss'

const transformRules = {
...defaultRules,
Expand Down Expand Up @@ -255,9 +255,9 @@ export default defineConfig({
> `presetWeapp` 配置 `prefix`, `transformerAttributify` 配置 `classPrefix`
```ts
import { defineConfig } from 'unocss'
import presetWeapp from 'unocss-preset-weapp'
import { extractorAttributify, transformerClass } from 'unocss-preset-weapp/transformer'
import { defineConfig } from 'unocss'

const prefix = 'li-'

Expand Down Expand Up @@ -343,8 +343,8 @@ Unocss({
* unocss.config.js 自定义动画

```js
import presetWeapp from 'unocss-preset-weapp'
import { defineConfig } from 'unocss'
import presetWeapp from 'unocss-preset-weapp'

export default defineConfig({
presets: [
Expand Down
2 changes: 1 addition & 1 deletion build.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineBuildConfig } from 'unbuild'
import { isWindows } from 'std-env'
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
entries: [
Expand Down
14 changes: 7 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { type PresetOptions, definePreset } from '@unocss/core'
import { cacheTransformEscapESelector, defaultRules } from 'unplugin-transform-class/utils'
import { definePreset, type PresetOptions } from '@unocss/core'
import { extractorArbitraryVariants } from '@unocss/extractor-arbitrary-variants'
import { cacheTransformEscapESelector, defaultRules } from 'unplugin-transform-class/utils'
import preflights from './preflights'
import { taroCssPxTransform, taroH5CssRemTransform, uniAppVue2CssRpxTransform } from './rpxTranform'
import { rules } from './rules'
import type { Theme, ThemeAnimation } from './theme'
import { shorthands } from './shorthands'
import { theme } from './theme'
import { variants } from './variants'
import { shorthands } from './shorthands'

import { taroCssPxTransform, taroH5CssRemTransform, uniAppVue2CssRpxTransform } from './rpxTranform'
import type { Theme, ThemeAnimation } from './theme'

export { theme, colors } from './theme'
export { colors, theme } from './theme'
export { parseColor } from './utils'

// support custom shadow color
export type { ThemeAnimation, Theme }
export type { Theme, ThemeAnimation }

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

const wxPrefix = ['page,root-portal-content,::before,::after']
Expand Down
2 changes: 1 addition & 1 deletion src/rules/align.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Rule } from '@unocss/core'
import { globalKeywords } from '../utils/mappings'
import { h } from '../utils/handlers'
import { globalKeywords } from '../utils/mappings'

const verticalAlignAlias: Record<string, string> = {
'mid': 'middle',
Expand Down
2 changes: 1 addition & 1 deletion src/rules/animation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Rule } from '@unocss/core'
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 '../'

Expand Down
2 changes: 1 addition & 1 deletion src/rules/background.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { colorOpacityToString, colorToString } from '@unocss/rule-utils'
import type { Rule, RuleContext } from '@unocss/core'
import type { CSSColorValue } from '@unocss/rule-utils'
import { colorOpacityToString, colorToString } from '@unocss/rule-utils'
import { globalKeywords, handler as h, makeGlobalStaticRules, parseColor, positionMap } from '../utils'
import type { Theme } from '../'

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 type { Theme } from '../theme'
import { colorResolver, globalKeywords, handler as h, isCSSMathFn } from '../utils'
import type { Theme } from '../theme'

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 type { CSSEntries, CSSObject, Rule, RuleContext } from '@unocss/core'
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 { colorOpacityToString, colorToString } from '@unocss/rule-utils'
import type { Theme } from '../theme'
import { cornerMap, directionMap, globalKeywords, handler as h, hasParseableColor, isCSSMathFn, parseColor } from '../utils'
import type { Theme } from '../theme'

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

Expand Down
2 changes: 1 addition & 1 deletion src/rules/color.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Rule } from '@unocss/core'
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'

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 type { Rule } from '@unocss/core'
import { warnOnce } from '@unocss/core'
import type { Rule } 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 type { Theme } from '../theme'
import { colorResolver, globalKeywords, handler as h, isCSSMathFn } from '../utils'
import type { Theme } from '../theme'

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

Expand Down
30 changes: 15 additions & 15 deletions src/rules/default.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
import type { Rule } from '@unocss/core'
import { transitions } from './transition'
import { borders } from './border'
import { textAligns, verticalAligns } from './align'
import { animations } from './animation'

import { backgroundStyles } from './background'
import { appearance, outline, willChange } from './behaviors'
import { borders } from './border'
import { bgColors, colorScheme, opacity } from './color'
import { containerParent } from './container'
import { textDecorations } from './decoration'
import { divides } from './divide'
import { filters } from './filters'
import { flex } from './flex'
import { fonts, tabSizes, textIndents, textShadows, textStrokes } from './typography'
import { gaps } from './gap'
import { grids } from './grid'
import { overflows } from './layout'
import { lineClamps } from './line-clamp'
import { alignments, boxSizing, flexGridJustifiesAlignments, floats, insets, justifies, orders, placements, positions, zIndexes } from './position'
import { rings } from './ring'
import { safeArea } from './safe-area'
import { boxShadows } from './shadow'
import { aspectRatio, sizes } from './size'
import { margins, paddings, spaces } from './spacing'
import { appearances, backgroundBlendModes, breaks, contains, contentVisibility, contents, cursors, displays, dynamicViewportHeight, fontSmoothings, fontStyles, hyphens, isolations, mixBlendModes, objectPositions, pointerEvents, resizes, screenReadersAccess, textOverflows, textTransforms, textWraps, userSelects, whitespaces, writingModes, writingOrientations } from './static'
import { appearances, backgroundBlendModes, breaks, contains, contents, contentVisibility, cursors, displays, dynamicViewportHeight, fontSmoothings, fontStyles, hyphens, isolations, mixBlendModes, objectPositions, pointerEvents, resizes, screenReadersAccess, textOverflows, textTransforms, textWraps, userSelects, whitespaces, writingModes, writingOrientations } from './static'
import { svgUtilities } from './svg'
import { transforms } from './transform'
import { transitions } from './transition'
import { fonts, tabSizes, textIndents, textShadows, textStrokes } from './typography'
import { cssProperty, cssVariables } from './variables'
import { textAligns, verticalAligns } from './align'
import { appearance, outline, willChange } from './behaviors'
import { textDecorations } from './decoration'
import { svgUtilities } from './svg'
import { safeArea } from './safe-area'
import { animations } from './animation'
import { backgroundStyles } from './background'
import { containerParent } from './container'
import { divides } from './divide'
import { lineClamps } from './line-clamp'
import { filters } from './filters'

export const rules: Rule[] = [
cssVariables,
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 { borderStyles } from '../rules/border'
import { colorResolver, directionMap, handler as h } from '../utils'
import type { Theme } from '../theme'
import { borderStyles } from '../rules/border'

export const divides: Rule[] = [
// divides
Expand Down
4 changes: 2 additions & 2 deletions 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 { colorResolver, colorableShadows, globalKeywords, h } from '../utils'
import { varEmpty } from '../rules'
import { colorableShadows, colorResolver, globalKeywords, h } from '../utils'
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 type { Rule } from '@unocss/core'
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import type { Theme } from '../theme'
import type { Rule } from '@unocss/core'
import { handler as h } from '../utils'
import type { Theme } from '../theme'

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 type { Theme } from '../theme'
import { handler as h } from '../utils'
import type { Theme } from '../theme'

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 type { Theme } from '../theme'
import { handler as h } from '../utils'
import type { Theme } from '../theme'

const rowCol = (s: string) => s.replace('col', 'column')
const rowColTheme = (s: string) => s[0] === 'r' ? 'Row' : 'Column'
Expand Down
14 changes: 7 additions & 7 deletions src/rules/index.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
/* @export-submodules */
export * from './align'
export * from './animation'
export * from './background'
export * from './behaviors'
export * from './border'
export * from './color'
export * from './container'
export * from './decoration'
export * from './default'
export * from './divide'
export * from './filters'
export * from './flex'
export * from './gap'
export * from './grid'
export * from './layout'
export * from './line-clamp'
export * from './position'
export * from './question-mark'
export * from './ring'
export * from './safe-area'
export * from './shadow'
export * from './size'
export * from './spacing'

export * from './static'
export * from './svg'
export * from './transform'
export * from './transition'
export * from './typography'
export * from './variables'

export * from './animation'
export * from './background'
export * from './safe-area'
export * from './line-clamp'
export * from './filters'
export * from './divide'
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 type { CSSEntries, Rule, RuleContext, StaticRule } from '@unocss/core'
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import type { Theme } from '../theme'
import type { CSSEntries, Rule, RuleContext, StaticRule } from '@unocss/core'
import { globalKeywords, handler as h, insetMap, makeGlobalStaticRules } from '../utils'
import type { Theme } from '../theme'

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 './static'
import type { Theme } from '../theme'

export const ringBase = {
'--un-ring-inset': varEmpty,
Expand Down
6 changes: 3 additions & 3 deletions src/rules/shadow.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Rule } from '@unocss/core'
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import type { Theme } from '../theme'
import { colorResolver, colorableShadows, handler as h, hasParseableColor } from '../utils'
import type { Rule } from '@unocss/core'
import { colorableShadows, colorResolver, handler as h, hasParseableColor } from '../utils'
import { varEmpty } from './static'
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 type { Rule, RuleContext } from '@unocss/core'
import { cacheRestoreSelector } from 'unplugin-transform-class/utils'
import type { Theme } from '../theme'
import type { Rule, RuleContext } from '@unocss/core'
import { handler as h, resolveBreakpoints } from '../utils'
import type { Theme } from '../theme'

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 type { Theme } from '../theme'
import { directionMap, directionSize, handler as h } from '../utils'
import type { Theme } from '../theme'

export const paddings: Rule[] = [
[/^pa?()-?(.+)$/, directionSize('padding'), { autocomplete: ['(m|p)<num>', '(m|p)-<num>'] }],
Expand Down
Loading

0 comments on commit 7fe6ec0

Please sign in to comment.