diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index e52351470..1d0479e71 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -1,4 +1,6 @@ # Ran prettier on source # after adding tailwind plugin 54563d9deba9d95c1212c1be2217ce8fa181162b -8e07a190aff0eba2a3e072f9857a654dca6fa0e1 \ No newline at end of file +8e07a190aff0eba2a3e072f9857a654dca6fa0e1 +72f8c1b0735361a80910e196a60dd705f5b2145e +c0f9e8108e4e7c29b44c0ef0b7faf2e3711f93ca \ No newline at end of file diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 000000000..cfdf3e6f3 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,22 @@ +name: Format Check + +on: + pull_request: + push: + branches: [main] + +jobs: + oxfmt: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 20 + + - run: yarn install --frozen-lockfile + + - name: Check formatting + run: yarn format:check diff --git a/.husky/.gitignore b/.husky/.gitignore deleted file mode 100644 index 31354ec13..000000000 --- a/.husky/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_ diff --git a/.oxfmtrc.json b/.oxfmtrc.json new file mode 100644 index 000000000..18b7a3ac5 --- /dev/null +++ b/.oxfmtrc.json @@ -0,0 +1,19 @@ +{ + "$schema": "./node_modules/oxfmt/configuration_schema.json", + "singleQuote": true, + "semi": false, + "tabWidth": 2, + "useTabs": false, + "printWidth": 100, + "trailingComma": "all", + "bracketSpacing": true, + "arrowParens": "always", + "quoteProps": "consistent", + "objectWrap": "preserve", + "sortImports": { + "newlinesBetween": true, + "groups": [["builtin"], "external", ["parent", "sibling", "index"], "unknown"] + }, + "sortTailwindcss": true, + "ignorePatterns": ["node_modules/**", "dist/**"] +} diff --git a/.oxlintrc.json b/.oxlintrc.json new file mode 100644 index 000000000..d75db718a --- /dev/null +++ b/.oxlintrc.json @@ -0,0 +1,34 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "plugins": ["typescript", "unicorn", "oxc"], + "categories": { + "correctness": "error", + "suspicious": "warn", + "perf": "warn" + }, + "env": { + "builtin": true + }, + "rules": { + "no-empty": ["warn", { "allowEmptyCatch": true }], + "unicorn/no-array-for-each": "off", + "unicorn/no-null": "off", + "typescript/no-explicit-any": "warn", + "typescript/consistent-type-imports": ["warn", { "prefer": "type-imports" }] + }, + // Relax rules that are overly strict in test code: + // - no-shadow: callback params like (q) => and (doc) => shadow outer imports — unavoidable + // - no-explicit-any: catch (e: any) and controller hook stubs legitimately need any + // - consistent-function-scoping: helper closures inside describe blocks are fine + "overrides": [ + { + "files": ["tests/**/*.ts"], + "rules": { + "no-shadow": "off", + "typescript/no-explicit-any": "off", + "unicorn/consistent-function-scoping": "off" + } + } + ], + "ignorePatterns": ["node_modules", "dist"] +} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index d8776e235..000000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,27 +0,0 @@ -exclude: 'node_modules|.git' -default_stages: [commit] -fail_fast: false - - -repos: - - repo: https://github.com/pre-commit/mirrors-prettier - rev: v4.0.0-alpha.8 - hooks: - - id: prettier - types_or: - - javascript - - vue - additional_dependencies: - - prettier - - prettier-plugin-tailwindcss - exclude: | - (?x)^( - .*node_modules.*| - .*boilerplate.*| - .*src.*.js| - )$ - -ci: - autoupdate_schedule: weekly - skip: [] - submodules: false diff --git a/.prettierrc.json b/.prettierrc.json deleted file mode 100644 index 50f7605fd..000000000 --- a/.prettierrc.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "semi": false, - "singleQuote": true, - "tabWidth": 2, - "proseWrap": "always" -} \ No newline at end of file diff --git a/404.html b/404.html index 2f9e807bc..0e4c58f3a 100644 --- a/404.html +++ b/404.html @@ -1,14 +1,13 @@ - + - - - + + + - - - - \ No newline at end of file + + + diff --git a/auto-imports.d.ts b/auto-imports.d.ts index 9d2400790..b0b03575b 100644 --- a/auto-imports.d.ts +++ b/auto-imports.d.ts @@ -5,6 +5,4 @@ // Generated by unplugin-auto-import // biome-ignore lint: disable export {} -declare global { - -} +declare global {} diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 698b01a42..95857aea4 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -34,4 +34,4 @@ // visit(originalFn: CommandOriginalFn, url: string, options: Partial): Chainable // } // } -// } \ No newline at end of file +// } diff --git a/cypress/support/component-index.html b/cypress/support/component-index.html index ac6e79fd8..faf3b5f43 100644 --- a/cypress/support/component-index.html +++ b/cypress/support/component-index.html @@ -1,12 +1,12 @@ - + - - - + + + Components App
- \ No newline at end of file + diff --git a/cypress/support/component.ts b/cypress/support/component.ts index 1d9645713..9decaa799 100644 --- a/cypress/support/component.ts +++ b/cypress/support/component.ts @@ -16,7 +16,6 @@ // Import commands.js using ES2015 syntax: import './commands' import './setup' - import { mount } from 'cypress/vue' // Augment the Cypress namespace to include type definitions for diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index b54ad53db..30646a812 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -1,11 +1,13 @@ +import fs from 'fs' +import path from 'path' + +import { transformerStyleToClass } from '@shikijs/transformers' import { defineConfig } from 'vitepress' + import { lucideIcons } from '../../vite/lucideIcons' -import path from 'path' import { meta } from './meta' -import { getComponentItems } from './utils' -import { transformerStyleToClass } from '@shikijs/transformers' import componentTransformer from './plugins/componentTransformer' -import fs from 'fs' +import { getComponentItems } from './utils' // needed for transforming shiki inline styles to classes const toClass = transformerStyleToClass({ @@ -32,10 +34,7 @@ export default defineConfig({ head: [ // newsreader font ['link', { rel: 'preconnect', href: 'https://fonts.googleapis.com' }], - [ - 'link', - { rel: 'preconnect', href: 'https://fonts.gstatic.com', crossorigin: '' }, - ], + ['link', { rel: 'preconnect', href: 'https://fonts.gstatic.com', crossorigin: '' }], [ 'link', { @@ -92,9 +91,7 @@ export default defineConfig({ { text: 'Blog', link: '/blog' }, ], // sidebar: sidebarConfig, - socialLinks: [ - { icon: 'github', link: 'https://github.com/frappe/frappe-ui' }, - ], + socialLinks: [{ icon: 'github', link: 'https://github.com/frappe/frappe-ui' }], }, vite: { plugins: [lucideIcons()], diff --git a/docs/.vitepress/meta.ts b/docs/.vitepress/meta.ts index 5c7f54b9b..39dc3895e 100644 --- a/docs/.vitepress/meta.ts +++ b/docs/.vitepress/meta.ts @@ -1,5 +1,5 @@ export const meta = { - name: 'Frappe UI', - github: 'https://github.com/frappe/frappe-ui', - description: 'An UI component library based on the Frappe design system ', + name: 'Frappe UI', + github: 'https://github.com/frappe/frappe-ui', + description: 'An UI component library based on the Frappe design system ', } diff --git a/docs/.vitepress/plugins/componentTransformer.ts b/docs/.vitepress/plugins/componentTransformer.ts index eb967af07..9635c49d5 100644 --- a/docs/.vitepress/plugins/componentTransformer.ts +++ b/docs/.vitepress/plugins/componentTransformer.ts @@ -1,6 +1,7 @@ -import type { MarkdownEnv, MarkdownRenderer } from 'vitepress' import { dirname, resolve } from 'node:path' +import type { MarkdownEnv, MarkdownRenderer } from 'vitepress' + export default function (md: MarkdownRenderer) { md.core.ruler.after('inline', 'component-preview', (state) => { const previewRegex = @@ -22,9 +23,10 @@ export default function (md: MarkdownRenderer) { token.content = `\n` state.tokens.unshift(token) } else { - state.tokens[scriptIdx].content = state.tokens[ - scriptIdx - ].content.replace('', `${importStr}\n`) + state.tokens[scriptIdx].content = state.tokens[scriptIdx].content.replace( + '', + `${importStr}\n`, + ) } const idx = state.tokens.findIndex((i) => i.content.match(previewRegex)) @@ -48,8 +50,7 @@ export default function (md: MarkdownRenderer) { }) // Handle PropsTable - const propsRegex = - //g + const propsRegex = //g state.src = state.src.replace(propsRegex, (match, name, data) => { const typesPath = `../../../../src/components/${name}/types.ts` @@ -58,8 +59,7 @@ export default function (md: MarkdownRenderer) { if (idx !== -1) { const { realPath, path: _path } = state.env as MarkdownEnv - state.tokens[idx].content = - `