Skip to content

Commit 4bb774f

Browse files
committed
chore: switch to @tony.ganchev/eslint-plugin-header
Hi, team, I noticed you are using _eslint-plugin-header_ on ESLint 8. I forked _@tony.ganchev/eslint-plugin-header_ mid-2024 to add support for ESLint 9 and hoped it would be a temporary measure but since the original has not been updated for five years I decided to continue improving the new plugin and have been doing so for the last two years. Specific improvements include: - full JSON schema for validating the configuration. - fixed multiple bugs with the behavior of the plugin on Windows. - many other bug-fixes. - improved autofixing and error-reporting behavior. - added support for leading pragma comments before the header such as `@jest-environment` or `eslint-env`. In the case of the current review, this allowed me to remove the `eslint-disable` directive from one file and reintroduce validation. I switched the configuration to use the new config format for v3.2.x as the leading comments feature is not supported by the array-based format inherited from _eslint-plugin-header_. I've sent PR proposals to other projects in the _cloudscape-design_ space: - cloudscape-design/board-components#401 - cloudscape-design/browser-test-tools#188 - cloudscape-design/chart-components#185 - cloudscape-design/code-view#122 - cloudscape-design/collection-hooks#136 - cloudscape-design/component-toolkit#200 - cloudscape-design/components#4308 - cloudscape-design/demos#243 - cloudscape-design/documenter#112 - cloudscape-design/global-styles#73 - cloudscape-design/jest-preset#58 - cloudscape-design/test-utils#114 - cloudscape-design/theming-core#148 Looking forward to your feedback.
1 parent cd08e74 commit 4bb774f

File tree

4 files changed

+28
-17
lines changed

4 files changed

+28
-17
lines changed

.eslintrc

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"jsx": true
1717
}
1818
},
19-
"plugins": ["unicorn", "react-hooks", "no-unsanitized", "header", "import", "simple-import-sort", "@vitest"],
19+
"plugins": ["unicorn", "react-hooks", "no-unsanitized", "@tony.ganchev/header", "import", "simple-import-sort", "@vitest"],
2020
"rules": {
2121
"@typescript-eslint/no-unused-vars": "error",
2222
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
@@ -54,10 +54,22 @@
5454
"eqeqeq": "error",
5555
"no-return-await": "error",
5656
"require-await": "error",
57-
"header/header": [
57+
"@tony.ganchev/header/header": [
5858
"error",
59-
"line",
60-
[" Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.", " SPDX-License-Identifier: Apache-2.0"]
59+
{
60+
"header": {
61+
"commentType": "line",
62+
"lines": [" Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.", " SPDX-License-Identifier: Apache-2.0"]
63+
},
64+
"leadingComments": {
65+
"comments": [
66+
{
67+
"commentType": "block",
68+
"lines": [" eslint-env node "]
69+
}
70+
]
71+
}
72+
}
6173
],
6274
"no-restricted-imports": [
6375
"error",

package-lock.json

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
"@cloudscape-design/theming-build": "^1",
7272
"@testing-library/jest-dom": "^5.16.5",
7373
"@testing-library/react": "^13.4.0",
74+
"@tony.ganchev/eslint-plugin-header": "^3.3.1",
7475
"@types/jest-image-snapshot": "^6.1.0",
7576
"@types/lodash": "^4.14.191",
7677
"@types/node": "^18.19.4",
@@ -87,7 +88,6 @@
8788
"delay-cli": "^2.0.0",
8889
"eslint": "^8.57.0",
8990
"eslint-config-prettier": "^9.1.0",
90-
"eslint-plugin-header": "^3.1.1",
9191
"eslint-plugin-import": "^2.26.0",
9292
"eslint-plugin-no-unsanitized": "^4.0.2",
9393
"eslint-plugin-prettier": "^5.1.3",

src/__tests__/utils.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* eslint-env node */
2-
/* eslint-disable header/header */
32
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
43
// SPDX-License-Identifier: Apache-2.0
54
import * as fs from "node:fs";

0 commit comments

Comments
 (0)