diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..848c2d4 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,7 @@ +{ + "extends": ["airbnb-base", "prettier"], + "plugins": ["prettier"], + "rules": { + "prettier/prettier": ["error"] + } +} \ No newline at end of file diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..17b1d52 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,5 @@ +{ + "semi": false, + "singleQuote": true, + "trailingComma": "es5" +} \ No newline at end of file diff --git a/best-cigars-guide/blocks/article-list/article-list.js b/best-cigars-guide/blocks/article-list/article-list.js index 22cc3b8..b2c171a 100644 --- a/best-cigars-guide/blocks/article-list/article-list.js +++ b/best-cigars-guide/blocks/article-list/article-list.js @@ -74,8 +74,7 @@ export default function decorate(block) { anchor.appendChild(picture); } } else if ( - !div.querySelector('picture') && - li.querySelector('.article-list-card-body') === null + !div.querySelector('picture') && li.querySelector('.article-list-card-body') === null ) { // second div is for the article body div.className = 'article-list-card-body'; @@ -85,7 +84,7 @@ export default function decorate(block) { // Set class names for the first and second paragraphs within the article-list-card-body const paragraphs = div.previousSibling.querySelectorAll('p'); if (paragraphs.length > 0) { - //change article title to an h3 + // change article title to an h3 const h3 = document.createElement('h3'); h3.className = 'article-title'; h3.textContent = paragraphs[0].textContent; @@ -120,13 +119,9 @@ export default function decorate(block) { }); // optimize images - ul.querySelectorAll('img').forEach((img) => - img - .closest('picture') - .replaceWith( - createOptimizedPicture(img.src, img.alt, false, [{ width: '750' }]) - ) - ); + ul.querySelectorAll('img').forEach((img) => img.closest('picture').replaceWith( + createOptimizedPicture(img.src, img.alt, false, [{ width: '750' }]), + )); // Remove any empty div tags [...ul.querySelectorAll('div')].forEach((div) => { diff --git a/package-lock.json b/package-lock.json index f3ce874..a8c5eb5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,9 +12,10 @@ "@babel/core": "7.24.4", "@babel/eslint-parser": "7.24.1", "chai": "5.1.0", - "eslint": "8.57.0", - "eslint-config-airbnb-base": "15.0.0", - "eslint-plugin-import": "2.29.1", + "eslint": "^8.57.0", + "eslint-config-airbnb-base": "^15.0.0", + "eslint-plugin-import": "^2.29.1", + "prettier": "^3.2.5", "stylelint": "16.3.1", "stylelint-config-standard": "36.0.0" } @@ -3205,6 +3206,21 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", @@ -6432,6 +6448,12 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, + "prettier": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", + "dev": true + }, "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", diff --git a/package.json b/package.json index 8bd4b96..c1041e8 100644 --- a/package.json +++ b/package.json @@ -22,9 +22,10 @@ "@babel/core": "7.24.4", "@babel/eslint-parser": "7.24.1", "chai": "5.1.0", - "eslint": "8.57.0", - "eslint-config-airbnb-base": "15.0.0", - "eslint-plugin-import": "2.29.1", + "eslint": "^8.57.0", + "eslint-config-airbnb-base": "^15.0.0", + "eslint-plugin-import": "^2.29.1", + "prettier": "^3.2.5", "stylelint": "16.3.1", "stylelint-config-standard": "36.0.0" } diff --git a/tools/importer/import-category.js b/tools/importer/import-category.js deleted file mode 100644 index ecc4b38..0000000 --- a/tools/importer/import-category.js +++ /dev/null @@ -1,90 +0,0 @@ -const formatUrl = (originalUrl) => { - // Create a URL object based on the original URL - var url = new URL(originalUrl); - - // Set the new domain (including protocol) - url.hostname = 'www.famous-smoke.com'; - url.protocol = 'https:'; - url.port = ''; - - return url; -} - -const createMetadataBlock = (main, document) => { - const meta = {}; - - // find the