diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..cae4f4c --- /dev/null +++ b/.editorconfig @@ -0,0 +1,26 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_style = tab +trim_trailing_whitespace = true +max_line_length = 120 + +[*.json] +max_line_length = unset + +[*.yml] +indent_style = space +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false + +[LICENSE] +max_line_length = unset + +[dist/**] +indent_style = unset +max_line_length = unset +trim_trailing_whitespace = unset diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..11e01b9 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,23 @@ +# https://nektosact.com/usage/index.html +# https://github.com/reviewdog/action-eclint +name: On PR +on: + workflow_dispatch: + pull_request: + branches: [main] + +jobs: + pr: + name: Validates formatting and linting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: reviewdog/action-eclint@d51e853275e707b64c0526881ada324f454c1110 # v1.7.1 + with: + reporter: github-pr-check + eclint_flags: '--fix' + - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + with: + node-version: 20.16 + - run: npm ci + - run: bs/lint.sh diff --git a/docs/components/examples/customElement/observedAttributes.js b/docs/components/examples/customElement/observedAttributes.js index bee6d3e..035618a 100644 --- a/docs/components/examples/customElement/observedAttributes.js +++ b/docs/components/examples/customElement/observedAttributes.js @@ -2,7 +2,7 @@ import { customElementRender, customElementWithDDE, observedAttributes, - el, on, scope + el, on, scope, } from "deka-dom-el"; import { S } from "deka-dom-el/signals"; export class HTMLCustomElement extends HTMLElement{ @@ -24,7 +24,7 @@ export class HTMLCustomElement extends HTMLElement{ /** @param {{ attr: ddeSignal }} props */ function ddeComponent({ attr }){ scope.host( - on.connected(e=> console.log(e.target.outerHTML)), + on.connected(e=> console.log(( /** @type {HTMLParagraphElement} */ (e.target)).outerHTML)), ); return el().append( el("p", S(()=> `Hello from Custom Element with attribute '${attr()}'`))