diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index ea5fdfa..30d3ad9 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -6,22 +6,16 @@ labels: bug assignees: '' --- -**Describe the bug** -A clear description of what the bug is. +**Describe the bug** A clear description of what the bug is. -**To Reproduce** -Steps to reproduce: -1. -2. -3. +**To Reproduce** Steps to reproduce: 1. 2. 3. -**Expected behavior** -What you expected to happen. +**Expected behavior** What you expected to happen. **Environment** + - Node.js version: - Package version: - OS: -**Additional context** -Any other context about the problem. +**Additional context** Any other context about the problem. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index edb648c..10b7c13 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -6,14 +6,10 @@ labels: enhancement assignees: '' --- -**Is your feature request related to a problem?** -A clear description of the problem. +**Is your feature request related to a problem?** A clear description of the problem. -**Describe the solution you'd like** -What you want to happen. +**Describe the solution you'd like** What you want to happen. -**Alternatives considered** -Any alternative solutions you've considered. +**Alternatives considered** Any alternative solutions you've considered. -**Additional context** -Any other context or screenshots. +**Additional context** Any other context or screenshots. diff --git a/.github/SECURITY.md b/.github/SECURITY.md index 383a08a..32adeed 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -13,5 +13,5 @@ We will acknowledge receipt within 48 hours and aim to release a fix within 7 da ## Supported Versions | Version | Supported | -|---------|-----------| +| ------- | --------- | | 1.0.x | Yes | diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c2596fd..c76bb73 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,33 +1,33 @@ version: 2 updates: - - package-ecosystem: "npm" - directory: "/" + - package-ecosystem: 'npm' + directory: '/' schedule: - interval: "weekly" + interval: 'weekly' groups: development-dependencies: - dependency-type: "development" + dependency-type: 'development' ignore: # @typescript-eslint/eslint-plugin peers on typescript ">=4.8.4 <6.1.0". # A major bump to TS 7 makes `npm ci` fail with ERESOLVE. Revisit when # typescript-eslint ships TS 7 support. - - dependency-name: "typescript" - update-types: ["version-update:semver-major"] + - dependency-name: 'typescript' + update-types: ['version-update:semver-major'] # graphql 17 is not yet supported by the surrounding ecosystem: # graphql-request peers on "14 - 16", graphql-yoga on "^15.2.0 || ^16.0.0". # Revisit once those ship v17-compatible releases. - - dependency-name: "graphql" - update-types: ["version-update:semver-major"] + - dependency-name: 'graphql' + update-types: ['version-update:semver-major'] commit-message: - prefix: "fix" - prefix-development: "chore" - - package-ecosystem: "github-actions" - directory: "/" + prefix: 'fix' + prefix-development: 'chore' + - package-ecosystem: 'github-actions' + directory: '/' schedule: - interval: "weekly" + interval: 'weekly' groups: github-actions: patterns: - - "*" + - '*' commit-message: - prefix: "chore" + prefix: 'chore' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 67db0ff..bca6f2b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,8 @@ jobs: node-version: ${{ matrix.node-version }} cache: 'npm' - run: npm ci - - run: npm run lint + - name: Ultracite check + run: npm run lint - run: npm run typecheck - run: npm test - run: npm run build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2a39fc4..04bf365 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,9 +8,9 @@ on: workflow_dispatch: inputs: bump: - description: "Semver bump" + description: 'Semver bump' required: true - default: "patch" + default: 'patch' type: choice options: - patch @@ -29,7 +29,7 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 22 - registry-url: "https://registry.npmjs.org" + registry-url: 'https://registry.npmjs.org' - name: Upgrade npm (OIDC trusted publishing needs npm >= 11.5; pin 11) run: npm install -g npm@11 - name: Install diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..c317064 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +AGENTS.md diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 4cbc711..0000000 --- a/.prettierrc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "semi": true, - "singleQuote": true, - "trailingComma": "all", - "printWidth": 100, - "tabWidth": 2 -} diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..ff26838 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,123 @@ +# Ultracite Code Standards + +This project uses **Ultracite**, a zero-config preset that enforces strict code quality standards through automated formatting and linting. + +## Quick Reference + +- **Format code**: `npm exec -- ultracite fix` +- **Check for issues**: `npm exec -- ultracite check` +- **Diagnose setup**: `npm exec -- ultracite doctor` + +ESLint + Prettier + Stylelint (the underlying engine) provides robust linting and formatting. Most issues are automatically fixable. + +--- + +## Core Principles + +Write code that is **accessible, performant, type-safe, and maintainable**. Focus on clarity and explicit intent over brevity. + +### Type Safety & Explicitness + +- Use explicit types for function parameters and return values when they enhance clarity +- Prefer `unknown` over `any` when the type is genuinely unknown +- Use const assertions (`as const`) for immutable values and literal types +- Leverage TypeScript's type narrowing instead of type assertions +- Use meaningful variable names instead of magic numbers - extract constants with descriptive names + +### Modern JavaScript/TypeScript + +- Use arrow functions for callbacks and short functions +- Prefer `for...of` loops over `.forEach()` and indexed `for` loops +- Use optional chaining (`?.`) and nullish coalescing (`??`) for safer property access +- Prefer template literals over string concatenation +- Use destructuring for object and array assignments +- Use `const` by default, `let` only when reassignment is needed, never `var` + +### Async & Promises + +- Always `await` promises in async functions - don't forget to use the return value +- Use `async/await` syntax instead of promise chains for better readability +- Handle errors appropriately in async code with try-catch blocks +- Don't use async functions as Promise executors + +### React & JSX + +- Use function components over class components +- Call hooks at the top level only, never conditionally +- Specify all dependencies in hook dependency arrays correctly +- Use the `key` prop for elements in iterables (prefer unique IDs over array indices) +- Nest children between opening and closing tags instead of passing as props +- Don't define components inside other components +- Use semantic HTML and ARIA attributes for accessibility: + - Provide meaningful alt text for images + - Use proper heading hierarchy + - Add labels for form inputs + - Include keyboard event handlers alongside mouse events + - Use semantic elements (`