Skip to content

Standardize license headers and fix ESLint config#2430

Open
rfontanarosa wants to merge 7 commits intomasterfrom
rfontanarosa/1833/code-health-add-lint-check-for-copyright-headers
Open

Standardize license headers and fix ESLint config#2430
rfontanarosa wants to merge 7 commits intomasterfrom
rfontanarosa/1833/code-health-add-lint-check-for-copyright-headers

Conversation

@rfontanarosa
Copy link
Collaborator

closes #1833

@auto-assign auto-assign bot requested a review from gino-m February 15, 2026 20:32
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @rfontanarosa, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing code quality and legal clarity by standardizing license headers throughout the project. It achieves this by integrating a new ESLint plugin to automatically check and enforce the presence and format of Apache 2.0 license headers in TypeScript and JavaScript files. The changes also include necessary updates to the ESLint configuration and development dependencies to support this new enforcement, alongside minor adjustments to package management files.

Highlights

  • License Header Standardization: Introduced eslint-plugin-headers to enforce a consistent Apache 2.0 license header across all TypeScript and JavaScript files, ensuring legal compliance and code uniformity.
  • ESLint Configuration Updates: Modified the main ESLint configuration (eslint.config.mjs) to integrate the new header plugin and updated the lint command in web/package.json to properly forward arguments.
  • Dependency Management: Updated various development dependencies, including several ESLint-related packages, to their latest versions in pnpm-workspace.yaml and added eslint-plugin-headers.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • eslint.config.mjs
    • Imported eslint-plugin-headers for license header enforcement.
    • Added headers plugin to the ESLint configuration.
    • Configured a new headers/header-format rule to enforce a specific Apache 2.0 license header for .ts and .js files.
  • package.json
    • Added eslint-plugin-headers to devDependencies.
    • Modified the lint target's dependsOn configuration to forward parameters.
  • pnpm-workspace.yaml
    • Updated versions for several ESLint-related development dependencies.
    • Added eslint-plugin-headers to the dev catalog.
    • Removed single quotes from package names in the packages list.
    • Removed a blank line.
  • web/package.json
    • Modified the lint command to include {args} for forwarding additional arguments.
Activity
  • The pull request was created by rfontanarosa to address issue [Code health] Add lint check for copyright headers #1833, which aimed to standardize license headers and fix ESLint configuration.
  • Changes were implemented across eslint.config.mjs, package.json, pnpm-workspace.yaml, and web/package.json to achieve the stated goals.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@rfontanarosa rfontanarosa self-assigned this Feb 15, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request successfully introduces eslint-plugin-headers to enforce standardized license headers and improves the NX linting configuration by allowing argument forwarding. However, there are some inconsistencies in the quote style used in the new ESLint configuration, and the license header template uses double quotes which conflicts with the existing single-quote style found in the repository (including the eslint.config.mjs file itself). Additionally, the header check is currently limited to JavaScript and TypeScript files, while the PR title suggests a broader standardization that should likely include HTML files as well.

Comment on lines 112 to 139
'headers/header-format': [
'warn',
{
"source": "string",
"content": `Copyright (year) {company}.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.`,
"variables": {
"company": "The Ground Authors"
},
"patterns": {
"year": {
"pattern": "\\d{4}",
"defaultValue": "2026"
}
},
},
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

There are two issues here:

  1. Quote Consistency: The keys and string values in this block use double quotes, which is inconsistent with the rest of the file.
  2. Header Content Discrepancy: The template uses double quotes for "License" and "AS IS", but the existing headers in the project (including the one at the top of this file) use single quotes ('License' and 'AS IS'). This will cause lint warnings on all existing files.

I've updated the suggestion to use single quotes for consistency and to match the existing header style.

      'headers/header-format': [
        'warn',
        {
          source: 'string',
          content: `Copyright (year) {company}.

Licensed under the Apache License, Version 2.0 (the 'License');
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an 'AS IS' BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.`,
          variables: {
            company: 'The Ground Authors',
          },
          patterns: {
            year: {
              pattern: '\\d{4}',
              defaultValue: '2026',
            },
          },
        },
      ],

import angularTemplatePlugin from '@angular-eslint/eslint-plugin-template';
import typescriptEslintPlugin from '@typescript-eslint/eslint-plugin';
import typescriptParser from '@typescript-eslint/parser';
import headers from "eslint-plugin-headers";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with the rest of the file and common JavaScript style (e.g., GTS), please use single quotes for imports.

Suggested change
import headers from "eslint-plugin-headers";
import headers from 'eslint-plugin-headers';

return newConfig;
}),
{
files: ['**/*.ts', '**/*.js'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The headers plugin and rule are currently scoped only to .ts and .js files. Since the PR aims to standardize license headers and the lint command in web/package.json also targets .html files, consider applying this rule to HTML files as well. This might require moving the headers configuration to a separate block or adding it to the HTML-specific configuration block.

@codecov-commenter
Copy link

codecov-commenter commented Feb 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.12%. Comparing base (eb0b9ee) to head (368d564).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2430   +/-   ##
=======================================
  Coverage   59.12%   59.12%           
=======================================
  Files         110      110           
  Lines        2752     2752           
  Branches      407      407           
=======================================
  Hits         1627     1627           
  Misses       1065     1065           
  Partials       60       60           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Code health] Add lint check for copyright headers

2 participants