Skip to content

Commit 6795a6a

Browse files
committed
chore: change some eslint rules
1 parent 9994546 commit 6795a6a

3 files changed

Lines changed: 13 additions & 6 deletions

File tree

eslint.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default antfu({
55
indent: 2,
66
semi: false,
77
quotes: 'single',
8-
jsx: true,
8+
jsx: false,
99
},
1010
formatters: true,
1111
typescript: true,
@@ -15,5 +15,8 @@ export default antfu({
1515
rules: {
1616
'ts/no-empty-object-type': 'off',
1717
'ts/no-namespace': 'off',
18+
'style/brace-style': ['error', '1tbs', { allowSingleLine: false }],
19+
'style/arrow-parens': ['error', 'always'],
20+
'curly': ['error', 'all'],
1821
},
1922
})

src/jsx.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ export function createElement(
2828
})
2929
}
3030

31-
if (typeof type === 'function')
31+
if (typeof type === 'function') {
3232
return type({ ...props, children })
33+
}
3334

3435
throw new Error(`Invalid JSX component: ${type}.`)
3536
}
@@ -49,11 +50,13 @@ function elementsFromNode(node: TgxNode): TgxElement[] {
4950
return [{ type: 'plain', value: node }]
5051
}
5152

52-
if (node == null)
53+
if (node == null) {
5354
return [{ type: 'plain', value: node }]
55+
}
5456

55-
if (Array.isArray(node))
56-
return node.flatMap(child => elementsFromNode(child))
57+
if (Array.isArray(node)) {
58+
return node.flatMap((child) => elementsFromNode(child))
59+
}
5760

5861
return [node]
5962
}

src/render.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ function renderTextElement(el: TgxElementText): string {
5353
}
5454

5555
function renderPlainElement({ value }: TgxElementPlain): string {
56-
if (value == null || typeof value === 'boolean')
56+
if (value == null || typeof value === 'boolean') {
5757
return ''
58+
}
5859
return sanitize(String(value))
5960
}
6061

0 commit comments

Comments
 (0)