mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
Replace prettier by stylistic to lint JavaScript (#3303)
In the latest versions of ESLint, more and more formatting rules were removed or declared deprecated. These rules have been integrated into the new Stylistic package (https://eslint.style/guide/why) and expanded. Stylistic acts as a better formatter for JavaScript as Prettier. With this PR there are many changes that make the code more uniform, but it may be difficult to review due to the large amount. Even if I have no worries about the changes, perhaps this would be something for the release after next. Let me know what you think.
This commit is contained in:
committed by
GitHub
parent
4e7b68a69d
commit
0b70274a1a
@@ -25,7 +25,7 @@ describe("AnimateCSS integration Test", () => {
|
||||
*/
|
||||
const doTest = async (animationIn, animationOut) => {
|
||||
await helpers.getDocument();
|
||||
let elem = await helpers.waitForElement(`.compliments`);
|
||||
let elem = await helpers.waitForElement(".compliments");
|
||||
expect(elem).not.toBeNull();
|
||||
let styles = window.getComputedStyle(elem);
|
||||
|
||||
|
@@ -4,13 +4,13 @@
|
||||
*/
|
||||
const mockError = (err) => {
|
||||
if (
|
||||
err.includes("ECONNREFUSED") ||
|
||||
err.includes("ECONNRESET") ||
|
||||
err.includes("socket hang up") ||
|
||||
err.includes("exports is not defined") ||
|
||||
err.includes("write EPIPE") ||
|
||||
err.includes("AggregateError") ||
|
||||
err.includes("ERR_SOCKET_CONNECTION_TIMEOUT")
|
||||
err.includes("ECONNREFUSED")
|
||||
|| err.includes("ECONNRESET")
|
||||
|| err.includes("socket hang up")
|
||||
|| err.includes("exports is not defined")
|
||||
|| err.includes("write EPIPE")
|
||||
|| err.includes("AggregateError")
|
||||
|| err.includes("ERR_SOCKET_CONNECTION_TIMEOUT")
|
||||
) {
|
||||
jest.fn();
|
||||
} else {
|
||||
|
@@ -2,6 +2,7 @@ const helpers = require("../helpers/global-setup");
|
||||
const serverBasicAuth = require("../helpers/basic-auth");
|
||||
|
||||
describe("Calendar module", () => {
|
||||
|
||||
/**
|
||||
* @param {string} element css selector
|
||||
* @param {string} result expected number
|
||||
|
@@ -1,6 +1,7 @@
|
||||
const helpers = require("../helpers/global-setup");
|
||||
|
||||
describe("Compliments module", () => {
|
||||
|
||||
/**
|
||||
* move similar tests in function doTest
|
||||
* @param {Array} complimentsArray The array of compliments.
|
||||
|
@@ -125,7 +125,7 @@ describe("Translations", () => {
|
||||
|
||||
const mmm = {
|
||||
name: "TranslationTest",
|
||||
file(file) {
|
||||
file (file) {
|
||||
return `http://localhost:3000/${file}`;
|
||||
}
|
||||
};
|
||||
|
@@ -1,6 +1,7 @@
|
||||
const helpers = require("../helpers/global-setup");
|
||||
|
||||
describe("Calendar module", () => {
|
||||
|
||||
/**
|
||||
* move similar tests in function doTest
|
||||
* @param {string} cssClass css selector
|
||||
|
@@ -1,6 +1,7 @@
|
||||
const helpers = require("../helpers/global-setup");
|
||||
|
||||
describe("Compliments module", () => {
|
||||
|
||||
/**
|
||||
* move similar tests in function doTest
|
||||
* @param {Array} complimentsArray The array of compliments.
|
||||
|
@@ -163,7 +163,7 @@ describe("Translator", () => {
|
||||
describe("load", () => {
|
||||
const mmm = {
|
||||
name: "TranslationTest",
|
||||
file(file) {
|
||||
file (file) {
|
||||
return `http://localhost:3000/translations/${file}`;
|
||||
}
|
||||
};
|
||||
|
@@ -31,7 +31,7 @@ describe("server_functions tests", () => {
|
||||
};
|
||||
|
||||
request = {
|
||||
url: `/cors?url=www.test.com`
|
||||
url: "/cors?url=www.test.com"
|
||||
};
|
||||
});
|
||||
|
||||
|
@@ -32,7 +32,7 @@ describe("Updatenotification", () => {
|
||||
const { promisify } = require("util");
|
||||
promisify.mockReturnValue(execMock);
|
||||
|
||||
const GitHelper = require(`../../../modules/default/updatenotification/git_helper`);
|
||||
const GitHelper = require("../../../modules/default/updatenotification/git_helper");
|
||||
gitHelper = new GitHelper();
|
||||
});
|
||||
|
||||
|
@@ -84,7 +84,7 @@ describe("Default modules utils tests", () => {
|
||||
|
||||
it("Returns object when data is received", async () => {
|
||||
urlToCall = "www.test.com";
|
||||
fetchResponse = new Response('{"body": "some content"}');
|
||||
fetchResponse = new Response("{\"body\": \"some content\"}");
|
||||
|
||||
const response = await performWebRequest(urlToCall);
|
||||
|
||||
@@ -93,7 +93,7 @@ describe("Default modules utils tests", () => {
|
||||
|
||||
it("Returns expected headers when data is received", async () => {
|
||||
urlToCall = "www.test.com";
|
||||
fetchResponse = new Response('{"body": "some content"}', { headers: { header1: "value1", header2: "value2" } });
|
||||
fetchResponse = new Response("{\"body\": \"some content\"}", { headers: { header1: "value1", header2: "value2" } });
|
||||
|
||||
const response = await performWebRequest(urlToCall, "json", false, undefined, ["header1"]);
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
const TestSequencer = require("@jest/test-sequencer").default;
|
||||
|
||||
class CustomSequencer extends TestSequencer {
|
||||
sort(tests) {
|
||||
sort (tests) {
|
||||
const orderPath = ["unit", "electron", "e2e"];
|
||||
return tests.sort((testA, testB) => {
|
||||
let indexA = -1;
|
||||
|
Reference in New Issue
Block a user