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:
Kristjan ESPERANTO 2023-12-25 08:17:11 +01:00 committed by GitHub
parent 4e7b68a69d
commit 0b70274a1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
64 changed files with 954 additions and 942 deletions

View file

@ -9,7 +9,7 @@
*/
(function () {
let initializing = false;
const fnTest = /xyz/.test(function () {
const fnTest = (/xyz/).test(function () {
xyz;
})
? /\b_super\b/
@ -36,31 +36,31 @@
// Copy the properties over onto the new prototype
for (const name in prop) {
// Check if we're overwriting an existing function
prototype[name] =
typeof prop[name] === "function" && typeof _super[name] === "function" && fnTest.test(prop[name])
prototype[name]
= typeof prop[name] === "function" && typeof _super[name] === "function" && fnTest.test(prop[name])
? (function (name, fn) {
return function () {
const tmp = this._super;
return function () {
const tmp = this._super;
// Add a new ._super() method that is the same method
// but on the super-class
this._super = _super[name];
// Add a new ._super() method that is the same method
// but on the super-class
this._super = _super[name];
// The method only need to be bound temporarily, so we
// remove it when we're done executing
const ret = fn.apply(this, arguments);
this._super = tmp;
// The method only need to be bound temporarily, so we
// remove it when we're done executing
const ret = fn.apply(this, arguments);
this._super = tmp;
return ret;
};
})(name, prop[name])
return ret;
};
}(name, prop[name]))
: prop[name];
}
/**
* The dummy class constructor
*/
function Class() {
function Class () {
// All construction is actually done in the init method
if (!initializing && this.init) {
this.init.apply(this, arguments);
@ -78,14 +78,14 @@
return Class;
};
})();
}());
/**
* Define the clone method for later use. Helper Method.
* @param {object} obj Object to be cloned
* @returns {object} the cloned object
*/
function cloneObject(obj) {
function cloneObject (obj) {
if (obj === null || typeof obj !== "object") {
return obj;
}