-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
489 additions
and
295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
// Enable the ESlint flat config support | ||
"eslint.experimental.useFlatConfig": true, | ||
|
||
// Disable the default formatter, use eslint instead | ||
"prettier.enable": false, | ||
"editor.formatOnSave": false, | ||
|
||
// Auto fix | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": "explicit", | ||
"source.organizeImports": "never" | ||
}, | ||
|
||
// Silent the stylistic rules in you IDE, but still auto fix them | ||
"eslint.rules.customizations": [ | ||
{ "rule": "style/*", "severity": "off" }, | ||
{ "rule": "format/*", "severity": "off" }, | ||
{ "rule": "*-indent", "severity": "off" }, | ||
{ "rule": "*-spacing", "severity": "off" }, | ||
{ "rule": "*-spaces", "severity": "off" }, | ||
{ "rule": "*-order", "severity": "off" }, | ||
{ "rule": "*-dangle", "severity": "off" }, | ||
{ "rule": "*-newline", "severity": "off" }, | ||
{ "rule": "*quotes", "severity": "off" }, | ||
{ "rule": "*semi", "severity": "off" } | ||
], | ||
|
||
// Enable eslint for all supported languages | ||
"eslint.validate": [ | ||
"javascript", | ||
"javascriptreact", | ||
"typescript", | ||
"typescriptreact", | ||
"vue", | ||
"html", | ||
"markdown", | ||
"json", | ||
"jsonc", | ||
"yaml", | ||
"toml" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import antfu from '@antfu/eslint-config' | ||
|
||
export default antfu({ | ||
ignores: ['dist', '**/dist/**', 'node_modules', '**/node_modules/**', 'build', '**/build/**', 'tmp', '**/tmp/**', 'demos', '**/demos/**', 'coverage', '**/coverage/**', '_archive', '**/_archive/**', '*.spec.*', '**/*.spec.*/**', 'vitest.config.ts', '**/vitest.config.ts/**', '*.md', '**/*.md/**', '*.yml', '**/*.yml/**'], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
/* eslint-disable no-console */ | ||
'use strict' | ||
exports.__esModule = true | ||
const dom = (<ol className="projects"> | ||
const dom = ( | ||
<ol className="projects"> | ||
<li>hostic</li> | ||
<li>hostic-dom</li> | ||
</ol>) | ||
</ol> | ||
) | ||
console.log(dom) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { escapeHTML } from "." | ||
import { escapeHTML } from '.' | ||
|
||
describe("encoding", () => { | ||
it("should encoding", () => { | ||
expect(escapeHTML("</")).toEqual("</") | ||
expect(escapeHTML("<and> &")).toEqual("<and> &") | ||
describe('encoding', () => { | ||
it('should encoding', () => { | ||
expect(escapeHTML('</')).toEqual('</') | ||
expect(escapeHTML('<and> &')).toEqual('<and> &') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,46 @@ | ||
// Copyright (c) 2020 Dirk Holtwick. All rights reserved. https://holtwick.de/copyright | ||
/** @jsx h */ | ||
|
||
import { html as h, CDATA } from "./html" | ||
import { CDATA, html as h } from './html' | ||
|
||
describe("HTML", () => { | ||
it("should generate a string", () => { | ||
let s = h("a", { href: "example.com" }, "Welcome & Hello & Ciao") | ||
describe('hTML', () => { | ||
it('should generate a string', () => { | ||
const s = h('a', { href: 'example.com' }, 'Welcome & Hello & Ciao') | ||
expect(s).toEqual( | ||
'<a href="example.com">Welcome & Hello &amp; Ciao</a>' | ||
'<a href="example.com">Welcome & Hello &amp; Ciao</a>', | ||
) // the second & is correct, because plain string should be unescaped | ||
}) | ||
|
||
it("should nest", () => { | ||
let s = h("a", { href: "example.com" }, h("hr"), h("b", {}, "Welcome")) | ||
it('should nest', () => { | ||
const s = h('a', { href: 'example.com' }, h('hr'), h('b', {}, 'Welcome')) | ||
expect(s).toEqual('<a href="example.com"><hr><b>Welcome</b></a>') | ||
}) | ||
|
||
it("should use JSX", () => { | ||
let spread = { | ||
title: "Hello", | ||
id: "greeting", | ||
it('should use JSX', () => { | ||
const spread = { | ||
title: 'Hello', | ||
id: 'greeting', | ||
} | ||
let s = ( | ||
const s = ( | ||
<a href="example.com" x="x" hidden={false} {...spread}> | ||
<hr myCaseSensitiveAttribute="1" /> | ||
{null && "This is invisible"} | ||
{null && 'This is invisible'} | ||
<b>Welcome</b> | ||
</a> | ||
) | ||
|
||
expect(s).toEqual( | ||
'<a href="example.com" x="x" title="Hello" id="greeting"><hr myCaseSensitiveAttribute="1"><b>Welcome</b></a>' | ||
'<a href="example.com" x="x" title="Hello" id="greeting"><hr myCaseSensitiveAttribute="1"><b>Welcome</b></a>', | ||
) | ||
}) | ||
|
||
it("should keep cdata", () => { | ||
let s = <cdata>{"<b>Do not escape! & </b>"}</cdata> | ||
it('should keep cdata', () => { | ||
const s = <cdata>{'<b>Do not escape! & </b>'}</cdata> | ||
expect(s).toMatchInlineSnapshot(`"<![CDATA[<b>Do not escape! & </b>]]>"`) | ||
|
||
let s2 = <div>{CDATA("<b>Do not escape! & </b>")}</div> | ||
const s2 = <div>{CDATA('<b>Do not escape! & </b>')}</div> | ||
expect(s2).toMatchInlineSnapshot( | ||
`"<div><![CDATA[<b>Do not escape! & </b>]]></div>"` | ||
`"<div><![CDATA[<b>Do not escape! & </b>]]></div>"`, | ||
) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.