Skip to content

Commit

Permalink
replace eslint with biome
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile committed Jan 5, 2024
1 parent 2066f80 commit 8305ef8
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 38 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ repos:
hooks:
- id: mypy
additional_dependencies: [types-all]
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v9.0.0-alpha.0
- repo: https://github.com/biomejs/pre-commit
rev: v0.1.0
hooks:
- id: eslint
args: [--fix]
- id: biome-check
additional_dependencies: ["@biomejs/[email protected]"]
- repo: local
hooks:
- id: no-github-dot-git
Expand Down
20 changes: 11 additions & 9 deletions assets/copyable.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
(function () {
'use strict';

(() => {
function copyTextToClipboard(text) {
var textArea = document.createElement('textarea');
const textArea = document.createElement('textarea');
textArea.value = text;
textArea.style.position = 'fixed';
textArea.style.left = '-1';
Expand All @@ -11,17 +13,17 @@
document.execCommand('copy');
document.body.removeChild(textArea);
}
var codeBlockElements = document.getElementsByClassName('copyable');
for (var i = 0; i < codeBlockElements.length; i++) {
var block = codeBlockElements[i];
var copyIcon = new Image(16, 16);
const codeBlockElements = document.getElementsByClassName('copyable');
for (let i = 0; i < codeBlockElements.length; i++) {
const block = codeBlockElements[i];
const copyIcon = new Image(16, 16);
copyIcon.setAttribute('src', './assets/copy-icon.svg');
copyIcon.setAttribute('alt', 'copy');
copyIcon.setAttribute('title', 'copy to clipboard');
block.insertBefore(copyIcon, block.children[0]);
copyIcon.addEventListener('click', function(block) {
var text = block.getElementsByTagName('pre')[0].innerText;
copyIcon.addEventListener('click', (block) => {
const text = block.getElementsByTagName('pre')[0].innerText;
copyTextToClipboard(text);
}.bind(null, block));
});
}
})();
8 changes: 6 additions & 2 deletions assets/filter_repos.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
const hookId = repoHook.dataset.id.toLowerCase();
const hookTypes = repoHook.dataset.types.split(', ');

if (hookId.includes(id) && (type === '' || hookTypes.includes(type))) {
if (
hookId.includes(id) &&
(type === '' || hookTypes.includes(type))
) {
repoHook.hidden = false;
hasVisibleHooks = true;
} else {
Expand All @@ -32,7 +35,8 @@
}

repo.hidden = !hasVisibleHooks;
hooks.querySelector(`h3[data-repo="${repo.dataset.repo}"]`).hidden = !hasVisibleHooks;
hooks.querySelector(`h3[data-repo="${repo.dataset.repo}"]`).hidden =
!hasVisibleHooks;
}
};

Expand Down
24 changes: 24 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "https://biomejs.dev/schemas/1.4.0/schema.json",
"organizeImports": {
"enabled": false
},
"formatter": {
"indentStyle": "space",
"indentWidth": 4
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"suspicious": {
"noRedundantUseStrict": "off"
}
}
}
}
23 changes: 0 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,5 @@
"dependencies": {
"bootstrap": "^5.0.0",
"sass": "^1.32.13"
},
"eslintConfig": {
"extends": "eslint:recommended",
"rules": {
"indent": [
"error",
4
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
]
},
"parserOptions": {
"ecmaVersion": 6
},
"env": {
"browser": true
}
}
}

0 comments on commit 8305ef8

Please sign in to comment.