mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Enable eslint rule 'no-useless-escape'
Enable recommended rule 'no-useless-escape' [1] and manually fix violations. [1] https://eslint.org/docs/latest/rules/no-useless-escape Ref: #8068 Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
parent
f29f0b7fd1
commit
14bb7730fe
5 changed files with 5 additions and 4 deletions
|
|
@ -38,7 +38,7 @@ const g_ModProperties = {
|
|||
/**
|
||||
* Tests if the string only contains alphanumeric characters and _ -
|
||||
*/
|
||||
const g_RegExpName = /[a-zA-Z0-9\-\_]+/;
|
||||
const g_RegExpName = /[a-zA-Z0-9\-_]+/;
|
||||
|
||||
/**
|
||||
* Tests if the version string consists only of numbers and at most two periods.
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ function escapeText(text)
|
|||
|
||||
function unescapeText(text)
|
||||
{
|
||||
return text.replace(/\\\\/g, "\\").replace(/\\\[/g, "\[");
|
||||
return text.replace(/\\\\/g, "\\").replace(/\\\[/g, "[");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ var g_BuddyListDelimiter = ",";
|
|||
*/
|
||||
function splitRatingFromNick(playerName)
|
||||
{
|
||||
const result = /^(\S+)\ \((\d+)\)$/g.exec(playerName);
|
||||
const result = /^(\S+) \((\d+)\)$/g.exec(playerName);
|
||||
return { "nick": result ? result[1] : playerName, "rating": result ? +result[2] : "" };
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ function init()
|
|||
const hotkeys = Engine.GetHotkeyMap();
|
||||
|
||||
// Replace anything starting with 'hotkey.' with its hotkey.
|
||||
mainText.caption = text.replace(/hotkey\.([a-z0-9_\.]+)/g, (_, k) => formatHotkeyCombinations(hotkeys[k]));
|
||||
mainText.caption = text.replace(/hotkey.([a-z0-9_.]+)/g, (_, k) => formatHotkeyCombinations(hotkeys[k]));
|
||||
|
||||
return new Promise(closePageCallback => {
|
||||
Engine.GetGUIObjectByName("closeButton").onPress = closePageCallback;
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ const configEslintRecommended = {
|
|||
/* "no-unused-vars": "warn", */
|
||||
"no-useless-backreference": "warn",
|
||||
"no-useless-catch": "warn",
|
||||
"no-useless-escape": "warn",
|
||||
"no-with": "warn",
|
||||
"use-isnan": "warn",
|
||||
"valid-typeof": "warn",
|
||||
|
|
|
|||
Loading…
Reference in a new issue