eslint
This commit is contained in:
259
packages/eslint/compat-grant.js
Normal file
259
packages/eslint/compat-grant.js
Normal file
@ -0,0 +1,259 @@
|
||||
// Fork from eslint-plugin-userscripts
|
||||
// Documentation:
|
||||
// - Tampermonkey: https://www.tampermonkey.net/documentation.php#_grant
|
||||
// - Violentmonkey: https://violentmonkey.github.io/api/gm
|
||||
// - Greasemonkey: https://wiki.greasespot.net/Greasemonkey_Manual:API
|
||||
// - ScriptCat: https://docs.scriptcat.org/docs/dev/cat-api/
|
||||
const compatMap = {
|
||||
CAT_userConfig: [{ type: "scriptcat", versionConstraint: ">=0.11.0-beta" }],
|
||||
CAT_fileStorage: [{ type: "scriptcat", versionConstraint: ">=0.11.0" }],
|
||||
"GM.addElement": [
|
||||
{ type: "tampermonkey", versionConstraint: ">=4.11.6113" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.13.0-beta.3" },
|
||||
],
|
||||
GM_addElement: [
|
||||
{ type: "tampermonkey", versionConstraint: ">=4.11.6113" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.13.0-beta.3" },
|
||||
{ type: "scriptcat", versionConstraint: "*" },
|
||||
],
|
||||
"GM.addStyle": [
|
||||
{ type: "tampermonkey", versionConstraint: ">=4.5" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.12.0" },
|
||||
],
|
||||
GM_addStyle: [
|
||||
{ type: "tampermonkey", versionConstraint: "*" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=0.6.1.4 <4" },
|
||||
],
|
||||
"GM.addValueChangeListener": [{ type: "tampermonkey", versionConstraint: ">=4.5" }],
|
||||
GM_addValueChangeListener: [
|
||||
{ type: "tampermonkey", versionConstraint: ">=2.3.2607" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.12.0" },
|
||||
],
|
||||
"GM.cookie": [
|
||||
{ type: "tampermonkey", versionConstraint: ">=4.8" },
|
||||
{ type: "scriptcat", versionConstraint: "*" },
|
||||
],
|
||||
GM_cookie: [
|
||||
{ type: "tampermonkey", versionConstraint: ">=4.8" },
|
||||
{ type: "scriptcat", versionConstraint: "*" },
|
||||
],
|
||||
"GM.deleteValue": [
|
||||
{ type: "tampermonkey", versionConstraint: ">=4.5" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.12.0" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=4.0" },
|
||||
],
|
||||
GM_deleteValue: [
|
||||
{ type: "tampermonkey", versionConstraint: "*" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=0.8.20090123.1 <4" },
|
||||
],
|
||||
"GM.download": [{ type: "tampermonkey", versionConstraint: ">=4.5" }],
|
||||
GM_download: [
|
||||
{ type: "tampermonkey", versionConstraint: ">=3.8" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.9.5" },
|
||||
],
|
||||
"GM.getResourceText": [{ type: "tampermonkey", versionConstraint: ">=4.5" }],
|
||||
GM_getResourceText: [
|
||||
{ type: "tampermonkey", versionConstraint: "*" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=0.8.20080609.0 <4" },
|
||||
],
|
||||
"GM.getResourceURL": [{ type: "violentmonkey", versionConstraint: ">=2.12.0 <2.13.0.10" }],
|
||||
GM_getResourceURL: [
|
||||
{ type: "tampermonkey", versionConstraint: "*" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=0.8.20080609.0 <4" },
|
||||
],
|
||||
"GM.getResourceUrl": [
|
||||
{ type: "tampermonkey", versionConstraint: ">=4.5" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.13.0.10" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=4.0" },
|
||||
],
|
||||
"GM.getTab": [{ type: "tampermonkey", versionConstraint: ">=4.5" }],
|
||||
GM_getTab: [{ type: "tampermonkey", versionConstraint: ">=4.0.10" }],
|
||||
"GM.getTabs": [{ type: "tampermonkey", versionConstraint: ">=4.5" }],
|
||||
GM_getTabs: [{ type: "tampermonkey", versionConstraint: ">=4.0.10" }],
|
||||
"GM.getValue": [
|
||||
{ type: "tampermonkey", versionConstraint: ">=4.5" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.12.0" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=4.0" },
|
||||
],
|
||||
GM_getValue: [
|
||||
{ type: "tampermonkey", versionConstraint: "*" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=0.3-beta <4" },
|
||||
],
|
||||
"GM.info": [
|
||||
{ type: "tampermonkey", versionConstraint: ">=4.5" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.12.0" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=4" },
|
||||
],
|
||||
GM_info: [
|
||||
{ type: "tampermonkey", versionConstraint: ">=2.4.2718" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=0.9.16 <4" },
|
||||
],
|
||||
"GM.listValues": [
|
||||
{ type: "tampermonkey", versionConstraint: ">=4.5" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.12.0" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=4" },
|
||||
],
|
||||
GM_listValues: [
|
||||
{ type: "tampermonkey", versionConstraint: "*" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=0.8.20090123.1 <4" },
|
||||
],
|
||||
"GM.log": [
|
||||
{ type: "tampermonkey", versionConstraint: ">=4.5" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=4" },
|
||||
],
|
||||
GM_log: [
|
||||
{ type: "tampermonkey", versionConstraint: "*" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=0.3-beta <4" },
|
||||
],
|
||||
"GM.notification": [
|
||||
{ type: "tampermonkey", versionConstraint: ">=4.5" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.12.0" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=4" },
|
||||
],
|
||||
GM_notification: [
|
||||
{ type: "tampermonkey", versionConstraint: ">=2.0.2344" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.5.0" },
|
||||
],
|
||||
"GM.openInTab": [
|
||||
{ type: "tampermonkey", versionConstraint: ">=4.5" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.12.0" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=4" },
|
||||
],
|
||||
GM_openInTab: [
|
||||
{ type: "tampermonkey", versionConstraint: "*" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=0.5-beta <4" },
|
||||
],
|
||||
"GM.registerMenuCommand": [
|
||||
{ type: "tampermonkey", versionConstraint: ">=4.5" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.12.0" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=4.11" },
|
||||
],
|
||||
GM_registerMenuCommand: [
|
||||
{ type: "tampermonkey", versionConstraint: "*" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=0.2.5 <4" },
|
||||
],
|
||||
"GM.removeValueChangeListener": [{ type: "tampermonkey", versionConstraint: ">=4.5" }],
|
||||
GM_removeValueChangeListener: [
|
||||
{ type: "tampermonkey", versionConstraint: ">=2.3.2607" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.12.0" },
|
||||
],
|
||||
"GM.saveTab": [{ type: "tampermonkey", versionConstraint: ">=4.5" }],
|
||||
GM_saveTab: [{ type: "tampermonkey", versionConstraint: ">=4.0.10" }],
|
||||
"GM.setClipboard": [
|
||||
{ type: "tampermonkey", versionConstraint: ">=4.5" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.12.0" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=4" },
|
||||
],
|
||||
GM_setClipboard: [
|
||||
{ type: "tampermonkey", versionConstraint: ">=2.6.2767" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.5.0" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=1.10 <4" },
|
||||
],
|
||||
"GM.setValue": [
|
||||
{ type: "tampermonkey", versionConstraint: ">=4.5" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.12.0" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=4" },
|
||||
],
|
||||
GM_setValue: [
|
||||
{ type: "tampermonkey", versionConstraint: "*" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=0.3-beta <4" },
|
||||
],
|
||||
"GM.unregisterMenuCommand": [{ type: "tampermonkey", versionConstraint: ">=4.5" }],
|
||||
GM_unregisterMenuCommand: [
|
||||
{ type: "tampermonkey", versionConstraint: ">=3.6.3737" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.9.4" },
|
||||
],
|
||||
"GM.webRequest": [{ type: "tampermonkey", versionConstraint: ">=4.5" }],
|
||||
GM_webRequest: [{ type: "tampermonkey", versionConstraint: ">=4.4" }],
|
||||
GM_xmlhttpRequest: [
|
||||
{ type: "tampermonkey", versionConstraint: "*" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=0.2.5 <4" },
|
||||
],
|
||||
"GM.xmlHttpRequest": [
|
||||
{ type: "tampermonkey", versionConstraint: ">=4.5" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.12.0" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=4.0" },
|
||||
],
|
||||
none: [
|
||||
{ type: "tampermonkey", versionConstraint: "*" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: "*" },
|
||||
],
|
||||
unsafeWindow: [
|
||||
{ type: "tampermonkey", versionConstraint: "*" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=0.5-beta" },
|
||||
],
|
||||
"window.close": [
|
||||
{ type: "tampermonkey", versionConstraint: ">=3.12.58" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.6.2" },
|
||||
],
|
||||
"window.focus": [
|
||||
{ type: "tampermonkey", versionConstraint: ">=3.12.58" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.12.10" },
|
||||
],
|
||||
"window.onurlchange": [{ type: "tampermonkey", versionConstraint: ">=4.11" }],
|
||||
};
|
||||
|
||||
const gmPolyfillOverride = {
|
||||
GM_addStyle: "ignore",
|
||||
GM_registerMenuCommand: "ignore",
|
||||
GM_getResourceText: {
|
||||
deps: ["GM.getResourceUrl", "GM.log"],
|
||||
},
|
||||
"GM.log": "ignore",
|
||||
"GM.info": {
|
||||
deps: ["GM_info"],
|
||||
},
|
||||
"GM.addStyle": {
|
||||
deps: ["GM_addStyle"],
|
||||
},
|
||||
"GM.deleteValue": {
|
||||
deps: ["GM_deleteValue"],
|
||||
},
|
||||
"GM.getResourceUrl": {
|
||||
deps: ["GM_getResourceURL"],
|
||||
},
|
||||
"GM.getValue": {
|
||||
deps: ["GM_getValue"],
|
||||
},
|
||||
"GM.listValues": {
|
||||
deps: ["GM_listValues"],
|
||||
},
|
||||
"GM.notification": {
|
||||
deps: ["GM_notification"],
|
||||
},
|
||||
"GM.openInTab": {
|
||||
deps: ["GM_openInTab"],
|
||||
},
|
||||
"GM.registerMenuCommand": {
|
||||
deps: ["GM_registerMenuCommand"],
|
||||
},
|
||||
"GM.setClipboard": {
|
||||
deps: ["GM_setClipboard"],
|
||||
},
|
||||
"GM.setValue": {
|
||||
deps: ["GM_setValue"],
|
||||
},
|
||||
"GM.xmlHttpRequest": {
|
||||
deps: ["GM_xmlhttpRequest"],
|
||||
},
|
||||
"GM.getResourceText": {
|
||||
deps: ["GM_getResourceText"],
|
||||
},
|
||||
};
|
||||
|
||||
module.exports.compatMap = compatMap;
|
||||
module.exports.gmPolyfillOverride = gmPolyfillOverride;
|
202
packages/eslint/compat-headers.js
Normal file
202
packages/eslint/compat-headers.js
Normal file
@ -0,0 +1,202 @@
|
||||
// Fork from eslint-plugin-userscripts
|
||||
// Documentation:
|
||||
// - Tampermonkey: https://www.tampermonkey.net/documentation.php
|
||||
// - Violentmonkey: https://violentmonkey.github.io/api/metadata-block/
|
||||
// - Greasemonkey: https://wiki.greasespot.net/Metadata_Block
|
||||
// - ScriptCat: https://docs.scriptcat.org/docs/dev/
|
||||
const compatMap = {
|
||||
localized: {
|
||||
name: [
|
||||
{ type: "tampermonkey", versionConstraint: ">=3.9" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.1.6.8" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=2.2 <4 || >=4.11" },
|
||||
],
|
||||
description: [
|
||||
{ type: "tampermonkey", versionConstraint: ">=3.9" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.1.6.8" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=2.2 <4 || >=4.11" },
|
||||
],
|
||||
antifeature: [
|
||||
{ type: "tampermonkey", versionConstraint: ">=4.12" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.12.10" },
|
||||
],
|
||||
},
|
||||
unlocalized: {
|
||||
include: [
|
||||
{ type: "tampermonkey", versionConstraint: "*" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: "*" },
|
||||
],
|
||||
exclude: [
|
||||
{ type: "tampermonkey", versionConstraint: "*" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: "*" },
|
||||
],
|
||||
"exclude-match": [{ type: "violentmonkey", versionConstraint: ">=2.6.2" }],
|
||||
version: [
|
||||
{ type: "tampermonkey", versionConstraint: "*" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=0.9.0" },
|
||||
],
|
||||
"run-at": [
|
||||
{ type: "tampermonkey", versionConstraint: ">=1.1.2190" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=0.9.8" },
|
||||
],
|
||||
resource: [
|
||||
{ type: "tampermonkey", versionConstraint: "*" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=0.8.20080609.0" },
|
||||
],
|
||||
require: [
|
||||
{ type: "tampermonkey", versionConstraint: "*" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=0.8.20080609.0" },
|
||||
],
|
||||
match: [
|
||||
{ type: "tampermonkey", versionConstraint: ">=1.1.2190" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=0.9.8" },
|
||||
],
|
||||
"user-agent": [{ type: "tampermonkey", versionConstraint: ">=2.8.2894" }],
|
||||
unwrap: [
|
||||
{ type: "greasemonkey", versionConstraint: "0.8.1 - 0.9.22" },
|
||||
{ type: "tampermonkey", versionConstraint: ">=4.14" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.13.0.16" },
|
||||
],
|
||||
grant: [
|
||||
{ type: "tampermonkey", versionConstraint: ">=3.0.3389" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.1.6.1" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=1" },
|
||||
],
|
||||
noframes: [
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.8.17" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=2.3" },
|
||||
{ type: "tampermonkey", versionConstraint: ">=2.0.2355" },
|
||||
],
|
||||
connect: [
|
||||
{ type: "tampermonkey", versionConstraint: ">=4.0" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.12.10" },
|
||||
],
|
||||
webRequest: [{ type: "tampermonkey", versionConstraint: ">=4.4" }],
|
||||
"inject-into": [{ type: "violentmonkey", versionConstraint: ">=2.10.0" }],
|
||||
domain: [], // Scriptish
|
||||
nocompat: [{ type: "tampermonkey", versionConstraint: ">=2.4.2683" }],
|
||||
namespace: [
|
||||
{ type: "tampermonkey", versionConstraint: "*" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=0.2.5" },
|
||||
],
|
||||
sandbox: [{ type: "tampermonkey", versionConstraint: ">=4.18" }],
|
||||
},
|
||||
nonFunctional: {
|
||||
name: [
|
||||
{ type: "tampermonkey", versionConstraint: "*" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: "*" },
|
||||
],
|
||||
description: [
|
||||
{ type: "tampermonkey", versionConstraint: "*" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: "*" },
|
||||
],
|
||||
author: [
|
||||
{ type: "tampermonkey", versionConstraint: "*" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
],
|
||||
antifeature: [
|
||||
{ type: "tampermonkey", versionConstraint: ">=4.12" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.12.10" },
|
||||
],
|
||||
copyright: [
|
||||
{ type: "tampermonkey", versionConstraint: "*" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
],
|
||||
license: [{ type: "tampermonkey", versionConstraint: "*" }],
|
||||
icon: [
|
||||
{ type: "tampermonkey", versionConstraint: ">=2.0.2359" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=0.9.0" },
|
||||
],
|
||||
defaulticon: [{ type: "tampermonkey", versionConstraint: ">=2.0.2359" }],
|
||||
icon64: [{ type: "tampermonkey", versionConstraint: ">=2.0.2359" }],
|
||||
iconURL: [{ type: "tampermonkey", versionConstraint: ">=2.0.2359" }],
|
||||
icon64URL: [{ type: "tampermonkey", versionConstraint: ">=2.0.2359" }],
|
||||
homepage: [
|
||||
{ type: "tampermonkey", versionConstraint: ">=2.0.2395" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
],
|
||||
homepageURL: [
|
||||
{ type: "tampermonkey", versionConstraint: ">=2.0.2395" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.1.5" },
|
||||
],
|
||||
website: [
|
||||
{ type: "tampermonkey", versionConstraint: ">=2.0.2395" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.13.1.2" },
|
||||
],
|
||||
source: [
|
||||
{ type: "tampermonkey", versionConstraint: ">=2.0.2395" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.13.1.2" },
|
||||
],
|
||||
downloadURL: [
|
||||
{ type: "tampermonkey", versionConstraint: ">=2.5.64" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=0.9.14" },
|
||||
],
|
||||
updateURL: [
|
||||
{ type: "tampermonkey", versionConstraint: ">=2.5.64" },
|
||||
{ type: "violentmonkey", versionConstraint: "*" },
|
||||
{ type: "greasemonkey", versionConstraint: ">=0.9.12" },
|
||||
],
|
||||
installURL: [{ type: "greasemonkey", versionConstraint: ">=0.9.2" }],
|
||||
supportURL: [
|
||||
{ type: "tampermonkey", versionConstraint: ">=3.8" },
|
||||
{ type: "violentmonkey", versionConstraint: ">=2.1.6.2" },
|
||||
],
|
||||
|
||||
// OpenUserJS
|
||||
collaborator: [],
|
||||
unstableMinify: [],
|
||||
"oujs:author": [],
|
||||
"oujs:collaborator": [],
|
||||
|
||||
// UserScripts.org
|
||||
"uso:script": [],
|
||||
"uso:version": [],
|
||||
"uso:timestamp": [],
|
||||
"uso:hash": [],
|
||||
"uso:rating": [],
|
||||
"uso:installs": [],
|
||||
"uso:reviews": [],
|
||||
"uso:discussions": [],
|
||||
"uso:fans": [],
|
||||
"uso:unlisted": [],
|
||||
contributor: [],
|
||||
contributors: [],
|
||||
major: [],
|
||||
minor: [],
|
||||
build: [],
|
||||
|
||||
// GreasyFork
|
||||
contributionURL: [],
|
||||
contributionAmount: [],
|
||||
incompatible: [],
|
||||
compatible: [{ type: "violentmonkey", versionConstraint: ">=2.12.10" }],
|
||||
|
||||
// Popular but not documented
|
||||
history: [],
|
||||
developer: [],
|
||||
|
||||
// SctiptCat
|
||||
background: [],
|
||||
crontab: [],
|
||||
cloudCat: [],
|
||||
cloudServer: [],
|
||||
exportValue: [],
|
||||
exportCookie: [],
|
||||
scriptUrl: [],
|
||||
storageName: [],
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = compatMap;
|
131
packages/eslint/linter-config.ts
Normal file
131
packages/eslint/linter-config.ts
Normal file
@ -0,0 +1,131 @@
|
||||
// 由于原库(eslint-plugin-userscripts)使用了 fs 模块,无法在 webpack5 中直接使用,故改写成如下形式
|
||||
const userscriptsConfig = {
|
||||
rules: {
|
||||
"userscripts/filename-user": ["error", "always"],
|
||||
"userscripts/no-invalid-metadata": ["error", { top: "required" }],
|
||||
"userscripts/require-name": ["error", "required"],
|
||||
"userscripts/require-description": ["error", "required"],
|
||||
"userscripts/require-version": ["error", "required"],
|
||||
"userscripts/require-attribute-space-prefix": "error",
|
||||
"userscripts/use-homepage-and-url": "error",
|
||||
"userscripts/use-download-and-update-url": "error",
|
||||
"userscripts/align-attributes": ["error", 2],
|
||||
"userscripts/metadata-spacing": ["error", "always"],
|
||||
"userscripts/no-invalid-headers": "error",
|
||||
"userscripts/no-invalid-grant": "error",
|
||||
"userscripts/compat-grant": "off",
|
||||
"userscripts/compat-headers": "off",
|
||||
"userscripts/better-use-match": "warn",
|
||||
},
|
||||
};
|
||||
|
||||
const userscriptsRules = Object.fromEntries(
|
||||
Object.keys(userscriptsConfig.rules).map((name) => {
|
||||
const ruleName = name.split("/")[1];
|
||||
// eslint-disable-next-line import/no-dynamic-require, global-require
|
||||
const ruleMeta = require(`eslint-plugin-userscripts/lib/rules/${ruleName}.js`);
|
||||
return [
|
||||
name,
|
||||
{
|
||||
...ruleMeta,
|
||||
meta: {
|
||||
...ruleMeta.meta,
|
||||
docs: {
|
||||
...ruleMeta.meta.docs,
|
||||
url: `https://yash-singh1.github.io/eslint-plugin-userscripts/#/rules/${ruleName}`,
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
})
|
||||
);
|
||||
|
||||
// 默认规则
|
||||
const config = {
|
||||
parserOptions: {
|
||||
ecmaVersion: "latest",
|
||||
sourceType: "script",
|
||||
ecmaFeatures: {
|
||||
globalReturn: true,
|
||||
},
|
||||
},
|
||||
globals: {
|
||||
CATRetryError: "readonly",
|
||||
CAT_fileStorage: "readonly",
|
||||
CAT_userConfig: "readonly",
|
||||
},
|
||||
rules: {
|
||||
"constructor-super": ["error"],
|
||||
"for-direction": ["error"],
|
||||
"getter-return": ["error"],
|
||||
"no-async-promise-executor": ["error"],
|
||||
"no-case-declarations": ["error"],
|
||||
"no-class-assign": ["error"],
|
||||
"no-compare-neg-zero": ["error"],
|
||||
"no-cond-assign": ["error"],
|
||||
"no-const-assign": ["error"],
|
||||
"no-constant-condition": ["error"],
|
||||
"no-control-regex": ["error"],
|
||||
"no-debugger": ["error"],
|
||||
"no-delete-var": ["error"],
|
||||
"no-dupe-args": ["error"],
|
||||
"no-dupe-class-members": ["error"],
|
||||
"no-dupe-else-if": ["error"],
|
||||
"no-dupe-keys": ["error"],
|
||||
"no-duplicate-case": ["error"],
|
||||
"no-empty": ["error"],
|
||||
"no-empty-character-class": ["error"],
|
||||
"no-empty-pattern": ["error"],
|
||||
"no-ex-assign": ["error"],
|
||||
"no-extra-boolean-cast": ["error"],
|
||||
"no-extra-semi": ["error"],
|
||||
"no-fallthrough": ["error"],
|
||||
"no-func-assign": ["error"],
|
||||
"no-global-assign": ["error"],
|
||||
"no-import-assign": ["error"],
|
||||
"no-inner-declarations": ["error"],
|
||||
"no-invalid-regexp": ["error"],
|
||||
"no-irregular-whitespace": ["error"],
|
||||
"no-loss-of-precision": ["error"],
|
||||
"no-misleading-character-class": ["error"],
|
||||
"no-mixed-spaces-and-tabs": ["error"],
|
||||
"no-new-symbol": ["error"],
|
||||
"no-nonoctal-decimal-escape": ["error"],
|
||||
"no-obj-calls": ["error"],
|
||||
"no-octal": ["error"],
|
||||
"no-prototype-builtins": ["error"],
|
||||
"no-redeclare": ["error"],
|
||||
"no-regex-spaces": ["error"],
|
||||
"no-self-assign": ["error"],
|
||||
"no-setter-return": ["error"],
|
||||
"no-shadow-restricted-names": ["error"],
|
||||
"no-sparse-arrays": ["error"],
|
||||
"no-this-before-super": ["error"],
|
||||
"no-undef": ["warn"],
|
||||
"no-unexpected-multiline": ["error"],
|
||||
"no-unreachable": ["error"],
|
||||
"no-unsafe-finally": ["error"],
|
||||
"no-unsafe-negation": ["error"],
|
||||
"no-unsafe-optional-chaining": ["error"],
|
||||
"no-unused-labels": ["error"],
|
||||
"no-unused-vars": ["error"],
|
||||
"no-useless-backreference": ["error"],
|
||||
"no-useless-catch": ["error"],
|
||||
"no-useless-escape": ["error"],
|
||||
"no-with": ["error"],
|
||||
"require-yield": ["error"],
|
||||
"use-isnan": ["error"],
|
||||
"valid-typeof": ["error"],
|
||||
...userscriptsConfig.rules,
|
||||
},
|
||||
env: {
|
||||
es6: true,
|
||||
browser: true,
|
||||
greasemonkey: true,
|
||||
},
|
||||
};
|
||||
|
||||
// 以文本形式导出默认规则
|
||||
const defaultConfig = JSON.stringify(config, null, 2);
|
||||
|
||||
export { defaultConfig, userscriptsConfig, userscriptsRules };
|
Reference in New Issue
Block a user