diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..f4c7245 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,40 @@ +# EditorConfig — https://editorconfig.org +# Keeps whitespace consistent across editors and IDEs before +# Prettier / rustfmt / ruff get a chance to run. + +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +# Markdown: trailing spaces are significant (hard line-break). +# Let Prettier handle wrapping; don't trim here. +trim_trailing_whitespace = false + +[*.{yml,yaml}] +indent_size = 2 + +[*.{json,jsonc}] +indent_size = 2 + +[*.toml] +indent_size = 4 + +[Makefile] +indent_style = tab + +[*.rs] +# rustfmt handles Rust formatting; EditorConfig just sets the baseline. +indent_size = 4 + +[*.py] +indent_size = 4 + +[*.{cpp,cc,c,h,hpp}] +indent_size = 4 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c8ad60a..5e71cb6 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,22 +1,54 @@ -name: lint +# The org-wide lint gate. Drop this file in as +# .github/workflows/lint.yml and change nothing else. +# +# The five checks it publishes are exactly the five contexts the +# org ruleset requires: +# +# lint / actionlint +# lint / JSON validity +# lint / prettier +# lint / markdownlint +# lint / yamllint +# +# Those strings come from the job being called `lint` and calling a +# reusable workflow - a check publishes as " / ". +# Do NOT convert this to a matrix: a matrix publishes +# "lint (actionlint)" instead and will not satisfy the ruleset. +# +# Also copy .prettierrc, .prettierignore, .markdownlint.jsonc and +# .yamllint.yaml from nyuchi/.github into your repo root. + +name: Lint on: pull_request: push: - branches: [master] - -permissions: - contents: read + # Every default-branch name in the estate: `main` covers 68 repos, + # `master` covers siafudb-kuzu, `scaffold` covers shamwari-core, + # shamwari-gateway and shamwari-web. Drop a name and merging to that + # repo's default branch fires nothing, so the five contexts never + # land on the default-branch head - which is how `lint / prettier` + # stayed red in bundu-labs/.github from 2026-05-02 unnoticed. + # + # A list rather than a bare `push:`, because unfiltered push would + # run the gate on every feature-branch push in 74 repos and bill it + # twice per PR. Add a name here if a repo ever adopts a fourth. + branches: [main, master, scaffold] + # Required for repos whose ruleset uses a MERGE QUEUE: required checks + # must report on the gh-readonly-queue/** ref, and only merge_group + # produces that. Without it a queued PR stalls for the full + # check_response_timeout and nothing can ever land. Harmless where + # there is no queue, so it stays in the one identical caller. + merge_group: + workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +permissions: + contents: read jobs: lint: uses: nyuchi/.github/.github/workflows/reusable-lint.yml@main - with: - # .svelte is excluded — formatting it needs prettier-plugin-svelte, - # which the org's reusable-lint workflow does not install. Svelte - # files stay locally-formattable; CI lints the rest. - prettier-glob: "**/*.{md,mdx,json,jsonc,ts,css,mjs}" diff --git a/.markdownlint-cli2.jsonc b/.markdownlint-cli2.jsonc deleted file mode 100644 index 6f188b0..0000000 --- a/.markdownlint-cli2.jsonc +++ /dev/null @@ -1,13 +0,0 @@ -// markdownlint-cli2 config — paths in scope for this repo. -{ - "config": { - "extends": ".markdownlint.jsonc", - }, - "globs": ["**/*.md", "**/*.mdx"], - "ignores": [ - "node_modules/**", - "**/.svelte-kit/**", - "**/.vercel/**", - "build/**", - ], -} diff --git a/.markdownlint.jsonc b/.markdownlint.jsonc index d411079..1a3974c 100644 --- a/.markdownlint.jsonc +++ b/.markdownlint.jsonc @@ -1,13 +1,39 @@ -// markdownlint-cli2 config — relaxed defaults that match nyuchi/.github. +// markdownlint-cli2 config for nyuchi/.github. +// +// Relaxed defaults that accommodate: +// - Long prose lines in docs (we format for readability, not width) +// - Inline HTML in the org profile (
) +// - Files that start with an HTML comment or a
instead of an H1 +// - Fenced code blocks without a language tag // // See https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md { "default": true, + + // Line length — we wrap for readability, not at a fixed column. "MD013": false, + + // Inline HTML — profile/README.md uses
for the + // landing-page layout and that's intentional. "MD033": false, + + // First line must be a top-level heading — profile/README.md opens + // with an HTML comment, which is correct. "MD041": false, + + // Fenced code blocks without a language — acceptable for output + // blocks and plain-text fences. "MD040": false, + + // Duplicate headings are fine as long as they aren't siblings + // (e.g. "## Summary" appears in multiple docs; that's expected). "MD024": { "siblings_only": true }, + + // Unordered list indentation — 2 spaces, matching our house style. "MD007": { "indent": 2 }, - "MD060": false, + + // Table-column-style — re-enabled now that Prettier is in CI and + // auto-formats tables. Prettier's table output should satisfy + // MD060's "aligned" style. + "MD060": true, } diff --git a/.prettierignore b/.prettierignore index 6531a77..b8d69cf 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,5 +1,30 @@ -.svelte-kit -build -.vercel -node_modules +# Prettier ignore for nyuchi/.github. + +# Standard ignores +node_modules/ +.git/ + +# Files with structural meaning that Prettier would harm +LICENSE +CODEOWNERS +CODEOWNERS.example +.github/CODEOWNERS + +# YAML is handled by yamllint and actionlint, not Prettier — they have +# stronger guarantees about GitHub Actions semantics that Prettier does +# not understand (e.g. the `on:` truthy quirk). +*.yml +*.yaml + +# Governance documents are authored by the Founder as legal / formal +# documents. Prettier's markdown formatter reflows numbered paragraphs +# ("2.2 The company pursues...") after a list as loose list-item +# continuations, which corrupts the document's structure. Hand-format +# these files. +profile/governance/ + +# Lockfiles, generated output +*-lock.json +*-lock.yaml package-lock.json +pnpm-lock.yaml diff --git a/.prettierrc b/.prettierrc index de42adf..333987c 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,7 +1,16 @@ { - "semi": true, - "singleQuote": false, + "printWidth": 80, + "proseWrap": "preserve", "tabWidth": 2, + "useTabs": false, + "endOfLine": "lf", "trailingComma": "all", - "printWidth": 80 + "overrides": [ + { + "files": ["*.md", "*.mdx"], + "options": { + "embeddedLanguageFormatting": "off" + } + } + ] } diff --git a/.yamllint.yaml b/.yamllint.yaml index 744516b..61cc7b6 100644 --- a/.yamllint.yaml +++ b/.yamllint.yaml @@ -1,4 +1,9 @@ -# yamllint config — matches nyuchi/.github. +# yamllint config for nyuchi/.github. +# +# Relaxed defaults that accommodate: +# - GitHub Actions workflows (which use `on:` — a YAML 1.1 boolean) +# - Long lines in shell heredocs and comment blocks inside workflows +# - Files without `---` document-start markers # # See https://yamllint.readthedocs.io/en/stable/configuration.html @@ -6,31 +11,72 @@ extends: default ignore: | node_modules/ - .svelte-kit/ - .vercel/ - build/ + # Lockfiles are generated, not authored. .prettierignore already + # exempts them under "Lockfiles, generated output"; yamllint not doing + # the same was an oversight that only stayed hidden because this repo + # has no lockfile. pnpm writes registry deprecation notices verbatim + # into pnpm-lock.yaml, which routinely exceeds the 140-char limit and + # cannot be rewrapped without invalidating the lockfile. + pnpm-lock.yaml + package-lock.json + yarn.lock + **/pnpm-lock.yaml + **/package-lock.json + **/yarn.lock + + # Rails fixtures are ERB TEMPLATES, not YAML documents. campfire's + # test/fixtures/users.yml opens with + # <% password_digest = BCrypt::Password.create("secret123456") %> + # and only becomes valid YAML after Rails renders it, so yamllint + # reports a hard syntax error and always will. The ActionText fixtures + # alongside them are HTML blobs that tests assert on byte-for-byte, so + # rewrapping their long lines would be a test change, not a formatting + # change. Seven files in that repo are ERB-templated YAML; the others + # only parse because their ERB happens to sit inside quoted scalars, + # which is luck rather than correctness. + test/fixtures/ + **/test/fixtures/ rules: + # 140-char limit. Workflow files have legitimately long shell URLs + # (the actionlint download script, action references) and issue- + # template `about:` strings render as a single line in the picker, + # so wrapping them would change user-visible behaviour. 140 is + # tight enough to flag truly excessive lines without forcing + # awkward breaks on URLs. Strict CI fails on any violation. line-length: max: 140 level: error allow-non-breakable-words: true allow-non-breakable-inline-mappings: true + # GitHub Actions uses `on:` as a key, which YAML 1.1 treats as a + # boolean. Disable the truthy check on keys to stop yamllint from + # rejecting every workflow. truthy: check-keys: false level: error + # We don't prefix YAML files with `---`. document-start: disable + # Be lenient about how many spaces follow `#` in comments. comments: min-spaces-from-content: 1 + # Comments-indentation flags standalone comments that don't match the + # indent of surrounding content. Real-world configs use comments to + # delimit sections (long `# ----` separator banners) and to mark + # commented-out blocks at the level of the code they replace, neither + # of which fits the rule cleanly. Disabled. comments-indentation: disable + # GitHub issue forms have deeply nested lists and mappings. indentation: spaces: 2 indent-sequences: consistent + # Stops a warning on the trailing-empty-line check for files that + # end cleanly with a single newline. empty-lines: max-end: 1