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
64 changed files with 954 additions and 942 deletions

View File

@@ -5,12 +5,13 @@
* MIT Licensed.
*/
const CalendarUtils = {
/**
* Capitalize the first letter of a string
* @param {string} string The string to capitalize
* @returns {string} The capitalized string
*/
capFirst: function (string) {
capFirst (string) {
return string.charAt(0).toUpperCase() + string.slice(1);
},
@@ -21,7 +22,7 @@ const CalendarUtils = {
* @param {number} timeFormat Specifies either 12 or 24-hour time format
* @returns {moment.LocaleSpecification} formatted time
*/
getLocaleSpecification: function (timeFormat) {
getLocaleSpecification (timeFormat) {
switch (timeFormat) {
case 12: {
return { longDateFormat: { LT: "h:mm A" } };
@@ -43,7 +44,7 @@ const CalendarUtils = {
* @param {number} maxTitleLines The max number of vertical lines before cutting event title
* @returns {string} The shortened string
*/
shorten: function (string, maxLength, wrapEvents, maxTitleLines) {
shorten (string, maxLength, wrapEvents, maxTitleLines) {
if (typeof string !== "string") {
return "";
}
@@ -98,7 +99,7 @@ const CalendarUtils = {
* yearmatchgroup: {number,optional} match group for year element
* @returns {string} The transformed title.
*/
titleTransform: function (title, titleReplace) {
titleTransform (title, titleReplace) {
let transformedTitle = title;
for (let tr in titleReplace) {
let transform = titleReplace[tr];