Skip to content

Commit

Permalink
fix: update prettier version in pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kunfang98927 committed Oct 11, 2024
1 parent 4539e3c commit f564ffb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ repos:
- id: black

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.3.2
rev: v3.1.0
hooks:
- id: prettier
additional_dependencies: ["prettier@2.3.2"]
additional_dependencies: ["prettier@3.1.0"]
files: "\\.(js|jsx|ts|tsx|css|scss|less|json|yaml|yml|md)$"

- repo: https://github.com/djlint/djLint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ addNameModal.addEventListener('show.bs.modal', function (event) {
var instrumentName = button.getAttribute('data-instrument-name');
var instrumentWikidataId = button.getAttribute('data-instrument-wikidata-id');
var instrumentNameInModal = addNameModal.querySelector(
'#instrumentNameInModal'
'#instrumentNameInModal',
);
instrumentNameInModal.textContent = instrumentName;

var instrumentWikidataIdInModal = addNameModal.querySelector(
'#instrumentWikidataIdInModal'
'#instrumentWikidataIdInModal',
);
instrumentWikidataIdInModal.textContent = instrumentWikidataId;
});
Expand Down Expand Up @@ -45,7 +45,7 @@ async function checkNameInWikidata(wikidataId, languageCode, languageLabel) {

const endpointUrl = 'https://query.wikidata.org/sparql';
const queryUrl = `${endpointUrl}?query=${encodeURIComponent(
sparqlQuery
sparqlQuery,
)}&format=json`;

try {
Expand Down Expand Up @@ -73,7 +73,7 @@ function createRow(index) {
.map(
(language) => `
<option value="${language.wikidata_code}">${language.autonym} - ${language.en_label}</option>
`
`,
)
.join('');

Expand Down Expand Up @@ -155,28 +155,28 @@ document
const nameInput = row.querySelector('.name-input input[type="text"]');
const sourceInput = row.querySelector('.source-input input[type="text"]');
const descriptionInput = row.querySelector(
'.description-input input[type="text"]'
'.description-input input[type="text"]',
);
const aliasInput = row.querySelector('.alias-input input[type="text"]');

const languageCode = languageInput.value;
const selectedOption = row.querySelector(
`option[value="${languageCode}"]`
`option[value="${languageCode}"]`,
);
const languageLabel = selectedOption ? selectedOption.textContent : '';

// get feedback elements for valid and invalid inputs respectively for language and name
const languageFeedbackValid = row.querySelector(
'.language-input .valid-feedback'
'.language-input .valid-feedback',
);
const languageFeedbackInvalid = row.querySelector(
'.language-input .invalid-feedback'
'.language-input .invalid-feedback',
);
const nameFeedbackInvalid = row.querySelector(
'.name-input .invalid-feedback'
'.name-input .invalid-feedback',
);
const sourceFeedbackInvalid = row.querySelector(
'.source-input .invalid-feedback'
'.source-input .invalid-feedback',
);

const wikidataId = document
Expand All @@ -195,7 +195,7 @@ document
const result = await checkNameInWikidata(
wikidataId,
languageCode,
languageLabel
languageLabel,
);
if (result.exists) {
languageInput.classList.add('is-invalid');
Expand Down Expand Up @@ -237,19 +237,18 @@ document
} catch (error) {
displayMessage(
'There was an error checking Wikidata. Please try again later.',
'danger'
'danger',
);
return; // Stop further processing
}
}

// If all rows are valid, show the confirmation modal
if (allValid) {
document.getElementById(
'publishResults'
).innerHTML = `You will publish the following:<br />${publishResults}`;
document.getElementById('publishResults').innerHTML =
`You will publish the following:<br />${publishResults}`;
const confirmationModal = new bootstrap.Modal(
document.getElementById('confirmationModal')
document.getElementById('confirmationModal'),
);
confirmationModal.show();
}
Expand Down Expand Up @@ -298,7 +297,7 @@ document
const nameInput = row.querySelector('.name-input input[type="text"]');
const sourceInput = row.querySelector('.source-input input[type="text"]');
const descriptionInput = row.querySelector(
'.description-input input[type="text"]'
'.description-input input[type="text"]',
);
const aliasInput = row.querySelector('.alias-input input[type="text"]');

Expand Down Expand Up @@ -327,7 +326,7 @@ document

// Check if the user wants to publish to Wikidata
const publishToWikidata = document.getElementById(
'publishToWikidataCheckbox'
'publishToWikidataCheckbox',
).checked;

// Publish data to our database and then to Wikidata
Expand All @@ -350,10 +349,10 @@ document
alert('Data published successfully!');
// Close both modals
const addNameModal = bootstrap.Modal.getInstance(
document.getElementById('addNameModal')
document.getElementById('addNameModal'),
);
const confirmationModal = bootstrap.Modal.getInstance(
document.getElementById('confirmationModal')
document.getElementById('confirmationModal'),
);

if (addNameModal) {
Expand Down

0 comments on commit f564ffb

Please sign in to comment.