diff --git a/.eslintrc.json b/.eslintrc.json index 3722418..1762a0d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,3 +1,11 @@ { - "extends": ["next/core-web-vitals", "next/typescript"] + "extends": ["next/core-web-vitals", "next/typescript"], + "plugins": ["header"], + "rules": { + "header/header": [ + 2, + "block", + "Copyright The OpenTelemetry Authors\nSPDX-License-Identifier: Apache-2.0" + ] + } } diff --git a/CLAUDE.md b/CLAUDE.md index 7af2a9e..f826d71 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -51,4 +51,4 @@ All source files must include the following copyright header: - Reference the issue number in the PR description with "Closes #X" - All linting must pass (`npm run lint`) - Make sure all copyright headers are present -- Keep changes focused and minimal \ No newline at end of file +- Keep changes focused and minimal diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..5811de4 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,19 @@ +// eslint.config.mjs + +import { FlatCompat } from "@eslint/eslintrc"; +import pluginHeader from "eslint-plugin-header"; + +pluginHeader.rules.header.meta.schema = false; + +const compat = new FlatCompat({ + // import.meta.dirname is available after Node.js v20.11.0 + baseDirectory: import.meta.dirname, +}); + +const eslintConfig = [ + ...compat.config({ + extends: ["next", "next/core-web-vitals", "next/typescript"], + }), +]; + +export default eslintConfig; diff --git a/package-lock.json b/package-lock.json index 648c42b..6148230 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,6 +27,7 @@ "@types/react-dom": "^19.0.0", "eslint": "^9.0.0", "eslint-config-next": "15.3.1", + "eslint-plugin-header": "^3.1.1", "postcss": "^8", "tailwindcss": "^4.0.0", "typescript": "^5" @@ -2694,6 +2695,16 @@ "ms": "^2.1.1" } }, + "node_modules/eslint-plugin-header": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-header/-/eslint-plugin-header-3.1.1.tgz", + "integrity": "sha512-9vlKxuJ4qf793CmeeSrZUvVClw6amtpghq3CuWcB5cUNnWHQhgcqy5eF8oVKFk1G3Y/CbchGfEaw3wiIJaNmVg==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "eslint": ">=7.7.0" + } + }, "node_modules/eslint-plugin-import": { "version": "2.31.0", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.31.0.tgz", diff --git a/package.json b/package.json index 325e4ef..7423e30 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "@types/react-dom": "^19.0.0", "eslint": "^9.0.0", "eslint-config-next": "15.3.1", + "eslint-plugin-header": "^3.1.1", "postcss": "^8", "tailwindcss": "^4.0.0", "typescript": "^5" diff --git a/src/app/api/revalidate/route.ts b/src/app/api/revalidate/route.ts index d3fc7e5..9b289b8 100644 --- a/src/app/api/revalidate/route.ts +++ b/src/app/api/revalidate/route.ts @@ -1,3 +1,8 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + import { revalidatePath } from "next/cache"; import { NextRequest } from "next/server"; diff --git a/src/app/api/test/route.ts b/src/app/api/test/route.ts index 3bb4f49..28a225f 100644 --- a/src/app/api/test/route.ts +++ b/src/app/api/test/route.ts @@ -1,3 +1,8 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + import { saveEntry } from "@/lib/store"; import { ChangelogEntry } from "@/types/entry"; diff --git a/src/app/api/webhook/route.ts b/src/app/api/webhook/route.ts index 68ea9fe..cccc86d 100644 --- a/src/app/api/webhook/route.ts +++ b/src/app/api/webhook/route.ts @@ -1,3 +1,8 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + import { NextRequest } from "next/server"; import { saveEntry } from "@/lib/store"; import { ChangelogEntry } from "@/types/entry"; diff --git a/src/app/feed/route.ts b/src/app/feed/route.ts index 615f93d..f7ab01f 100644 --- a/src/app/feed/route.ts +++ b/src/app/feed/route.ts @@ -1,3 +1,8 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + import { getAllEntries } from "@/lib/store"; export const dynamic = "force-dynamic"; diff --git a/src/app/layout.tsx b/src/app/layout.tsx index f8f07ce..2f95bf0 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,3 +1,8 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + import type { Metadata } from "next"; import localFont from "next/font/local"; import "./globals.css"; diff --git a/src/app/page.tsx b/src/app/page.tsx index b0d51b4..86219f6 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,3 +1,8 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + import { getAllEntries } from "@/lib/store"; import { ChangelogList } from "@/components/list"; import { TestControls } from "@/components/test-controls"; diff --git a/src/components/changelog-description.tsx b/src/components/changelog-description.tsx index d262e28..e543d51 100644 --- a/src/components/changelog-description.tsx +++ b/src/components/changelog-description.tsx @@ -1,3 +1,8 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + "use client"; import { useState } from "react"; diff --git a/src/components/commit-sha.tsx b/src/components/commit-sha.tsx index 6938b15..3d2cb48 100644 --- a/src/components/commit-sha.tsx +++ b/src/components/commit-sha.tsx @@ -1,3 +1,8 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + "use client"; interface CommitShaProps { diff --git a/src/components/filtered-list.tsx b/src/components/filtered-list.tsx index 37da523..9e8bff0 100644 --- a/src/components/filtered-list.tsx +++ b/src/components/filtered-list.tsx @@ -1,3 +1,8 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + "use client"; import { useState, useId } from "react"; diff --git a/src/components/github-username.tsx b/src/components/github-username.tsx index 846dc39..be70277 100644 --- a/src/components/github-username.tsx +++ b/src/components/github-username.tsx @@ -1,3 +1,8 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + "use client"; interface GitHubUsernameProps { diff --git a/src/components/list.tsx b/src/components/list.tsx index 46716de..bbba68b 100644 --- a/src/components/list.tsx +++ b/src/components/list.tsx @@ -1,3 +1,8 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + import { FilteredList } from "./filtered-list"; import { ChangelogEntry } from "@/types/entry"; diff --git a/src/components/test-controls.tsx b/src/components/test-controls.tsx index 0aa5c15..cfc3f62 100644 --- a/src/components/test-controls.tsx +++ b/src/components/test-controls.tsx @@ -1,3 +1,8 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + "use client"; import { useState } from "react"; diff --git a/src/lib/store.ts b/src/lib/store.ts index 5256e5f..e313bfc 100644 --- a/src/lib/store.ts +++ b/src/lib/store.ts @@ -1,3 +1,8 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + import { getStore } from "@netlify/blobs"; import { ChangelogEntry } from "@/types/entry"; diff --git a/src/types/entry.ts b/src/types/entry.ts index 0c15add..7945540 100644 --- a/src/types/entry.ts +++ b/src/types/entry.ts @@ -1,3 +1,8 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + export interface ChangelogEntry { id: number; title: string; diff --git a/tsconfig.json b/tsconfig.json index 94da14b..7e65d23 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,10 @@ { "compilerOptions": { - "lib": ["dom", "dom.iterable", "esnext"], + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], "allowJs": true, "skipLibCheck": true, "strict": true, @@ -19,9 +23,19 @@ } ], "paths": { - "@/*": ["./src/*"] - } + "@/*": [ + "./src/*" + ] + }, + "target": "ES2017" }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], - "exclude": ["node_modules"] + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx", + ".next/types/**/*.ts" + ], + "exclude": [ + "node_modules" + ] }