mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-30 05:00:31 +00:00
Merge pull request #20800 from Chocobo1/eslint_v9
WebUI: migrate to ESLint v9
This commit is contained in:
commit
a19ef58400
@ -1,29 +0,0 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es2022": true
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@stylistic/disable-legacy"
|
||||
],
|
||||
"plugins": [
|
||||
"html",
|
||||
"@stylistic"
|
||||
],
|
||||
"rules": {
|
||||
"eqeqeq": "error",
|
||||
"no-undef": "off",
|
||||
"no-unused-vars": "off",
|
||||
"@stylistic/no-mixed-operators": [
|
||||
"error",
|
||||
{
|
||||
"groups": [
|
||||
["&", "|", "^", "~", "<<", ">>", ">>>", "==", "!=", "===", "!==", ">", ">=", "<", "<=", "&&", "||", "in", "instanceof"]
|
||||
]
|
||||
}
|
||||
],
|
||||
"@stylistic/nonblock-statement-body-position": ["error", "below"],
|
||||
"@stylistic/semi": "error"
|
||||
}
|
||||
}
|
44
src/webui/www/eslint.config.mjs
Normal file
44
src/webui/www/eslint.config.mjs
Normal file
@ -0,0 +1,44 @@
|
||||
import Globals from 'globals';
|
||||
import Html from 'eslint-plugin-html';
|
||||
import Js from '@eslint/js';
|
||||
import Stylistic from '@stylistic/eslint-plugin';
|
||||
import * as RegexpPlugin from 'eslint-plugin-regexp';
|
||||
|
||||
export default [
|
||||
Js.configs.recommended,
|
||||
RegexpPlugin.configs["flat/recommended"],
|
||||
Stylistic.configs["disable-legacy"],
|
||||
{
|
||||
files: [
|
||||
"**/*.html",
|
||||
"**/*.js",
|
||||
"**/*.mjs"
|
||||
],
|
||||
languageOptions: {
|
||||
ecmaVersion: 2022,
|
||||
globals: {
|
||||
...Globals.browser
|
||||
}
|
||||
},
|
||||
plugins: {
|
||||
Html,
|
||||
RegexpPlugin,
|
||||
Stylistic
|
||||
},
|
||||
rules: {
|
||||
"eqeqeq": "error",
|
||||
"no-undef": "off",
|
||||
"no-unused-vars": "off",
|
||||
"Stylistic/no-mixed-operators": [
|
||||
"error",
|
||||
{
|
||||
"groups": [
|
||||
["&", "|", "^", "~", "<<", ">>", ">>>", "==", "!=", "===", "!==", ">", ">=", "<", "<=", "&&", "||", "in", "instanceof"]
|
||||
]
|
||||
}
|
||||
],
|
||||
"Stylistic/nonblock-statement-body-position": ["error", "below"],
|
||||
"Stylistic/semi": "error"
|
||||
}
|
||||
}
|
||||
];
|
@ -12,8 +12,9 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@stylistic/eslint-plugin": "*",
|
||||
"eslint": "^8",
|
||||
"eslint-plugin-html": "^8",
|
||||
"eslint": "*",
|
||||
"eslint-plugin-html": "*",
|
||||
"eslint-plugin-regexp": "*",
|
||||
"html-validate": "*",
|
||||
"i18next-parser": "*",
|
||||
"js-beautify": "*",
|
||||
|
@ -1527,8 +1527,8 @@ window.addEventListener("DOMContentLoaded", function() {
|
||||
return lowercaseStr.startsWith("http:")
|
||||
|| lowercaseStr.startsWith("https:")
|
||||
|| lowercaseStr.startsWith("magnet:")
|
||||
|| ((str.length === 40) && !(/[^0-9A-Fa-f]/.test(str))) // v1 hex-encoded SHA-1 info-hash
|
||||
|| ((str.length === 32) && !(/[^2-7A-Za-z]/.test(str))); // v1 Base32 encoded SHA-1 info-hash
|
||||
|| ((str.length === 40) && !(/[^0-9A-F]/i.test(str))) // v1 hex-encoded SHA-1 info-hash
|
||||
|| ((str.length === 32) && !(/[^2-7A-Z]/i.test(str))); // v1 Base32 encoded SHA-1 info-hash
|
||||
});
|
||||
|
||||
if (urls.length <= 0)
|
||||
|
@ -143,7 +143,7 @@ window.qBittorrent.Misc = (function() {
|
||||
* JS counterpart of the function in src/misc.cpp
|
||||
*/
|
||||
const parseHtmlLinks = function(text) {
|
||||
const exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|])/ig;
|
||||
const exp = /(\b(https?|ftp|file):\/\/[-\w+&@#/%?=~|!:,.;]*[-\w+&@#/%=~|])/gi;
|
||||
return text.replace(exp, "<a target='_blank' rel='noopener noreferrer' href='$1'>$1</a>");
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user