Skip to content

chore: bump @rnx-kit/eslint-plugin to 0.6.0 #1037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
],
"packageManager": "yarn@3.4.1",
"devDependencies": {
"@rnx-kit/eslint-plugin": "^0.5.0",
"eslint": "^8.54.0",
"prettier": "^2.8.8",
"typescript": "^5.3.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/api/example/ExampleExtension.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { StorageExtension } from "../src";
import type { StorageExtension } from "../src";

export interface MyExampleExtension extends StorageExtension {
double: (num: number) => Promise<number>;
Expand Down
9 changes: 4 additions & 5 deletions packages/api/example/ExampleStorage.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { AsyncStorage, StorageKeys, StorageModel } from "../src";
import { ExampleExtension, MyExampleExtension } from "./ExampleExtension";
import type { AsyncStorage, StorageKeys, StorageModel } from "../src";
import type { MyExampleExtension } from "./ExampleExtension";
import { ExampleExtension } from "./ExampleExtension";

type MyModel = StorageModel<{
age: number;
name: string;
likes: boolean[];
}>;

// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unused-vars
class ExampleStorage implements AsyncStorage<MyModel, MyExampleExtension> {
export class ExampleStorage implements AsyncStorage<MyModel, MyExampleExtension> {
private storage: MyModel = {
age: null,
name: null,
Expand Down
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"scripts": {
"prepack": "yarn build",
"build": "bob build",
"test:lint": "eslint src/**",
"test:lint": "eslint $(git ls-files '*.js' '*.ts' '*.tsx')",
"test:ts": "tsc --noEmit",
"test:jest": "jest"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/default-storage/example/examples/Basic.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @ts-ignore
// @ts-expect-error cannot find module
import AsyncStorage from "@react-native-async-storage/async-storage";
import React from "react";
import {
Expand Down
26 changes: 23 additions & 3 deletions packages/default-storage/example/examples/Functional.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @ts-ignore
// @ts-expect-error cannot find module
import AsyncStorage from "@react-native-async-storage/async-storage";
import React, { useEffect, useState } from "react";
import isEqual from "lodash/isEqual";
Expand All @@ -23,6 +23,18 @@ type TestResult =
actual?: string | null;
};

function isTestResult(result: unknown): result is TestResult {
return (
result === SKIP_TEST ||
Boolean(
result &&
typeof result === "object" &&
"step" in result &&
"expected" in result
)
);
}

function compare(expected: TestValue, actual: string): boolean {
return typeof expected === "string"
? expected === actual
Expand Down Expand Up @@ -105,7 +117,11 @@ function Functional(): JSX.Element {
try {
await execute(test);
testResults.push([name, undefined]);
} catch (e: any) {
} catch (e: unknown) {
if (!isTestResult(e)) {
throw e;
}

testResults.push([name, e]);
}
}
Expand Down Expand Up @@ -140,7 +156,11 @@ function Functional(): JSX.Element {
try {
await execute(test);
testResults.push([name, undefined]);
} catch (e: any) {
} catch (e: unknown) {
if (!isTestResult(e)) {
throw e;
}

testResults.push([name, e]);
await new Promise((resolve) => {
AsyncStorageTestSupport.test_unsetDelegate(resolve);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

// @ts-ignore
// @ts-expect-error cannot find module
import AsyncStorage from "@react-native-async-storage/async-storage";
import React from "react";
import { Button, StyleSheet, Text, View } from "react-native";
Expand Down
2 changes: 1 addition & 1 deletion packages/default-storage/example/examples/MergeItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

// @ts-ignore
// @ts-expect-error cannot find module
import AsyncStorage from "@react-native-async-storage/async-storage";
import React, { useCallback, useState } from "react";
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/default-storage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"bundle:ios": "scripts/ios_e2e.sh 'bundle'",
"bundle:macos": "react-native bundle --entry-file index.ts --platform macos --dev false --bundle-output example/index.macos.jsbundle",
"test": "concurrently -n lint,ts yarn:test:lint yarn:test:ts",
"test:lint": "eslint src/**/*.ts example/**/*.ts jest/*.js",
"test:lint": "eslint $(git ls-files '*.js' '*.ts' '*.tsx')",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

"test:ts": "tsc",
"test:e2e:android": "scripts/android_e2e.sh 'test'",
"test:e2e:ios": "scripts/ios_e2e.sh 'test'",
Expand Down
10 changes: 1 addition & 9 deletions packages/eslint-config/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
const { FlatCompat } = require("@eslint/eslintrc");
const js = require("@eslint/js");

const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
});

module.exports = compat.extends("plugin:@rnx-kit/recommended");
module.exports = require("@rnx-kit/eslint-plugin/recommended");
2 changes: 1 addition & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"dependencies": {
"@eslint/eslintrc": "^2.1.3",
"@eslint/js": "^8.33.0",
"@rnx-kit/eslint-plugin": "^0.5.0",
"@rnx-kit/eslint-plugin": "^0.6.0",
"eslint-plugin-wdio": "^8.20.0"
},
"peerDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion packages/eslint-config/recommended-wdio.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ const compat = new FlatCompat({
});

module.exports = [
...require("./index"),
{
plugins: {
wdio: require("eslint-plugin-wdio"),
},
},
...compat.extends("plugin:@rnx-kit/recommended", "plugin:wdio/recommended"),
...compat.extends("plugin:wdio/recommended"),
];
25 changes: 13 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2813,7 +2813,7 @@ __metadata:
languageName: node
linkType: hard

"@eslint/eslintrc@npm:^2.1.3":
"@eslint/eslintrc@npm:^2.1.2, @eslint/eslintrc@npm:^2.1.3":
version: 2.1.3
resolution: "@eslint/eslintrc@npm:2.1.3"
dependencies:
Expand Down Expand Up @@ -4214,7 +4214,7 @@ __metadata:
dependencies:
"@eslint/eslintrc": ^2.1.3
"@eslint/js": ^8.33.0
"@rnx-kit/eslint-plugin": ^0.5.0
"@rnx-kit/eslint-plugin": ^0.6.0
eslint-plugin-wdio: ^8.20.0
prettier: ^2.8.8
peerDependencies:
Expand All @@ -4226,7 +4226,6 @@ __metadata:
version: 0.0.0-use.local
resolution: "@react-native-async-storage/root@workspace:."
dependencies:
"@rnx-kit/eslint-plugin": ^0.5.0
eslint: ^8.54.0
prettier: ^2.8.8
typescript: ^5.3.0
Expand Down Expand Up @@ -4545,19 +4544,21 @@ __metadata:
languageName: node
linkType: hard

"@rnx-kit/eslint-plugin@npm:^0.5.0":
version: 0.5.3
resolution: "@rnx-kit/eslint-plugin@npm:0.5.3"
"@rnx-kit/eslint-plugin@npm:^0.6.0":
version: 0.6.0
resolution: "@rnx-kit/eslint-plugin@npm:0.6.0"
dependencies:
"@eslint/eslintrc": ^2.1.2
"@eslint/js": ^8.33.0
"@react-native/eslint-plugin": ^0.74.0
"@typescript-eslint/eslint-plugin": ^6.0.0
"@typescript-eslint/parser": ^6.0.0
enhanced-resolve: ^5.8.3
eslint-plugin-react: ^7.26.0
eslint-plugin-react-hooks: ^4.3.0
eslint-plugin-react: ^7.33.0
eslint-plugin-react-hooks: ^4.6.0
peerDependencies:
eslint: ">=6.0.0"
checksum: 2fd02a3ca53d932d5017693c1c76215bd9fc31caf6447582f8d88cbdd1c9e1eef3d5748c2ec23316c6539287e8f0c1a68d3e8cf6da1ed189d99eb4026d58c1c8
eslint: ">=8.23.0"
checksum: c351ee139b70af610e93186c0372505b674c55bceae04f19c9a0fd57ba7951cb8235374618cfd0134cd1588f8f36cb8dfdf3c6fd8c384b4a62a60b75454813c9
languageName: node
linkType: hard

Expand Down Expand Up @@ -10992,7 +10993,7 @@ __metadata:
languageName: node
linkType: hard

"eslint-plugin-react-hooks@npm:^4.3.0":
"eslint-plugin-react-hooks@npm:^4.6.0":
version: 4.6.0
resolution: "eslint-plugin-react-hooks@npm:4.6.0"
peerDependencies:
Expand All @@ -11001,7 +11002,7 @@ __metadata:
languageName: node
linkType: hard

"eslint-plugin-react@npm:^7.26.0":
"eslint-plugin-react@npm:^7.33.0":
version: 7.33.2
resolution: "eslint-plugin-react@npm:7.33.2"
dependencies:
Expand Down