From 7729029c2430d05d722be1e1aca5f606ed033f9a Mon Sep 17 00:00:00 2001 From: "prideraiser[bot]" <329588787+prideraiser[bot]@users.noreply.github.com> Date: Wed, 21 Oct 2026 18:25:43 +0000 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Move=20to=20pedantry=202.0?= =?UTF-8?q?.2=20with=20pedantry=20migrate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Migrated with `pedantry migrate` from v2.0.2 (types: typescript, css). Replaced: the `.pedantry` submodule and `.gitmodules`; `.prettierrc.json5` (now `"prettier": "@dryan/pedantry/prettier"` in package.json); the identical tsconfig options (now `extends: "@dryan/pedantry/tsconfig"`); the identical `.editorconfig` sections (now the managed block); the stale or identical lefthook prettier and eslint commands (now managed); the `.pedantry` entry in the eslint ignores. Preserved: tsconfig `outDir`, `ignoreDeprecations`, `baseUrl` and `paths`; the repo's other lefthook hooks (moved to lefthook-local.yml). New: @dryan/pedantry dev dependency, pedantry.toml, CLAUDE.md, the `@.pedantry/AGENTS.md` import in AGENTS.md, generated .pedantry/AGENTS.md. tsconfig options set to false to preserve old behaviour: none. Hand-fixed: - eslint.config.ts was a full copy of the old pedantry ESLint config; it now spreads `@dryan/pedantry/eslint` and keeps only the repo's `docs/dist/**` and `docs/sentry-init.js(.map)` ignores. The old copy's `projectService` parser options are not carried over. - stylelint.config.mjs (copy of the old pedantry config) now extends `@dryan/pedantry/stylelint` and keeps its `ignoreFiles`. - custom-elements-manifest.config.js was identical to the helper's defaults; it now calls `customElementsManifestConfig()`. - rollup.config.js now builds both configs with `rollupConfig` from `@dryan/pedantry/rollup`, keeping the repo's plugins (json, copy-to-docs), watch settings and `external: []`. `rollup -c` produces byte-identical dist/index.js, docs/dist/index.js and docs/sentry-init.js. - .github/copilot-instructions.md no longer names `.pedantry/tsconfig.json` and `.pedantry/eslint.config.ts`; the section describes the package paths and `pedantry sync`. Checks: pedantry check passes; eslint and stylelint pass. tsc still reports one error in examples.ts (unused variable), as on main; the two eslint.config.ts type errors from the old copy are gone. npm test passes here (it failed in the before run, which had no local build; not caused by this change). Prettier flags the same file as on main (the submodule's copy no longer counts). Co-Authored-By: Claude Sonnet 5.5 --- .editorconfig | 4 + .github/copilot-instructions.md | 14 +- .gitmodules | 3 - .pedantry | 1 - .pedantry/AGENTS.md | 668 +++++++++++++++++++++++++++++ .prettierignore | 7 + .prettierrc.json5 | 4 - AGENTS.md | 3 + CLAUDE.md | 1 + custom-elements-manifest.config.js | 17 +- eslint.config.ts | 120 +----- lefthook-local.yml | 6 + lefthook.yml | 20 +- package-lock.json | 157 ++++--- package.json | 4 +- pedantry.toml | 4 + rollup.config.js | 29 +- stylelint.config.mjs | 33 +- tsconfig.json | 33 +- 19 files changed, 817 insertions(+), 311 deletions(-) delete mode 100644 .gitmodules delete mode 160000 .pedantry create mode 100644 .pedantry/AGENTS.md delete mode 100644 .prettierrc.json5 create mode 100644 AGENTS.md create mode 100644 CLAUDE.md create mode 100644 lefthook-local.yml create mode 100644 pedantry.toml diff --git a/.editorconfig b/.editorconfig index 4b616b9..69c475c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,5 +1,8 @@ # EditorConfig helps maintain consistent coding styles # This file takes precedence over VS Code user settings + +# >>> pedantry +# pedantry 2.0.2: managed by pedantry sync, do not edit. root = true [*] @@ -21,3 +24,4 @@ trim_trailing_whitespace = false [Makefile] indent_style = tab +# <<< pedantry diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index f5bb146..4ef2373 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -4,19 +4,17 @@ This document provides guidelines for AI assistants working on this codebase. --- -## ⚠️ CRITICAL: Do Not Modify Submodule Files +## ⚠️ CRITICAL: Do Not Edit Pedantry-Managed Files -**If this project uses the pedantry submodule (`.pedantry/` directory), NEVER modify files within it.** +**Files written by `pedantry sync` are managed. Never edit them by hand; run `pedantry sync` instead.** -- All configuration files have been **copied** from the submodule to the project root -- Edit the copied files in the project root, NOT the originals in `.pedantry/` -- The submodule should remain unchanged so it can be updated cleanly -- Modifying submodule files will cause merge conflicts during updates +- Managed files are `lefthook.yml`, `.pedantry/AGENTS.md` and the marked blocks (`# >>> pedantry` to `# <<< pedantry`) +- TypeScript, ESLint, Prettier and Stylelint come from the `@dryan/pedantry` npm package **When editing configs:** -- ✅ Edit files at project root: `tsconfig.json`, `eslint.config.ts`, `pyproject.toml`, etc. -- ❌ Never edit: `.pedantry/tsconfig.json`, `.pedantry/eslint.config.ts`, etc. +- ✅ Edit the repo's own files: `tsconfig.json` (extends `@dryan/pedantry/tsconfig`), `eslint.config.ts` (imports `@dryan/pedantry/eslint`), etc. +- ❌ Never edit the managed files above --- diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 26cc24d..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule ".pedantry"] - path = .pedantry - url = https://github.com/dryan/pedantry.git diff --git a/.pedantry b/.pedantry deleted file mode 160000 index a103023..0000000 --- a/.pedantry +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a1030236d3c81fe075b8297db74b18b78ebd3447 diff --git a/.pedantry/AGENTS.md b/.pedantry/AGENTS.md new file mode 100644 index 0000000..19855a8 --- /dev/null +++ b/.pedantry/AGENTS.md @@ -0,0 +1,668 @@ + + +# Agent Instructions + +This document provides guidelines for AI assistants working on this codebase. + +--- + +## ⚠️ CRITICAL: Do Not Edit Pedantry-Managed Files + +**Files written by `pedantry sync` are managed. Never edit them by hand; run `pedantry sync` instead.** + +Managed files say so in a header (`managed by pedantry sync, do not edit`) or sit between `# >>> pedantry` and `# <<< pedantry` markers: + +- `lefthook.yml`, `.pedantry/` (including this file) +- the marked blocks in `.editorconfig`, `.prettierignore` and `pyproject.toml` (ruff, ty, vulture, pytest, django-upgrade) +- with `--vendor`: the JS configs under `.pedantry/` + +**Where repo-specific changes go:** + +- Extra or changed git hooks: `lefthook-local.yml` (lefthook merges it in) +- Extra editor or ignore rules: below the `# <<< pedantry` marker +- pyproject settings: outside the marked block, or list a whole table under `keep` in `[tool.pedantry]` to own it +- ESLint, TypeScript, Prettier and Stylelint: the repo's own `eslint.config.ts`, `tsconfig.json`, etc., which import or extend `@dryan/pedantry/...` +- Repo-specific agent rules: the repo's own `AGENTS.md`, which keeps the `@.pedantry/AGENTS.md` import + +**To change what pedantry enforces for everyone**, change the pedantry repo and cut a release. Then bump `version` in `[tool.pedantry]` (or `pedantry.toml`) and run `pedantry sync --upgrade`. + +`pedantry check` exits non-zero when a managed file differs from the pinned version. CI runs it. + +--- + +## Core Principle: Always Ask First + +**Default to asking about preferences rather than choosing automatically.** When there are multiple valid approaches or unclear requirements, always ask the user for guidance before proceeding. + +When you first encounter decisions about: + +- Code organization patterns +- Naming conventions +- Architecture choices +- Testing strategies +- Documentation standards +- Any project-specific preferences + +**Stop and ask the user** about their preferences for this project. Do not make assumptions based on general best practices alone. + +--- + +## Always Verify Fixes + +**Never claim something is "fixed" without verification.** + +When making changes that should resolve an error or issue: + +1. Make the change +2. Run the relevant command/test to verify it works +3. Only then report it as fixed + +Examples: + +- After fixing a config error, run the tool to verify it parses correctly +- After fixing a test, run the test to verify it passes +- After fixing a build error, run the build to verify it succeeds + +If verification fails, continue fixing until it actually works. + +--- + +## Show Full Output for Debugging + +**Never hide command output with `head`, `tail`, or similar filtering tools.** + +When running commands for verification or debugging: + +- Show the full output so the user can help diagnose issues +- Don't truncate output with `head -n 10`, `tail -n 20`, etc. +- Don't pipe through `grep` unless specifically filtering for known patterns +- Let the user see all errors, warnings, and diagnostic information + +The user needs complete information to assist with debugging. Hiding output makes troubleshooting harder. + +--- + +## Performance First + +Performance should always be a top consideration: + +- Consider bundle size and runtime performance +- Write efficient code +- Minimize unnecessary computations and re-renders +- Use appropriate data structures and algorithms +- Be mindful of Web Component lifecycle methods + +--- + +## Type Safety + +- Everything should be strongly typed +- Avoid `any` - use `unknown` if the type is truly unknown +- Use type assertions sparingly and document why they're needed +- Follow TypeScript best practices + +**Type vs Interface:** + +- Start with `interface` for object shapes +- Switch to `type` when shapes get advanced (unions, intersections, mapped types) + +--- + +## Web Components Best Practices + +### Vanilla Web Components + +- Use standard Custom Elements API +- Implement Shadow DOM when appropriate +- Follow the Custom Elements lifecycle: `constructor()`, `connectedCallback()`, `disconnectedCallback()`, `attributeChangedCallback()` +- Use `observedAttributes` static property for reactive attributes +- Keep components focused and composable + +### Lit Components + +- Use Lit decorators: `@customElement`, `@property`, `@state`, `@query` +- Leverage reactive properties for state management +- Use `html` template literals for templates +- Style with `css` tagged template literals +- Follow Lit's reactive update lifecycle +- Use `@query` and `@queryAll` instead of `querySelector` + +### General Web Components Guidelines + +- Always define a custom element name with a hyphen (e.g., `my-component`) +- Use semantic HTML within your components +- Implement proper accessibility (ARIA attributes, keyboard navigation) +- Emit custom events for component communication +- Use slots for content projection +- Document your public API (properties, methods, events, slots, CSS custom properties) + +--- + +## Documentation Requirements + +### Ask About Documentation Standards + +On first encounter, ask the user: + +1. What level of documentation is required? (JSDoc, inline comments, separate docs?) +2. Are there specific documentation tags or formats to follow? +3. Should all public APIs be documented? +4. What about internal/private methods? + +### General Documentation Guidelines + +- Document complex logic with inline comments +- Explain "why" not just "what" +- Keep documentation up to date with code changes +- Use clear, concise language +- For Web Components, document: + - Properties and attributes + - Methods + - Events + - Slots + - CSS custom properties + - CSS Shadow Parts + +--- + +## Code Style and Formatting + +This project uses: + +- **Prettier** for code formatting (defaults only) +- **ESLint** for JavaScript/TypeScript linting +- **Stylelint** for CSS linting +- **Ruff** for Python linting and formatting (if Python exists) +- **EditorConfig** for editor consistency + +**Let the tools handle formatting.** Focus on writing clear, maintainable code. + +--- + +## Python Workflow + +### Running Python Commands + +**Always run Python commands through `uv`:** + +```bash +# Correct +uv run python3 script.py +uv run pytest +uv run python3 -m module + +# Incorrect +python3 script.py +pytest +``` + +This ensures: + +- Consistent Python version across environments +- Automatic virtual environment management +- Dependencies are properly resolved + +### Dependency Management + +**NEVER manually edit `package.json` or `pyproject.toml` to manage dependencies.** + +Always use the appropriate package manager commands: + +**Node.js/npm:** + +```bash +# Correct +npm install package-name +npm install -D package-name +npm uninstall package-name + +# Incorrect +# Manually editing package.json dependencies +``` + +**Python/uv:** + +```bash +# Correct +uv add package-name +uv add --dev package-name +uv remove package-name + +# Incorrect +# Manually editing pyproject.toml dependencies +``` + +This ensures: + +- Proper lock file updates +- Version resolution +- Dependency tree consistency +- No conflicts or mismatches + +You may edit other sections of these files (scripts, configuration, metadata), but never the `dependencies` or `devDependencies` sections. + +### Script Management + +**Prefer `justfile` recipes over one-off bash scripts:** + +- Use `just` for reusable commands and workflows +- Keep project-specific tasks in `justfile` +- Use bash scripts only for complex logic that doesn't fit in recipes +- Document `just` recipes with comments + +**Example `justfile`:** + +```just +# Run all tests +test: + uv run pytest + +# Type check Python code +typecheck: + uv run ty check + +# Run linters +lint: + uv run ruff check . + npm run lint:js + +# Format all code +format: + uv run ruff format . + npm run format + +# Check everything (lint + type check + test) +check: lint typecheck test +``` + +--- + +## Testing + +### Web Components Testing + +Use `@web/test-runner` for browser-based tests: + +- Test actual browser behavior +- Test with real Shadow DOM +- Use `@web/test-runner-commands` for advanced interactions +- Test across multiple browsers (Chromium, Firefox, WebKit) + +**Browser Debugging:** + +When debugging browser-based code or Web Components: + +- Use the Chrome MCP server when available for interactive browser debugging +- Inspect actual DOM and Shadow DOM states in real-time +- Execute JavaScript in the browser context to test behavior +- Capture screenshots and performance traces for analysis +- This is especially useful for debugging complex Web Component interactions + +### Python Testing + +Use `pytest`: + +- Write clear, focused test functions +- Use fixtures for setup/teardown +- Use parametrize for testing multiple cases +- Keep tests fast and isolated + +**Python Type Checking:** + +Use `ty` for static type checking (NOTE: `ty` is a separate tool, NOT Pyright itself): + +- Run `uv run ty` to type check Python code +- Use `uv run ty --watch` for continuous checking +- Configure strictness in `pyproject.toml` under `[tool.pyright]` (ty uses Pyright under the hood) +- Type checking modes: `basic`, `standard` (default), or `strict` +- Always add type hints to function signatures and complex variables + +**Python Code Quality Tools:** + +Use additional tools for code quality: + +- **Vulture**: Detect dead/unused code (`uv run vulture src/`) + - Reports functions, classes, variables, imports that are never used + - Configure `min_confidence` in `pyproject.toml` (default: 80) + - Useful for finding code that can be safely removed + +- **django-upgrade**: Modernize Django code (Django projects only) + - Run `uv run django-upgrade --target-version 5.1 src/**/*.py` + - Updates deprecated Django patterns to modern equivalents + - Automatically fixes outdated code + - Only run on Django projects + +- **Note**: pyupgrade functionality is already handled by Ruff's UP rules + - Ruff includes all pyupgrade checks in the "UP" rule selector + - No need to run pyupgrade separately + +### General Testing Guidelines + +- Write tests for critical functionality +- Test edge cases and error conditions +- Keep tests focused and maintainable +- Use descriptive test names +- Aim for high coverage but focus on meaningful tests + +--- + +## Accessibility + +- Follow WCAG 2.2 guidelines when applicable +- Use semantic HTML when working with markup +- Prefer native HTML elements over ARIA when possible +- Ensure keyboard navigation works correctly +- Test with screen readers when building UI components +- Use proper ARIA roles, states, and properties +- Ensure focus management is correct +- Provide text alternatives for non-text content + +--- + +## Common Mistakes to Avoid + +### DON'T + +1. **Don't make assumptions** - ask for clarification when uncertain +2. **Don't ignore performance** - always consider the impact of your changes +3. **Don't use `any` type** - use proper types or `unknown` +4. **Don't skip error handling** - handle edge cases and errors appropriately +5. **Don't mix concerns** - keep code modular and focused +6. **Don't ignore existing patterns** - follow established conventions in the codebase +7. **Don't commit commented-out code** - remove it or explain why it's needed +8. **Don't hardcode values** - use constants, config files, or environment variables +9. **Don't duplicate code** - extract shared logic into reusable functions +10. **Don't forget to update tests** - keep tests in sync with code changes +11. **Don't use `innerHTML` without sanitization** - XSS risk +12. **Don't forget Shadow DOM encapsulation** - styles and queries don't cross boundaries +13. **Don't leak memory** - clean up event listeners in `disconnectedCallback` + +### DO + +1. **Do ask questions** when the path forward is unclear +2. **Do consider performance** in all decisions +3. **Do follow existing patterns** in the codebase +4. **Do write clear, self-documenting code** with good variable names +5. **Do handle errors gracefully** with appropriate error messages +6. **Do keep functions small and focused** - single responsibility principle +7. **Do use meaningful names** for variables, functions, and types +8. **Do write tests** for new functionality +9. **Do keep dependencies up to date** - but test after updating +10. **Do document complex logic** with comments explaining "why" +11. **Do use Shadow DOM** when you need style encapsulation +12. **Do dispatch custom events** for component communication +13. **Do use slots** for flexible content composition +14. **Do implement proper lifecycle methods** for setup and cleanup + +--- + +## File Organization + +### Web Components Projects + +``` +src/ + components/ # Custom element definitions + my-component.ts + another-component.ts + utils/ # Utility functions + styles/ # Shared styles + types/ # TypeScript type definitions +tests/ # Test files (if separate from src/) +``` + +### Python Projects + +``` +src/ + module_name/ + __init__.py + module.py +tests/ + test_module.py +``` + +### Hybrid Projects + +Organize by feature or domain, with clear separation between Python and TypeScript/JavaScript code. + +### General Guidelines + +- Keep related files together +- Use consistent file naming conventions (kebab-case for files, PascalCase for classes) +- Organize by feature or domain when appropriate +- Keep the project structure flat when possible +- Don't create unnecessary nesting + +--- + +## Import/Export Patterns + +### TypeScript/JavaScript + +- Use path aliases configured in `tsconfig.json` (`@/`, `~/`, `@components/`, etc.) +- Prefer named exports over default exports +- Group imports logically: + 1. External dependencies (lit, third-party) + 2. Internal modules (@/, ~/) + 3. Relative imports (../, ./) + 4. Type imports (separate `import type` statements) + +Example: + +```typescript +import { LitElement, html, css } from "lit"; +import { customElement, property } from "lit/decorators.js"; + +import { someUtil } from "@/utils/helpers"; +import { sharedStyles } from "@styles/shared"; + +import type { MyType } from "@types/common"; +``` + +### Python + +- Follow PEP 8 import ordering +- Use absolute imports when possible +- Group imports: + 1. Standard library + 2. Third-party packages + 3. Local application imports + +--- + +## Git and Version Control + +- Write clear, descriptive commit messages +- Use gitmoji prefixes for commit messages (e.g., ✨ for new features, 🐛 for bug fixes, 📝 for documentation) +- Commit frequently - don't wait until everything is perfect +- Keep commits focused on a single change +- Follow the project's branching strategy +- Don't commit generated files or secrets +- Keep pull requests reasonably sized + +--- + +## Browser/Platform Support + +### Web Components + +- Target modern browsers (ES2022+) +- Use native Custom Elements (no polyfills needed for modern browsers) +- Test in Chromium, Firefox, and WebKit +- Be aware of Safari quirks with Shadow DOM and custom elements + +### Python + +- Target Python 3.11+ (adjust based on project) +- Use type hints for Python 3.11+ features +- Be aware of breaking changes between Python versions + +--- + +## Dependencies + +### Ask Before Adding Dependencies + +Before adding new dependencies: + +1. Is this dependency necessary? +2. Are there alternatives already in the project? +3. What is the bundle size impact? +4. Is it actively maintained? +5. Does it have known security issues? +6. Is it tree-shakeable? + +**Always ask the user before adding new dependencies.** + +### Web Components Dependencies + +- Prefer native Web APIs over libraries +- Use Lit for reactive components when complexity warrants it +- Keep bundle size small - Web Components should be lightweight +- Avoid large framework dependencies (React, Vue, Angular) + +--- + +## Language-Specific Guidelines + +### TypeScript + +- Use ES2022+ features when appropriate +- Prefer `const` over `let`, avoid `var` +- Use async/await over raw promises +- Use optional chaining (`?.`) and nullish coalescing (`??`) +- Avoid deeply nested code +- Use `satisfies` operator for type checking without widening + +### JavaScript + +- Prefer TypeScript for new files +- If writing vanilla JS, add JSDoc types +- Follow the same patterns as TypeScript code + +### CSS + +- Use modern CSS features (custom properties, grid, flexbox, container queries) + +### Python + +- Follow PEP 8 style guide +- Use type hints (Python 3.11+ syntax) - **always type function signatures** +- Run `uv run ty` to validate type hints +- Write docstrings for functions and classes (Google or NumPy style) +- Use context managers for resource management +- Prefer list comprehensions and generators +- Use dataclasses or Pydantic for structured data +- Import types from `typing` when needed (e.g., `List`, `Dict`, `Optional`, `Union`) + +### HTML + +- Use semantic HTML5 elements +- Ensure proper document structure +- Include appropriate meta tags +- Use ARIA only when necessary +- Keep markup clean and minimal +- For Web Components, use slots for content projection + +--- + +## Security + +- Never commit secrets, API keys, or passwords +- Validate and sanitize user input +- Use parameterized queries for database access +- Follow OWASP guidelines for web security +- Be cautious with `eval()` and similar dynamic execution +- Use HTTPS for external requests +- Handle authentication and authorization properly +- Sanitize HTML when using `innerHTML` (prefer `textContent` or template literals) +- Be careful with custom event data - don't leak sensitive info + +--- + +## Web Components Specific + +### Shadow DOM + +- Use Shadow DOM for style encapsulation +- Understand the difference between open and closed Shadow Roots +- Use `:host`, `:host()`, and `:host-context()` for styling +- Use `::slotted()` for styling slotted content +- Use `::part()` for exposing styleable parts + +### Custom Events + +- Use `CustomEvent` with descriptive names +- Namespace event names to avoid conflicts (e.g., `my-component:change`) +- Include relevant data in `detail` property +- Set `bubbles: true` if event should bubble +- Set `composed: true` if event should cross Shadow DOM boundary +- Document all custom events + +### Attributes vs Properties + +- Reflect important properties as attributes (for CSS selectors and HTML) +- Use primitive types for attributes (string, number, boolean) +- Use properties for complex types (objects, arrays) +- Convert between attributes and properties appropriately +- Follow naming conventions: `kebab-case` for attributes, `camelCase` for properties + +### Lifecycle + +- Initialize in `constructor()` (but don't manipulate DOM or attributes) +- Set up in `connectedCallback()` (add event listeners, fetch data) +- Clean up in `disconnectedCallback()` (remove event listeners, cancel timers) +- Handle attribute changes in `attributeChangedCallback()` +- For Lit, use `firstUpdated()`, `updated()`, and `willUpdate()` lifecycle methods + +--- + +## Questions or Uncertainty? + +**When in doubt, ASK!** This is the most important rule. + +It's better to ask for clarification than to make incorrect assumptions about: + +- Project requirements +- Implementation approaches +- Design decisions +- Architecture patterns +- Conventions and standards +- Any aspect of the codebase + +--- + +## Working with This Project + +### First Steps + +When you first start working with this project: + +1. **Ask about the project type**: What kind of project is this? (library, application, Django site, 11ty site, etc.) +2. **Ask about tech stack**: Web Components? Lit? Python? Hybrid? +3. **Ask about conventions**: Are there coding standards or style guides to follow? +4. **Ask about priorities**: What are the most important considerations? (performance, accessibility, maintainability, etc.) +5. **Ask about workflow**: What is the development and deployment process? + +### Ongoing Work + +- Read existing code to understand established patterns +- Follow the conventions you see in the codebase +- Ask questions when you encounter ambiguity +- Suggest improvements when you see opportunities +- Be respectful of existing decisions while offering alternatives + +--- + +## Communication + +- Be clear and concise in explanations +- Provide context for decisions +- Explain trade-offs when multiple approaches exist +- Use examples to illustrate complex concepts +- Be open to feedback and alternative approaches + +--- + +**Remember**: Every project is different. These guidelines are a starting point, but always defer to project-specific requirements and user preferences. **When in doubt, ask!** diff --git a/.prettierignore b/.prettierignore index f8b2b25..c07d1e3 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,5 @@ +# >>> pedantry +# pedantry 2.0.2: managed by pedantry sync, do not edit. # Dependencies node_modules @@ -34,3 +36,8 @@ coverage .env .env.local *.backup.* + +# Written by pedantry sync +.pedantry +lefthook.yml +# <<< pedantry diff --git a/.prettierrc.json5 b/.prettierrc.json5 deleted file mode 100644 index d25010f..0000000 --- a/.prettierrc.json5 +++ /dev/null @@ -1,4 +0,0 @@ -{ - // Using Prettier defaults - no custom configuration - // This ensures consistency across all developers -} diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..da3e4d1 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,3 @@ +# Agent Instructions + +@.pedantry/AGENTS.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..43c994c --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md diff --git a/custom-elements-manifest.config.js b/custom-elements-manifest.config.js index 16d308b..e2f8000 100644 --- a/custom-elements-manifest.config.js +++ b/custom-elements-manifest.config.js @@ -1,18 +1,5 @@ // @ts-check -/** - * Custom Elements Manifest configuration - * - * Generates custom-elements.json for Web Components - * This file is used by VS Code, IDEs, and documentation tools - * to provide autocomplete and documentation for custom elements. - */ +import { customElementsManifestConfig } from "@dryan/pedantry/custom-elements-manifest"; -export default { - globs: ["src/**/*.ts"], - exclude: ["src/**/*.test.ts", "src/**/*.spec.ts"], - outdir: ".", - - // Lit-specific plugin - plugins: [], -}; +export default customElementsManifestConfig(); diff --git a/eslint.config.ts b/eslint.config.ts index 7c520b0..976de51 100644 --- a/eslint.config.ts +++ b/eslint.config.ts @@ -1,124 +1,10 @@ import type { Linter } from "eslint"; -import eslint from "@eslint/js"; -import tseslint from "typescript-eslint"; -import prettierConfig from "eslint-config-prettier"; -import json from "@eslint/json"; -import globals from "globals"; -import { fileURLToPath } from "node:url"; -import { dirname } from "node:path"; - -const __dirname = dirname(fileURLToPath(import.meta.url)); +import pedantryConfig from "@dryan/pedantry/eslint"; const config: Linter.Config[] = [ + ...pedantryConfig, { - // Global ignores - ignores: [ - ".pedantry/**", - "node_modules/**", - "dist/**", - "docs/dist/**", - "docs/sentry-init.js", - "docs/sentry-init.js.map", - "build/**", - ".vscode/**", - ".rollup.cache/**", - "coverage/**", - "package-lock.json", - "*.backup.*", - "*.js", // Ignore generated JS files - "!*.config.js", // But don't ignore config files - "!eslint.config.js", - "!eslint.config.ts", - "!rollup.config.js", - "!web-test-runner.config.js", - "!scripts/**/*.js", - // Python - "__pycache__/**", - "*.pyc", - ".pytest_cache/**", - ".ruff_cache/**", - "*.egg-info/**", - ".venv/**", - "venv/**", - ], - }, - - // JSON files - { - files: ["**/*.json"], - ignores: ["**/tsconfig*.json"], // Exclude tsconfig which has comments - language: "json/json", - ...json.configs.recommended, - }, - - // JSONC files (JSON with Comments like tsconfig.json) - { - files: ["**/tsconfig*.json"], - language: "json/jsonc", - ...json.configs.recommended, - }, - - // Base configs - { - ...eslint.configs.recommended, - files: ["**/*.{js,ts,jsx,tsx}"], - }, - ...tseslint.configs.recommended.map((config) => ({ - ...config, - files: ["**/*.{js,ts,jsx,tsx}"], - languageOptions: { - ...config.languageOptions, - parserOptions: { - ...config.languageOptions?.parserOptions, - tsconfigRootDir: __dirname, - projectService: true, - }, - }, - })), - { - ...prettierConfig, - files: ["**/*.{js,ts,jsx,tsx}"], - }, - - // JavaScript/TypeScript files - custom rules - { - files: ["**/*.js", "**/*.ts"], - rules: { - // Web Components often use property decorators - "@typescript-eslint/no-unused-vars": [ - "error", - { - argsIgnorePattern: "^_", - varsIgnorePattern: "^_", - // Ignore decorator-related unused vars - ignoreRestSiblings: true, - }, - ], - }, - }, - - // Config files - add Node.js globals - { - files: ["*.config.js", "*.config.ts", "scripts/**/*.js", "scripts/**/*.ts"], - languageOptions: { - globals: globals.node, - }, - }, - - // Browser-based files - add browser globals - { - files: ["src/**/*.js", "src/**/*.ts"], - languageOptions: { - globals: globals.browser, - }, - }, - - // Test files - add test globals - { - files: ["**/*.test.js", "**/*.test.ts", "**/*.spec.js", "**/*.spec.ts"], - languageOptions: { - globals: globals.jest, - }, + ignores: ["docs/dist/**", "docs/sentry-init.js", "docs/sentry-init.js.map"], }, ]; diff --git a/lefthook-local.yml b/lefthook-local.yml new file mode 100644 index 0000000..1769a98 --- /dev/null +++ b/lefthook-local.yml @@ -0,0 +1,6 @@ +# Repo-specific lefthook config, moved out of lefthook.yml by pedantry migrate. +# lefthook merges this file into the managed lefthook.yml. +pre-push: + commands: + fetch-flags: + run: npm run fetch-flags diff --git a/lefthook.yml b/lefthook.yml index 1ace9d3..5b1f00e 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -1,8 +1,5 @@ -pre-push: - commands: - fetch-flags: - run: npm run fetch-flags - +# pedantry 2.0.2: managed by pedantry sync, do not edit. +# Repo-specific hooks go in lefthook-local.yml, which lefthook merges in. pre-commit: parallel: false commands: @@ -13,11 +10,10 @@ pre-commit: FILES=$(for f in {staged_files}; do [ -f "$f" ] && [ ! -L "$f" ] && echo "$f" done) - echo "Sending to prettier: $FILES" [ -z "$FILES" ] || npx prettier --write $FILES stage_fixed: true - # Lint JavaScript/TypeScript + # Lint JavaScript and TypeScript eslint: glob: "*.{js,ts,json}" run: | @@ -26,3 +22,13 @@ pre-commit: done) [ -z "$FILES" ] || npx eslint --fix $FILES stage_fixed: true + + # Lint CSS + stylelint: + glob: "*.css" + run: | + FILES=$(for f in {staged_files}; do + [ -f "$f" ] && echo "$f" + done) + [ -z "$FILES" ] || npx stylelint --fix $FILES + stage_fixed: true diff --git a/package-lock.json b/package-lock.json index fe306ac..5bc4374 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "license": "MIT", "devDependencies": { "@custom-elements-manifest/analyzer": "*", + "@dryan/pedantry": "github:dryan-org/pedantry#v2.0.2", "@eslint/js": "*", "@eslint/json": "^0.14.0", "@rollup/plugin-commonjs": "*", @@ -474,6 +475,22 @@ "custom-elements-manifest": "dist/index.js" } }, + "node_modules/@dryan/pedantry": { + "version": "2.0.2", + "resolved": "git+ssh://git@github.com/dryan-org/pedantry.git#df58c2d1a459a4230626386f12a2ea8deb052e5d", + "dev": true, + "license": "ISC", + "dependencies": { + "@eslint/js": "^10.0.1", + "@eslint/json": "^0.14.0", + "eslint-config-prettier": "^10.1.8", + "globals": "^17.13.0", + "jiti": "^2.7.0", + "stylelint-config-recess-order": "^7.8.2", + "stylelint-config-standard": "^40.0.0", + "typescript-eslint": "^8.72.0" + } + }, "node_modules/@emnapi/runtime": { "version": "1.11.3", "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz", @@ -3332,17 +3349,17 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.70.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.70.0.tgz", - "integrity": "sha512-/v8HZt6RlyIZxB3ntehELOcUcfxKPVGWXnQdJuHRmzrqgF8nQypcC/oxGW+Ot4VGKDq81XugPKxx0n5PBtf9PA==", + "version": "8.72.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.72.0.tgz", + "integrity": "sha512-aysKgysPX9XOv/dk95UkvUDe++Q3n3dJPG9CEWT3RUccxfkPJ+Qn6nhKPDhZXU6Ofo9kgwGWwKyQCnZIXTgngg==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.12.2", - "@typescript-eslint/scope-manager": "8.70.0", - "@typescript-eslint/type-utils": "8.70.0", - "@typescript-eslint/utils": "8.70.0", - "@typescript-eslint/visitor-keys": "8.70.0", + "@typescript-eslint/scope-manager": "8.72.0", + "@typescript-eslint/type-utils": "8.72.0", + "@typescript-eslint/utils": "8.72.0", + "@typescript-eslint/visitor-keys": "8.72.0", "ignore": "^7.0.5", "natural-compare": "^1.4.0", "ts-api-utils": "^2.5.0" @@ -3355,15 +3372,15 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^8.70.0", + "@typescript-eslint/parser": "^8.72.0", "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { - "version": "7.0.9", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.9.tgz", - "integrity": "sha512-brTTsvFRt5C1gGHtPst/281UjPD5t9fBqbgoMPlVWy11ZLTPfu7HxK4ZYqO9H7o/yC9rSTCI85EaQ4OoY12qYw==", + "version": "7.0.13", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.13.tgz", + "integrity": "sha512-2E8Q6rh+1RRSq/YdaGsNfXsEZy9FVqv6BSSrkmZJP7BnaoPnRfKL+YaofPvP+5rzdk144qSm6i4+hvPgUcbV4Q==", "dev": true, "license": "MIT", "engines": { @@ -3371,16 +3388,16 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.70.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.70.0.tgz", - "integrity": "sha512-zYvrmj9Yxd63UGaXw+kdt6A0F0s0qveJyuatIM77bYC2DE4pgmg7a50u8LR7PRtXd0x+h+Tl3eXabGm06SWd3Q==", + "version": "8.72.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.72.0.tgz", + "integrity": "sha512-0O+x3ynciD6zuXb1CKSu165haQV6ey53DKhHHUnujP7U+XlltJG+/keT0Xhd1HXCze+IHf7Tvt39ovyepX/LNw==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/scope-manager": "8.70.0", - "@typescript-eslint/types": "8.70.0", - "@typescript-eslint/typescript-estree": "8.70.0", - "@typescript-eslint/visitor-keys": "8.70.0", + "@typescript-eslint/scope-manager": "8.72.0", + "@typescript-eslint/types": "8.72.0", + "@typescript-eslint/typescript-estree": "8.72.0", + "@typescript-eslint/visitor-keys": "8.72.0", "debug": "^4.4.3" }, "engines": { @@ -3396,14 +3413,14 @@ } }, "node_modules/@typescript-eslint/project-service": { - "version": "8.70.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.70.0.tgz", - "integrity": "sha512-hFHbTNqhU9G+2eKFXCBVb1tjFT/LceiJ4+HfLO4pTpDI0KHi6iajpcFFkaSQ9gXmCh7n82A0PthaayEdN6mspQ==", + "version": "8.72.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.72.0.tgz", + "integrity": "sha512-bzHngBbmIgzj6TsTjVUCntGx6FFLgE7mPjpO0PzHycOaZHXqS43XnrkFIHRS16LLr/xO6FHSXG3GJFo/F4bSBQ==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/tsconfig-utils": "^8.70.0", - "@typescript-eslint/types": "^8.70.0", + "@typescript-eslint/tsconfig-utils": "^8.72.0", + "@typescript-eslint/types": "^8.72.0", "debug": "^4.4.3" }, "engines": { @@ -3418,14 +3435,14 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.70.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.70.0.tgz", - "integrity": "sha512-8nP3Kwh5hlgZ4FicGvmznAmJe8UL4sdU8tLukrPaMuQmDuk4Y8xYfzu/aYZW4xT2JCgc7H/TpDI5cGlxcWJSqQ==", + "version": "8.72.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.72.0.tgz", + "integrity": "sha512-JewPyJOYcXBSAS7PIgufscHOwZqhTGyBRiQJhhuDln66tMchxvvt7nJ90JKKIoOelmdHA3kAQbm9cEUHc4JSEA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.70.0", - "@typescript-eslint/visitor-keys": "8.70.0" + "@typescript-eslint/types": "8.72.0", + "@typescript-eslint/visitor-keys": "8.72.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -3436,9 +3453,9 @@ } }, "node_modules/@typescript-eslint/tsconfig-utils": { - "version": "8.70.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.70.0.tgz", - "integrity": "sha512-adnkeeNq9Sq1sUf4+FRVc0KdgYghzsgFpZSQVZVvY0LCuUuN0FnQgyGzCJeC4fW1cdXseBAjU2EOqUIjbNcZUw==", + "version": "8.72.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.72.0.tgz", + "integrity": "sha512-0vbxCf7xLVPSjcOdm6eQbgViH8EDJ8xnl1laLT9yoqSz2YmcSfSg5Vdl0JUvZf6rcuJ0ZivJIuMD4edTg8obaA==", "dev": true, "license": "MIT", "engines": { @@ -3453,15 +3470,15 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.70.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.70.0.tgz", - "integrity": "sha512-NUMKIhYVaVIVLnRL9CRt+VVcuLgSHUCpXn4/+K8wql+vdInUzvx8BjUO1oJ7cG9shjFJKtF8F8Hh2kCh3/KBVw==", + "version": "8.72.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.72.0.tgz", + "integrity": "sha512-gEXxmmbSTSOVTC37IYYvremOM31v+UN2W772bJxmVYPhAOPSUxtacyb7wkm1EhkYKU6KzFJsdU44DCV4to0LWw==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.70.0", - "@typescript-eslint/typescript-estree": "8.70.0", - "@typescript-eslint/utils": "8.70.0", + "@typescript-eslint/types": "8.72.0", + "@typescript-eslint/typescript-estree": "8.72.0", + "@typescript-eslint/utils": "8.72.0", "debug": "^4.4.3", "ts-api-utils": "^2.5.0" }, @@ -3478,9 +3495,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.70.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.70.0.tgz", - "integrity": "sha512-asTOIYhDg4zdzOScCyaytrsV3cR6B4ecPQlXw/dJIm7J/MZTtCtfVII9JD8Geh4jTCrK/Xe6cg5UevoleMcoJQ==", + "version": "8.72.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.72.0.tgz", + "integrity": "sha512-Adfoy59kxNEjT5E5fnyrp7GpHYuWs8ONbdohu4ez6IU46qDq8LltG90tLmkucZB2uhYL8mqBjtXqGd8yhfjXqQ==", "dev": true, "license": "MIT", "engines": { @@ -3492,16 +3509,16 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.70.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.70.0.tgz", - "integrity": "sha512-d9NmHMPEKQ7QCLLm1jI3zmoQBwT5KwFYjXBJ9ymZfKCUU+5rmTRykKAFvH5Qn/ZCds3CEAFS9OC9M/jkl0X2bA==", + "version": "8.72.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.72.0.tgz", + "integrity": "sha512-gwLfFgWcw15tN2KXDCJvxEOQjPn+P3j/n3eSqkZ5sX4VpW9Cosodr+tWwBZRvJT3TcKx6HnPRGZMCNAiP1Xhug==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/project-service": "8.70.0", - "@typescript-eslint/tsconfig-utils": "8.70.0", - "@typescript-eslint/types": "8.70.0", - "@typescript-eslint/visitor-keys": "8.70.0", + "@typescript-eslint/project-service": "8.72.0", + "@typescript-eslint/tsconfig-utils": "8.72.0", + "@typescript-eslint/types": "8.72.0", + "@typescript-eslint/visitor-keys": "8.72.0", "debug": "^4.4.3", "minimatch": "^10.2.2", "semver": "^7.7.3", @@ -3520,16 +3537,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.70.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.70.0.tgz", - "integrity": "sha512-oZmtKJz/4fufZ2p3+Cn3ijEojcdfR+1zYDH2xKYrEly0dR/Q/1xUPRCOlKGxod78nWlU2UnDe09GZ3TaknBFGA==", + "version": "8.72.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.72.0.tgz", + "integrity": "sha512-0up3oArJZBYnzOaEXKo8DmI43QvMZyPoFEt9LWzRJcyl/RcJjfKKPebknN1VbTgXBf3M/KggUh5uUMdURLnseg==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.9.1", - "@typescript-eslint/scope-manager": "8.70.0", - "@typescript-eslint/types": "8.70.0", - "@typescript-eslint/typescript-estree": "8.70.0" + "@typescript-eslint/scope-manager": "8.72.0", + "@typescript-eslint/types": "8.72.0", + "@typescript-eslint/typescript-estree": "8.72.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -3544,13 +3561,13 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.70.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.70.0.tgz", - "integrity": "sha512-BoC8PiO4Hkdo0TVJh9Ntxr5MxPDI7/oFsrygN5ADelFSeXG/qgNuucIGA+L5Z6JpPTE/uRfcTWtscjbUaufepQ==", + "version": "8.72.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.72.0.tgz", + "integrity": "sha512-E2mroviasaWecDzTGiGMtuEguuLVOeRggnrIn93CJuxYJzQBHbyymlT08aVQydbBal5538o+JkBKXh2sRuCyIA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.70.0", + "@typescript-eslint/types": "8.72.0", "eslint-visitor-keys": "^5.0.0" }, "engines": { @@ -5883,9 +5900,9 @@ } }, "node_modules/globals": { - "version": "17.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-17.12.0.tgz", - "integrity": "sha512-cezEd/DTyyht9cvSSURyygXPfy04GtWO/5e6ZPvH7fCtjKz9PYOmuawphw1Ctd1f6C+5JypXfGD7ahNMXvevBA==", + "version": "17.13.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-17.13.0.tgz", + "integrity": "sha512-RwMTC61u7hrG3ZJMkZQOK4JLJrKS8QtoTii63EmWvFXHqycY9FObBJQCbsLxSO8kjKhWE5kV1GC+Vb1g3RI0Zg==", "dev": true, "license": "MIT", "engines": { @@ -8782,9 +8799,9 @@ } }, "node_modules/stylelint-config-recess-order": { - "version": "7.8.0", - "resolved": "https://registry.npmjs.org/stylelint-config-recess-order/-/stylelint-config-recess-order-7.8.0.tgz", - "integrity": "sha512-ObYusdkXavm8ulgb5xvmU1l8wgCdveNYG12hOTUEdjS8bNhSRggl4or0mE0JaOnQz+Ve2xZemVpwqERCgJbntg==", + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/stylelint-config-recess-order/-/stylelint-config-recess-order-7.8.2.tgz", + "integrity": "sha512-IIRCTkrGiynshEapnjdc53Nq/EaoqdWr/5U0Kk42b9O026+CmgBu4BHQPraWdV98E/U/XsotAhWZXs5gS7/7Zw==", "dev": true, "license": "ISC", "peerDependencies": { @@ -9292,16 +9309,16 @@ } }, "node_modules/typescript-eslint": { - "version": "8.70.0", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.70.0.tgz", - "integrity": "sha512-P/W5cz70/cQAuKfY3xwQMWWTV7BvJ0mAQmi+9mBcsVPaBUpd6Ohpa+fECv9rBFrQcig86jAiNBFNWUqnTjr4pw==", + "version": "8.72.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.72.0.tgz", + "integrity": "sha512-r26Fkc8As+mZvqp7SLsMmNFyYUup/6CjK7/eHBHmhOw6GH6n6YFxHVFrG0jN1c5CMpDzelLPxvgeCOzx7BjN+A==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/eslint-plugin": "8.70.0", - "@typescript-eslint/parser": "8.70.0", - "@typescript-eslint/typescript-estree": "8.70.0", - "@typescript-eslint/utils": "8.70.0" + "@typescript-eslint/eslint-plugin": "8.72.0", + "@typescript-eslint/parser": "8.72.0", + "@typescript-eslint/typescript-estree": "8.72.0", + "@typescript-eslint/utils": "8.72.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" diff --git a/package.json b/package.json index 29e9b1a..9e4325d 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,7 @@ }, "devDependencies": { "@custom-elements-manifest/analyzer": "*", + "@dryan/pedantry": "github:dryan-org/pedantry#v2.0.2", "@eslint/js": "*", "@eslint/json": "^0.14.0", "@rollup/plugin-commonjs": "*", @@ -93,5 +94,6 @@ "vitest": "^4.1.11", "wrangler": "^4.147.0" }, - "customElements": "custom-elements.json" + "customElements": "custom-elements.json", + "prettier": "@dryan/pedantry/prettier" } diff --git a/pedantry.toml b/pedantry.toml new file mode 100644 index 0000000..bc793f2 --- /dev/null +++ b/pedantry.toml @@ -0,0 +1,4 @@ +# Pins the pedantry version for this repo. Edit `version`, then run +# `pedantry sync --upgrade` with that version. +version = "2.0.2" +types = ["typescript", "css"] diff --git a/rollup.config.js b/rollup.config.js index 2af3041..0cbd30c 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,14 +1,5 @@ // @ts-check -/** - * Rollup configuration for Web Components - * - * This is a template configuration. Adjust based on your project needs: - * - Add/remove plugins as needed - * - Adjust input/output paths - * - Configure for library vs application builds - */ - import { copyFileSync, mkdirSync, readFileSync, writeFileSync } from "node:fs"; import resolve from "@rollup/plugin-node-resolve"; import commonjs from "@rollup/plugin-commonjs"; @@ -16,17 +7,13 @@ import typescript from "@rollup/plugin-typescript"; import terser from "@rollup/plugin-terser"; import json from "@rollup/plugin-json"; import summary from "rollup-plugin-summary"; +import { rollupConfig } from "@dryan/pedantry/rollup"; // Set to true for production builds const production = !process.env["ROLLUP_WATCH"]; -const libraryBuild = { +const libraryBuild = rollupConfig({ input: "src/index.ts", - output: { - dir: "dist", - format: "es", - sourcemap: true, - }, plugins: [ // Resolve bare module specifiers to relative paths resolve(), @@ -81,13 +68,13 @@ const libraryBuild = { clearScreen: false, }, - preserveEntrySignatures: "strict", -}; + external: [], +}); // Error reporting for the demo site only (docs/index.html) - deliberately // separate from libraryBuild above so Sentry never ends up in dist/ or the // published npm package that other people's pages load as . -const demoSentryBuild = { +const demoSentryBuild = rollupConfig({ input: "demo/sentry-init.ts", output: { dir: "docs", @@ -112,7 +99,7 @@ const demoSentryBuild = { }), summary(), ], - preserveEntrySignatures: "strict", -}; + external: [], +}); -export default [libraryBuild, demoSentryBuild]; +export default Promise.all([libraryBuild, demoSentryBuild]); diff --git a/stylelint.config.mjs b/stylelint.config.mjs index 0e92354..dd5b773 100644 --- a/stylelint.config.mjs +++ b/stylelint.config.mjs @@ -1,36 +1,5 @@ export default { - extends: ["stylelint-config-standard", "stylelint-config-recess-order"], - rules: { - "declaration-no-important": true, - "font-weight-notation": "numeric", - "custom-property-pattern": [ - "^(__?)?([a-z][a-z0-9]*)(-[a-z0-9]+)*$", - { - message: - "Expected custom property name to be kebab-case, optionally prefixed with __ or _", - }, - ], - // Allow :host and ::slotted for Web Components - "selector-pseudo-class-no-unknown": [ - true, - { - ignorePseudoClasses: ["host", "host-context"], - }, - ], - "selector-pseudo-element-no-unknown": [ - true, - { - ignorePseudoElements: ["slotted", "part"], - }, - ], - // Allow @property for CSS custom properties - "at-rule-no-unknown": [ - true, - { - ignoreAtRules: ["property"], - }, - ], - }, + extends: ["@dryan/pedantry/stylelint"], ignoreFiles: [ "node_modules/**", "dist/**", diff --git a/tsconfig.json b/tsconfig.json index 345b538..75d869a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,39 +1,8 @@ { + "extends": "@dryan/pedantry/tsconfig", "compilerOptions": { - // Target modern browsers and Node.js - "target": "ES2022", - "module": "ESNext", - "lib": ["ES2022", "DOM", "DOM.Iterable"], - - // Module resolution - "moduleResolution": "Bundler", - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - - // Output "outDir": "dist", - "declaration": true, - "declarationMap": true, - "sourceMap": true, - - // Strict type checking - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "noUncheckedIndexedAccess": true, - "noPropertyAccessFromIndexSignature": true, - - // Other options - "allowJs": true, - "checkJs": false, - "forceConsistentCasingInFileNames": true, - "skipLibCheck": true, - "resolveJsonModule": true, "ignoreDeprecations": "6.0", - - // Path aliases - customize per project "baseUrl": ".", "paths": { "@/*": ["src/*"],