' +
+ const price_options = $(
+ '
' +
'
' +
'Calculate prices as the:
' +
'
');
- var dialog = unsafeWindow.ShowConfirmDialog('Steam Economy Enhancer', price_options).done(function() {
+ unsafeWindow.ShowConfirmDialog('Steam Economy Enhancer', price_options).done(() => {
setSetting(SETTING_MIN_NORMAL_PRICE, $('#' + SETTING_MIN_NORMAL_PRICE, price_options).val());
setSetting(SETTING_MAX_NORMAL_PRICE, $('#' + SETTING_MAX_NORMAL_PRICE, price_options).val());
setSetting(SETTING_MIN_FOIL_PRICE, $('#' + SETTING_MIN_FOIL_PRICE, price_options).val());
@@ -3700,7 +3909,8 @@
//#endregion
//#region UI
- injectCss('.ui-selected { outline: 2px dashed #FFFFFF; } ' +
+ injectCss(
+ '.ui-selected { outline: 2px dashed #FFFFFF; } ' +
'#logger { color: #767676; font-size: 12px;margin-top:16px; max-height: 200px; overflow-y: auto; }' +
'.trade_offer_sum { color: #767676; font-size: 12px;margin-top:8px; }' +
'.trade_offer_buttons { margin-top: 12px; }' +
@@ -3735,9 +3945,10 @@
'#see_market_progress[hidden] { visibility: hidden; }' +
'.pagination { padding-left: 0px; }' +
'.pagination li { display:inline-block; padding: 5px 10px;background: rgba(255, 255, 255, 0.10); margin-right: 6px; border: 1px solid #666666; }' +
- '.pagination li.active { background: rgba(255, 255, 255, 0.25); }');
+ '.pagination li.active { background: rgba(255, 255, 255, 0.25); }'
+ );
- $(document).ready(function() {
+ $(document).ready(() => {
// Make sure the user is logged in, there's not much we can do otherwise.
if (!isLoggedIn) {
return;
@@ -3757,24 +3968,19 @@
});
function injectCss(css) {
- var head, style;
- head = document.getElementsByTagName('head')[0];
+ const head = document.getElementsByTagName('head')[0];
if (!head) {
return;
}
- style = document.createElement('style');
+ const style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}
$.fn.delayedEach = function(timeout, callback, continuous) {
- var $els, iterator;
-
- $els = this;
- iterator = function(index) {
- var cur;
-
+ const $els = this;
+ const iterator = function(index) {
if (index >= $els.length) {
if (!continuous) {
return;
@@ -3782,20 +3988,15 @@
index = 0;
}
- cur = $els[index];
+ const cur = $els[index];
callback.call(cur, index, cur);
- setTimeout(function() {
+ setTimeout(() => {
iterator(++index);
}, timeout);
};
iterator(0);
};
-
- String.prototype.replaceAll = function(search, replacement) {
- var target = this;
- return target.replace(new RegExp(search, 'g'), replacement);
- };
//#endregion
-})(jQuery, async);
+}(jQuery, async));
diff --git a/eslint.config.mjs b/eslint.config.mjs
index 5a40f81..e105c41 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -1,10 +1,35 @@
-import globals from "globals";
-import pluginJs from "@eslint/js";
+import globals from 'globals';
+import pluginJs from '@eslint/js';
import userscripts from 'eslint-plugin-userscripts';
+import stylistic from '@stylistic/eslint-plugin';
export default [
- {languageOptions: { globals: globals.browser }},
- pluginJs.configs.recommended,
+ {
+ languageOptions: {
+ globals: globals.browser
+ },
+ plugins: {
+ '@stylistic': stylistic,
+ },
+ ...pluginJs.configs.recommended,
+ ...stylistic.configs['all-flat'],
+ rules: {
+ '@stylistic/function-call-argument-newline': 'off',
+ '@stylistic/multiline-comment-style': 'off',
+ '@stylistic/multiline-ternary': 'off',
+ '@stylistic/newline-per-chained-call': 'off',
+ '@stylistic/padded-blocks': 'off',
+ '@stylistic/quote-props': ['error', 'as-needed'],
+ '@stylistic/quotes': ['error', 'single'],
+ '@stylistic/space-before-function-paren': ['error', 'never'],
+ '@stylistic/spaced-comment': 'off',
+ '@stylistic/brace-style': ['error', '1tbs'],
+ curly: ['error', 'all'],
+ 'no-var': 'error',
+ 'prefer-const': 'error',
+ 'prefer-arrow-callback': 'error',
+ }
+ },
{
files: ['*.user.js'],
plugins: {
@@ -13,7 +38,7 @@ export default [
}
},
rules: {
- ...userscripts.configs.recommended.rules
+ ...userscripts.configs.recommended.rules,
},
settings: {
userscriptVersions: {
diff --git a/package.json b/package.json
index 7b3eb29..4e9007a 100644
--- a/package.json
+++ b/package.json
@@ -3,10 +3,12 @@
"name": "@nuklon/steam-economy-enhancer",
"license": "MIT",
"scripts": {
+ "fix": "eslint --fix",
"test": "eslint"
},
"devDependencies": {
"@eslint/js": "^9.5.0",
+ "@stylistic/eslint-plugin": "^2.3.0",
"eslint": "^9.5.0",
"eslint-plugin-userscripts": "^0.5.3",
"globals": "^15.6.0"