Skip to content

Commit 833f033

Browse files
author
Krzysztof Borowy
committed
lint result
1 parent a9e865e commit 833f033

16 files changed

+104
-104
lines changed
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import { config as commonConfig } from './common.conf';
1+
import { config as commonConfig } from "./common.conf";
22

33
export const config: WebdriverIO.Config = {
44
...commonConfig,
55
capabilities: [
66
{
7-
platformName: 'Android',
7+
platformName: "Android",
88
maxInstances: 1,
9-
'appium:deviceName': 'Android Emulator',
10-
'appium:app':
11-
'example/android/app/build/outputs/apk/release/app-release.apk',
12-
'appium:automationName': 'UiAutomator2',
13-
'appium:newCommandTimeout': 240,
14-
'appium:appWaitActivity':
15-
'com.microsoft.reacttestapp.component.ComponentActivity',
9+
"appium:deviceName": "Android Emulator",
10+
"appium:app":
11+
"example/android/app/build/outputs/apk/release/app-release.apk",
12+
"appium:automationName": "UiAutomator2",
13+
"appium:newCommandTimeout": 240,
14+
"appium:appWaitActivity":
15+
"com.microsoft.reacttestapp.component.ComponentActivity",
1616
},
1717
],
1818
};

packages/default-storage-backend/example/__tests__/asyncstorage.spec.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
import { commands as cmd } from './commands';
2-
import testCases from '../examples/tests';
1+
import { commands as cmd } from "./commands";
2+
import testCases from "../examples/tests";
33

4-
describe('Async Storage functional tests', () => {
5-
it('should be visible', async () => {
4+
describe("Async Storage functional tests", () => {
5+
it("should be visible", async () => {
66
// wait until content loads, as android's waitForSelectorTimeout setting does not seem to work
77
await new Promise((r) => setTimeout(r, 3000));
8-
const el = await cmd.elementByLabel('functional-view');
8+
const el = await cmd.elementByLabel("functional-view");
99
await expect(await el.isExisting()).toEqual(true);
1010
});
1111

1212
const testNames = Object.keys(testCases);
13-
describe('storing / reading values', () => {
13+
describe("storing / reading values", () => {
1414
for (const name of testNames) {
1515
it(name, async () => {
1616
const el = await cmd.elementByLabel(`test:${name}`);
17-
await expect(await el.getText()).toEqual('Pass');
17+
await expect(await el.getText()).toEqual("Pass");
1818
});
1919
}
2020
});
2121

22-
describe('storing / reading values with delegate', () => {
22+
describe("storing / reading values with delegate", () => {
2323
for (const currentName of testNames) {
24-
const name = currentName + ' with delegate';
24+
const name = currentName + " with delegate";
2525
it(name, async () => {
2626
const el = await cmd.elementByLabel(`test:${name}`);
2727
const label = await el.getText();
28-
if (label === 'Skip') {
28+
if (label === "Skip") {
2929
return;
3030
}
3131

32-
expect(label).toEqual('Pass');
32+
expect(label).toEqual("Pass");
3333
});
3434
}
3535
});

packages/default-storage-backend/example/__tests__/commands.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const testAppId = 'com.microsoft.ReactTestApp';
2-
import { browser } from '@wdio/globals';
1+
const testAppId = "com.microsoft.ReactTestApp";
2+
import { browser } from "@wdio/globals";
33

44
export const commands = {
55
restartApp: async () => {

packages/default-storage-backend/example/__tests__/common.conf.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
export const config: WebdriverIO.Config = {
2-
runner: 'local',
2+
runner: "local",
33
autoCompileOpts: {
44
autoCompile: true,
55
tsNodeOpts: {
66
transpileOnly: true,
7-
project: '../../tsconfig.all.json',
7+
project: "../../tsconfig.all.json",
88
},
99
},
1010
capabilities: [],
1111
connectionRetryTimeout: 180000,
1212
waitforTimeout: 90000,
13-
framework: 'mocha',
14-
reporters: ['spec'],
13+
framework: "mocha",
14+
reporters: ["spec"],
1515
mochaOpts: {
16-
ui: 'bdd',
16+
ui: "bdd",
1717
/**
1818
* NOTE: This has been increased for more stable Appium Native app
1919
* tests because they can take a bit longer.
2020
*/
2121
timeout: 5 * 60 * 1000, // 5min
2222
},
23-
specs: ['./asyncstorage.spec.ts'],
23+
specs: ["./asyncstorage.spec.ts"],
2424
services: [
2525
[
26-
'appium',
26+
"appium",
2727
{
28-
command: 'appium',
28+
command: "appium",
2929
args: {
3030
// This is needed to tell Appium that we can execute local ADB commands
3131
// and to automatically download the latest version of ChromeDriver
3232
relaxedSecurity: true,
33-
address: '127.0.0.1',
34-
'callback-port': 4723,
33+
address: "127.0.0.1",
34+
"callback-port": 4723,
3535
port: 4723,
3636
},
3737
},
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import { config as commonConfig } from './common.conf';
1+
import { config as commonConfig } from "./common.conf";
22

33
export const config: WebdriverIO.Config = {
44
...commonConfig,
55
capabilities: [
66
{
7-
platformName: 'iOS',
8-
'appium:platformVersion': '16.4',
9-
'appium:deviceName': 'iPhone 14',
10-
'appium:automationName': 'XCUITest',
11-
'appium:app':
12-
'example/ios/build/Build/Products/Release-iphonesimulator/ReactTestApp.app',
7+
platformName: "iOS",
8+
"appium:platformVersion": "16.4",
9+
"appium:deviceName": "iPhone 14",
10+
"appium:automationName": "XCUITest",
11+
"appium:app":
12+
"example/ios/build/Build/Products/Release-iphonesimulator/ReactTestApp.app",
1313
},
1414
],
1515
};

packages/default-storage-backend/example/examples/tests.ts

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,47 @@ export type TestValue = string | Record<string, string>;
22

33
export type TestStep =
44
| {
5-
command: 'merge' | 'set';
5+
command: "merge" | "set";
66
key: string;
77
value: TestValue;
88
expected?: TestValue | null;
99
}
1010
| {
11-
command: 'remove';
11+
command: "remove";
1212
key: string;
1313
};
1414

1515
const tests: Record<string, TestStep[]> = {
16-
'Should store value in AsyncStorage': [
17-
{ command: 'set', key: 'a', value: '0' },
18-
{ command: 'set', key: 'a', value: '10' },
19-
{ command: 'set', key: 'a', value: '20' },
20-
{ command: 'set', key: 'a', value: '30' },
21-
{ command: 'set', key: 'a', value: '40' },
16+
"Should store value in AsyncStorage": [
17+
{ command: "set", key: "a", value: "0" },
18+
{ command: "set", key: "a", value: "10" },
19+
{ command: "set", key: "a", value: "20" },
20+
{ command: "set", key: "a", value: "30" },
21+
{ command: "set", key: "a", value: "40" },
2222
],
23-
'Should clear item': [
24-
{ command: 'set', key: 'a', value: '42' },
25-
{ command: 'remove', key: 'a' },
23+
"Should clear item": [
24+
{ command: "set", key: "a", value: "42" },
25+
{ command: "remove", key: "a" },
2626
],
27-
'Should merge items': [
27+
"Should merge items": [
2828
{
29-
command: 'set',
30-
key: 'a',
29+
command: "set",
30+
key: "a",
3131
value: {
32-
name: 'Jerry',
33-
age: '21',
34-
eyesColor: 'blue',
35-
shoeSize: '9',
32+
name: "Jerry",
33+
age: "21",
34+
eyesColor: "blue",
35+
shoeSize: "9",
3636
},
3737
},
3838
{
39-
command: 'merge',
40-
key: 'a',
39+
command: "merge",
40+
key: "a",
4141
value: {
42-
name: 'Sarah',
43-
age: '23',
44-
eyesColor: 'green',
45-
shoeSize: '10',
42+
name: "Sarah",
43+
age: "23",
44+
eyesColor: "green",
45+
shoeSize: "10",
4646
},
4747
},
4848
],

packages/default-storage-backend/example/index.ts

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

8-
import { AppRegistry, Platform } from 'react-native';
9-
import App from './App';
10-
import { name as appName } from './app.json';
8+
import { AppRegistry, Platform } from "react-native";
9+
import App from "./App";
10+
import { name as appName } from "./app.json";
1111

1212
AppRegistry.registerComponent(appName, () => App);
1313

14-
if (Platform.OS === 'web') {
15-
const rootTag = document.getElementById('root');
14+
if (Platform.OS === "web") {
15+
const rootTag = document.getElementById("root");
1616
AppRegistry.runApplication(appName, { rootTag });
1717
}

packages/default-storage-backend/jest/async-storage-mock.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable no-undef */
22

3-
const merge = require('merge-options').bind({
3+
const merge = require("merge-options").bind({
44
concatArrays: true,
55
ignoreUndefined: true,
66
});

packages/default-storage-backend/src/AsyncStorage.native.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ import {
1010
checkValidInput,
1111
convertError,
1212
convertErrors,
13-
} from './helpers';
14-
import RCTAsyncStorage from './RCTAsyncStorage';
13+
} from "./helpers";
14+
import RCTAsyncStorage from "./RCTAsyncStorage";
1515
import type {
1616
AsyncStorageStatic,
1717
ErrorLike,
1818
KeyValuePair,
1919
MultiRequest,
20-
} from './types';
20+
} from "./types";
2121

2222
if (!RCTAsyncStorage) {
2323
throw new Error(`[@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.

packages/default-storage-backend/src/AsyncStorage.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
*/
88

99
// @ts-ignore Cannot find module 'merge-options' or its corresponding type declarations
10-
import mergeOptions from 'merge-options';
10+
import mergeOptions from "merge-options";
1111
import type {
1212
AsyncStorageStatic,
1313
MultiCallback,
1414
MultiGetCallback,
15-
} from './types';
15+
} from "./types";
1616

1717
const merge = mergeOptions.bind({
1818
concatArrays: true,
@@ -112,7 +112,7 @@ const AsyncStorage: AsyncStorageStatic = {
112112
const numberOfKeys = window.localStorage.length;
113113
const keys: string[] = [];
114114
for (let i = 0; i < numberOfKeys; i += 1) {
115-
const key = window.localStorage.key(i) || '';
115+
const key = window.localStorage.key(i) || "";
116116
keys.push(key);
117117
}
118118
return keys;

packages/default-storage-backend/src/NativeAsyncStorageModule.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TurboModuleRegistry, TurboModule } from 'react-native';
1+
import { TurboModuleRegistry, TurboModule } from "react-native";
22

33
export interface Spec extends TurboModule {
44
multiGet: (
@@ -23,4 +23,4 @@ export interface Spec extends TurboModule {
2323
clear: (callback: (error?: Object[]) => void) => void;
2424
}
2525

26-
export default TurboModuleRegistry.get<Spec>('RNCAsyncStorage');
26+
export default TurboModuleRegistry.get<Spec>("RNCAsyncStorage");

packages/default-storage-backend/src/RCTAsyncStorage.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
// @ts-ignore Module '"react-native"' has no exported member 'TurboModuleRegistry'.
2-
import { NativeModules, TurboModuleRegistry } from 'react-native';
3-
import { shouldFallbackToLegacyNativeModule } from './shouldFallbackToLegacyNativeModule';
2+
import { NativeModules, TurboModuleRegistry } from "react-native";
3+
import { shouldFallbackToLegacyNativeModule } from "./shouldFallbackToLegacyNativeModule";
44

55
// TurboModuleRegistry falls back to NativeModules so we don't have to try go
66
// assign NativeModules' counterparts if TurboModuleRegistry would resolve
77
// with undefined.
88
let RCTAsyncStorage = TurboModuleRegistry
9-
? TurboModuleRegistry.get('PlatformLocalStorage') || // Support for external modules, like react-native-windows
10-
TurboModuleRegistry.get('RNC_AsyncSQLiteDBStorage') ||
11-
TurboModuleRegistry.get('RNCAsyncStorage')
12-
: NativeModules['PlatformLocalStorage'] || // Support for external modules, like react-native-windows
13-
NativeModules['RNC_AsyncSQLiteDBStorage'] ||
14-
NativeModules['RNCAsyncStorage'];
9+
? TurboModuleRegistry.get("PlatformLocalStorage") || // Support for external modules, like react-native-windows
10+
TurboModuleRegistry.get("RNC_AsyncSQLiteDBStorage") ||
11+
TurboModuleRegistry.get("RNCAsyncStorage")
12+
: NativeModules["PlatformLocalStorage"] || // Support for external modules, like react-native-windows
13+
NativeModules["RNC_AsyncSQLiteDBStorage"] ||
14+
NativeModules["RNCAsyncStorage"];
1515

1616
if (!RCTAsyncStorage && shouldFallbackToLegacyNativeModule()) {
1717
if (TurboModuleRegistry) {
1818
RCTAsyncStorage =
19-
TurboModuleRegistry.get('AsyncSQLiteDBStorage') ||
20-
TurboModuleRegistry.get('AsyncLocalStorage');
19+
TurboModuleRegistry.get("AsyncSQLiteDBStorage") ||
20+
TurboModuleRegistry.get("AsyncLocalStorage");
2121
} else {
2222
RCTAsyncStorage =
23-
NativeModules['AsyncSQLiteDBStorage'] ||
24-
NativeModules['AsyncLocalStorage'];
23+
NativeModules["AsyncSQLiteDBStorage"] ||
24+
NativeModules["AsyncLocalStorage"];
2525
}
2626
}
2727

packages/default-storage-backend/src/helpers.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ErrorLike } from './types';
1+
import type { ErrorLike } from "./types";
22

33
export function checkValidArgs(keyValuePairs: unknown[], callback: unknown) {
44
if (
@@ -7,34 +7,34 @@ export function checkValidArgs(keyValuePairs: unknown[], callback: unknown) {
77
!Array.isArray(keyValuePairs[0])
88
) {
99
throw new Error(
10-
'[AsyncStorage] Expected array of key-value pairs as first argument to multiSet'
10+
"[AsyncStorage] Expected array of key-value pairs as first argument to multiSet"
1111
);
1212
}
1313

14-
if (callback && typeof callback !== 'function') {
14+
if (callback && typeof callback !== "function") {
1515
if (Array.isArray(callback)) {
1616
throw new Error(
17-
'[AsyncStorage] Expected function as second argument to multiSet. Did you forget to wrap key-value pairs in an array for the first argument?'
17+
"[AsyncStorage] Expected function as second argument to multiSet. Did you forget to wrap key-value pairs in an array for the first argument?"
1818
);
1919
}
2020

2121
throw new Error(
22-
'[AsyncStorage] Expected function as second argument to multiSet'
22+
"[AsyncStorage] Expected function as second argument to multiSet"
2323
);
2424
}
2525
}
2626

2727
export function checkValidInput(...input: unknown[]) {
2828
const [key, value] = input;
2929

30-
if (typeof key !== 'string') {
30+
if (typeof key !== "string") {
3131
// eslint-disable-next-line no-console
3232
console.warn(
3333
`[AsyncStorage] Using ${typeof key} type for key is not supported. This can lead to unexpected behavior/errors. Use string instead.\nKey passed: ${key}\n`
3434
);
3535
}
3636

37-
if (input.length > 1 && typeof value !== 'string') {
37+
if (input.length > 1 && typeof value !== "string") {
3838
if (value == null) {
3939
throw new Error(
4040
`[AsyncStorage] Passing null/undefined as value is not supported. If you want to remove value, Use .removeItem method instead.\nPassed value: ${value}\nPassed key: ${key}\n`

0 commit comments

Comments
 (0)