Skip to content

Commit

Permalink
chore: run lint
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-ub committed Nov 23, 2024
1 parent e479832 commit e1ada80
Show file tree
Hide file tree
Showing 28 changed files with 98 additions and 95 deletions.
1 change: 1 addition & 0 deletions docs/src/__registry__/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ try {
process.exit(1)
}

// eslint-disable-next-line adrianub/no-top-level-await
await buildRegistry(result.data)
}
catch (error) {
Expand Down
3 changes: 1 addition & 2 deletions docs/src/components/component-preview/component-preview.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import type { Style } from '@/registry/registry-styles'
import { Index } from '@/__registry__'
import { cn } from '@/lib/utils'
import { AsyncPipe, NgComponentOutlet } from '@angular/common'
import { Component, computed, input } from '@angular/core'

import type { Style } from '@/registry/registry-styles'

@Component({
standalone: true,
selector: 'component-preview',
Expand Down
2 changes: 1 addition & 1 deletion docs/src/entrypoints/alpine.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import focus from '@alpinejs/focus'
import type { Alpine } from 'alpinejs'
import focus from '@alpinejs/focus'

export default (Alpine: Alpine): void => {
Alpine.plugin(focus)
Expand Down
3 changes: 2 additions & 1 deletion docs/src/pages/r/styles/[style]/[name].json.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { z } from 'astro/zod'

import fs from 'node:fs/promises'
import { tmpdir } from 'node:os'
import path from 'node:path'
Expand All @@ -7,7 +9,6 @@ import { registry } from '@/registry'
import { styles } from '@/registry/registry-styles'
import { type RegistryEntry, registryEntrySchema, type registryItemTypeSchema } from '@/registry/schema'
import { Project, ScriptKind } from 'ts-morph'
import type { z } from 'astro/zod'

const project = new Project({
compilerOptions: {},
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/r/styles/[style]/index/index.json.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type Style, styles } from '@/registry/registry-styles'
import type { RegistryEntry } from '@/registry/schema'
import { type Style, styles } from '@/registry/registry-styles'

export async function getStaticPaths(): Promise<{ params: { style: string } }[]> {
return styles.map(style => ({
Expand Down
5 changes: 3 additions & 2 deletions docs/src/plugins/rehype-component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import type { UnistNode, UnistTree } from '../../types/unist'

import fs from 'node:fs'
import path from 'node:path'
import process from 'node:process'
import { u } from 'unist-builder'
import { visit } from 'unist-util-visit'

import { visit } from 'unist-util-visit'
import { Index } from '../__registry__'
import { styles } from '../registry/registry-styles'
import type { UnistNode, UnistTree } from '../../types/unist'

function toCamelCase(str: string): string {
return str
Expand Down
3 changes: 2 additions & 1 deletion docs/src/plugins/rehype-npm-command.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { visit } from 'unist-util-visit'
import type { UnistNode, UnistTree } from '../../types/unist'

import { visit } from 'unist-util-visit'

export function rehypeNpmCommand() {
return (tree: UnistTree) => {
visit(tree, (node: UnistNode) => {
Expand Down
6 changes: 3 additions & 3 deletions docs/src/registry/default/ui/accordion.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import type { ClassValue } from 'clsx'
import { cn } from '@/lib/utils'
import { Component, computed, Directive, input } from '@angular/core'

import { Component, computed, Directive, input } from '@angular/core'
import { NgIconComponent, provideIcons } from '@ng-icons/core'
import { lucideChevronDown } from '@ng-icons/lucide'

import { lucideChevronDown } from '@ng-icons/lucide'
import {
RdxAccordionContentDirective,
RdxAccordionHeaderDirective,
RdxAccordionItemDirective,
RdxAccordionRootDirective,
RdxAccordionTriggerDirective,
} from '@radix-ng/primitives/accordion'
import type { ClassValue } from 'clsx'

@Directive({
standalone: true,
Expand Down
2 changes: 1 addition & 1 deletion docs/src/registry/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Registry } from './schema'
import { blocks } from './registry-blocks'
import { charts } from './registry-charts'
import { examples } from './registry-examples'
import { lib } from './registry-lib'
import { themes } from './registry-themes'
import { ui } from './registry-ui'
import type { Registry } from './schema'

export const registry: Registry = [
...ui,
Expand Down
6 changes: 3 additions & 3 deletions docs/src/registry/new-york/ui/accordion.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import type { ClassValue } from 'clsx'
import { cn } from '@/lib/utils'
import { Component, computed, Directive, input } from '@angular/core'

import { Component, computed, Directive, input } from '@angular/core'
import { NgIconComponent, provideIcons } from '@ng-icons/core'
import { lucideChevronDown } from '@ng-icons/lucide'

import { lucideChevronDown } from '@ng-icons/lucide'
import {
RdxAccordionContentDirective,
RdxAccordionHeaderDirective,
RdxAccordionItemDirective,
RdxAccordionRootDirective,
RdxAccordionTriggerDirective,
} from '@radix-ng/primitives/accordion'
import type { ClassValue } from 'clsx'

@Directive({
standalone: true,
Expand Down
4 changes: 2 additions & 2 deletions docs/src/registry/new-york/ui/tabs.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { cn } from '@/lib/utils'
import type { BooleanInput } from '@angular/cdk/coercion'

import { cn } from '@/lib/utils'
import { booleanAttribute, computed, Directive, input } from '@angular/core'
import {
RdxTabsContentDirective,
RdxTabsListDirective,
RdxTabsRootDirective,
RdxTabsTriggerDirective,
} from '@radix-ng/primitives/tabs'
import type { BooleanInput } from '@angular/cdk/coercion'

@Directive({
selector: '[ubTabs]',
Expand Down
8 changes: 4 additions & 4 deletions src/commands/add.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import type { AddOptions } from '../schemas/add'
import path from 'node:path'
import process from 'node:process'

import process from 'node:process'
import * as p from '@clack/prompts'
import { Command } from 'commander'
import { z } from 'zod'

import { z } from 'zod'
import { preFlightAdd } from '../prefilghts/preflight-add'
import { addOptionsSchema } from '../schemas/add'
import { addComponents } from '../utils/add-components'
Expand All @@ -13,9 +14,8 @@ import * as ERRORS from '../utils/errors'
import { handleError } from '../utils/handle-error'
import { highlighter } from '../utils/highlighter'
import { getRegistryIndex } from '../utils/registry'
import { runInit } from './init'

import type { AddOptions } from '../schemas/add'
import { runInit } from './init'

export const add = new Command()
.name('add')
Expand Down
12 changes: 6 additions & 6 deletions src/commands/diff.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import type { Change } from 'diff'
import type { z } from 'zod'
import type { Config } from '../utils/get-config'

import type { registryIndexSchema } from '../utils/registry/schema'
import fs, { existsSync } from 'node:fs'
import path from 'node:path'
import process from 'node:process'

import * as p from '@clack/prompts'

import { Command } from 'commander'
import { diffLines } from 'diff'
import type { Change } from 'diff'
import type { z } from 'zod'

import { updateOptionsSchema } from '../schemas/diff'
import { getConfig } from '../utils/get-config'
import { handleError } from '../utils/handle-error'
import { highlighter } from '../utils/highlighter'
import { fetchTree, getItemTargetPath, getRegistryBaseColor, getRegistryIndex } from '../utils/registry'
import { transform } from '../utils/transformers'
import type { Config } from '../utils/get-config'
import type { registryIndexSchema } from '../utils/registry/schema'

export const diff = new Command()
.name('diff')
Expand Down
8 changes: 4 additions & 4 deletions src/commands/init.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import type { InitOptions } from '../schemas/init'
import type { Config } from '../utils/get-config'
import fs from 'node:fs/promises'

import path from 'node:path'
import process from 'node:process'

import * as p from '@clack/prompts'
import { Command } from 'commander'

import { preFlightInit } from '../prefilghts/preflight-init'
import { initOptionsSchema } from '../schemas/init'
import { addComponents } from '../utils/add-components'
import { createProject } from '../utils/create-project'
import * as ERRORS from '../utils/errors'
import { DEFAULT_COMPONENTS, DEFAULT_TAILWIND_CONFIG, DEFAULT_TAILWIND_CSS, DEFAULT_UTILS, getConfig, rawConfigSchema, resolveConfigPaths } from '../utils/get-config'

import { getProjectConfig, getProjectInfo } from '../utils/get-project-info'
import { handleError } from '../utils/handle-error'

import { highlighter } from '../utils/highlighter'
import { getRegistryBaseColors, getRegistryStyles } from '../utils/registry'
import { updateTailwindContent } from '../utils/updaters/update-tailwind-content'
import type { InitOptions } from '../schemas/init'
import type { Config } from '../utils/get-config'

async function promptForMinimalConfig(defaultConfig: Config, opts: InitOptions): Promise<Omit<Config, 'resolvedPaths'>> {
let style = defaultConfig.style
Expand Down
4 changes: 2 additions & 2 deletions src/prefilghts/preflight-add.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { AddOptions } from '../schemas/add'
import fs from 'node:fs'
import path from 'node:path'

import process from 'node:process'

import * as p from '@clack/prompts'

import * as ERRORS from '../utils/errors'
import { getConfig } from '../utils/get-config'
import { highlighter } from '../utils/highlighter'
import type { AddOptions } from '../schemas/add'

export async function preFlightAdd(options: AddOptions): Promise<{ errors: Record<string, boolean>, config: any | null }> {
const errors: Record<string, boolean> = {}
Expand Down
14 changes: 7 additions & 7 deletions src/prefilghts/preflight-init.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import type { InitOptions } from '../schemas/init'
import type { ProjectInfo } from '../utils/get-project-info'
import fs from 'node:fs'

import path from 'node:path'
import process from 'node:process'

import process from 'node:process'
import * as p from '@clack/prompts'

import * as ERRORS from '../utils/errors'

import { getProjectInfo } from '../utils/get-project-info'
import { highlighter } from '../utils/highlighter'

import type { InitOptions } from '../schemas/init'
import type { ProjectInfo } from '../utils/get-project-info'

export async function preFlightInit(
options: InitOptions,
): Promise<{ errors: Record<string, boolean>, projectInfo: ProjectInfo | null }> {
Expand Down Expand Up @@ -43,8 +43,8 @@ export async function preFlightInit(
options.cwd,
)}.
To start over, remove the ${highlighter.info(
'components.json',
)} file and run ${highlighter.info('init')} again.`,
'components.json',
)} file and run ${highlighter.info('init')} again.`,
3,
)
process.exit(1)
Expand Down
4 changes: 2 additions & 2 deletions src/utils/add-components.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as p from '@clack/prompts'
import type { Config } from './get-config'

import * as p from '@clack/prompts'
import { handleError } from './handle-error'
import { registryResolveItemsTree } from './registry'
import { updateCssVars } from './updaters/update-css-vars'
import { updateDependencies } from './updaters/update-dependencies'
import { updateFiles } from './updaters/update-files'
import { updateTailwindConfig } from './updaters/update-tailwind-config'
import type { Config } from './get-config'

export async function addComponents(
components: string[],
Expand Down
6 changes: 3 additions & 3 deletions src/utils/create-project.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import type { InitOptions } from '../schemas/init'
import fs from 'node:fs/promises'

import path from 'node:path'

import process from 'node:process'

import { installPackage } from '@antfu/install-pkg'
import * as p from '@clack/prompts'

import * as p from '@clack/prompts'
import { execa } from 'execa'
import { getPackageManager } from './get-package-manager'
import { highlighter } from './highlighter'
import { loadTsConfig } from './load-tsconfig'
import type { InitOptions } from '../schemas/init'

export async function createProject(
options: Pick<InitOptions, 'cwd' | 'force'>,
Expand Down
14 changes: 7 additions & 7 deletions src/utils/get-project-info.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import type { Framework } from './frameworks'
import type {
Config,
RawConfig,
} from './get-config'

import fs from 'node:fs/promises'
import path from 'node:path'

import fg from 'fast-glob'

import { loadConfig as loadTsConfig } from 'tsconfig-paths'
import { loadConfig } from 'unconfig'

import { FRAMEWORKS } from './frameworks'
import {
getConfig,
resolveConfigPaths,
} from './get-config'
import type { Framework } from './frameworks'
import type {
Config,
RawConfig,
} from './get-config'

export interface ProjectInfo {
framework: Framework
Expand Down
10 changes: 5 additions & 5 deletions src/utils/registry/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import type { Config } from '../../utils/get-config'
import type {
registryItemFileSchema,
} from '../../utils/registry/schema'

import path from 'node:path'
import process from 'node:process'

import deepmerge from 'deepmerge'
import { HttpsProxyAgent } from 'https-proxy-agent'
import fetch from 'node-fetch'
Expand All @@ -15,10 +19,6 @@ import {
stylesSchema,
} from '../../utils/registry/schema'
import { buildTailwindThemeColorsFromCssVars } from '../../utils/updaters/update-tailwind-config'
import type { Config } from '../../utils/get-config'
import type {
registryItemFileSchema,
} from '../../utils/registry/schema'

const REGISTRY_URL = process.env.REGISTRY_URL ?? 'https://ui.adrianub.dev/r'

Expand Down
8 changes: 4 additions & 4 deletions src/utils/transformers/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type { z } from 'zod'
import type { Config } from '../get-config'
import type { registryBaseColorSchema } from '../registry/schema'

import fs from 'node:fs'
import { tmpdir } from 'node:os'
import path from 'node:path'

import { Project, ScriptKind, type SourceFile } from 'ts-morph'
import type { z } from 'zod'
import { transformCssVars } from './transform-css-vars'
import { transformImport } from './transform-import'
import { transformTwPrefixes } from './transform-tw-prefix'
import type { Config } from '../get-config'
import type { registryBaseColorSchema } from '../registry/schema'

export interface TransformOpts {
filename: string
Expand Down
4 changes: 2 additions & 2 deletions src/utils/transformers/transform-css-vars.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { SyntaxKind } from 'ts-morph'

import type { z } from 'zod'

import type { Transformer } from '.'
import type { registryBaseColorSchema } from '../registry/schema'
import { SyntaxKind } from 'ts-morph'

export const transformCssVars: Transformer = async ({
sourceFile,
Expand Down
4 changes: 2 additions & 2 deletions src/utils/transformers/transform-tw-prefix.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Transformer } from '.'
import { SyntaxKind } from 'ts-morph'
import { splitClassName } from './transform-css-vars'

import type { Transformer } from '.'
import { splitClassName } from './transform-css-vars'

export const transformTwPrefixes: Transformer = async ({
sourceFile,
Expand Down
Loading

0 comments on commit e1ada80

Please sign in to comment.