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
12
js/app.js
12
js/app.js
@@ -47,7 +47,7 @@ process.on("uncaughtException", function (err) {
|
||||
* The core app.
|
||||
* @class
|
||||
*/
|
||||
function App() {
|
||||
function App () {
|
||||
let nodeHelpers = [];
|
||||
let httpServer;
|
||||
|
||||
@@ -56,7 +56,7 @@ function App() {
|
||||
* @async
|
||||
* @returns {Promise<object>} the loaded config or the defaults if something goes wrong
|
||||
*/
|
||||
async function loadConfig() {
|
||||
async function loadConfig () {
|
||||
Log.log("Loading config ...");
|
||||
const defaults = require(`${__dirname}/defaults`);
|
||||
|
||||
@@ -136,7 +136,7 @@ function App() {
|
||||
* if it encounters one option from the deprecated.js list
|
||||
* @param {object} userConfig The user config
|
||||
*/
|
||||
function checkDeprecatedOptions(userConfig) {
|
||||
function checkDeprecatedOptions (userConfig) {
|
||||
const deprecated = require(`${global.root_path}/js/deprecated`);
|
||||
const deprecatedOptions = deprecated.configs;
|
||||
|
||||
@@ -150,7 +150,7 @@ function App() {
|
||||
* Loads a specific module.
|
||||
* @param {string} module The name of the module (including subpath).
|
||||
*/
|
||||
function loadModule(module) {
|
||||
function loadModule (module) {
|
||||
const elements = module.split("/");
|
||||
const moduleName = elements[elements.length - 1];
|
||||
let moduleFolder = `${__dirname}/../modules/${module}`;
|
||||
@@ -204,7 +204,7 @@ function App() {
|
||||
* @param {Module[]} modules All modules to be loaded
|
||||
* @returns {Promise} A promise that is resolved when all modules been loaded
|
||||
*/
|
||||
async function loadModules(modules) {
|
||||
async function loadModules (modules) {
|
||||
Log.log("Loading module helpers ...");
|
||||
|
||||
for (let module of modules) {
|
||||
@@ -221,7 +221,7 @@ function App() {
|
||||
* @returns {number} A positive number if a is larger than b, a negative
|
||||
* number if a is smaller and 0 if they are the same
|
||||
*/
|
||||
function cmpVersions(a, b) {
|
||||
function cmpVersions (a, b) {
|
||||
let i, diff;
|
||||
const regExStrip0 = /(\.0+)+$/;
|
||||
const segmentsA = a.replace(regExStrip0, "").split(".");
|
||||
|
Reference in New Issue
Block a user