Skip to content

Commit 3bf44c7

Browse files
committed
Refactor code-style
1 parent a0eaf6b commit 3bf44c7

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

Diff for: script/build.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import fs from 'node:fs'
2-
import path from 'node:path'
1+
import fs from 'node:fs/promises'
32
import {svgTagNames} from 'svg-tag-names'
43

54
const casing = svgTagNames.filter((d) => d !== d.toLowerCase())
65

7-
fs.writeFileSync(
8-
path.join('lib', 'svg-case-sensitive-tag-names.js'),
6+
await fs.writeFile(
7+
new URL('../lib/svg-case-sensitive-tag-names.js', import.meta.url),
98
'export const svgCaseSensitiveTagNames = ' +
109
JSON.stringify(casing, null, 2) +
1110
'\n'

Diff for: script/generate-jsx.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import fs from 'node:fs/promises'
2-
import path from 'node:path'
32
import acornJsx from 'acorn-jsx'
43
import {fromJs} from 'esast-util-from-js'
54
import {toJs} from 'estree-util-to-js'
65
import {buildJsx} from 'estree-util-build-jsx'
76

8-
const doc = String(await fs.readFile(path.join('test', 'jsx.jsx')))
7+
const doc = String(
8+
await fs.readFile(new URL('../test/jsx.jsx', import.meta.url))
9+
)
910

1011
await fs.writeFile(
11-
path.join('test', 'jsx-build-jsx-classic.js'),
12+
new URL('../test/jsx-build-jsx-classic.js', import.meta.url),
1213
toJs(
1314
buildJsx(
1415
fromJs(doc.replace(/'name'/, "'jsx (estree-util-build-jsx, classic)'"), {
@@ -21,7 +22,8 @@ await fs.writeFile(
2122
)
2223

2324
await fs.writeFile(
24-
path.join('test', 'jsx-build-jsx-automatic.js'),
25+
new URL('../test/jsx-build-jsx-automatic.js', import.meta.url),
26+
2527
toJs(
2628
buildJsx(
2729
fromJs(

Diff for: test-d/automatic-h.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ expectError(<a invalid={[true]} />)
4949

5050
// This is where the automatic runtime differs from the classic runtime.
5151
// The automatic runtime the children prop to define JSX children, whereas it’s used as an attribute in the classic runtime.
52+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
5253
expectType<Result>(<a children={<b />} />)
5354

5455
declare function Bar(props?: Record<string, unknown>): Element

Diff for: test-d/automatic-s.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ expectError(<a invalid={[true]} />)
3939

4040
// This is where the automatic runtime differs from the classic runtime.
4141
// The automatic runtime the children prop to define JSX children, whereas it’s used as an attribute in the classic runtime.
42+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
4243
expectType<Result>(<a children={<b />} />)
4344

4445
declare function Bar(props?: Record<string, unknown>): Element

0 commit comments

Comments
 (0)