Skip to content

Commit 6b98043

Browse files
committed
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 source and reintroduce validation for its header. 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/code-view#122 - cloudscape-design/collection-hooks#136 - cloudscape-design/component-toolkit#200 - cloudscape-design/components#4308 - cloudscape-design/demos#243 - cloudscape-design/jest-preset#58 - cloudscape-design/theming-core#148 - cloudscape-design/test-utils#114 Looking forward to your feedback.
1 parent d83ee1b commit 6b98043

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
@@ -15,7 +15,7 @@
1515
"jsx": true
1616
}
1717
},
18-
"plugins": ["unicorn", "react-hooks", "no-unsanitized", "header", "import", "simple-import-sort"],
18+
"plugins": ["unicorn", "react-hooks", "no-unsanitized", "@tony.ganchev/header", "import", "simple-import-sort"],
1919
"rules": {
2020
"@typescript-eslint/no-unused-vars": "error",
2121
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
@@ -52,10 +52,22 @@
5252
"eqeqeq": "error",
5353
"no-return-await": "error",
5454
"require-await": "error",
55-
"header/header": [
55+
"@tony.ganchev/header/header": [
5656
"error",
57-
"line",
58-
[" Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.", " SPDX-License-Identifier: Apache-2.0"]
57+
{
58+
"header": {
59+
"commentType": "line",
60+
"lines": [" Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.", " SPDX-License-Identifier: Apache-2.0"]
61+
},
62+
"leadingComments": {
63+
"comments": [
64+
{
65+
"commentType": "block",
66+
"lines": [" eslint-env node "]
67+
}
68+
]
69+
}
70+
}
5971
],
6072
"no-restricted-imports": [
6173
"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
@@ -70,6 +70,7 @@
7070
"@juggle/resize-observer": "^3.4.0",
7171
"@testing-library/jest-dom": "^5.16.5",
7272
"@testing-library/react": "^13.4.0",
73+
"@tony.ganchev/eslint-plugin-header": "^3.3.1",
7374
"@types/jest-image-snapshot": "^6.1.0",
7475
"@types/lodash": "^4.14.191",
7576
"@types/node": "^18.19.4",
@@ -83,7 +84,6 @@
8384
"deep-freeze-es6": "^1.4.1",
8485
"eslint": "^8.57.0",
8586
"eslint-config-prettier": "^9.1.0",
86-
"eslint-plugin-header": "^3.1.1",
8787
"eslint-plugin-import": "^2.26.0",
8888
"eslint-plugin-no-unsanitized": "^4.0.2",
8989
"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)