Skip to content

Commit c5750f3

Browse files
authored
Refactor lint stack to Oxlint and Oxfmt (#2119)
1 parent e122920 commit c5750f3

24 files changed

Lines changed: 377 additions & 643 deletions

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=lf

.github/pull_request_template.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ Please follow the template below to help reviewers understand your changes clear
1010
<!-- Mark completed items with [x]. Remove tasks that don't apply. -->
1111

1212
<!-- If you added a new library or updated the existing one. -->
13+
1314
- [ ] Added library to **`react-native-libraries.json`**
1415
- [ ] Updated library in **`react-native-libraries.json`**
1516

1617
<!-- If you added a feature or fixed a bug -->
18+
1719
- [ ] Documented how you found or replicated the issue.
1820
- [ ] Explained how you fixed the issue or built the feature.
1921
- [ ] Described how to use or verify the change.

.github/workflows/code-deploy-preview.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "[CODE] Deploy preview website"
1+
name: '[CODE] Deploy preview website'
22

33
on:
44
pull_request:
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "[CODE] Deploy production website"
1+
name: '[CODE] Deploy production website'
22

33
on:
44
push:
@@ -19,15 +19,15 @@ jobs:
1919
name: production
2020
url: https://reactnative.directory
2121
steps:
22-
- uses: actions/checkout@v6
23-
- name: Use Bun
24-
uses: oven-sh/setup-bun@v2
25-
- name: Deploy
26-
shell: bash
27-
run: bunx vercel --force --token "$VERCEL_TOKEN" --prod
28-
env:
29-
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
30-
BLOB_READ_WRITE_TOKEN: ${{ secrets.BLOB_READ_WRITE_TOKEN }}
31-
# https://spectrum.chat/zeit/now/solved-project-linking-and-ci-cd-pipelines~5e6eb62a-9d56-47ac-9e32-0d973a523787
32-
VERCEL_ORG_ID: 'team_IsLEAhLb9cZj6y1Bud9XYmeK'
33-
VERCEL_PROJECT_ID: 'QmecQ8hTu4DUHv6js5U8L9pJ9vp54mg1bmRLWaS5RZCyt4'
22+
- uses: actions/checkout@v6
23+
- name: Use Bun
24+
uses: oven-sh/setup-bun@v2
25+
- name: Deploy
26+
shell: bash
27+
run: bunx vercel --force --token "$VERCEL_TOKEN" --prod
28+
env:
29+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
30+
BLOB_READ_WRITE_TOKEN: ${{ secrets.BLOB_READ_WRITE_TOKEN }}
31+
# https://spectrum.chat/zeit/now/solved-project-linking-and-ci-cd-pipelines~5e6eb62a-9d56-47ac-9e32-0d973a523787
32+
VERCEL_ORG_ID: 'team_IsLEAhLb9cZj6y1Bud9XYmeK'
33+
VERCEL_PROJECT_ID: 'QmecQ8hTu4DUHv6js5U8L9pJ9vp54mg1bmRLWaS5RZCyt4'
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "[CODE] Lint and test"
1+
name: '[CODE] Lint and test'
22

33
on:
44
push:
@@ -11,14 +11,14 @@ jobs:
1111
test:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v6
15-
- name: Use Bun
16-
uses: oven-sh/setup-bun@v2
17-
- name: Install dependencies
18-
run: bun install
19-
- name: TSC
20-
run: bun tsc
21-
- name: Lint
22-
run: bun lint
23-
- name: Build Next app
24-
run: bun next build --webpack
14+
- uses: actions/checkout@v6
15+
- name: Use Bun
16+
uses: oven-sh/setup-bun@v2
17+
- name: Install dependencies
18+
run: bun install
19+
- name: TSC
20+
run: bun tsc
21+
- name: Lint
22+
run: bun lint
23+
- name: Build Next app
24+
run: bun next build --webpack
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "[DATA] Test and Validate"
1+
name: '[DATA] Test and Validate'
22

33
on:
44
push:
@@ -11,18 +11,18 @@ jobs:
1111
test:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v6
15-
- name: Use Bun
16-
uses: oven-sh/setup-bun@v2
17-
- name: Install dependencies
18-
run: bun install
19-
- name: Validate react-native-libraries.json
20-
run: bun data:validate
21-
- name: Test react-native-libraries.json
22-
run: bun data:test
23-
- name: Check new entries in react-native-libraries.json
24-
run: bun ci:validate
25-
env:
26-
CI_CHECKS_TOKEN: ${{ github.token }}
27-
- name: Lint data
28-
run: bun eslint react-native-libraries.json
14+
- uses: actions/checkout@v6
15+
- name: Use Bun
16+
uses: oven-sh/setup-bun@v2
17+
- name: Install dependencies
18+
run: bun install
19+
- name: Validate react-native-libraries.json
20+
run: bun data:validate
21+
- name: Test react-native-libraries.json
22+
run: bun data:test
23+
- name: Check new entries in react-native-libraries.json
24+
run: bun ci:validate
25+
env:
26+
CI_CHECKS_TOKEN: ${{ github.token }}
27+
- name: Lint data
28+
run: bun oxfmt react-native-libraries.json
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "[VERCEL] Cleanup data blobs"
1+
name: '[VERCEL] Cleanup data blobs'
22

33
on:
44
push:
@@ -11,12 +11,12 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v6
15-
- name: Use Bun
16-
uses: oven-sh/setup-bun@v2
17-
- name: Install dependencies
18-
run: bun install
19-
- name: Cleanup data blobs
20-
run: bun ci:cleanup-blobs
21-
env:
22-
BLOB_READ_WRITE_TOKEN: ${{ secrets.BLOB_READ_WRITE_TOKEN }}
14+
- uses: actions/checkout@v6
15+
- name: Use Bun
16+
uses: oven-sh/setup-bun@v2
17+
- name: Install dependencies
18+
run: bun install
19+
- name: Cleanup data blobs
20+
run: bun ci:cleanup-blobs
21+
env:
22+
BLOB_READ_WRITE_TOKEN: ${{ secrets.BLOB_READ_WRITE_TOKEN }}

.oxfmtrc.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"printWidth": 100,
4+
"tabWidth": 2,
5+
"singleQuote": true,
6+
"bracketSameLine": true,
7+
"trailingComma": "es5",
8+
"arrowParens": "avoid",
9+
"endOfLine": "lf",
10+
"ignorePatterns": [
11+
"**/.next",
12+
"**/.swc",
13+
"**/node_modules",
14+
"**/out",
15+
"**/public",
16+
"**/assets",
17+
"README.md",
18+
"next-env.d.ts"
19+
]
20+
}

.oxlintrc.json

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"plugins": ["import", "jsx-a11y", "nextjs", "react", "typescript", "unicorn"],
4+
"ignorePatterns": [
5+
"**/.next",
6+
"**/.swc",
7+
"**/node_modules",
8+
"**/out",
9+
"**/public",
10+
"**/assets",
11+
"README.md",
12+
"next-env.d.ts"
13+
],
14+
"rules": {
15+
"curly": "error",
16+
"eqeqeq": [
17+
"error",
18+
"always",
19+
{
20+
"null": "ignore"
21+
}
22+
],
23+
"func-style": ["error", "declaration"],
24+
"no-unused-expressions": [
25+
"error",
26+
{
27+
"allowShortCircuit": true,
28+
"enforceForJSX": true
29+
}
30+
],
31+
"no-unused-vars": [
32+
"error",
33+
{
34+
"vars": "all",
35+
"args": "none",
36+
"ignoreRestSiblings": true,
37+
"caughtErrors": "all",
38+
"caughtErrorsIgnorePattern": "^_"
39+
}
40+
],
41+
"no-useless-computed-key": "error",
42+
"no-useless-concat": "error",
43+
"no-useless-constructor": "error",
44+
"no-useless-return": "error",
45+
"no-void": [
46+
"error",
47+
{
48+
"allowAsStatement": true
49+
}
50+
],
51+
"prefer-promise-reject-errors": "error",
52+
"prefer-rest-params": "error",
53+
"prefer-spread": "error",
54+
55+
"import/consistent-type-specifier-style": ["error", "prefer-inline"],
56+
"import/default": "error",
57+
"import/namespace": "error",
58+
"import/no-cycle": [
59+
"error",
60+
{
61+
"maxDepth": 3,
62+
"disableScc": true
63+
}
64+
],
65+
"import/no-duplicates": "error",
66+
"import/no-named-as-default": "error",
67+
"import/no-named-as-default-member": "error",
68+
"import/no-self-import": "error",
69+
"jsx-a11y/alt-text": "error",
70+
"jsx-a11y/anchor-has-content": "error",
71+
"jsx-a11y/anchor-is-valid": "error",
72+
"jsx-a11y/aria-props": "error",
73+
"jsx-a11y/heading-has-content": "error",
74+
"jsx-a11y/img-redundant-alt": "error",
75+
"jsx-a11y/no-noninteractive-tabindex": "error",
76+
"jsx-a11y/no-redundant-roles": "error",
77+
"jsx-a11y/prefer-tag-over-role": "off",
78+
"nextjs/google-font-display": "error",
79+
"nextjs/google-font-preconnect": "error",
80+
"nextjs/inline-script-id": "error",
81+
"nextjs/next-script-for-ga": "error",
82+
"nextjs/no-assign-module-variable": "error",
83+
"nextjs/no-async-client-component": "error",
84+
"nextjs/no-before-interactive-script-outside-document": "error",
85+
"nextjs/no-css-tags": "error",
86+
"nextjs/no-document-import-in-page": "error",
87+
"nextjs/no-duplicate-head": "error",
88+
"nextjs/no-head-element": "error",
89+
"nextjs/no-head-import-in-document": "error",
90+
"nextjs/no-html-link-for-pages": "error",
91+
"nextjs/no-img-element": "off",
92+
"nextjs/no-page-custom-font": "error",
93+
"nextjs/no-script-component-in-head": "error",
94+
"nextjs/no-styled-jsx-in-document": "error",
95+
"nextjs/no-sync-scripts": "error",
96+
"nextjs/no-title-in-document-head": "error",
97+
"nextjs/no-typos": "error",
98+
"nextjs/no-unwanted-polyfillio": "error",
99+
"react-hooks/rules-of-hooks": "error",
100+
"react/jsx-boolean-value": ["error"],
101+
"react/jsx-curly-brace-presence": ["error"],
102+
"react/jsx-fragments": ["error", "syntax"],
103+
"react/jsx-key": [
104+
"error",
105+
{
106+
"checkFragmentShorthand": true,
107+
"checkKeyMustBeforeSpread": true,
108+
"warnOnDuplicates": true
109+
}
110+
],
111+
"react/jsx-no-duplicate-props": "error",
112+
"react/jsx-no-undef": "error",
113+
"react/no-did-mount-set-state": "error",
114+
"react/no-direct-mutation-state": "error",
115+
"react/no-redundant-should-component-update": "error",
116+
"react/no-this-in-sfc": "error",
117+
"react/no-unknown-property": "error",
118+
"react/no-will-update-set-state": "error",
119+
"react/self-closing-comp": "error",
120+
"typescript/await-thenable": "error",
121+
"typescript/ban-ts-comment": [
122+
"error",
123+
{
124+
"minimumDescriptionLength": 3,
125+
"ts-check": false,
126+
"ts-expect-error": "allow-with-description",
127+
"ts-ignore": true,
128+
"ts-nocheck": true
129+
}
130+
],
131+
"typescript/consistent-type-imports": [
132+
"error",
133+
{
134+
"fixStyle": "inline-type-imports"
135+
}
136+
],
137+
"typescript/no-confusing-non-null-assertion": "error",
138+
"typescript/no-extra-non-null-assertion": "error",
139+
"typescript/no-misused-promises": [
140+
"error",
141+
{
142+
"checksVoidReturn": false
143+
}
144+
],
145+
"typescript/no-restricted-types": "error",
146+
"typescript/no-unnecessary-boolean-literal-compare": "error",
147+
"typescript/no-unnecessary-type-arguments": "error",
148+
"typescript/no-unnecessary-type-assertion": "error",
149+
"typescript/no-unsafe-enum-comparison": "error",
150+
"typescript/prefer-includes": "error",
151+
"typescript/prefer-readonly": "error",
152+
"typescript/return-await": ["error", "error-handling-correctness-only"],
153+
"typescript/unbound-method": "off",
154+
"unicorn/prefer-array-find": "error",
155+
"unicorn/prefer-array-flat": "error",
156+
"unicorn/prefer-array-flat-map": "error",
157+
"unicorn/prefer-array-some": "error",
158+
"unicorn/prefer-node-protocol": "error"
159+
}
160+
}

0 commit comments

Comments
 (0)