Skip to content

Commit 6207a8d

Browse files
authored
chore: replace prettier and eslint with oxfmt and oxlint (#57)
1 parent ea74478 commit 6207a8d

25 files changed

Lines changed: 3330 additions & 6324 deletions

.eslintrc

Lines changed: 0 additions & 42 deletions
This file was deleted.
Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
name: Check Pull Request Health
22

33
on:
4-
pull_request:
5-
types:
6-
- opened
7-
- synchronize
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
88

99
jobs:
10-
build:
11-
runs-on: ubuntu-latest
12-
timeout-minutes: 60
13-
steps:
14-
- name: Checkout repository
15-
uses: actions/checkout@v4
10+
build:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 60
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
1616

17-
- name: Setup Node.js from .node-version
18-
uses: actions/setup-node@v3
19-
with:
20-
node-version-file: .node-version
17+
- name: Setup Node.js from .node-version
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version-file: .node-version
2121

22-
- name: Install dependencies
23-
run: npm ci --legacy-peer-deps
22+
- name: Install dependencies
23+
run: npm ci --legacy-peer-deps
2424

25-
- name: Lint the codebase
26-
run: npm run lint
27-
env:
28-
CI: true
25+
- name: Check the codebase
26+
run: npm run check
27+
env:
28+
CI: true
2929

30-
- name: Test the codebase
31-
run: npm run test
32-
env:
33-
CI: true
30+
- name: Test the codebase
31+
run: npm run test
32+
env:
33+
CI: true
3434

35-
- name: Build the codebase
36-
run: npm run build
35+
- name: Build the codebase
36+
run: npm run build

.github/workflows/publish.yml

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
11
name: Release @doist/react-interpolate package
22

33
on:
4-
release:
5-
types: [created]
6-
workflow_dispatch:
4+
release:
5+
types: [created]
6+
workflow_dispatch:
77

88
permissions:
9-
# Enable the use of OIDC for trusted publishing and npm provenance
10-
id-token: write
11-
# Enable the use of GitHub Packages registry
12-
packages: write
9+
# Enable the use of OIDC for trusted publishing and npm provenance
10+
id-token: write
11+
# Enable the use of GitHub Packages registry
12+
packages: write
1313

1414
jobs:
15-
publish:
16-
runs-on: ubuntu-latest
17-
timeout-minutes: 60
18-
steps:
19-
- name: Checkout repository
20-
uses: actions/checkout@v4
21-
22-
- name: Setup Node.js from .node-version
23-
uses: actions/setup-node@v3
24-
with:
25-
node-version-file: .node-version
26-
27-
- name: Ensure npm 11.5.1 or later is installed
28-
run: npm install -g npm@latest
29-
30-
- name: Install dependencies
31-
run: npm ci --legacy-peer-deps
32-
33-
- name: Lint the codebase
34-
run: npm run lint
35-
env:
36-
CI: true
37-
38-
- name: Build the codebase
39-
run: npm run build
40-
41-
- name: Publish to GitHub Package Registry
42-
uses: actions/setup-node@v3
43-
with:
44-
node-version-file: .node-version
45-
registry-url: https://npm.pkg.github.com/
46-
scope: '@doist'
47-
- run: npm publish
48-
env:
49-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50-
51-
- name: Clear npm config between GitHub/npm registries
52-
run: rm -f $NPM_CONFIG_USERCONFIG
53-
54-
- name: Publish to npm registry
55-
uses: actions/setup-node@v3
56-
with:
57-
node-version-file: .node-version
58-
registry-url: https://registry.npmjs.org/
59-
scope: '@doist'
60-
- run: npm publish --provenance --access public
15+
publish:
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 60
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node.js from .node-version
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version-file: .node-version
26+
27+
- name: Ensure npm 11.5.1 or later is installed
28+
run: npm install -g npm@latest
29+
30+
- name: Install dependencies
31+
run: npm ci --legacy-peer-deps
32+
33+
- name: Check the codebase
34+
run: npm run check
35+
env:
36+
CI: true
37+
38+
- name: Build the codebase
39+
run: npm run build
40+
41+
- name: Publish to GitHub Package Registry
42+
uses: actions/setup-node@v3
43+
with:
44+
node-version-file: .node-version
45+
registry-url: https://npm.pkg.github.com/
46+
scope: "@doist"
47+
- run: npm publish
48+
env:
49+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
51+
- name: Clear npm config between GitHub/npm registries
52+
run: rm -f $NPM_CONFIG_USERCONFIG
53+
54+
- name: Publish to npm registry
55+
uses: actions/setup-node@v3
56+
with:
57+
node-version-file: .node-version
58+
registry-url: https://registry.npmjs.org/
59+
scope: "@doist"
60+
- run: npm publish --provenance --access public

.oxlintrc.jsonc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"ignorePatterns": ["dist/*", "**/node_modules/*"],
4+
"plugins": ["import", "jest", "react", "typescript"],
5+
"rules": {
6+
"react/react-in-jsx-scope": "off",
7+
},
8+
"overrides": [
9+
{
10+
// These suites use assertion helpers and no-throw checks, which trip Jest's static
11+
// expect detection without indicating a real test quality problem here.
12+
"files": ["__test__/**/*.{ts,tsx}"],
13+
"rules": {
14+
"jest/expect-expect": "off",
15+
},
16+
},
17+
{
18+
// The parser fixture strings make dynamic test titles more readable than duplicated
19+
// literal prefixes.
20+
"files": ["__test__/parser.test.ts"],
21+
"rules": {
22+
"jest/valid-title": "off",
23+
},
24+
},
25+
],
26+
}

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
One core goal this library is to deliver a lightweight solution. Therefore, it comes to critically when it comes to user of dependencies and also polyfill usage.
44

5-
- `react` should be its only dependencies.
6-
- No polyfill.
5+
- `react` should be its only dependencies.
6+
- No polyfill.

README.md

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
A string interpolation component that formats and interpolates a template string in a safe way.
66

77
```jsx
8-
import Interpolate from '@doist/react-interpolate'
8+
import Interpolate from "@doist/react-interpolate";
99

1010
function Greeting() {
11-
return (
12-
<Interpolate
13-
string="<h1>Hello {name}. Here is <a>your order info</a></h1>"
14-
mapping={{
15-
name: 'William',
16-
a: <a href="https://orderinfo.com" />,
17-
}}
18-
/>
19-
)
11+
return (
12+
<Interpolate
13+
string="<h1>Hello {name}. Here is <a>your order info</a></h1>"
14+
mapping={{
15+
name: "William",
16+
a: <a href="https://orderinfo.com" />,
17+
}}
18+
/>
19+
);
2020
}
2121
```
2222

@@ -40,24 +40,24 @@ Please see the [Interpolation syntax](./#interpolation-syntax) section below for
4040

4141
An object that defines the values to be injected for placeholder and tags defined in the template string. Optional.
4242

43-
- For placeholder or self-closing tag, the mapping value could be any valid element value
44-
- For open & close tag, the mapping value could be either renderer function or an element.
43+
- For placeholder or self-closing tag, the mapping value could be any valid element value
44+
- For open & close tag, the mapping value could be either renderer function or an element.
4545

4646
```jsx
4747
<Interpolate
48-
string="Hello {name}. Here is <orderLink>your order info</orderLink><hr/>. \
48+
string="Hello {name}. Here is <orderLink>your order info</orderLink><hr/>. \
4949
Please contact <supportLink>support</supportLink> for help"
50-
mapping={{
51-
// you can map placholder and self-closing tag to any valid element value
52-
name: 'William',
53-
hr: <hr className="break" />,
50+
mapping={{
51+
// you can map placholder and self-closing tag to any valid element value
52+
name: "William",
53+
hr: <hr className="break" />,
5454

55-
// you can map open & close tag to a rendering function
56-
orderLink: (text) => <a href="https://orderinfo.com">{text}</a>,
55+
// you can map open & close tag to a rendering function
56+
orderLink: (text) => <a href="https://orderinfo.com">{text}</a>,
5757

58-
// or you can map open & close tag to an element
59-
supportLink: <a href="https://orderinfo.com" />,
60-
}}
58+
// or you can map open & close tag to an element
59+
supportLink: <a href="https://orderinfo.com" />,
60+
}}
6161
/>
6262
```
6363

@@ -83,21 +83,21 @@ Here is interpolation syntax you can use in your `string`.
8383
#### Placeholder
8484

8585
```jsx
86-
'hello {user_name}'
86+
"hello {user_name}";
8787
```
8888

8989
Placeholder name should be alphanumeric (`[A-Za-z0-9_]`). Placeholders could be mapped to any valid element value.
9090

9191
#### Open & close tags
9292

9393
```jsx
94-
'Here is <a>your order info</a>'
94+
"Here is <a>your order info</a>";
9595

9696
// tag name could be any alphanumeric string
97-
'Here is <link>your order info</link>'
97+
"Here is <link>your order info</link>";
9898

9999
// you can nest tag and placeholder
100-
'Here is <a><b>you order info {name}</b></a>'
100+
"Here is <a><b>you order info {name}</b></a>";
101101
```
102102

103103
Tag name should be alphanumeric (`[A-Za-z0-9_]`).
@@ -131,32 +131,32 @@ Open & close tag could be mapped to a rendering function, which would take a sin
131131

132132
```jsx
133133
<Interpolate
134-
string="Here is <a>your order info</a>"
135-
mapping={{
136-
a: (text) => (
137-
<a href="https://orderinfo.com">
138-
<b>{text}</b>
139-
<br />
140-
</a>
141-
),
142-
}}
134+
string="Here is <a>your order info</a>"
135+
mapping={{
136+
a: (text) => (
137+
<a href="https://orderinfo.com">
138+
<b>{text}</b>
139+
<br />
140+
</a>
141+
),
142+
}}
143143
/>
144144
```
145145

146146
Unclosed tag or incorrect nesting of tag would result in syntax error.
147147

148148
```js
149149
// bad: no close tag
150-
'Here is <a>your order info'
150+
"Here is <a>your order info";
151151

152152
// bad: incorrect tag structure
153-
'Here is <a><b>your order info</a></b>'
153+
"Here is <a><b>your order info</a></b>";
154154
```
155155

156156
#### Self closing tag
157157

158158
```js
159-
'Hello.<br/>Here is your order'
159+
"Hello.<br/>Here is your order";
160160
```
161161

162162
Tag name should be alphanumeric (`[A-Za-z0-9_]`). Self closing tags could be mapped to any valid element value.

0 commit comments

Comments
 (0)