Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump eslint to 9.x #1371

Merged
merged 10 commits into from
May 28, 2024
20 changes: 0 additions & 20 deletions .eslintrc.yml

This file was deleted.

3 changes: 1 addition & 2 deletions bin/phantomas.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ let options = parseArgv(process.argv);
if (typeof options.url !== "string" && typeof options.config === "undefined") {
debug("URL not provided - show help and leave");
getProgram().outputHelp();
process.exitCode = 1;
return;
process.exit(1);
}

url = options.url;
Expand Down
2 changes: 1 addition & 1 deletion core/modules/requestsMonitor/requestsMonitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function parseEntryUrl(entry) {
entry.protocol = false;
entry.isBlob = true;
} else {
parsed = new URL(entry.url) || {};
parsed = new URL(entry.url);

entry.protocol = parsed.protocol.replace(":", ""); // e.g. "http:"
entry.domain = parsed.hostname;
Expand Down
1 change: 1 addition & 0 deletions core/scope.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
console,
"log:" + stringify(Array.prototype.slice.call(arguments))
);
// eslint-disable-next-line no-empty
} catch (e) {}
};

Expand Down
39 changes: 39 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const globals = require("globals");
const js = require("@eslint/js");

const eslintConfigPrettier = require("eslint-config-prettier");

module.exports = [
js.configs.recommended,
eslintConfigPrettier,
{
languageOptions: {
ecmaVersion: 2022,
sourceType: "script",
globals: {
// https://eslint.org/docs/latest/use/configure/language-options#predefined-global-variables
...globals.node,
...globals.browser,
},
},
rules: {
"prefer-const": "off",
"no-console": "off",
"no-async-promise-executor": "off",
// https://eslint.org/docs/latest/rules/no-unused-vars
"no-unused-vars": [
"error",
{
vars: "all",
args: "after-used",
caughtErrors: "none", // ignore catch block variables
ignoreRestSiblings: false,
reportUsedIgnorePattern: false,
},
],
},
},
{
ignores: ["coverage/**", "test/webroot/**"],
},
];
3 changes: 1 addition & 2 deletions examples/screenshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ var phantomas = require(".."),

if (typeof url !== "string") {
console.log("Usage:\n\t./screenshot.js <URL>");
process.exitCode = 1;
return;
process.exit(1);
}

run = phantomas(url, {
Expand Down
4 changes: 2 additions & 2 deletions extensions/postLoadDelay/postLoadDelay.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
"use strict";

const { setTimeout } = require("timers/promises");
const { setTimeout: setTimeoutAsync } = require("timers/promises");

module.exports = function (phantomas) {
// e.g. --post-load-delay 5
Expand All @@ -19,6 +19,6 @@ module.exports = function (phantomas) {
phantomas.on("beforeClose", async () => {
phantomas.log("Sleeping for %d seconds", delay);

return setTimeout(delay * 1000);
return setTimeoutAsync(delay * 1000);
});
};
Loading
Loading