summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler <[email protected]>2025-04-20 17:16:25 -0700
committerGitHub <[email protected]>2025-04-20 17:16:25 -0700
commitd55168f51ff989f6818ce386ae5ab7f383b9d3e3 (patch)
tree65df07b5deac7024961839823583b6e61306cebd
parent305ed41b880e10f8c04404ca7e35edfb9cc5392f (diff)
add linter for checking license headers (and eslint --fix target to match, and fix missing license headers while we're here) (#62)
-rw-r--r--eslint.config.js19
-rw-r--r--package-lock.json21
-rw-r--r--package.json2
-rw-r--r--packages/cli/src/index.test.ts6
-rw-r--r--packages/cli/src/ui/colors.ts6
-rw-r--r--packages/cli/src/ui/hooks/useStdin.ts6
-rw-r--r--packages/server/src/core/turn.ts6
-rw-r--r--packages/server/src/index.test.ts6
8 files changed, 72 insertions, 0 deletions
diff --git a/eslint.config.js b/eslint.config.js
index ae924cc7..a846d22d 100644
--- a/eslint.config.js
+++ b/eslint.config.js
@@ -12,6 +12,7 @@ import reactHooks from 'eslint-plugin-react-hooks';
import prettierConfig from 'eslint-config-prettier';
import importPlugin from 'eslint-plugin-import';
import globals from 'globals';
+import licenseHeader from 'eslint-plugin-license-header';
export default tseslint.config(
{
@@ -142,6 +143,24 @@ export default tseslint.config(
'default-case': 'error',
},
},
+ {
+ files: ['./**/*.{tsx,ts,js}'],
+ plugins: {
+ 'license-header': licenseHeader,
+ },
+ rules: {
+ 'license-header/header': [
+ 'error',
+ [
+ '/**',
+ ' * @license',
+ ' * Copyright 2025 Google LLC',
+ ' * SPDX-License-Identifier: Apache-2.0',
+ ' */',
+ ],
+ ],
+ },
+ },
// Prettier config must be last
prettierConfig,
);
diff --git a/package-lock.json b/package-lock.json
index 18c09048..1930a77a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -14,6 +14,7 @@
"eslint": "^9.24.0",
"eslint-config-prettier": "^10.1.2",
"eslint-plugin-import": "^2.31.0",
+ "eslint-plugin-license-header": "^0.8.0",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.2.0",
"globals": "^16.0.0",
@@ -2796,6 +2797,16 @@
"ms": "^2.1.1"
}
},
+ "node_modules/eslint-plugin-license-header": {
+ "version": "0.8.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-license-header/-/eslint-plugin-license-header-0.8.0.tgz",
+ "integrity": "sha512-khTCz6G3JdoQfwrtY4XKl98KW4PpnWUKuFx8v+twIRhJADEyYglMDC0td8It75C1MZ88gcvMusWuUlJsos7gYg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "requireindex": "^1.2.0"
+ }
+ },
"node_modules/eslint-plugin-react": {
"version": "7.37.5",
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.37.5.tgz",
@@ -4968,6 +4979,16 @@
"node": ">=0.10.0"
}
},
+ "node_modules/requireindex": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/requireindex/-/requireindex-1.2.0.tgz",
+ "integrity": "sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.5"
+ }
+ },
"node_modules/resolve": {
"version": "1.22.10",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz",
diff --git a/package.json b/package.json
index 240c7ca3..b0d56370 100644
--- a/package.json
+++ b/package.json
@@ -12,6 +12,7 @@
"test": "npm run test --workspaces",
"start": "scripts/start.sh",
"debug": "scripts/debug.sh",
+ "fix": "eslint . --fix",
"lint": "eslint . --ext .ts,.tsx",
"typecheck": "tsc --noEmit --jsx react",
"format": "prettier --write .",
@@ -22,6 +23,7 @@
"eslint": "^9.24.0",
"eslint-config-prettier": "^10.1.2",
"eslint-plugin-import": "^2.31.0",
+ "eslint-plugin-license-header": "^0.8.0",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.2.0",
"globals": "^16.0.0",
diff --git a/packages/cli/src/index.test.ts b/packages/cli/src/index.test.ts
index bbe9fa8b..9d65e38f 100644
--- a/packages/cli/src/index.test.ts
+++ b/packages/cli/src/index.test.ts
@@ -1,3 +1,9 @@
+/**
+ * @license
+ * Copyright 2025 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
import { describe, it, expect } from 'vitest';
import { toolRegistry } from './tools/tool-registry.js';
diff --git a/packages/cli/src/ui/colors.ts b/packages/cli/src/ui/colors.ts
index be8dac19..946be512 100644
--- a/packages/cli/src/ui/colors.ts
+++ b/packages/cli/src/ui/colors.ts
@@ -1,3 +1,9 @@
+/**
+ * @license
+ * Copyright 2025 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
export const Colors = {
Background: '#1E1E2E',
Foreground: 'white',
diff --git a/packages/cli/src/ui/hooks/useStdin.ts b/packages/cli/src/ui/hooks/useStdin.ts
index 8c741c9b..e91b90e6 100644
--- a/packages/cli/src/ui/hooks/useStdin.ts
+++ b/packages/cli/src/ui/hooks/useStdin.ts
@@ -1,3 +1,9 @@
+/**
+ * @license
+ * Copyright 2025 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
import { useState, useEffect } from 'react';
import { useStdin } from 'ink';
diff --git a/packages/server/src/core/turn.ts b/packages/server/src/core/turn.ts
index bf5c3e86..3d8c8c76 100644
--- a/packages/server/src/core/turn.ts
+++ b/packages/server/src/core/turn.ts
@@ -1,3 +1,9 @@
+/**
+ * @license
+ * Copyright 2025 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
import {
Part,
Chat,
diff --git a/packages/server/src/index.test.ts b/packages/server/src/index.test.ts
index 50c8a54e..154c96a6 100644
--- a/packages/server/src/index.test.ts
+++ b/packages/server/src/index.test.ts
@@ -1,3 +1,9 @@
+/**
+ * @license
+ * Copyright 2025 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
import { describe, it, expect } from 'vitest';
describe('placeholder tests', () => {