From 8b6c8bc0ecedfea82370a253050657e5ca9d48f1 Mon Sep 17 00:00:00 2001 From: Rini Date: Thu, 10 Aug 2023 00:17:49 +0000 Subject: [PATCH] chore: transition to shorter license headers (#6) Transition from the GPL jumpscare to a more concise header: /* * Vencord, a Discord client mod * Copyright (c) 2023 Vendicated and contributors * * SPDX-License-Identifier: GPL-3.0 */ Old files still keep the old headers, while eslint will now autofix the new header Reviewed-on: https://codeberg.org/Ven/cord/pulls/6 Co-authored-by: Rini Co-committed-by: Rini --- .eslintrc.json | 37 ++++--------------- package.json | 7 ++-- .../eslint-plugin-simple-header@1.0.1.patch | 13 +++++++ pnpm-lock.yaml | 29 ++++++++------- scripts/header-new.txt | 3 ++ scripts/header-old.txt | 17 +++++++++ src/VencordNative.ts | 20 ++-------- src/api/DataStore/index.ts | 2 +- src/components/VencordSettings/VencordTab.tsx | 1 - src/main/themes/index.ts | 2 +- src/main/updater/common.ts | 1 - src/main/utils/crxToZip.ts | 2 +- src/plugins/betterGifAltText.ts | 1 - .../biggerStreamPreview/webpack/stores.ts | 1 - src/plugins/clearURLs/defaultRules.ts | 1 - src/plugins/mutualGroupDMs.tsx | 1 - src/plugins/noPendingCount.ts | 1 - src/plugins/reviewDB/reviewDbApi.ts | 1 - src/plugins/shikiCodeblocks/api/shiki.ts | 1 - .../shikiCodeblocks/previewExample.tsx | 2 +- src/plugins/startupTimings/index.tsx | 1 - src/plugins/translate/languages.ts | 1 - src/utils/constants.ts | 6 ++- src/webpack/common/menu.ts | 1 - 24 files changed, 72 insertions(+), 80 deletions(-) create mode 100644 patches/eslint-plugin-simple-header@1.0.1.patch create mode 100644 scripts/header-new.txt create mode 100644 scripts/header-old.txt diff --git a/.eslintrc.json b/.eslintrc.json index e45e446f..8fa3386a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -4,7 +4,7 @@ "ignorePatterns": ["dist", "browser"], "plugins": [ "@typescript-eslint", - "header", + "simple-header", "simple-import-sort", "unused-imports", "path-alias" @@ -26,35 +26,12 @@ // Since it's only been a month and Vencord has already been stolen // by random skids who rebranded it to "AlphaCord" and erased all license // information - "header/header": [ - 2, - "block", - [ - { - "pattern": "!?", - "template": " " - }, - " * Vencord, a modification for Discord's desktop app", - { - "pattern": " \\* Copyright \\(c\\) \\d{4}", - "template": " * Copyright (c) 2023 Vendicated and contributors" - }, - " *", - " * 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 .", - "" - ], - 2 + "simple-header/header": [ + "error", + { + "files": ["scripts/header-new.txt", "scripts/header-old.txt"], + "templates": { "author": [".*", "Vendicated and contributors"] } + } ], "quotes": ["error", "double", { "avoidEscape": true }], "jsx-quotes": ["error", "prefer-double"], diff --git a/package.json b/package.json index 51f6d092..5444bf03 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "type": "git", "url": "git+https://github.com/Vendicated/Vencord.git" }, - "license": "GPL-3.0", + "license": "GPL-3.0-or-later", "author": "Vendicated", "directories": { "doc": "docs" @@ -33,6 +33,7 @@ "dependencies": { "@vap/core": "0.0.12", "@vap/shiki": "0.10.5", + "eslint-plugin-simple-header": "^1.0.1", "fflate": "^0.7.4", "nanoid": "^4.0.2", "virtual-merge": "^1.0.1" @@ -51,7 +52,6 @@ "esbuild": "^0.15.18", "eslint": "^8.28.0", "eslint-import-resolver-alias": "^1.1.2", - "eslint-plugin-header": "^3.1.1", "eslint-plugin-path-alias": "^1.0.0", "eslint-plugin-simple-import-sort": "^10.0.0", "eslint-plugin-unused-imports": "^2.0.0", @@ -69,7 +69,8 @@ "pnpm": { "patchedDependencies": { "eslint-plugin-path-alias@1.0.0": "patches/eslint-plugin-path-alias@1.0.0.patch", - "eslint@8.28.0": "patches/eslint@8.28.0.patch" + "eslint@8.28.0": "patches/eslint@8.28.0.patch", + "eslint-plugin-simple-header@1.0.1": "patches/eslint-plugin-simple-header@1.0.1.patch" }, "peerDependencyRules": { "ignoreMissing": [ diff --git a/patches/eslint-plugin-simple-header@1.0.1.patch b/patches/eslint-plugin-simple-header@1.0.1.patch new file mode 100644 index 00000000..bb82fb1d --- /dev/null +++ b/patches/eslint-plugin-simple-header@1.0.1.patch @@ -0,0 +1,13 @@ +diff --git a/src/index.js b/src/index.js +index e8a8ee34fbafe310c75e752d59ba3a56109d67f1..6aecfe40f863823c8b115bca00537fcd78934137 100644 +--- a/src/index.js ++++ b/src/index.js +@@ -95,7 +95,7 @@ function create(ctx) { + ?? [Array.isArray(options.text) ? options.text.join("\n") : options.text]; + + /** @type {string} */ +- const src = ctx.sourceCode.getText(); ++ const src = ctx.getSourceCode().getText(); + const srcHeader = findHeader(src, syntax); + const headers = rawHeaders.map((raw) => makeComment(raw, syntax, decor)); + const trailingLines = "\n".repeat(src.slice(srcHeader.length).trim() ? 1 + newlines : 1); \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c4373710..8523f7b1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,9 +1,16 @@ lockfileVersion: '6.0' +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + patchedDependencies: eslint-plugin-path-alias@1.0.0: hash: m6sma4g6bh67km3q6igf6uxaja path: patches/eslint-plugin-path-alias@1.0.0.patch + eslint-plugin-simple-header@1.0.1: + hash: ej6cxkrs2np2767qe2tatjdt54 + path: patches/eslint-plugin-simple-header@1.0.1.patch eslint@8.28.0: hash: 7wc6icvgtg3uswirb5tpsbjnbe path: patches/eslint@8.28.0.patch @@ -15,6 +22,9 @@ dependencies: '@vap/shiki': specifier: 0.10.5 version: 0.10.5 + eslint-plugin-simple-header: + specifier: ^1.0.1 + version: 1.0.1(patch_hash=ej6cxkrs2np2767qe2tatjdt54) fflate: specifier: ^0.7.4 version: 0.7.4 @@ -65,9 +75,6 @@ devDependencies: eslint-import-resolver-alias: specifier: ^1.1.2 version: 1.1.2 - eslint-plugin-header: - specifier: ^3.1.1 - version: 3.1.1(eslint@8.28.0) eslint-plugin-path-alias: specifier: ^1.0.0 version: 1.0.0(patch_hash=m6sma4g6bh67km3q6igf6uxaja)(eslint@8.28.0) @@ -1446,17 +1453,6 @@ packages: optional: true dev: true - /eslint-plugin-header@3.1.1(eslint@8.28.0): - resolution: {integrity: sha512-9vlKxuJ4qf793CmeeSrZUvVClw6amtpghq3CuWcB5cUNnWHQhgcqy5eF8oVKFk1G3Y/CbchGfEaw3wiIJaNmVg==} - peerDependencies: - eslint: '>=7.7.0' - peerDependenciesMeta: - eslint: - optional: true - dependencies: - eslint: 8.28.0(patch_hash=7wc6icvgtg3uswirb5tpsbjnbe) - dev: true - /eslint-plugin-path-alias@1.0.0(patch_hash=m6sma4g6bh67km3q6igf6uxaja)(eslint@8.28.0): resolution: {integrity: sha512-FXus57yC+Zd3sMv46pbloXYwFeNVNHJqlACr9V68FG/IzGFBBokGJpmjDbEjpt8ZCeVSndUubeDWWl2A8sCNVQ==} peerDependencies: @@ -1472,6 +1468,11 @@ packages: dev: true patched: true + /eslint-plugin-simple-header@1.0.1(patch_hash=ej6cxkrs2np2767qe2tatjdt54): + resolution: {integrity: sha512-vpTMgF7bOIflnczDmbfTKtYhjTsPLTTjv/whkh1rXtu4Jp2NtvJr57gJB8QOzNjXyh34/D/LA2NY7tZsebKoZg==} + dev: false + patched: true + /eslint-plugin-simple-import-sort@10.0.0(eslint@8.28.0): resolution: {integrity: sha512-AeTvO9UCMSNzIHRkg8S6c3RPy5YEwKWSQPx3DYghLedo2ZQxowPFLGDN1AZ2evfg6r6mjBSZSLxLFsWSu3acsw==} peerDependencies: diff --git a/scripts/header-new.txt b/scripts/header-new.txt new file mode 100644 index 00000000..0db705db --- /dev/null +++ b/scripts/header-new.txt @@ -0,0 +1,3 @@ +Vencord, a Discord client mod +Copyright (c) {year} {author} +SPDX-License-Identifier: GPL-3.0-or-later diff --git a/scripts/header-old.txt b/scripts/header-old.txt new file mode 100644 index 00000000..8bb40244 --- /dev/null +++ b/scripts/header-old.txt @@ -0,0 +1,17 @@ +/* + * Vencord, a modification for Discord's desktop app + * Copyright (c) {year} {author} + * + * 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 . +*/ diff --git a/src/VencordNative.ts b/src/VencordNative.ts index da09ade5..58f553cf 100644 --- a/src/VencordNative.ts +++ b/src/VencordNative.ts @@ -1,20 +1,8 @@ /* - * Vencord, a modification for Discord's desktop app - * Copyright (c) 2022 - * - * 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 . -*/ + * Vencord, a Discord client mod + * Copyright (c) 2023 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ import { IpcEvents } from "@utils/IpcEvents"; import { IpcRes } from "@utils/types"; diff --git a/src/api/DataStore/index.ts b/src/api/DataStore/index.ts index 49c85952..97f43edd 100644 --- a/src/api/DataStore/index.ts +++ b/src/api/DataStore/index.ts @@ -1,4 +1,4 @@ -/* eslint-disable header/header */ +/* eslint-disable simple-header/header */ /*! * idb-keyval v6.2.0 diff --git a/src/components/VencordSettings/VencordTab.tsx b/src/components/VencordSettings/VencordTab.tsx index 1502bfab..a80b79a4 100644 --- a/src/components/VencordSettings/VencordTab.tsx +++ b/src/components/VencordSettings/VencordTab.tsx @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - import { openNotificationLogModal } from "@api/Notifications/notificationLog"; import { Settings, useSettings } from "@api/Settings"; import { classNameFactory } from "@api/Styles"; diff --git a/src/main/themes/index.ts b/src/main/themes/index.ts index f660e502..0751663f 100644 --- a/src/main/themes/index.ts +++ b/src/main/themes/index.ts @@ -1,4 +1,4 @@ -/* eslint-disable header/header */ +/* eslint-disable simple-header/header */ /*! * BetterDiscord addon meta parser diff --git a/src/main/updater/common.ts b/src/main/updater/common.ts index 7cea82d4..69832d1d 100644 --- a/src/main/updater/common.ts +++ b/src/main/updater/common.ts @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - export const VENCORD_FILES = [ IS_DISCORD_DESKTOP ? "patcher.js" : "vencordDesktopMain.js", "preload.js", diff --git a/src/main/utils/crxToZip.ts b/src/main/utils/crxToZip.ts index ca438904..f018629a 100644 --- a/src/main/utils/crxToZip.ts +++ b/src/main/utils/crxToZip.ts @@ -1,4 +1,4 @@ -/* eslint-disable header/header */ +/* eslint-disable simple-header/header */ /*! * crxToZip diff --git a/src/plugins/betterGifAltText.ts b/src/plugins/betterGifAltText.ts index 5e0191b9..dcffc029 100644 --- a/src/plugins/betterGifAltText.ts +++ b/src/plugins/betterGifAltText.ts @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - import { Devs } from "@utils/constants"; import definePlugin from "@utils/types"; diff --git a/src/plugins/biggerStreamPreview/webpack/stores.ts b/src/plugins/biggerStreamPreview/webpack/stores.ts index e8a4ee2c..ba5227ba 100644 --- a/src/plugins/biggerStreamPreview/webpack/stores.ts +++ b/src/plugins/biggerStreamPreview/webpack/stores.ts @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - import { findStoreLazy } from "@webpack"; import * as t from "./types/stores"; diff --git a/src/plugins/clearURLs/defaultRules.ts b/src/plugins/clearURLs/defaultRules.ts index 5a5f135a..b162bbc2 100644 --- a/src/plugins/clearURLs/defaultRules.ts +++ b/src/plugins/clearURLs/defaultRules.ts @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - export const defaultRules = [ "action_object_map", "action_type_map", diff --git a/src/plugins/mutualGroupDMs.tsx b/src/plugins/mutualGroupDMs.tsx index a3658137..d445522b 100644 --- a/src/plugins/mutualGroupDMs.tsx +++ b/src/plugins/mutualGroupDMs.tsx @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - import { Devs } from "@utils/constants"; import { isNonNullish } from "@utils/guards"; import definePlugin from "@utils/types"; diff --git a/src/plugins/noPendingCount.ts b/src/plugins/noPendingCount.ts index 0de3ecd1..2ce375e0 100644 --- a/src/plugins/noPendingCount.ts +++ b/src/plugins/noPendingCount.ts @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - import { definePluginSettings } from "@api/Settings"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; diff --git a/src/plugins/reviewDB/reviewDbApi.ts b/src/plugins/reviewDB/reviewDbApi.ts index e3ab8a8c..e8008c8c 100644 --- a/src/plugins/reviewDB/reviewDbApi.ts +++ b/src/plugins/reviewDB/reviewDbApi.ts @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - import { Review, ReviewDBUser } from "./entities"; import { settings } from "./settings"; import { authorize, showToast } from "./utils"; diff --git a/src/plugins/shikiCodeblocks/api/shiki.ts b/src/plugins/shikiCodeblocks/api/shiki.ts index e7691ce3..91e179b7 100644 --- a/src/plugins/shikiCodeblocks/api/shiki.ts +++ b/src/plugins/shikiCodeblocks/api/shiki.ts @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - import { shikiOnigasmSrc, shikiWorkerSrc } from "@utils/dependencies"; import { WorkerClient } from "@vap/core/ipc"; import type { IShikiTheme, IThemedToken } from "@vap/shiki"; diff --git a/src/plugins/shikiCodeblocks/previewExample.tsx b/src/plugins/shikiCodeblocks/previewExample.tsx index 971d0167..508153b4 100644 --- a/src/plugins/shikiCodeblocks/previewExample.tsx +++ b/src/plugins/shikiCodeblocks/previewExample.tsx @@ -1,4 +1,4 @@ -/* eslint-disable header/header */ +/* eslint-disable simple-header/header */ import React from "react"; const handleClick = async () => diff --git a/src/plugins/startupTimings/index.tsx b/src/plugins/startupTimings/index.tsx index acb11c98..3eec9d0c 100644 --- a/src/plugins/startupTimings/index.tsx +++ b/src/plugins/startupTimings/index.tsx @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - import { Devs } from "@utils/constants"; import { LazyComponent } from "@utils/react"; import definePlugin from "@utils/types"; diff --git a/src/plugins/translate/languages.ts b/src/plugins/translate/languages.ts index c3be0535..4bf370b5 100644 --- a/src/plugins/translate/languages.ts +++ b/src/plugins/translate/languages.ts @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - /* To generate: - Visit https://translate.google.com/?sl=auto&tl=en&op=translate diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 9771f428..667e396f 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -334,7 +334,11 @@ export const Devs = /* #__PURE__*/ Object.freeze({ HypedDomi: { name: "HypedDomi", id: 354191516979429376n - } + }, + Rini: { + name: "Rini", + id: 1079479184478441643n + }, } satisfies Record); // iife so #__PURE__ works correctly diff --git a/src/webpack/common/menu.ts b/src/webpack/common/menu.ts index 97d1d2f5..e2ad3720 100644 --- a/src/webpack/common/menu.ts +++ b/src/webpack/common/menu.ts @@ -16,7 +16,6 @@ * along with this program. If not, see . */ - // eslint-disable-next-line path-alias/no-relative import { filters, mapMangledModuleLazy, waitFor } from "../webpack"; import type * as t from "./types/menu";