Skip to content

Commit

Permalink
Let Prettier read config from .editorconfig; use default for traili…
Browse files Browse the repository at this point in the history
…ngComma
  • Loading branch information
jace committed Jun 7, 2024
1 parent 7a3243a commit 373f864
Show file tree
Hide file tree
Showing 52 changed files with 176 additions and 177 deletions.
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ root = True
[*]
end_of_line = lf
insert_final_newline = true
tab_width = 8

# For all code, config and documentation
[*.{js,py,jinja2,j2,html,xml,css,sass,scss,json,yml,md,rst}]
[*.{js,py,jinja2,j2,html,xml,css,sass,scss,json,yml,yaml,md,rst}]
charset = utf-8
indent_style = space
tab_width = 8
max_line_length = 88

# Python code
Expand Down
5 changes: 1 addition & 4 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"endOfLine": "lf",
"singleQuote": true,
"trailingComma": "es5",
"printWidth": 88
"singleQuote": true
}
2 changes: 1 addition & 1 deletion funnel/assets/js/account_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ window.Hasgeek.Accountform = ({
.text(remoteData.error_description);
} else {
const errorTxt = $('<p class="mui-form__error"></p>').text(
remoteData.error_description
remoteData.error_description,
);
$(errorTxt).insertBefore($(fieldWrapper).find('.mui-form__helptext'));
}
Expand Down
8 changes: 4 additions & 4 deletions funnel/assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ const pace = require('pace-js');
$(() => {
/* eslint-disable no-console */
console.log(
'Hello, curious geek. Our source is at https://github.com/hasgeek. Why not contribute a patch?'
'Hello, curious geek. Our source is at https://github.com/hasgeek. Why not contribute a patch?',
);

loadLangTranslations();
window.Hasgeek.Config.errorMsg = {
serverError: window.gettext(
'An internal server error occurred. Our support team has been notified and will investigate'
'An internal server error occurred. Our support team has been notified and will investigate',
),
networkError: window.gettext(
'Unable to connect. Check connection and refresh the page'
'Unable to connect. Check connection and refresh the page',
),
rateLimitError: window.gettext('This is unusually high activity. Try again later'),
error: window.gettext('An error occured when submitting the form'),
Expand Down Expand Up @@ -58,7 +58,7 @@ $(() => {
polyfill.setAttribute('type', 'text/javascript');
polyfill.setAttribute(
'src',
'https://cdnjs.cloudflare.com/ajax/libs/url-search-params/1.1.0/url-search-params.js'
'https://cdnjs.cloudflare.com/ajax/libs/url-search-params/1.1.0/url-search-params.js',
);
document.head.appendChild(polyfill);
}
Expand Down
2 changes: 1 addition & 1 deletion funnel/assets/js/autosave_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ window.Hasgeek.autoSave = ({ autosave, formId, msgElemId }) => {
$(window).bind('beforeunload', () => {
if (haveDirtyFields()) {
return window.gettext(
'You have unsaved changes on this page. Do you want to leave this page?'
'You have unsaved changes on this page. Do you want to leave this page?',
);
}
return true;
Expand Down
10 changes: 5 additions & 5 deletions funnel/assets/js/comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ const Comments = {
const editorView = codemirrorHelper(
textareaId,
copyTextAreaContent,
SAVE_EDITOR_CONTENT_TIMEOUT
SAVE_EDITOR_CONTENT_TIMEOUT,
);
editorView.focus();
});
Expand Down Expand Up @@ -268,7 +268,7 @@ const Comments = {
refreshCommentsTimer() {
this.refreshTimer = window.setInterval(
this.fetchCommentsList,
REFRESH_INTERVAL
REFRESH_INTERVAL,
);
},
getInitials: Utils.getInitials,
Expand Down Expand Up @@ -320,22 +320,22 @@ const Comments = {
{
rootMargin: '0px',
threshold: 0,
}
},
);
observer.observe(commentSection);
}
},
updated() {
if (this.initialLoad && window.location.hash) {
ScrollHelper.animateScrollTo(
$(window.location.hash).offset().top - this.headerHeight
$(window.location.hash).offset().top - this.headerHeight,
);
this.initialLoad = false;
}
if (this.scrollTo) {
if ($(window).width() < MOBILE_BREAKPOINT) {
ScrollHelper.animateScrollTo(
$(this.scrollTo).offset().top - this.headerHeight
$(this.scrollTo).offset().top - this.headerHeight,
);
}
this.scrollTo = '';
Expand Down
6 changes: 3 additions & 3 deletions funnel/assets/js/contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ $(() => {
fullname,
email,
phone,
company
company,
) {
const vCard = vCardsJS();
vCard.firstName = fullname;
Expand All @@ -16,8 +16,8 @@ $(() => {
element.setAttribute(
'href',
`data:text/x-vcard;charset=utf-8,${encodeURIComponent(
vCard.getFormattedString()
)}`
vCard.getFormattedString(),
)}`,
);
element.setAttribute('download', `${vCard.firstName}.vcf`);
};
Expand Down
10 changes: 5 additions & 5 deletions funnel/assets/js/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Queue {
then it is removed from checkin queue */
this.updateQueue = function updateQueue(
participantsHashMap,
ticketParticipantList
ticketParticipantList,
) {
const queue = this;
const ticketParticipantIds = queue.readAll();
Expand All @@ -73,11 +73,11 @@ class Queue {
const index = Utils.findLoopIndex(
ticketParticipants,
'puuid_b58',
ticketParticipantId
ticketParticipantId,
);
ticketParticipantList.set(
`ticket_participants.${index}.submitting`,
true
true,
);
}
} else if (participantsHashMap[ticketParticipantId].checked_in) {
Expand All @@ -87,7 +87,7 @@ class Queue {
const index = Utils.findLoopIndex(
ticketParticipants,
'puuid_b58',
ticketParticipantId
ticketParticipantId,
);
ticketParticipantList.set(`ticket_participants.${index}.submitting`, true);
}
Expand Down Expand Up @@ -165,7 +165,7 @@ const ParticipantTable = {
list.set('ticket_participants', data.ticket_participants).then(() => {
const ticketParticipants = Utils.tohashMap(
data.ticket_participants,
'puuid_b58'
'puuid_b58',
);
list.get('checkinQ').updateQueue(ticketParticipants, list);
list.get('cancelcheckinQ').updateQueue(ticketParticipants, list);
Expand Down
4 changes: 2 additions & 2 deletions funnel/assets/js/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ window.Hasgeek.initWidgets = async function init(fieldName, config) {
window.Hasgeek.preventDoubleSubmit = function stopDoubleSubmit(
formId,
isXHR,
alertBoxHtml
alertBoxHtml,
) {
if (isXHR) {
document.body.addEventListener('htmx:beforeSend', () => {
Expand Down Expand Up @@ -79,7 +79,7 @@ window.Hasgeek.recaptcha = function handleRecaptcha(
formId,
formWrapperId,
ajax,
alertBoxHtml
alertBoxHtml,
) {
if (ajax) {
window.onInvisibleRecaptchaSubmit = function handleAjaxFormSubmit() {
Expand Down
4 changes: 2 additions & 2 deletions funnel/assets/js/notification_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const Notification = {
this.notifications[$(notification).attr('data-index')];
const url = this.markReadUrl.replace(
'eventid_b58',
notificationItem.notification.eventid_b58
notificationItem.notification.eventid_b58,
);
const response = await fetch(url, {
method: 'POST',
Expand Down Expand Up @@ -140,7 +140,7 @@ const Notification = {
{
rootMargin: '0px',
threshold: 0,
}
},
);
notificationObserver.observe(elem);
const notificationItem = app.notifications[$(elem).attr('data-index')];
Expand Down
6 changes: 3 additions & 3 deletions funnel/assets/js/notification_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ $(() => {
if (currentState && transport) {
$(`input[data-transport="preference-${transport}"]`).attr(
'disabled',
false
false,
);
$(`label[data-transport="preference-${transport}"]`).removeClass(
'switch-label--disabled'
'switch-label--disabled',
);
} else if (transport) {
$(`input[data-transport="preference-${transport}"]`).attr('disabled', true);
$(`label[data-transport="preference-${transport}"]`).addClass(
'switch-label--disabled'
'switch-label--disabled',
);
}
})
Expand Down
4 changes: 2 additions & 2 deletions funnel/assets/js/project_header.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ $(() => {
tickets = '',
toggleId = '',
sort = '',
rsvpModalHash = 'register-modal'
rsvpModalHash = 'register-modal',
) => {
if (saveProjectConfig) {
SaveProject(saveProjectConfig);
Expand All @@ -40,7 +40,7 @@ $(() => {
openModal: true,
},
'',
`#${rsvpModalHash}`
`#${rsvpModalHash}`,
);
});

Expand Down
6 changes: 3 additions & 3 deletions funnel/assets/js/scan_badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const badgeScan = {
0,
0,
canvasElement.width,
canvasElement.height
canvasElement.height,
);
const qrcode = jsQR(imageData.data, imageData.width, imageData.height);
this.verifyQRDecode(qrcode);
Expand Down Expand Up @@ -165,8 +165,8 @@ const badgeScan = {
this.set(
'error',
window.gettext(
'Unable to access video stream. Please make sure you have camera enabled or try a different browser'
)
'Unable to access video stream. Please make sure you have camera enabled or try a different browser',
),
);
}
},
Expand Down
14 changes: 7 additions & 7 deletions funnel/assets/js/scan_contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ const badgeScan = {
event.node.setAttribute(
'href',
`data:text/x-vcard;charset=utf-8,${encodeURIComponent(
vCard.getFormattedString()
)}`
vCard.getFormattedString(),
)}`,
);
event.node.setAttribute('download', `${vCard.firstName}.vcf`);
},
Expand All @@ -51,7 +51,7 @@ const badgeScan = {
const puk = qrcode.substring(0, 8);
const key = qrcode.substring(8);
const formValues = `puk=${encodeURIComponent(puk)}&key=${encodeURIComponent(
key
key,
)}`;

function handleError(error) {
Expand Down Expand Up @@ -88,7 +88,7 @@ const badgeScan = {
.some(
(contact) =>
contact.fullname === responseData.contact.fullname &&
contact.email === responseData.contact.email
contact.email === responseData.contact.email,
)
) {
badgeScanComponent.push('contacts', responseData.contact);
Expand Down Expand Up @@ -129,7 +129,7 @@ const badgeScan = {
0,
0,
canvasElement.width,
canvasElement.height
canvasElement.height,
);
const qrcode = jsQR(imageData.data, imageData.width, imageData.height);
this.verifyQRDecode(qrcode);
Expand Down Expand Up @@ -162,8 +162,8 @@ const badgeScan = {
this.set(
'error',
window.gettext(
'Unable to access video stream. Please make sure you have camera enabled or try a different browser'
)
'Unable to access video stream. Please make sure you have camera enabled or try a different browser',
),
);
}
},
Expand Down
18 changes: 9 additions & 9 deletions funnel/assets/js/schedule_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const Schedule = {
hasActiveRoom(session) {
return Object.prototype.hasOwnProperty.call(
session.rooms[this.activeTab],
'talk'
'talk',
);
},
removeImg(descriptionHtml) {
Expand Down Expand Up @@ -109,7 +109,7 @@ const Schedule = {
openModal: true,
},
'',
currentPage
currentPage,
);
Spa.updateMetaTags(pageDetails);
}
Expand Down Expand Up @@ -193,7 +193,7 @@ const Schedule = {
this.showSessionModal(activeSession);
// Scroll page to session
ScrollHelper.animateScrollTo(
$(`#${activeSession.url_name_uuid_b58}`).offset().top - this.headerHeight
$(`#${activeSession.url_name_uuid_b58}`).offset().top - this.headerHeight,
);
} else if (
window.location.pathname === this.pathName &&
Expand All @@ -213,12 +213,12 @@ const Schedule = {
} else if ($('.schedule__date--upcoming').length) {
// Scroll to the upcoming schedule
ScrollHelper.animateScrollTo(
$('.schedule__date--upcoming').first().offset().top - this.headerHeight
$('.schedule__date--upcoming').first().offset().top - this.headerHeight,
);
} else {
// Scroll to the last schedule
ScrollHelper.animateScrollTo(
$('.schedule__date').last().offset().top - this.headerHeight
$('.schedule__date').last().offset().top - this.headerHeight,
);
}
window.history.replaceState(
Expand All @@ -229,7 +229,7 @@ const Schedule = {
refresh: false,
},
'',
this.pageDetails.url
this.pageDetails.url,
);

// On exiting the page, save page scroll position in session storage
Expand Down Expand Up @@ -268,12 +268,12 @@ const Schedule = {
session.endTime = this.Utils.getTime(session.end_at);
session.eventDay = this.Utils.getEventDay(
session.start_at,
this.config.eventDayhashes
this.config.eventDayhashes,
);
session.duration = this.Utils.getDuration(
session.end_at,
session.start_at,
this.config.slotInterval
this.config.slotInterval,
);
if (this.config.schedule[session.eventDay]) {
this.config.schedule[session.eventDay].sessions[session.startTime].showLabel =
Expand Down Expand Up @@ -302,7 +302,7 @@ const Schedule = {
};
sessionSlots = new Date(sessionSlots);
sessionSlots = sessionSlots.setMinutes(
sessionSlots.getMinutes() + this.config.slotInterval
sessionSlots.getMinutes() + this.config.slotInterval,
);
}
slots[day.endTime].showLabel = true;
Expand Down
Loading

0 comments on commit 373f864

Please sign in to comment.