Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import angularTemplate from '@angular-eslint/template-parser';
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';

import importPlugin from 'eslint-plugin-import';
import nodePlugin from 'eslint-plugin-n';
import prettierPlugin from 'eslint-plugin-prettier';
Expand Down Expand Up @@ -51,11 +52,13 @@ export default [
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.

plugins: {
'@typescript-eslint': typescriptEslintPlugin,
n: nodePlugin,
prettier: prettierPlugin,
'unused-imports': unusedImports,
headers,
},
languageOptions: {
globals: {
Expand Down Expand Up @@ -106,6 +109,34 @@ export default [
varsIgnorePattern: '^_',
},
],
'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"
}
},
},
],
Comment on lines +112 to +139
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',
            },
          },
        },
      ],

},
},
{
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"dependsOn": [
{
"target": "lint",
"projects": "*"
"projects": "*",
"params": "forward"
}
]
},
Expand Down Expand Up @@ -100,17 +101,18 @@
},
"homepage": "https://groundplatform.org",
"devDependencies": {
"@angular/cli": "catalog:dev",
"@angular-eslint/builder": "catalog:dev",
"@angular-eslint/eslint-plugin": "catalog:dev",
"@angular-eslint/eslint-plugin-template": "catalog:dev",
"@angular-eslint/template-parser": "catalog:dev",
"@angular/cli": "catalog:dev",
"@eslint/eslintrc": "catalog:dev",
"@types/jasmine": "catalog:dev",
"@typescript-eslint/eslint-plugin": "catalog:dev",
"@typescript-eslint/parser": "catalog:dev",
"eslint": "catalog:dev",
"eslint-config-prettier": "catalog:dev",
"eslint-plugin-headers": "catalog:dev",
"eslint-plugin-import": "catalog:dev",
"eslint-plugin-n": "catalog:dev",
"eslint-plugin-prettier": "catalog:dev",
Expand Down
Loading