Skip to content

Commit

Permalink
Add eslint config for VSC. Auto fixes for eslit issues. Move import-c…
Browse files Browse the repository at this point in the history
…ategory.js info a folder ignored by eslint because WebImporter class is undefined.
  • Loading branch information
codecodeio committed May 10, 2024
1 parent c69ad08 commit 1995833
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 106 deletions.
7 changes: 7 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": ["airbnb-base", "prettier"],
"plugins": ["prettier"],
"rules": {
"prettier/prettier": ["error"]
}
}
5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"semi": false,
"singleQuote": true,
"trailingComma": "es5"
}
15 changes: 5 additions & 10 deletions best-cigars-guide/blocks/article-list/article-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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;
Expand Down Expand Up @@ -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) => {
Expand Down
28 changes: 25 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
90 changes: 0 additions & 90 deletions tools/importer/import-category.js

This file was deleted.

0 comments on commit 1995833

Please sign in to comment.