From ec7290eff744eb5fa52314efef067f2adf3e209a Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Wed, 25 Jan 2023 23:56:50 +0100 Subject: [PATCH] chore: enforce license header (#588) Signed-off-by: Jan Kowalleck Signed-off-by: Jan Kowalleck --- .eslintrc.js | 10 ++++++++-- .license-header.js | 18 ++++++++++++++++++ examples/simple/src/index.js | 2 -- package-lock.json | 17 +++++++++++++++++ package.json | 1 + tests/integration/index.test.js | 3 --- tests/integration/setup.js | 1 - 7 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 .license-header.js diff --git a/.eslintrc.js b/.eslintrc.js index 793c64f6..92fc1f85 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -29,7 +29,10 @@ module.exports = { project: './tsconfig.json' }, plugins: [ - 'simple-import-sort' + /* see https://github.com/lydell/eslint-plugin-simple-import-sort#readme */ + 'simple-import-sort', + /* see https://github.com/Stuk/eslint-plugin-header#readme */ + 'header' ], env: { commonjs: true, @@ -55,7 +58,10 @@ module.exports = { 'sort-imports': 0, /** @see https://github.com/lydell/eslint-plugin-simple-import-sort/ */ 'simple-import-sort/imports': 'error', - 'simple-import-sort/exports': 'error' + 'simple-import-sort/exports': 'error', // endregion sort imports/exports + /* see https://github.com/Stuk/eslint-plugin-header#readme */ + 'header/header': ['error', '.license-header.js'] + // endregion license-header } } diff --git a/.license-header.js b/.license-header.js new file mode 100644 index 00000000..59fcd922 --- /dev/null +++ b/.license-header.js @@ -0,0 +1,18 @@ +/*! +This file is part of CycloneDX Webpack plugin. + +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. + +SPDX-License-Identifier: Apache-2.0 +Copyright (c) OWASP Foundation. All Rights Reserved. +*/ diff --git a/examples/simple/src/index.js b/examples/simple/src/index.js index 0503ca91..3dde27e5 100644 --- a/examples/simple/src/index.js +++ b/examples/simple/src/index.js @@ -1,5 +1,3 @@ -'use strict' - /*! This file is part of CycloneDX Webpack plugin. diff --git a/package-lock.json b/package-lock.json index 10aeae99..5b022bcb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ "@types/webpack": "^5", "eslint": "^8.23.0", "eslint-config-standard-with-typescript": "^24.0.0", + "eslint-plugin-header": "^3.1.1", "eslint-plugin-simple-import-sort": "^8.0.0", "jest": "^28.1.3", "jest-junit": "^15.0.0", @@ -2709,6 +2710,15 @@ "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, + "peerDependencies": { + "eslint": ">=7.7.0" + } + }, "node_modules/eslint-plugin-import": { "version": "2.26.0", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz", @@ -8712,6 +8722,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.26.0", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz", diff --git a/package.json b/package.json index 9bcc9fdc..773aa18f 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "@types/webpack": "^5", "eslint": "^8.23.0", "eslint-config-standard-with-typescript": "^24.0.0", + "eslint-plugin-header": "^3.1.1", "eslint-plugin-simple-import-sort": "^8.0.0", "jest": "^28.1.3", "jest-junit": "^15.0.0", diff --git a/tests/integration/index.test.js b/tests/integration/index.test.js index f049b2c5..2cce8f58 100644 --- a/tests/integration/index.test.js +++ b/tests/integration/index.test.js @@ -1,6 +1,3 @@ -'use strict' -/* eslint-env jest */ - /*! This file is part of CycloneDX Webpack plugin. diff --git a/tests/integration/setup.js b/tests/integration/setup.js index 6238046e..76080d30 100644 --- a/tests/integration/setup.js +++ b/tests/integration/setup.js @@ -1,4 +1,3 @@ -'use strict' /*! This file is part of CycloneDX Webpack plugin.