Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
nc-andreashaller committed Dec 19, 2023
1 parent f9aed0b commit fb399b3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions blocks/columns/columns.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
export default function decorate(block) {
const id = `gen${crypto.randomUUID().split('-')[0]}`;
block.id = id;

const columns = block.querySelectorAll(':scope > div > div');
const columnCount = columns.length;
// following line regex matches partition sizes separated by dashes like 1-2-3
const columnPartionRegex = /^\d{1,}(?:-\d{1,})*$/;
const columnPartions = [...block.classList].find((c) => columnPartionRegex.test(c))?.split('-') || [];

let variables = '';
for(let i = 0; i < columnCount; i+=1) {
for (let i = 0; i < columnCount; i += 1) {
const partition = columnPartions.length > i ? columnPartions[i] : 1;
variables += `--column${i}-flex: ${partition};`;
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"lint:js": "eslint .",
"lint:css": "stylelint blocks/**/*.css styles/*.css",
"lint": "npm run lint:js && npm run lint:css",
"lint:fix": "npm run lint:js -- --fix && npm run lint:css -- --fix",
"semantic-release": "semantic-release --debug"
},
"repository": {
Expand Down

0 comments on commit fb399b3

Please sign in to comment.