Header lint (#1444)

* Add eslint-plugin-header

* Add rule for header format

* Add missing header

* Fix header issues
This commit is contained in:
toasted-nutbread 2021-02-25 20:21:05 -05:00 committed by GitHub
parent b2f225a0d6
commit 782b945905
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 53 additions and 7 deletions

View File

@ -14,7 +14,10 @@
"es2017": true, "es2017": true,
"webextensions": true "webextensions": true
}, },
"plugins": ["no-unsanitized"], "plugins": [
"no-unsanitized",
"header"
],
"ignorePatterns": [ "ignorePatterns": [
"/ext/lib/" "/ext/lib/"
], ],
@ -82,7 +85,26 @@
"template-tag-spacing": ["error", "never"], "template-tag-spacing": ["error", "never"],
"no-unsanitized/method": "error", "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": [ "overrides": [
{ {

View File

@ -12,7 +12,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * 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 /* global

View File

@ -12,7 +12,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * 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 { class HtmlTemplateCollection {

View File

@ -12,7 +12,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * 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 /* global

View File

@ -12,7 +12,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * 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/>.
*/ */
/** /**

View File

@ -8,7 +8,7 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License

6
package-lock.json generated
View File

@ -3310,6 +3310,12 @@
"v8-compile-cache": "^2.0.3" "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": { "eslint-plugin-no-unsanitized": {
"version": "3.1.4", "version": "3.1.4",
"resolved": "https://registry.npmjs.org/eslint-plugin-no-unsanitized/-/eslint-plugin-no-unsanitized-3.1.4.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-no-unsanitized/-/eslint-plugin-no-unsanitized-3.1.4.tgz",

View File

@ -37,6 +37,7 @@
"devDependencies": { "devDependencies": {
"browserify": "^16.5.2", "browserify": "^16.5.2",
"eslint": "^7.15.0", "eslint": "^7.15.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-no-unsanitized": "^3.1.4", "eslint-plugin-no-unsanitized": "^3.1.4",
"fake-indexeddb": "^3.1.2", "fake-indexeddb": "^3.1.2",
"html-validate": "^4.3.0", "html-validate": "^4.3.0",

View File

@ -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) { function requestFullscreen(element) {
if (element.requestFullscreen) { if (element.requestFullscreen) {
element.requestFullscreen(); element.requestFullscreen();