diff --git a/.github/workflows/shared-quality.yml b/.github/workflows/shared-quality.yml new file mode 100644 index 0000000..c039096 --- /dev/null +++ b/.github/workflows/shared-quality.yml @@ -0,0 +1,47 @@ +name: Shared quality configuration + +on: + pull_request: + push: + branches: [main] + +permissions: + contents: read + +jobs: + configuration: + runs-on: ubuntu-latest + env: + POLICY_REF: c63c2e8c2ba7e11502934a52ad2ce3734e804cdc + steps: + - uses: actions/checkout@v7 + with: + persist-credentials: false + - uses: actions/setup-node@v7 + with: + node-version: 22 + - run: npm ci --ignore-scripts + - name: Install the exact shared audit provider + run: | + git init --quiet "$RUNNER_TEMP/quality-policy" + git -C "$RUNNER_TEMP/quality-policy" remote add origin https://github.com/cordisx/cordisxmono.git + git -C "$RUNNER_TEMP/quality-policy" fetch --depth=1 origin "$POLICY_REF" + git -C "$RUNNER_TEMP/quality-policy" checkout --quiet --detach FETCH_HEAD + test "$(git -C "$RUNNER_TEMP/quality-policy" rev-parse HEAD)" = "$POLICY_REF" + npm --prefix "$RUNNER_TEMP/quality-policy" ci --ignore-scripts + - name: Check effective configuration and tracked file coverage + run: >- + node "$RUNNER_TEMP/quality-policy/scripts/check-quality.mjs" + --repo "$GITHUB_WORKSPACE" --profile next + --policy-root "$RUNNER_TEMP/quality-policy" --policy-ref "$POLICY_REF" + --json > "$RUNNER_TEMP/quality-consumption.json" + - name: Enforce full-source lint + run: npm run --silent lint:source -- --format json --output-file "$RUNNER_TEMP/source-lint.json" + - uses: actions/upload-artifact@v4 + if: always() + with: + name: quality-results + path: | + ${{ runner.temp }}/quality-consumption.json + ${{ runner.temp }}/source-lint.json + if-no-files-found: warn diff --git a/AGENTS.md b/AGENTS.md index 5f52ae2..93bd02e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -11,3 +11,13 @@ - Choose validation from the affected component's `package.json`. For a documentation-only change, check the diff and local links; report those checks separately from build, runtime, or live-app verification. + +## Shared quality configuration + +The local dprint and ESLint entry points consume an exact formal +[Mono quality configuration](https://github.com/cordisx/cordisxmono/blob/c63c2e8c2ba7e11502934a52ad2ce3734e804cdc/.agents/docs/quality-tooling.md). +The Shared quality configuration CI job checks the installed configuration and +tracked-file coverage; inspect its report for excluded paths. +`npm run lint:source` runs the full source policy as a blocking CI step. +Configuration coverage and full-source lint are separate checks. +Update the dependency, lock, formatter reference and CI provider SHA together. diff --git a/dprint.json b/dprint.json index f42be14..9e2c7f1 100644 --- a/dprint.json +++ b/dprint.json @@ -1,18 +1,6 @@ { - "indentWidth": 2, - "newLineKind": "lf", - "typescript": { - "quoteStyle": "preferSingle", - "jsx.quoteStyle": "preferDouble", - "semiColons": "always", - "module.sortImportDeclarations": "maintain", - "module.sortExportDeclarations": "maintain" - }, - "markdown": { - "textWrap": "maintain" - }, "includes": [ - "**/*.{ts,tsx,js,jsx,mjs,cjs,json,md}" + "**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs,json,md}" ], "excludes": [ "**/node_modules/**", @@ -32,9 +20,9 @@ "plugin/src/assets/portraits/generated.ts", "drizzle/meta/*.json" ], - "plugins": [ - "npm:@dprint/typescript@0.96.1", - "npm:@dprint/json@0.23.0", - "npm:@dprint/markdown@0.23.3" - ] + "extends": "https://raw.githubusercontent.com/cordisx/cordisxmono/c63c2e8c2ba7e11502934a52ad2ce3734e804cdc/tooling/quality/dprint/code.json", + "typescript": { + "jsx.quoteStyle": "preferDouble", + "semiColons": "always" + } } diff --git a/eslint.config.mjs b/eslint.config.mjs index 1cba718..fd06f60 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,11 +1,29 @@ import { defineConfig, globalIgnores } from 'eslint/config'; +import sourcePolicy from '@cordisx/eslint-config'; import nextVitals from 'eslint-config-next/core-web-vitals'; import nextTs from 'eslint-config-next/typescript'; const eslintConfig = defineConfig([ ...nextVitals, ...nextTs, - globalIgnores(['.next/**', 'out/**', 'build/**', 'next-env.d.ts']), + // Build outputs and the same verified generated artifacts excluded by dprint. + globalIgnores([ + '**/node_modules/**', + '**/dist/**', + '**/build/**', + '**/coverage/**', + '**/.cache/**', + '.next/**', + '.vinext/**', + 'out/**', + '.wrangler/**', + 'outputs/**', + 'work/**', + 'next-env.d.ts', + 'plugin/src/assets/identity/generated.ts', + 'plugin/src/assets/portraits/generated.ts', + ]), + { files: ['**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}'], extends: [sourcePolicy] }, ]); export default eslintConfig; diff --git a/package-lock.json b/package-lock.json index 9a3d8bf..b3c2522 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "devDependencies": { "@cloudflare/vite-plugin": "1.37.1", "@cloudflare/workers-types": "4.20260515.1", + "@cordisx/eslint-config": "github:cordisx/cordisxmono#c63c2e8c2ba7e11502934a52ad2ce3734e804cdc", "@openai/sites-vite-plugin": "^0.1.0 || ^0.2.0", "@tailwindcss/postcss": "4.2.1", "@types/node": "22.19.19", @@ -427,6 +428,18 @@ "devOptional": true, "license": "MIT OR Apache-2.0" }, + "node_modules/@cordisx/eslint-config": { + "version": "0.1.0", + "resolved": "git+ssh://git@github.com/cordisx/cordisxmono.git#c63c2e8c2ba7e11502934a52ad2ce3734e804cdc", + "integrity": "sha512-632wj/pukB0l/fHumPQeRaZQfq+foCOBMwyQzaDZGSexi6guoUkY87x+Ek1qgdnp15W8BaWmglXg8vqbZPLXJg==", + "dev": true, + "engines": { + "node": ">=22.13.0" + }, + "peerDependencies": { + "eslint": "^9.39.4 || ^10.0.0" + } + }, "node_modules/@cspotcode/source-map-support": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", diff --git a/package.json b/package.json index 51687a6..afcf997 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "start": "vinext start", "lint": "eslint . --ignore-pattern dist --ignore-pattern .next", "format": "dprint fmt", - "format:check": "dprint check" + "format:check": "dprint check", + "lint:source": "eslint ." }, "dependencies": { "drizzle-orm": "^0.45.2", @@ -39,7 +40,8 @@ "vinext": "1.0.0-beta.3", "vite": "8.0.13", "wrangler": "4.92.0", - "dprint": "0.57.1" + "dprint": "0.57.1", + "@cordisx/eslint-config": "github:cordisx/cordisxmono#c63c2e8c2ba7e11502934a52ad2ce3734e804cdc" }, "type": "module" }