Skip to content

Commit 8932b23

Browse files
authored
chore: format and lint setup (#657)
1 parent 24d16d2 commit 8932b23

16 files changed

+512
-451
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
version: 2
22

33
updates:
4-
- package-ecosystem: "npm"
4+
- package-ecosystem: "bun"
55
target-branch: "main"
66
directory: "/"
77
schedule:
88
interval: "weekly"
9-
- package-ecosystem: "npm"
9+
- package-ecosystem: "bun"
1010
target-branch: "0.x"
1111
directory: "/"
1212
schedule:

.github/workflows/build-android.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ on:
1010
- 'packages/react-native-quick-crypto/nitrogen/generated/android/**'
1111
- 'packages/react-native-quick-crypto/nitrogen/generated/shared/**'
1212
- 'example/android/**'
13-
- 'bun.lockb'
14-
- 'example/bun.lockb'
13+
- 'bun.lock'
14+
- 'example/bun.lock'
1515
pull_request:
1616
paths:
1717
- '.github/workflows/build-android.yml'
1818
- 'packages/react-native-quick-crypto/android/**'
1919
- 'packages/react-native-quick-crypto/nitrogen/generated/android/**'
2020
- 'packages/react-native-quick-crypto/nitrogen/generated/shared/**'
2121
- 'example/android/**'
22-
- 'bun.lockb'
23-
- 'example/bun.lockb'
22+
- 'bun.lock'
23+
- 'example/bun.lock'
2424

2525
jobs:
2626
build_android_example:
@@ -36,7 +36,7 @@ jobs:
3636
3737
- uses: oven-sh/setup-bun@v2
3838
with:
39-
bun-version: 1.1.26
39+
bun-version: 1.2.9
4040

4141
- name: Setup JDK
4242
uses: actions/setup-java@v4

.github/workflows/build-ios.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333

3434
- uses: oven-sh/setup-bun@v2
3535
with:
36-
bun-version: 1.1.26
36+
bun-version: 1.2.9
3737

3838
- name: Bootstrap JS
3939
run: |

.github/workflows/update-lockfiles.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Update Lockfiles (bun.lockb + Podfile.lock)'
1+
name: 'Update Lockfiles (Podfile.lock)'
22

33
on:
44
push:
@@ -17,7 +17,7 @@ permissions:
1717

1818
jobs:
1919
update-lockfiles:
20-
name: "Update lockfiles (bun.lockb + Podfile.lock)"
20+
name: "Update lockfiles (Podfile.lock)"
2121
if: github.actor == 'dependabot[bot]'
2222
runs-on: macOS-latest
2323
steps:
@@ -28,7 +28,7 @@ jobs:
2828

2929
- uses: oven-sh/setup-bun@v2
3030
with:
31-
bun-version: 1.1.26
31+
bun-version: 1.2.9
3232

3333
- name: Setup Ruby (bundle)
3434
uses: ruby/setup-ruby@v1
@@ -39,7 +39,6 @@ jobs:
3939

4040
- run: |
4141
bun install
42-
git add bun.lockb
4342
4443
cd example
4544
bundle install

.github/workflows/validate-android.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
- uses: oven-sh/setup-bun@v2
2525
with:
26-
bun-version: 1.1.26
26+
bun-version: 1.2.9
2727

2828
- name: Setup JDK
2929
uses: actions/setup-java@v4

.github/workflows/validate-js.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,29 @@ on:
66
- main
77
paths:
88
- '.github/workflows/validate-js.yml'
9-
- 'bun.lockb'
9+
- 'bun.lock'
1010
- 'packages/react-native-quick-crypto/src/**'
1111
- 'packages/react-native-quick-crypto/*.json'
1212
- 'packages/react-native-quick-crypto/*.*s'
13-
- 'packages/react-native-quick-crypto/bun.lockb'
13+
- 'packages/react-native-quick-crypto/bun.lock'
1414
- 'example/src/**'
1515
- 'example/*.json'
1616
- 'example/*.*s'
1717
- 'example/*.*sx'
18-
- 'example/bun.lockb'
18+
- 'example/bun.lock'
1919
pull_request:
2020
paths:
2121
- '.github/workflows/validate-js.yml'
22-
- 'bun.lockb'
22+
- 'bun.lock'
2323
- 'packages/react-native-quick-crypto/src/**'
2424
- 'packages/react-native-quick-crypto/*.json'
2525
- 'packages/react-native-quick-crypto/*.*s'
26-
- 'packages/react-native-quick-crypto/bun.lockb'
26+
- 'packages/react-native-quick-crypto/bun.lock'
2727
- 'example/src/**'
2828
- 'example/*.json'
2929
- 'example/*.*s'
3030
- 'example/*.*sx'
31-
- 'example/bun.lockb'
31+
- 'example/bun.lock'
3232

3333
jobs:
3434
compile_js:
@@ -39,7 +39,7 @@ jobs:
3939

4040
- uses: oven-sh/setup-bun@v2
4141
with:
42-
bun-version: 1.1.26
42+
bun-version: 1.2.9
4343

4444
- name: Install reviewdog
4545
uses: reviewdog/action-setup@v1
@@ -64,7 +64,7 @@ jobs:
6464
- name: Setup Bun
6565
uses: oven-sh/setup-bun@v2
6666
with:
67-
bun-version: 1.1.26
67+
bun-version: 1.2.9
6868

6969
- name: Bootstrap JS
7070
run: |
@@ -83,4 +83,4 @@ jobs:
8383
bun format:fix
8484
8585
- name: Verify no files have changed after auto-fix
86-
run: git diff --exit-code HEAD -- . ':(exclude)bun.lockb'
86+
run: git diff --exit-code HEAD -- . ':(exclude)bun.lock'

.prettierrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"arrowParens": "avoid",
3+
"bracketSameLine": true,
4+
"bracketSpacing": true,
5+
"singleQuote": true,
6+
"trailingComma": "all"
7+
}

bun.lock

Lines changed: 339 additions & 373 deletions
Large diffs are not rendered by default.

eslint.config.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import js from '@eslint/js';
2+
import typescriptEslint from 'typescript-eslint';
3+
4+
// Import prettier plugin and config directly
5+
import eslintPluginPrettier from 'eslint-plugin-prettier';
6+
import eslintConfigPrettier from 'eslint-config-prettier';
7+
8+
// This is a root-level ESLint config that primarily serves to:
9+
// 1. Enable ESLint to find a config at the root level
10+
// 2. Provide basic linting for files outside workspaces
11+
// 3. Delegate to workspace-specific configs for workspace files
12+
13+
// Create a simplified config array
14+
export default [
15+
// Base JS config
16+
js.configs.recommended,
17+
18+
// TypeScript config
19+
...typescriptEslint.configs.recommended,
20+
{
21+
languageOptions: {
22+
parser: typescriptEslint.parser,
23+
parserOptions: {
24+
projectService: true,
25+
},
26+
},
27+
plugins: {
28+
'@typescript-eslint': typescriptEslint.plugin,
29+
},
30+
},
31+
32+
// Prettier integration
33+
{
34+
plugins: {
35+
prettier: eslintPluginPrettier,
36+
},
37+
rules: {
38+
'prettier/prettier': 'error',
39+
},
40+
},
41+
eslintConfigPrettier,
42+
// Ignore workspace-specific config files and node_modules
43+
{
44+
ignores: [
45+
'**/node_modules/**',
46+
'example/**',
47+
'packages/**',
48+
'.vscode/**',
49+
'*.config.js',
50+
],
51+
},
52+
];

example/eslint.config.js

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,40 @@ import js from '@eslint/js';
33
import eslintReactNative from 'eslint-plugin-react-native';
44
import typescriptEslint from 'typescript-eslint';
55

6-
export default typescriptEslint.config(
6+
import eslintPluginPrettier from 'eslint-plugin-prettier';
7+
import eslintConfigPrettier from 'eslint-config-prettier';
8+
9+
// Create a simplified config array
10+
export default [
11+
// Base JS config
12+
js.configs.recommended,
13+
14+
// TypeScript config
15+
...typescriptEslint.configs.recommended,
716
{
8-
plugins: {
9-
'@typescript-eslint': typescriptEslint.plugin,
10-
},
1117
languageOptions: {
12-
parser: '@typescript-eslint/parser',
18+
parser: typescriptEslint.parser,
1319
parserOptions: {
14-
// project: './tsconfig.json',
1520
projectService: true,
1621
},
1722
},
18-
rules: {},
23+
plugins: {
24+
'@typescript-eslint': typescriptEslint.plugin,
25+
},
1926
},
20-
js.configs.recommended,
21-
...typescriptEslint.configs.recommended,
22-
// react-native
27+
28+
// Prettier integration
29+
{
30+
plugins: {
31+
prettier: eslintPluginPrettier,
32+
},
33+
rules: {
34+
'prettier/prettier': 'error',
35+
},
36+
},
37+
eslintConfigPrettier,
38+
// React Native config
2339
{
24-
name: 'eslint-plugin-react-native',
2540
plugins: {
2641
'react-native': fixupPluginRules({
2742
rules: eslintReactNative.rules,
@@ -33,8 +48,9 @@ export default typescriptEslint.config(
3348
'react-native/no-inline-styles': 'warn',
3449
},
3550
},
36-
// don't lint config files
51+
52+
// Ignore patterns
3753
{
3854
ignores: ['*.config.*js'],
3955
},
40-
);
56+
];

0 commit comments

Comments
 (0)