From 8a83f6154d539e6b535b70ef675aef6ed81c2239 Mon Sep 17 00:00:00 2001 From: Tony Ganchev Date: Fri, 6 Mar 2026 23:23:03 +0200 Subject: [PATCH] devops: switch to @tony.ganchev/eslint-plugin-header Reasons: - The fork is supported and updated. - ESLint 9-native with full schema support and needing no hacks. - Windows support - Multiple other bugfixes. - UX improvements - better error messages and more autofix capabilities. - Extensive documentation. - Better configuration format (although the old one is still supported). Signed-off-by: Tony Ganchev --- eslint.config.mjs | 45 ++++++++++++++++++++++++++------------------- package-lock.json | 21 +++++++++++---------- package.json | 2 +- 3 files changed, 38 insertions(+), 30 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 59bd75fb7..aeeb2c843 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,6 +1,6 @@ import { defineConfig } from 'eslint/config'; import globals from 'globals'; -import header from 'eslint-plugin-header'; +import header from '@tony.ganchev/eslint-plugin-header'; import prettier from 'eslint-plugin-prettier'; import eslintConfigPrettier from 'eslint-plugin-prettier/recommended'; import tsParser from '@typescript-eslint/parser'; @@ -40,24 +40,31 @@ export default defineConfig([{ customRules, ], rules: { - 'header/header': [2, 'block', [ - '*', - { pattern: '^ \\* (?:©|(?:\\(C\\))) Copyright IBM Corp(?:\\.|(?:oration)) 20\\d\\d(?:, 20\\d\\d)?\\.(?: All Rights Reserved\\.)?$' }, - ' *', - ' * 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', - ' *', - ' * http://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.', - ' ' - ]], - + 'header/header': [ + 2, + { + header: { + commentType: 'block', + lines: [ + '*', + /^ \* (?:©|(?:\(C\))) Copyright IBM Corp(?:\.|(?:oration)) 20\d\d(?:, 20\d\d)?\.(?: All Rights Reserved\.)?$/, + ' *', + ' * 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', + ' *', + ' * http://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.', + ' ' + ] + } + } + ], 'max-len': ['error', { 'code': 120, }], diff --git a/package-lock.json b/package-lock.json index 5fb389179..b665516fb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "devDependencies": { "@eslint/js": "9.39.3", "@ibm-cloud/sdk-test-utilities": "^1.0.0", + "@tony.ganchev/eslint-plugin-header": "3.2.4", "@types/extend": "3.0.4", "@types/jest": "30.0.0", "@typescript-eslint/eslint-plugin": "8.56.1", @@ -22,7 +23,6 @@ "dotenv": "17.3.1", "eslint": "9.39.3", "eslint-config-prettier": "10.1.8", - "eslint-plugin-header": "3.1.1", "eslint-plugin-import": "2.32.0", "eslint-plugin-jest": "29.13.0", "eslint-plugin-jsdoc": "62.7.1", @@ -3133,6 +3133,16 @@ "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==" }, + "node_modules/@tony.ganchev/eslint-plugin-header": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@tony.ganchev/eslint-plugin-header/-/eslint-plugin-header-3.2.4.tgz", + "integrity": "sha512-zqMKTW/KQmqKGINkhwEPoJFcJ0ewUkUAmvzHLB5N+n/6bsk7D/xkQ50VhUakG2P4JHHtqsncaXrPxgSeuBPmOw==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "eslint": ">=7.7.0" + } + }, "node_modules/@tybys/wasm-util": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.9.0.tgz", @@ -5338,15 +5348,6 @@ "ms": "^2.1.1" } }, - "node_modules/eslint-plugin-header": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-header/-/eslint-plugin-header-3.1.1.tgz", - "integrity": "sha512-9vlKxuJ4qf793CmeeSrZUvVClw6amtpghq3CuWcB5cUNnWHQhgcqy5eF8oVKFk1G3Y/CbchGfEaw3wiIJaNmVg==", - "dev": true, - "peerDependencies": { - "eslint": ">=7.7.0" - } - }, "node_modules/eslint-plugin-import": { "version": "2.32.0", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.32.0.tgz", diff --git a/package.json b/package.json index 8e3be92d1..cc12e324b 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "devDependencies": { "@eslint/js": "9.39.3", "@ibm-cloud/sdk-test-utilities": "^1.0.0", + "@tony.ganchev/eslint-plugin-header": "3.2.4", "@types/extend": "3.0.4", "@types/jest": "30.0.0", "@typescript-eslint/eslint-plugin": "8.56.1", @@ -53,7 +54,6 @@ "dotenv": "17.3.1", "eslint": "9.39.3", "eslint-config-prettier": "10.1.8", - "eslint-plugin-header": "3.1.1", "eslint-plugin-import": "2.32.0", "eslint-plugin-jest": "29.13.0", "eslint-plugin-jsdoc": "62.7.1",