From 484fa7bc559ac4156253e88c230a23921877f84c Mon Sep 17 00:00:00 2001 From: ci-maintainer Date: Mon, 5 Oct 2026 04:56:01 -0400 Subject: [PATCH] ci: lint scripts/ and netlify/ alongside src/ The TypeScript & Lint Check workflow already triggers on scripts/** and netlify/** and both directories sit inside the Vitest coverage gate, but `npm run lint` was `eslint src/`, so ESLint never inspected them. Extend the lint and lint:fix scripts, add .mts to the TypeScript parser glob (netlify/functions/nps.mts otherwise fails to parse under espree), and turn no-console off for scripts/ and netlify/ where console.log is the output channel. Documents the new scope in CONTRIBUTING. Closes #218 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: ci-maintainer --- CONTRIBUTING.md | 2 +- changelog.d/changed-lint-scripts-netlify.md | 1 + eslint.config.mjs | 10 +++++++++- package.json | 4 ++-- 4 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 changelog.d/changed-lint-scripts-netlify.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cb203c7..ac66648 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,7 +22,7 @@ npm run type-check # TypeScript without emitting files npm test # Vitest unit tests npx vitest run --coverage # what CI runs: tests plus the coverage gate npm run check-links # internal docs links -npm run lint # ESLint for src/ +npm run lint # ESLint for src/, scripts/ and netlify/ npm run build # production build and doc-sync scripts ``` diff --git a/changelog.d/changed-lint-scripts-netlify.md b/changelog.d/changed-lint-scripts-netlify.md new file mode 100644 index 0000000..3edacdb --- /dev/null +++ b/changelog.d/changed-lint-scripts-netlify.md @@ -0,0 +1 @@ +- Run ESLint over `scripts/` and `netlify/` as well as `src/` (`npm run lint`), parse `.mts` files with the TypeScript parser, and allow `console` output in those CLI/serverless entry points (#218). diff --git a/eslint.config.mjs b/eslint.config.mjs index e96ceb9..5b07111 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -13,7 +13,7 @@ export default [ }, js.configs.recommended, { - files: ["**/*.{js,jsx,ts,tsx}"], + files: ["**/*.{js,jsx,ts,tsx,mts}"], languageOptions: { parser: typescriptEslintParser, parserOptions: { @@ -120,4 +120,12 @@ export default [ "jsx-a11y/no-static-element-interactions": "warn", }, }, + { + // Build/sync scripts and the Netlify function are CLI and serverless + // entry points: console.log is their output channel, not a leftover. + files: ["scripts/**/*.{js,ts}", "netlify/**/*.{js,ts,mts}"], + rules: { + "no-console": "off", + }, + }, ]; diff --git a/package.json b/package.json index 7b5c68a..6dd5b66 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,8 @@ "prebuild": "(tsx scripts/update-meeting-recordings.ts || echo \"meeting recordings refresh unavailable - using committed data\") && (tsx scripts/sync-hive-docs.ts || echo \"hive docs sync unavailable - using committed content\") && (tsx scripts/sync-sibling-docs.ts || echo \"sibling docs sync unavailable - using committed content\") && tsx scripts/generate-shared-config.ts", "build": "next build", "start": "next start", - "lint": "eslint src/", - "lint:fix": "eslint src/ --fix", + "lint": "eslint src/ scripts/ netlify/", + "lint:fix": "eslint src/ scripts/ netlify/ --fix", "lint:md": "markdownlint-cli2 \"README.md\" \"CONTRIBUTING.md\" \"docs/**/*.{md,mdx}\" \"src/**/*.{md,mdx}\"", "sync-hive-docs": "tsx scripts/sync-hive-docs.ts", "check-links": "tsx scripts/check-internal-links.ts",