Skip to content

Commit 9bfc5e6

Browse files
authored
chore: bump @rnx-kit/eslint-plugin to 0.6.0 (#1037)
1 parent 44f696c commit 9bfc5e6

File tree

13 files changed

+50
-38
lines changed

13 files changed

+50
-38
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
],
77
"packageManager": "[email protected]",
88
"devDependencies": {
9-
"@rnx-kit/eslint-plugin": "^0.5.0",
109
"eslint": "^8.54.0",
1110
"prettier": "^2.8.8",
1211
"typescript": "^5.3.0"

packages/api/example/ExampleExtension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { StorageExtension } from "../src";
1+
import type { StorageExtension } from "../src";
22

33
export interface MyExampleExtension extends StorageExtension {
44
double: (num: number) => Promise<number>;

packages/api/example/ExampleStorage.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
import { AsyncStorage, StorageKeys, StorageModel } from "../src";
2-
import { ExampleExtension, MyExampleExtension } from "./ExampleExtension";
1+
import type { AsyncStorage, StorageKeys, StorageModel } from "../src";
2+
import type { MyExampleExtension } from "./ExampleExtension";
3+
import { ExampleExtension } from "./ExampleExtension";
34

45
type MyModel = StorageModel<{
56
age: number;
67
name: string;
78
likes: boolean[];
89
}>;
910

10-
// @ts-ignore
11-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
12-
class ExampleStorage implements AsyncStorage<MyModel, MyExampleExtension> {
11+
export class ExampleStorage implements AsyncStorage<MyModel, MyExampleExtension> {
1312
private storage: MyModel = {
1413
age: null,
1514
name: null,

packages/api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"scripts": {
1717
"prepack": "yarn build",
1818
"build": "bob build",
19-
"test:lint": "eslint src/**",
19+
"test:lint": "eslint $(git ls-files '*.js' '*.ts' '*.tsx')",
2020
"test:ts": "tsc --noEmit",
2121
"test:jest": "jest"
2222
},

packages/default-storage/example/examples/Basic.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @ts-ignore
1+
// @ts-expect-error cannot find module
22
import AsyncStorage from "@react-native-async-storage/async-storage";
33
import React from "react";
44
import {

packages/default-storage/example/examples/Functional.tsx

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @ts-ignore
1+
// @ts-expect-error cannot find module
22
import AsyncStorage from "@react-native-async-storage/async-storage";
33
import React, { useEffect, useState } from "react";
44
import isEqual from "lodash/isEqual";
@@ -23,6 +23,18 @@ type TestResult =
2323
actual?: string | null;
2424
};
2525

26+
function isTestResult(result: unknown): result is TestResult {
27+
return (
28+
result === SKIP_TEST ||
29+
Boolean(
30+
result &&
31+
typeof result === "object" &&
32+
"step" in result &&
33+
"expected" in result
34+
)
35+
);
36+
}
37+
2638
function compare(expected: TestValue, actual: string): boolean {
2739
return typeof expected === "string"
2840
? expected === actual
@@ -105,7 +117,11 @@ function Functional(): JSX.Element {
105117
try {
106118
await execute(test);
107119
testResults.push([name, undefined]);
108-
} catch (e: any) {
120+
} catch (e: unknown) {
121+
if (!isTestResult(e)) {
122+
throw e;
123+
}
124+
109125
testResults.push([name, e]);
110126
}
111127
}
@@ -140,7 +156,11 @@ function Functional(): JSX.Element {
140156
try {
141157
await execute(test);
142158
testResults.push([name, undefined]);
143-
} catch (e: any) {
159+
} catch (e: unknown) {
160+
if (!isTestResult(e)) {
161+
throw e;
162+
}
163+
144164
testResults.push([name, e]);
145165
await new Promise((resolve) => {
146166
AsyncStorageTestSupport.test_unsetDelegate(resolve);

packages/default-storage/example/examples/GetSetClear.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
// @ts-ignore
8+
// @ts-expect-error cannot find module
99
import AsyncStorage from "@react-native-async-storage/async-storage";
1010
import React from "react";
1111
import { Button, StyleSheet, Text, View } from "react-native";

packages/default-storage/example/examples/MergeItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
// @ts-ignore
8+
// @ts-expect-error cannot find module
99
import AsyncStorage from "@react-native-async-storage/async-storage";
1010
import React, { useCallback, useState } from "react";
1111
import {

packages/default-storage/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"bundle:ios": "scripts/ios_e2e.sh 'bundle'",
5656
"bundle:macos": "react-native bundle --entry-file index.ts --platform macos --dev false --bundle-output example/index.macos.jsbundle",
5757
"test": "concurrently -n lint,ts yarn:test:lint yarn:test:ts",
58-
"test:lint": "eslint src/**/*.ts example/**/*.ts jest/*.js",
58+
"test:lint": "eslint $(git ls-files '*.js' '*.ts' '*.tsx')",
5959
"test:ts": "tsc",
6060
"test:e2e:android": "scripts/android_e2e.sh 'test'",
6161
"test:e2e:ios": "scripts/ios_e2e.sh 'test'",

packages/eslint-config/index.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1 @@
1-
const { FlatCompat } = require("@eslint/eslintrc");
2-
const js = require("@eslint/js");
3-
4-
const compat = new FlatCompat({
5-
baseDirectory: __dirname,
6-
recommendedConfig: js.configs.recommended,
7-
});
8-
9-
module.exports = compat.extends("plugin:@rnx-kit/recommended");
1+
module.exports = require("@rnx-kit/eslint-plugin/recommended");

0 commit comments

Comments
 (0)