From 1c084410dc9f26ae6c700ffedd7824011f307d9e Mon Sep 17 00:00:00 2001 From: Christian Murphy Date: Thu, 30 Apr 2020 18:17:21 -0700 Subject: [PATCH] build: add license header eslint plugin --- licenseHeader.js | 17 +++++++++++++++++ package-lock.json | 23 +++++++++++++++++++++++ package.json | 12 +++++++++++- 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 licenseHeader.js diff --git a/licenseHeader.js b/licenseHeader.js new file mode 100644 index 0000000000..025bbeb356 --- /dev/null +++ b/licenseHeader.js @@ -0,0 +1,17 @@ +/* + * Licensed to The Apereo Foundation under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * + * The Apereo Foundation licenses this file to you 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 7094b4bfc1..62209c8269 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1192,6 +1192,17 @@ } } }, + "eslint-plugin-notice": { + "version": "0.9.10", + "resolved": "https://registry.npmjs.org/eslint-plugin-notice/-/eslint-plugin-notice-0.9.10.tgz", + "integrity": "sha512-rF79EuqdJKu9hhTmwUkNeSvLmmq03m/NXq/NHwUENHbdJ0wtoyOjxZBhW4QCug8v5xYE6cGe3AWkGqSIe9KUbQ==", + "dev": true, + "requires": { + "find-root": "^1.1.0", + "lodash": "^4.17.15", + "metric-lcs": "^0.1.2" + } + }, "eslint-plugin-prettier": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.3.tgz", @@ -1455,6 +1466,12 @@ "to-regex-range": "^5.0.1" } }, + "find-root": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz", + "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==", + "dev": true + }, "find-up": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", @@ -2651,6 +2668,12 @@ "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", "dev": true }, + "metric-lcs": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/metric-lcs/-/metric-lcs-0.1.2.tgz", + "integrity": "sha512-+TZ5dUDPKPJaU/rscTzxyN8ZkX7eAVLAiQU/e+YINleXPv03SCmJShaMT1If1liTH8OcmWXZs0CmzCBRBLcMpA==", + "dev": true + }, "micromatch": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", diff --git a/package.json b/package.json index 4c7459e1ea..4bd3f60067 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "eslint-plugin-import": "2.20.2", "eslint-plugin-jest": "23.8.2", "eslint-plugin-jsx-a11y": "6.2.3", + "eslint-plugin-notice": "0.9.10", "eslint-plugin-prettier": "3.1.3", "eslint-plugin-react": "7.19.0", "eslint-plugin-react-hooks": "2.5.0", @@ -57,13 +58,22 @@ "plugin:jest/style", "plugin:prettier/recommended" ], + "plugins": [ + "notice" + ], "env": { "jquery": true }, "rules": { "jest/require-top-level-describe": "error", "jest/consistent-test-it": "error", - "jest/no-mocks-import": "warn" + "jest/no-mocks-import": "warn", + "notice/notice": [ + "error", + { + "templateFile": "licenseHeader.js" + } + ] }, "overrides": [ {