Skip to content

Commit 28a07a7

Browse files
committed
fix lint errors in rnqc
1 parent d2827ac commit 28a07a7

File tree

6 files changed

+61
-44
lines changed

6 files changed

+61
-44
lines changed

bun.lockb

-7.15 KB
Binary file not shown.

example/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"android": "react-native run-android",
88
"ios": "react-native run-ios",
99
"clean": "del-cli android/build node_modules/**/android/build lib",
10-
"lint": "eslint \"**/*.{js,ts,tsx}\" --fix",
10+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
11+
"lint-fix": "eslint \"src/**/*.{js,ts,tsx}\" --fix",
1112
"start": "react-native start",
1213
"pods": "cd ios && RCT_NEW_ARCH_ENABLED=1 pod install && rm -rf .xcode.env.local",
1314
"build:android": "cd android && ./gradlew assembleDebug --no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a",
Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,40 @@
1-
module.exports = {
2-
root: true,
3-
extends: [
4-
"@react-native",
5-
"prettier"
6-
],
7-
rules: {
8-
"prettier/prettier": [
9-
"warn",
10-
{
11-
"object-curly-spacing": ["always"],
12-
quoteProps: "consistent",
13-
singleQuote: true,
14-
tabWidth: 2,
15-
trailingComma: "es5",
16-
useTabs: false,
17-
semi: true,
18-
}
19-
]
1+
import { fixupPluginRules } from '@eslint/compat';
2+
import js from '@eslint/js';
3+
import eslintReactNative from 'eslint-plugin-react-native';
4+
import typescriptEslint from 'typescript-eslint';
5+
6+
export default typescriptEslint.config(
7+
{
8+
plugins: {
9+
'@typescript-eslint': typescriptEslint.plugin,
10+
},
11+
languageOptions: {
12+
parser: '@typescript-eslint/parser',
13+
parserOptions: {
14+
// project: './tsconfig.json',
15+
projectService: true,
16+
},
17+
},
18+
rules: {},
2019
},
21-
ignorePatterns: [
22-
"node_modules/",
23-
"lib/"
24-
]
25-
};
20+
js.configs.recommended,
21+
...typescriptEslint.configs.recommended,
22+
// react-native
23+
{
24+
name: 'eslint-plugin-react-native',
25+
plugins: {
26+
'react-native': fixupPluginRules({
27+
rules: eslintReactNative.rules,
28+
}),
29+
},
30+
rules: {
31+
...eslintReactNative.configs.all.rules,
32+
'react-native/sort-styles': 'off',
33+
'react-native/no-inline-styles': 'warn',
34+
},
35+
},
36+
// don't lint config files
37+
{
38+
ignores: ['.prettierrc.js', '*.config.js'],
39+
},
40+
);

packages/react-native-quick-crypto/package.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "react-native-quick-crypto",
33
"version": "1.0.0-rc.0",
44
"description": "A fast implementation of Node's `crypto` module written in C/C++ JSI",
5+
"type": "module",
56
"main": "lib/commonjs/index",
67
"module": "lib/module/index",
78
"types": "lib/typescript/index.d.ts",
@@ -30,7 +31,8 @@
3031
"scripts": {
3132
"tsc": "tsc --noEmit",
3233
"typescript": "tsc --noEmit",
33-
"lint": "eslint \"**/*.{js,ts,tsx}\"",
34+
"lint": "eslint \"src/**/*.{js,ts,tsx}\"",
35+
"lint-fix": "eslint \"src/**/*.{js,ts,tsx}\" --fix",
3436
"prepare": "bob build",
3537
"release": "release-it",
3638
"test": "jest"
@@ -70,16 +72,15 @@
7072
"util": "0.12.5"
7173
},
7274
"devDependencies": {
73-
"@jamesacarr/eslint-formatter-github-actions": "0.2.0",
75+
"@eslint/compat": "^1.1.1",
76+
"@eslint/js": "^9.9.0",
7477
"@release-it/conventional-changelog": "8.0.1",
75-
"@stylistic/eslint-plugin": "^2.6.2",
7678
"@types/jest": "29.5.11",
7779
"@types/node": "22.0.0",
7880
"@types/react": "18.3.3",
7981
"@types/readable-stream": "4.0.11",
80-
"eslint": "8.57.0",
81-
"eslint-config-prettier": "9.1.0",
82-
"eslint-plugin-prettier": "5.2.1",
82+
"eslint": "9.9.0",
83+
"eslint-plugin-react-native": "^4.1.0",
8384
"jest": "29.7.0",
8485
"nitro-codegen": "0.3.0",
8586
"prettier": "3.2.5",
@@ -88,7 +89,8 @@
8889
"react-native-builder-bob": "0.29.0",
8990
"react-native-nitro-modules": "0.3.0",
9091
"release-it": "17.6.0",
91-
"typescript": "5.1.6"
92+
"typescript": "5.1.6",
93+
"typescript-eslint": "^8.0.1"
9294
},
9395
"peerDependencies": {
9496
"react": "*",

packages/react-native-quick-crypto/src/random.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ export function randomFill<T extends ArrayBufferView>(
3232
callback: (err: Error | null, buf: T) => void
3333
): void;
3434

35-
export function randomFill(buffer: ArrayBufferView, ...rest: any[]): void {
35+
export function randomFill(buffer: ArrayBufferView, ...rest: unknown[]): void {
3636
if (typeof rest[rest.length - 1] !== 'function') {
3737
throw new Error('No callback provided to randomFill');
3838
}
3939

40-
const callback = rest[rest.length - 1] as any as (
40+
const callback = rest[rest.length - 1] as unknown as (
4141
err: Error | null,
4242
buf?: ArrayBuffer
4343
) => void;
@@ -46,12 +46,12 @@ export function randomFill(buffer: ArrayBufferView, ...rest: any[]): void {
4646
let size: number = buffer.byteLength;
4747

4848
if (typeof rest[2] === 'function') {
49-
offset = rest[0];
50-
size = rest[1];
49+
offset = rest[0] as number;
50+
size = rest[1] as number;
5151
}
5252

5353
if (typeof rest[1] === 'function') {
54-
offset = rest[0];
54+
offset = rest[0] as number;
5555
}
5656

5757
getNative();
@@ -158,12 +158,12 @@ export function randomInt(
158158
typeof arg2 === 'undefined' || typeof arg2 === 'function';
159159

160160
if (minNotSpecified) {
161-
callback = arg2 as any as undefined | RandomIntCallback;
161+
callback = arg2 as undefined | RandomIntCallback;
162162
max = arg1;
163163
min = 0;
164164
} else {
165165
min = arg1;
166-
max = arg2 as any as number;
166+
max = arg2 as number;
167167
}
168168
if (typeof callback !== 'undefined' && typeof callback !== 'function') {
169169
throw new TypeError('callback must be a function or undefined');
@@ -219,7 +219,7 @@ export function randomInt(
219219
if (x < randLimit) {
220220
const n = (x % range) + min;
221221
if (isSync) return n;
222-
process.nextTick(callback as Function, undefined, n);
222+
process.nextTick(callback as RandomIntCallback, undefined, n);
223223
return;
224224
}
225225
}
@@ -294,9 +294,7 @@ export function randomUUID() {
294294
randomFillSync(buffer, 0, size);
295295

296296
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
297-
// eslint-disable-next-line no-bitwise
298297
buffer[6] = (buffer[6]! & 0x0f) | 0x40;
299-
// eslint-disable-next-line no-bitwise
300298
buffer[8] = (buffer[8]! & 0x3f) | 0x80;
301299

302300
return (

packages/react-native-quick-crypto/tsconfig.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"compilerOptions": {
33
"composite": true,
44
"outDir": "lib",
5-
"rootDir": "src",
5+
"rootDir": ".",
66
"allowUnreachableCode": false,
77
"allowUnusedLabels": false,
88
"esModuleInterop": true,
@@ -25,5 +25,6 @@
2525
"target": "esnext",
2626
"verbatimModuleSyntax": true,
2727
},
28-
"include": ["src"]
28+
"include": ["src"],
29+
"exclude": ["zzz"]
2930
}

0 commit comments

Comments
 (0)