summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-02-25 20:21:05 -0500
committerGitHub <noreply@github.com>2021-02-25 20:21:05 -0500
commit782b945905c948b9a0495aa85524ad1a92c7bd97 (patch)
tree2dfe5e1b38a2f448f77f62135a974ca75002090f
parentb2f225a0d6a63d65d0543539d688d33c51a4fb8e (diff)
Header lint (#1444)
* Add eslint-plugin-header * Add rule for header format * Add missing header * Fix header issues
-rw-r--r--.eslintrc.json26
-rw-r--r--ext/js/display/display-generator.js2
-rw-r--r--ext/js/dom/html-template-collection.js2
-rw-r--r--ext/js/input/hotkey-help-controller.js2
-rw-r--r--ext/js/input/hotkey-util.js2
-rw-r--r--ext/js/pages/settings/backup-controller.js2
-rw-r--r--package-lock.json6
-rw-r--r--package.json1
-rw-r--r--test/data/html/test-document2-script.js17
9 files changed, 53 insertions, 7 deletions
diff --git a/.eslintrc.json b/.eslintrc.json
index 297f7500..4bed4a0d 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -14,7 +14,10 @@
"es2017": true,
"webextensions": true
},
- "plugins": ["no-unsanitized"],
+ "plugins": [
+ "no-unsanitized",
+ "header"
+ ],
"ignorePatterns": [
"/ext/lib/"
],
@@ -82,7 +85,26 @@
"template-tag-spacing": ["error", "never"],
"no-unsanitized/method": "error",
- "no-unsanitized/property": "error"
+ "no-unsanitized/property": "error",
+
+ "header/header": ["error", "block", [
+ "",
+ {"pattern": " \\* Copyright \\(C\\) (\\d+-)?2021 Yomichan Authors"},
+ " *",
+ " * This program is free software: you can redistribute it and/or modify",
+ " * it under the terms of the GNU General Public License as published by",
+ " * the Free Software Foundation, either version 3 of the License, or",
+ " * (at your option) any later version.",
+ " *",
+ " * This program is distributed in the hope that it will be useful,",
+ " * but WITHOUT ANY WARRANTY; without even the implied warranty of",
+ " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
+ " * GNU General Public License for more details.",
+ " *",
+ " * You should have received a copy of the GNU General Public License",
+ " * along with this program. If not, see <https://www.gnu.org/licenses/>.",
+ " "
+ ]]
},
"overrides": [
{
diff --git a/ext/js/display/display-generator.js b/ext/js/display/display-generator.js
index da1b053a..b904c16e 100644
--- a/ext/js/display/display-generator.js
+++ b/ext/js/display/display-generator.js
@@ -12,7 +12,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/* global
diff --git a/ext/js/dom/html-template-collection.js b/ext/js/dom/html-template-collection.js
index 52d5f3b0..271986cb 100644
--- a/ext/js/dom/html-template-collection.js
+++ b/ext/js/dom/html-template-collection.js
@@ -12,7 +12,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
class HtmlTemplateCollection {
diff --git a/ext/js/input/hotkey-help-controller.js b/ext/js/input/hotkey-help-controller.js
index 9bf95c77..3f33a1f4 100644
--- a/ext/js/input/hotkey-help-controller.js
+++ b/ext/js/input/hotkey-help-controller.js
@@ -12,7 +12,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/* global
diff --git a/ext/js/input/hotkey-util.js b/ext/js/input/hotkey-util.js
index ea3daf97..3e6d6388 100644
--- a/ext/js/input/hotkey-util.js
+++ b/ext/js/input/hotkey-util.js
@@ -12,7 +12,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
diff --git a/ext/js/pages/settings/backup-controller.js b/ext/js/pages/settings/backup-controller.js
index 649645d4..6f6614b6 100644
--- a/ext/js/pages/settings/backup-controller.js
+++ b/ext/js/pages/settings/backup-controller.js
@@ -8,7 +8,7 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
diff --git a/package-lock.json b/package-lock.json
index 586a71c3..10983b5a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -3310,6 +3310,12 @@
"v8-compile-cache": "^2.0.3"
}
},
+ "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
+ },
"eslint-plugin-no-unsanitized": {
"version": "3.1.4",
"resolved": "https://registry.npmjs.org/eslint-plugin-no-unsanitized/-/eslint-plugin-no-unsanitized-3.1.4.tgz",
diff --git a/package.json b/package.json
index 5453926d..4ef284e8 100644
--- a/package.json
+++ b/package.json
@@ -37,6 +37,7 @@
"devDependencies": {
"browserify": "^16.5.2",
"eslint": "^7.15.0",
+ "eslint-plugin-header": "^3.1.1",
"eslint-plugin-no-unsanitized": "^3.1.4",
"fake-indexeddb": "^3.1.2",
"html-validate": "^4.3.0",
diff --git a/test/data/html/test-document2-script.js b/test/data/html/test-document2-script.js
index 01bc211f..8e381b09 100644
--- a/test/data/html/test-document2-script.js
+++ b/test/data/html/test-document2-script.js
@@ -1,3 +1,20 @@
+/*
+ * Copyright (C) 2021 Yomichan Authors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
function requestFullscreen(element) {
if (element.requestFullscreen) {
element.requestFullscreen();