From 497d7a525daad4e0965550adc5b6f95144221266 Mon Sep 17 00:00:00 2001 From: Konstantina Blazhukova Date: Fri, 1 Nov 2024 16:58:23 +0200 Subject: [PATCH] Adds check for license header Signed-off-by: Konstantina Blazhukova --- .eslintrc.js | 29 +++++++++++++++++++++++++++++ package-lock.json | 20 ++++++++++++++++++++ package.json | 1 + 3 files changed, 50 insertions(+) diff --git a/.eslintrc.js b/.eslintrc.js index 76a1a635cc..c06a92ba77 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -29,6 +29,9 @@ module.exports = { "plugin:@typescript-eslint/recommended", "prettier" ], + "plugins": [ + "header" + ], "overrides": [ { "env": { @@ -65,5 +68,31 @@ module.exports = { "ignoreMemberSort": false, "memberSyntaxSortOrder": ["none", "all", "multiple", "single"], }], + "header/header": + [ + 'error', + 'block', + [ + " *", + " * Hedera JSON RPC Relay", + " *", + {"pattern": "* Copyright \(C\) (202[0-9])(-(202[0-9]))?"}, + " Hedera Hashgraph, LLC", + " *", + " * 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.", + " *", + " */" + ] + ] }, }; diff --git a/package-lock.json b/package-lock.json index 5b0eb505bd..c841623745 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,6 +41,7 @@ "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.3.0", "eslint-config-standard-with-typescript": "^43.0.1", + "eslint-plugin-header": "^3.1.1", "eslint-plugin-import": "^2.28.1", "eslint-plugin-n": "^15.7.0", "ethereum-waffle": "^4.0.7", @@ -8842,6 +8843,16 @@ "node": ">=4" } }, + "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, + "license": "MIT", + "peerDependencies": { + "eslint": ">=7.7.0" + } + }, "node_modules/eslint-plugin-import": { "version": "2.28.1", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.28.1.tgz", @@ -10307,6 +10318,7 @@ "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.5.tgz", "integrity": "sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A==", "dev": true, + "hasInstallScript": true, "optional": true, "dependencies": { "node-gyp-build": "^4.3.0" @@ -10669,6 +10681,7 @@ "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.7.tgz", "integrity": "sha512-vLt1O5Pp+flcArHGIyKEQq883nBt8nN8tVBcoL0qUXj2XT1n7p70yGIq2VK98I5FdZ1YHc0wk/koOnHjnXWk1Q==", "dev": true, + "hasInstallScript": true, "optional": true, "dependencies": { "node-gyp-build": "^4.3.0" @@ -29106,6 +29119,13 @@ } } }, + "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, + "requires": {} + }, "eslint-plugin-import": { "version": "2.28.1", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.28.1.tgz", diff --git a/package.json b/package.json index cb2e87e580..24b2f3ba5d 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.3.0", "eslint-config-standard-with-typescript": "^43.0.1", + "eslint-plugin-header": "^3.1.1", "eslint-plugin-import": "^2.28.1", "eslint-plugin-n": "^15.7.0", "ethereum-waffle": "^4.0.7",