Skip to content

Commit

Permalink
style: update biome rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Sukaato committed Aug 16, 2024
1 parent e6e8574 commit 30e4ca9
Show file tree
Hide file tree
Showing 9 changed files with 102 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/actions/quality/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ runs:
shell: bash

- name: Prettier
run: npm run format
run: npm run format -- --reporter=github
working-directory: ./packages/${{ inputs.package }}
shell: bash

- name: Lint
run: npm run lint
run: npm run lint -- --reporter=github
working-directory: ./packages/${{ inputs.package }}
shell: bash

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ log.txt
*.tgz

.idea/
.vscode/
.vscode/**
!.vscode/extensions.json
.sass-cache/
.versions/
Expand Down
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"github.vscode-github-actions",
"biomejs.biome",
"vue.volar"
]
}
63 changes: 61 additions & 2 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,66 @@
"rules": {
"recommended": true,
"suspicious": {
"noExplicitAny": "off"
"noExplicitAny": "off",
"noConfusingVoidType": "off",
"noDoubleEquals": "error",
"noFunctionAssign": "error",
"noSparseArray": "error",
"useIsArray": "error",
"useAwait": "off"
},
"correctness": {
"noUnusedPrivateClassMembers": "error",
"noUnnecessaryContinue": "error",
"noUnreachable": "error",
"noUnsafeOptionalChaining": "error",
"noVoidTypeReturn": "off",
"useIsNan": "error",
"useYield": "error"
},
"nursery": {
"noEmptyBlock": "error",
"noSubstr": "error",
"useDeprecatedReason": "error",
"useSemanticElements": "warn",
"useThrowOnlyError": "error"
},
"security": {
"noGlobalEval": "error"
},
"style": {
"useTemplate": "error",
"noImplicitBoolean": "warn",
"noUnusedTemplateLiteral": "error",
"noUselessElse": "error",
"noVar": "error",
"useConst": "error",
"useExportType": "error",
"useImportType": "error",
"useNodejsImportProtocol": "error",
"useSelfClosingElements": "error",
"useShorthandArrayType": "error",
"useSingleVarDeclarator": "error"
},
"complexity": {
"noForEach": "off"
"noForEach": "off",
"noUselessConstructor": "error",
"noThisInStatic": "error",
"noUselessEmptyExport": "error",
"noVoid": "off",
"useFlatMap": "error",
"useOptionalChain": "error",
"useRegexLiterals": "warn"
},
"a11y": {
"noRedundantRoles": "error",
"noRedundantAlt": "error",
"useAltText": "error",
"useButtonType": "error",
"useAriaPropsForRole": "error",
"useValidAriaProps": "error",
"useValidAriaRole": "error",
"useValidAriaValues": "error"
}
}
},
Expand All @@ -42,6 +98,9 @@
"bracketSameLine": false,
"quoteStyle": "single",
"attributePosition": "multiline"
},
"linter": {
"enabled": true
}
}
}
21 changes: 15 additions & 6 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poppy-ui/core",
"version": "0.2.0-dev.1",
"version": "0.2.0-beta.0",
"description": "Base component for Poppy based on Daisy-ui",
"author": "Sukaato <sukaato.dev@proton.me>",
"homepage": "https://github.com/CheeseGrinder/poppy-ui#readme",
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/utils/click-outside.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,22 +90,22 @@ function initClickOutside(
component: ComponentInterface,
element: HTMLElement,
callback: () => void,
excludedNodes?: Array<HTMLElement>,
excludedNodes?: HTMLElement[],
) {
const target = event.target as HTMLElement;
if (!element.contains(target) && !isExcluded(target, excludedNodes)) {
callback.call(component);
}
}

function getTriggerEvents(opt: ClickOutsideOptions): Array<string> {
function getTriggerEvents(opt: ClickOutsideOptions): string[] {
if (opt.triggerEvents) {
return opt.triggerEvents.split(',').map(e => e.trim());
}
return ['click'];
}

function getExcludedNodes(opt: ClickOutsideOptions): Array<HTMLElement> {
function getExcludedNodes(opt: ClickOutsideOptions): HTMLElement[] {
if (opt.exclude) {
try {
return Array.from(document.querySelectorAll(opt.exclude));
Expand All @@ -119,7 +119,7 @@ function getExcludedNodes(opt: ClickOutsideOptions): Array<HTMLElement> {
return;
}

function isExcluded(target: HTMLElement, excudedNodes?: Array<HTMLElement>): boolean {
function isExcluded(target: HTMLElement, excudedNodes?: HTMLElement[]): boolean {
if (target && excudedNodes) {
for (const excludedNode of excudedNodes) {
if (excludedNode.contains(target)) {
Expand Down
4 changes: 1 addition & 3 deletions packages/vue/biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@
"noUnusedPrivateClassMembers": "error",
"noUnusedVariables": "error",
"useArrayLiterals": "off",
"useIsNan": "error",
"useValidForDirection": "error",
"useYield": "error"
"useValidForDirection": "error"
},
"style": {
"noNamespace": "error",
Expand Down
15 changes: 10 additions & 5 deletions packages/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
},
"main": "./dist/index.js",
"types": "./dist/types/index.d.ts",
"files": ["dist/", "css/"],
"files": [
"dist/",
"css/"
],
"keywords": [
"daisy-ui",
"framework",
Expand Down Expand Up @@ -46,7 +49,7 @@
"biome": "biome"
},
"dependencies": {
"@poppy-ui/core": "0.2.0-dev.1"
"@poppy-ui/core": "file:../core/poppy-ui-core-0.2.0-beta.0.tgz"
},
"devDependencies": {
"@biomejs/biome": "^1.8.3",
Expand All @@ -55,9 +58,9 @@
"change-case": "^5.4.4",
"rimraf": "^6.0.1",
"rollup": "^4.20.0",
"typescript": "^5.4.5",
"vite": "^5.4.0",
"vue": "~3.3.9",
"typescript": "^5.4.5"
"vue": "~3.3.9"
},
"peerDependencies": {
"vue": ">=3.3.9"
Expand All @@ -67,5 +70,7 @@
"attributes": "dist/vetur/attributes.json"
},
"web-types": "dist/web-types.json",
"sideEffects": ["css/*.css"]
"sideEffects": [
"css/*.css"
]
}

0 comments on commit 30e4ca9

Please sign in to comment.