Prefer const wherever possible
Summary: Non-final identifiers make code harder to understand. This is particularly true for JavaScript where even the *type* can change as a value gets reassigned later. This enforces to use `const` whereever possible, but doesn't "outlaw" `let`. Mixed destructuring is also still allowed. Used `eslint --fix` to change all existing cases. Reviewed By: jknoxville Differential Revision: D16131329 fbshipit-source-id: 2eceaca7c603b71b36e005be5d135e1849f2518d
This commit is contained in:
committed by
Facebook Github Bot
parent
662db20948
commit
c588b650ae
@@ -22,8 +22,9 @@ module.exports = {
|
|||||||
'no-bitwise': 0, // bitwise operations needed in some places
|
'no-bitwise': 0, // bitwise operations needed in some places
|
||||||
'consistent-return': 0,
|
'consistent-return': 0,
|
||||||
'no-var': 2,
|
'no-var': 2,
|
||||||
'max-len': 0, // let's take prettier take care of this
|
'prefer-const': [2, {destructuring: 'all'}],
|
||||||
indent: 0, // let's take prettier take care of this
|
'max-len': 0, // lets prettier take care of this
|
||||||
|
indent: 0, // lets prettier take care of this
|
||||||
'no-console': 0, // we're setting window.console in App.js
|
'no-console': 0, // we're setting window.console in App.js
|
||||||
'prefer-promise-reject-errors': 1,
|
'prefer-promise-reject-errors': 1,
|
||||||
|
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ async function exitActions(
|
|||||||
store: Store,
|
store: Store,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const {metrics, exit} = userArguments;
|
const {metrics, exit} = userArguments;
|
||||||
for (let exitAction of exitClosures) {
|
for (const exitAction of exitClosures) {
|
||||||
try {
|
try {
|
||||||
const action = await exitAction(userArguments, store);
|
const action = await exitAction(userArguments, store);
|
||||||
if (action.exit) {
|
if (action.exit) {
|
||||||
|
|||||||
@@ -355,7 +355,7 @@ const shadow = (props, hover) => {
|
|||||||
if (props.inactive) {
|
if (props.inactive) {
|
||||||
return `inset 0 0 0 1px ${colors.light10}`;
|
return `inset 0 0 0 1px ${colors.light10}`;
|
||||||
}
|
}
|
||||||
let shadow = ['1px 1px 5px rgba(0,0,0,0.1)'];
|
const shadow = ['1px 1px 5px rgba(0,0,0,0.1)'];
|
||||||
if (props.isSelected) {
|
if (props.isSelected) {
|
||||||
shadow.push(`inset 0 0 0 2px ${colors.macOSTitleBarIconSelected}`);
|
shadow.push(`inset 0 0 0 2px ${colors.macOSTitleBarIconSelected}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class LocationsButton extends Component<Props> {
|
|||||||
goToLocation = (location: string) => {
|
goToLocation = (location: string) => {
|
||||||
const {selectedDevice} = this.props;
|
const {selectedDevice} = this.props;
|
||||||
if (selectedDevice instanceof AndroidDevice) {
|
if (selectedDevice instanceof AndroidDevice) {
|
||||||
let shellCommand = `am start ${location}`;
|
const shellCommand = `am start ${location}`;
|
||||||
selectedDevice.adb.shell(selectedDevice.serial, shellCommand);
|
selectedDevice.adb.shell(selectedDevice.serial, shellCommand);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ class PluginDebugger extends Component<Props> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getRows(): Array<TableBodyRow> {
|
getRows(): Array<TableBodyRow> {
|
||||||
let rows: Array<TableBodyRow> = [];
|
const rows: Array<TableBodyRow> = [];
|
||||||
|
|
||||||
// bundled plugins are loaded from the defaultPlugins directory within
|
// bundled plugins are loaded from the defaultPlugins directory within
|
||||||
// Flipper's package.
|
// Flipper's package.
|
||||||
|
|||||||
@@ -9,24 +9,24 @@ import {uriComponents} from '../application.js';
|
|||||||
|
|
||||||
test('test parsing of deeplink URL', () => {
|
test('test parsing of deeplink URL', () => {
|
||||||
const url = 'flipper://app/plugin/meta/data';
|
const url = 'flipper://app/plugin/meta/data';
|
||||||
let components = uriComponents(url);
|
const components = uriComponents(url);
|
||||||
expect(components).toEqual(['app', 'plugin', 'meta/data']);
|
expect(components).toEqual(['app', 'plugin', 'meta/data']);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('test parsing of deeplink URL when arguments are less', () => {
|
test('test parsing of deeplink URL when arguments are less', () => {
|
||||||
const url = 'flipper://app/';
|
const url = 'flipper://app/';
|
||||||
let components = uriComponents(url);
|
const components = uriComponents(url);
|
||||||
expect(components).toEqual(['app']);
|
expect(components).toEqual(['app']);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('test parsing of deeplink URL when url is null', () => {
|
test('test parsing of deeplink URL when url is null', () => {
|
||||||
// $FlowFixMe
|
// $FlowFixMe
|
||||||
let components = uriComponents(null);
|
const components = uriComponents(null);
|
||||||
expect(components).toEqual([]);
|
expect(components).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('test parsing of deeplink URL when pattern does not match', () => {
|
test('test parsing of deeplink URL when pattern does not match', () => {
|
||||||
const url = 'Some random string';
|
const url = 'Some random string';
|
||||||
let components = uriComponents(url);
|
const components = uriComponents(url);
|
||||||
expect(components).toEqual([]);
|
expect(components).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ async function checkXcodeVersionMismatch() {
|
|||||||
let {stdout: xcodeCLIVersion} = await exec('xcode-select -p');
|
let {stdout: xcodeCLIVersion} = await exec('xcode-select -p');
|
||||||
xcodeCLIVersion = xcodeCLIVersion.trim();
|
xcodeCLIVersion = xcodeCLIVersion.trim();
|
||||||
const {stdout} = await exec('ps aux | grep CoreSimulator');
|
const {stdout} = await exec('ps aux | grep CoreSimulator');
|
||||||
for (let line of stdout.split('\n')) {
|
for (const line of stdout.split('\n')) {
|
||||||
const match = line.match(
|
const match = line.match(
|
||||||
/\/Applications\/Xcode[^/]*\.app\/Contents\/Developer/,
|
/\/Applications\/Xcode[^/]*\.app\/Contents\/Developer/,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export default class TemperatureTable extends Component<TemperatureTableProps> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
buildRows = () => {
|
buildRows = () => {
|
||||||
let rows = [];
|
const rows = [];
|
||||||
for (const tz of Object.keys(this.props.temperatureMap).sort()) {
|
for (const tz of Object.keys(this.props.temperatureMap).sort()) {
|
||||||
rows.push(this.buildRow(tz, this.props.temperatureMap[tz]));
|
rows.push(this.buildRow(tz, this.props.temperatureMap[tz]));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {FlipperDevicePlugin, Device} from 'flipper';
|
import {FlipperDevicePlugin, Device} from 'flipper';
|
||||||
let adb = require('adbkit-fb');
|
const adb = require('adbkit-fb');
|
||||||
import TemperatureTable from './TemperatureTable.js';
|
import TemperatureTable from './TemperatureTable.js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -107,7 +107,7 @@ const Heading = styled('div')({
|
|||||||
|
|
||||||
// check if str is a number
|
// check if str is a number
|
||||||
function isNormalInteger(str) {
|
function isNormalInteger(str) {
|
||||||
let n = Math.floor(Number(str));
|
const n = Math.floor(Number(str));
|
||||||
return String(n) === str && n >= 0;
|
return String(n) === str && n >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ export default class CPUFrequencyTable extends FlipperDevicePlugin<CPUState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
let device = ((this.device: any): AndroidDevice);
|
const device = ((this.device: any): AndroidDevice);
|
||||||
this.adbClient = device.adb;
|
this.adbClient = device.adb;
|
||||||
|
|
||||||
this.updateHardwareInfo();
|
this.updateHardwareInfo();
|
||||||
@@ -153,9 +153,9 @@ export default class CPUFrequencyTable extends FlipperDevicePlugin<CPUState> {
|
|||||||
|
|
||||||
// check how many cores we have on this device
|
// check how many cores we have on this device
|
||||||
this.executeShell((output: string) => {
|
this.executeShell((output: string) => {
|
||||||
let idx = output.indexOf('-');
|
const idx = output.indexOf('-');
|
||||||
let cpuFreq = [];
|
const cpuFreq = [];
|
||||||
let count = parseInt(output.substring(idx + 1), 10) + 1;
|
const count = parseInt(output.substring(idx + 1), 10) + 1;
|
||||||
for (let i = 0; i < count; ++i) {
|
for (let i = 0; i < count; ++i) {
|
||||||
cpuFreq[i] = {
|
cpuFreq[i] = {
|
||||||
cpu_id: i,
|
cpu_id: i,
|
||||||
@@ -187,8 +187,8 @@ export default class CPUFrequencyTable extends FlipperDevicePlugin<CPUState> {
|
|||||||
|
|
||||||
updateCoreFrequency = (core: number, type: string) => {
|
updateCoreFrequency = (core: number, type: string) => {
|
||||||
this.executeShell((output: string) => {
|
this.executeShell((output: string) => {
|
||||||
let cpuFreq = this.state.cpuFreq;
|
const cpuFreq = this.state.cpuFreq;
|
||||||
let newFreq = isNormalInteger(output) ? parseInt(output, 10) : -1;
|
const newFreq = isNormalInteger(output) ? parseInt(output, 10) : -1;
|
||||||
|
|
||||||
// update table only if frequency changed
|
// update table only if frequency changed
|
||||||
if (cpuFreq[core][type] != newFreq) {
|
if (cpuFreq[core][type] != newFreq) {
|
||||||
@@ -207,12 +207,12 @@ export default class CPUFrequencyTable extends FlipperDevicePlugin<CPUState> {
|
|||||||
|
|
||||||
updateAvailableFrequencies = (core: number) => {
|
updateAvailableFrequencies = (core: number) => {
|
||||||
this.executeShell((output: string) => {
|
this.executeShell((output: string) => {
|
||||||
let cpuFreq = this.state.cpuFreq;
|
const cpuFreq = this.state.cpuFreq;
|
||||||
let freqs = output.split(' ').map((num: string) => {
|
const freqs = output.split(' ').map((num: string) => {
|
||||||
return parseInt(num, 10);
|
return parseInt(num, 10);
|
||||||
});
|
});
|
||||||
cpuFreq[core].scaling_available_freqs = freqs;
|
cpuFreq[core].scaling_available_freqs = freqs;
|
||||||
let maxFreq = cpuFreq[core].scaling_max_freq;
|
const maxFreq = cpuFreq[core].scaling_max_freq;
|
||||||
if (maxFreq > 0 && freqs.indexOf(maxFreq) == -1) {
|
if (maxFreq > 0 && freqs.indexOf(maxFreq) == -1) {
|
||||||
freqs.push(maxFreq); // always add scaling max to available frequencies
|
freqs.push(maxFreq); // always add scaling max to available frequencies
|
||||||
}
|
}
|
||||||
@@ -224,7 +224,7 @@ export default class CPUFrequencyTable extends FlipperDevicePlugin<CPUState> {
|
|||||||
|
|
||||||
updateCoreGovernor = (core: number) => {
|
updateCoreGovernor = (core: number) => {
|
||||||
this.executeShell((output: string) => {
|
this.executeShell((output: string) => {
|
||||||
let cpuFreq = this.state.cpuFreq;
|
const cpuFreq = this.state.cpuFreq;
|
||||||
if (output.toLowerCase().includes('no such file')) {
|
if (output.toLowerCase().includes('no such file')) {
|
||||||
cpuFreq[core].scaling_governor = 'N/A';
|
cpuFreq[core].scaling_governor = 'N/A';
|
||||||
} else {
|
} else {
|
||||||
@@ -238,7 +238,7 @@ export default class CPUFrequencyTable extends FlipperDevicePlugin<CPUState> {
|
|||||||
|
|
||||||
readAvailableGovernors = (core: number) => {
|
readAvailableGovernors = (core: number) => {
|
||||||
this.executeShell((output: string) => {
|
this.executeShell((output: string) => {
|
||||||
let cpuFreq = this.state.cpuFreq;
|
const cpuFreq = this.state.cpuFreq;
|
||||||
cpuFreq[core].scaling_available_governors = output.split(' ');
|
cpuFreq[core].scaling_available_governors = output.split(' ');
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -248,7 +248,7 @@ export default class CPUFrequencyTable extends FlipperDevicePlugin<CPUState> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
readCoreFrequency = (core: number) => {
|
readCoreFrequency = (core: number) => {
|
||||||
let freq = this.state.cpuFreq[core];
|
const freq = this.state.cpuFreq[core];
|
||||||
if (freq.cpuinfo_max_freq < 0) {
|
if (freq.cpuinfo_max_freq < 0) {
|
||||||
this.updateCoreFrequency(core, 'cpuinfo_max_freq');
|
this.updateCoreFrequency(core, 'cpuinfo_max_freq');
|
||||||
}
|
}
|
||||||
@@ -296,21 +296,21 @@ export default class CPUFrequencyTable extends FlipperDevicePlugin<CPUState> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
readThermalZones = () => {
|
readThermalZones = () => {
|
||||||
let thermal_dir = '/sys/class/thermal/';
|
const thermal_dir = '/sys/class/thermal/';
|
||||||
let map = {};
|
const map = {};
|
||||||
this.executeShell(async (output: string) => {
|
this.executeShell(async (output: string) => {
|
||||||
if (output.toLowerCase().includes('permission denied')) {
|
if (output.toLowerCase().includes('permission denied')) {
|
||||||
this.setState({thermalAccessible: false});
|
this.setState({thermalAccessible: false});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let dirs = output.split(/\s/);
|
const dirs = output.split(/\s/);
|
||||||
let promises = [];
|
const promises = [];
|
||||||
for (let d of dirs) {
|
for (let d of dirs) {
|
||||||
d = d.trim();
|
d = d.trim();
|
||||||
if (d.length == 0) {
|
if (d.length == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let path = thermal_dir + d;
|
const path = thermal_dir + d;
|
||||||
promises.push(this.readThermalZone(path, d, map));
|
promises.push(this.readThermalZone(path, d, map));
|
||||||
}
|
}
|
||||||
await Promise.all(promises);
|
await Promise.all(promises);
|
||||||
@@ -374,7 +374,7 @@ export default class CPUFrequencyTable extends FlipperDevicePlugin<CPUState> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
cleanup = () => {
|
cleanup = () => {
|
||||||
let cpuFreq = this.state.cpuFreq;
|
const cpuFreq = this.state.cpuFreq;
|
||||||
for (let i = 0; i < this.state.cpuCount; ++i) {
|
for (let i = 0; i < this.state.cpuCount; ++i) {
|
||||||
cpuFreq[i].scaling_cur_freq = -1;
|
cpuFreq[i].scaling_cur_freq = -1;
|
||||||
cpuFreq[i].scaling_min_freq = -1;
|
cpuFreq[i].scaling_min_freq = -1;
|
||||||
@@ -394,7 +394,7 @@ export default class CPUFrequencyTable extends FlipperDevicePlugin<CPUState> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
buildRow = (freq: CPUFrequency, idx: number) => {
|
buildRow = (freq: CPUFrequency, idx: number) => {
|
||||||
let selected = this.state.selectedIds.indexOf(idx) >= 0;
|
const selected = this.state.selectedIds.indexOf(idx) >= 0;
|
||||||
let style = {};
|
let style = {};
|
||||||
if (freq.scaling_cur_freq == -2) {
|
if (freq.scaling_cur_freq == -2) {
|
||||||
style = {
|
style = {
|
||||||
@@ -466,11 +466,11 @@ export default class CPUFrequencyTable extends FlipperDevicePlugin<CPUState> {
|
|||||||
if (freq.scaling_available_freqs.length == 0) {
|
if (freq.scaling_available_freqs.length == 0) {
|
||||||
return <Text>N/A</Text>;
|
return <Text>N/A</Text>;
|
||||||
}
|
}
|
||||||
let info = freq;
|
const info = freq;
|
||||||
return (
|
return (
|
||||||
<Text>
|
<Text>
|
||||||
{freq.scaling_available_freqs.map((freq, idx) => {
|
{freq.scaling_available_freqs.map((freq, idx) => {
|
||||||
let style = {};
|
const style = {};
|
||||||
if (
|
if (
|
||||||
freq == info.scaling_cur_freq ||
|
freq == info.scaling_cur_freq ||
|
||||||
freq == info.scaling_min_freq ||
|
freq == info.scaling_min_freq ||
|
||||||
@@ -519,15 +519,15 @@ export default class CPUFrequencyTable extends FlipperDevicePlugin<CPUState> {
|
|||||||
|
|
||||||
sidebarRows = (id: number) => {
|
sidebarRows = (id: number) => {
|
||||||
let availableFreqTitle = 'Scaling Available Frequencies';
|
let availableFreqTitle = 'Scaling Available Frequencies';
|
||||||
let selected = this.state.cpuFreq[id];
|
const selected = this.state.cpuFreq[id];
|
||||||
if (selected.scaling_available_freqs.length > 0) {
|
if (selected.scaling_available_freqs.length > 0) {
|
||||||
availableFreqTitle +=
|
availableFreqTitle +=
|
||||||
' (' + selected.scaling_available_freqs.length.toString() + ')';
|
' (' + selected.scaling_available_freqs.length.toString() + ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
let keys = [availableFreqTitle, 'Scaling Available Governors'];
|
const keys = [availableFreqTitle, 'Scaling Available Governors'];
|
||||||
|
|
||||||
let vals = [
|
const vals = [
|
||||||
this.buildAvailableFreqList(selected),
|
this.buildAvailableFreqList(selected),
|
||||||
this.buildAvailableGovList(selected),
|
this.buildAvailableGovList(selected),
|
||||||
];
|
];
|
||||||
@@ -540,8 +540,8 @@ export default class CPUFrequencyTable extends FlipperDevicePlugin<CPUState> {
|
|||||||
if (!this.state.displayCPUDetail || this.state.selectedIds.length == 0) {
|
if (!this.state.displayCPUDetail || this.state.selectedIds.length == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
let id = this.state.selectedIds[0];
|
const id = this.state.selectedIds[0];
|
||||||
let cols = {
|
const cols = {
|
||||||
key: {
|
key: {
|
||||||
value: 'key',
|
value: 'key',
|
||||||
resizable: true,
|
resizable: true,
|
||||||
@@ -551,7 +551,7 @@ export default class CPUFrequencyTable extends FlipperDevicePlugin<CPUState> {
|
|||||||
resizable: true,
|
resizable: true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let colSizes = {
|
const colSizes = {
|
||||||
key: '35%',
|
key: '35%',
|
||||||
value: 'flex',
|
value: 'flex',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -346,20 +346,20 @@ test('test parsing of path when a regex is not present', () => {
|
|||||||
});
|
});
|
||||||
test('test shouldShowCrashNotification function for all correct inputs', () => {
|
test('test shouldShowCrashNotification function for all correct inputs', () => {
|
||||||
const device = new BaseDevice('TH1S-15DEV1CE-1D', 'emulator', 'test device');
|
const device = new BaseDevice('TH1S-15DEV1CE-1D', 'emulator', 'test device');
|
||||||
let content =
|
const content =
|
||||||
'Blaa Blaaa \n Blaa Blaaa \n Path: path/to/simulator/TH1S-15DEV1CE-1D/App Name.app/App Name \n Blaa Blaa \n Blaa Blaa';
|
'Blaa Blaaa \n Blaa Blaaa \n Path: path/to/simulator/TH1S-15DEV1CE-1D/App Name.app/App Name \n Blaa Blaa \n Blaa Blaa';
|
||||||
const shouldShowNotification = shouldShowCrashNotification(device, content);
|
const shouldShowNotification = shouldShowCrashNotification(device, content);
|
||||||
expect(shouldShowNotification).toEqual(true);
|
expect(shouldShowNotification).toEqual(true);
|
||||||
});
|
});
|
||||||
test('test shouldShowCrashNotification function for all correct inputs but incorrect id', () => {
|
test('test shouldShowCrashNotification function for all correct inputs but incorrect id', () => {
|
||||||
const device = new BaseDevice('TH1S-15DEV1CE-1D', 'emulator', 'test device');
|
const device = new BaseDevice('TH1S-15DEV1CE-1D', 'emulator', 'test device');
|
||||||
let content =
|
const content =
|
||||||
'Blaa Blaaa \n Blaa Blaaa \n Path: path/to/simulator/TH1S-1598DEV1CE-2D/App Name.app/App Name \n Blaa Blaa \n Blaa Blaa';
|
'Blaa Blaaa \n Blaa Blaaa \n Path: path/to/simulator/TH1S-1598DEV1CE-2D/App Name.app/App Name \n Blaa Blaa \n Blaa Blaa';
|
||||||
const shouldShowNotification = shouldShowCrashNotification(device, content);
|
const shouldShowNotification = shouldShowCrashNotification(device, content);
|
||||||
expect(shouldShowNotification).toEqual(false);
|
expect(shouldShowNotification).toEqual(false);
|
||||||
});
|
});
|
||||||
test('test shouldShowCrashNotification function for undefined device', () => {
|
test('test shouldShowCrashNotification function for undefined device', () => {
|
||||||
let content =
|
const content =
|
||||||
'Blaa Blaaa \n Blaa Blaaa \n Path: path/to/simulator/TH1S-1598DEV1CE-2D/App Name.app/App Name \n Blaa Blaa \n Blaa Blaa';
|
'Blaa Blaaa \n Blaa Blaaa \n Path: path/to/simulator/TH1S-1598DEV1CE-2D/App Name.app/App Name \n Blaa Blaa \n Blaa Blaa';
|
||||||
const shouldShowNotification = shouldShowCrashNotification(null, content);
|
const shouldShowNotification = shouldShowCrashNotification(null, content);
|
||||||
expect(shouldShowNotification).toEqual(false);
|
expect(shouldShowNotification).toEqual(false);
|
||||||
|
|||||||
@@ -544,7 +544,7 @@ export default class CrashReporterPlugin extends FlipperDevicePlugin<
|
|||||||
};
|
};
|
||||||
|
|
||||||
static trimCallStackIfPossible = (callstack: string): string => {
|
static trimCallStackIfPossible = (callstack: string): string => {
|
||||||
let regex = /Application Specific Information:/;
|
const regex = /Application Specific Information:/;
|
||||||
const query = regex.exec(callstack);
|
const query = regex.exec(callstack);
|
||||||
return query ? callstack.substring(0, query.index) : callstack;
|
return query ? callstack.substring(0, query.index) : callstack;
|
||||||
};
|
};
|
||||||
@@ -555,7 +555,7 @@ export default class CrashReporterPlugin extends FlipperDevicePlugin<
|
|||||||
persistedState: PersistedState,
|
persistedState: PersistedState,
|
||||||
): Array<Notification> => {
|
): Array<Notification> => {
|
||||||
const filteredCrashes = persistedState.crashes.filter(crash => {
|
const filteredCrashes = persistedState.crashes.filter(crash => {
|
||||||
let ignore = !crash.name && !crash.reason;
|
const ignore = !crash.name && !crash.reason;
|
||||||
if (ignore) {
|
if (ignore) {
|
||||||
console.error('Ignored the notification for the crash', crash);
|
console.error('Ignored the notification for the crash', crash);
|
||||||
}
|
}
|
||||||
@@ -563,7 +563,7 @@ export default class CrashReporterPlugin extends FlipperDevicePlugin<
|
|||||||
});
|
});
|
||||||
return filteredCrashes.map((crash: Crash) => {
|
return filteredCrashes.map((crash: Crash) => {
|
||||||
const id = crash.notificationID;
|
const id = crash.notificationID;
|
||||||
let name: string = crash.name || crash.reason;
|
const name: string = crash.name || crash.reason;
|
||||||
let title: string = 'CRASH: ' + truncate(name, 50);
|
let title: string = 'CRASH: ' + truncate(name, 50);
|
||||||
title = `${
|
title = `${
|
||||||
name == crash.reason
|
name == crash.reason
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ export default class extends FlipperPlugin<PluginState, *, PersistedState> {
|
|||||||
this.props.setPersistedState({imagesMap: images}),
|
this.props.setPersistedState({imagesMap: images}),
|
||||||
);
|
);
|
||||||
|
|
||||||
let images = this.filterImages(
|
const images = this.filterImages(
|
||||||
this.props.persistedState.images,
|
this.props.persistedState.images,
|
||||||
this.props.persistedState.events,
|
this.props.persistedState.events,
|
||||||
this.state.selectedSurface,
|
this.state.selectedSurface,
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ function constructSearchResultTree(
|
|||||||
AXMode: boolean,
|
AXMode: boolean,
|
||||||
AXNode: ?Element,
|
AXNode: ?Element,
|
||||||
): SearchResultTree {
|
): SearchResultTree {
|
||||||
let searchResult = {
|
const searchResult = {
|
||||||
id: node.id,
|
id: node.id,
|
||||||
isMatch,
|
isMatch,
|
||||||
hasChildren: children.length > 0,
|
hasChildren: children.length > 0,
|
||||||
@@ -118,7 +118,7 @@ class ProxyArchiveClient {
|
|||||||
}
|
}
|
||||||
const {ids} = paramaters;
|
const {ids} = paramaters;
|
||||||
const arr: Array<Element> = [];
|
const arr: Array<Element> = [];
|
||||||
for (let id: ElementID of ids) {
|
for (const id: ElementID of ids) {
|
||||||
arr.push(this.persistedState.elements[id]);
|
arr.push(this.persistedState.elements[id]);
|
||||||
}
|
}
|
||||||
return Promise.resolve({elements: arr});
|
return Promise.resolve({elements: arr});
|
||||||
@@ -129,7 +129,7 @@ class ProxyArchiveClient {
|
|||||||
}
|
}
|
||||||
const {ids} = paramaters;
|
const {ids} = paramaters;
|
||||||
const arr: Array<Element> = [];
|
const arr: Array<Element> = [];
|
||||||
for (let id: ElementID of ids) {
|
for (const id: ElementID of ids) {
|
||||||
arr.push(this.persistedState.AXelements[id]);
|
arr.push(this.persistedState.AXelements[id]);
|
||||||
}
|
}
|
||||||
return Promise.resolve({elements: arr});
|
return Promise.resolve({elements: arr});
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ function constructPersistedState(axMode: boolean): PersistedState {
|
|||||||
let state = constructPersistedState(false);
|
let state = constructPersistedState(false);
|
||||||
|
|
||||||
function populateChildren(state: PersistedState, axMode: boolean) {
|
function populateChildren(state: PersistedState, axMode: boolean) {
|
||||||
let elements = {};
|
const elements = {};
|
||||||
elements['root'] = constructElement('root', 'root view', [
|
elements['root'] = constructElement('root', 'root view', [
|
||||||
'child0',
|
'child0',
|
||||||
'child1',
|
'child1',
|
||||||
@@ -95,7 +95,7 @@ beforeEach(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('test the searchNode for root in axMode false', async () => {
|
test('test the searchNode for root in axMode false', async () => {
|
||||||
let searchResult: ?SearchResultTree = await searchNodes(
|
const searchResult: ?SearchResultTree = await searchNodes(
|
||||||
state.elements['root'],
|
state.elements['root'],
|
||||||
'root',
|
'root',
|
||||||
false,
|
false,
|
||||||
@@ -115,7 +115,7 @@ test('test the searchNode for root in axMode false', async () => {
|
|||||||
test('test the searchNode for root in axMode true', async () => {
|
test('test the searchNode for root in axMode true', async () => {
|
||||||
state = constructPersistedState(true);
|
state = constructPersistedState(true);
|
||||||
populateChildren(state, true);
|
populateChildren(state, true);
|
||||||
let searchResult: ?SearchResultTree = await searchNodes(
|
const searchResult: ?SearchResultTree = await searchNodes(
|
||||||
state.AXelements['root'],
|
state.AXelements['root'],
|
||||||
'RoOT',
|
'RoOT',
|
||||||
true,
|
true,
|
||||||
@@ -133,7 +133,7 @@ test('test the searchNode for root in axMode true', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('test the searchNode which matches just one child', async () => {
|
test('test the searchNode which matches just one child', async () => {
|
||||||
let searchResult: ?SearchResultTree = await searchNodes(
|
const searchResult: ?SearchResultTree = await searchNodes(
|
||||||
state.elements['root'],
|
state.elements['root'],
|
||||||
'child0_child0',
|
'child0_child0',
|
||||||
false,
|
false,
|
||||||
@@ -169,14 +169,14 @@ test('test the searchNode which matches just one child', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('test the searchNode for which matches multiple child', async () => {
|
test('test the searchNode for which matches multiple child', async () => {
|
||||||
let searchResult: ?SearchResultTree = await searchNodes(
|
const searchResult: ?SearchResultTree = await searchNodes(
|
||||||
state.elements['root'],
|
state.elements['root'],
|
||||||
'child0',
|
'child0',
|
||||||
false,
|
false,
|
||||||
state,
|
state,
|
||||||
);
|
);
|
||||||
expect(searchResult).toBeDefined();
|
expect(searchResult).toBeDefined();
|
||||||
let expectedSearchResult = {
|
const expectedSearchResult = {
|
||||||
id: 'root',
|
id: 'root',
|
||||||
isMatch: false,
|
isMatch: false,
|
||||||
hasChildren: true,
|
hasChildren: true,
|
||||||
@@ -231,14 +231,14 @@ test('test the searchNode for which matches multiple child', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('test the searchNode, it should not be case sensitive', async () => {
|
test('test the searchNode, it should not be case sensitive', async () => {
|
||||||
let searchResult: ?SearchResultTree = await searchNodes(
|
const searchResult: ?SearchResultTree = await searchNodes(
|
||||||
state.elements['root'],
|
state.elements['root'],
|
||||||
'ChIlD0',
|
'ChIlD0',
|
||||||
false,
|
false,
|
||||||
state,
|
state,
|
||||||
);
|
);
|
||||||
expect(searchResult).toBeDefined();
|
expect(searchResult).toBeDefined();
|
||||||
let expectedSearchResult = {
|
const expectedSearchResult = {
|
||||||
id: 'root',
|
id: 'root',
|
||||||
isMatch: false,
|
isMatch: false,
|
||||||
hasChildren: true,
|
hasChildren: true,
|
||||||
@@ -293,7 +293,7 @@ test('test the searchNode, it should not be case sensitive', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('test the searchNode for non existent query', async () => {
|
test('test the searchNode for non existent query', async () => {
|
||||||
let searchResult: ?SearchResultTree = await searchNodes(
|
const searchResult: ?SearchResultTree = await searchNodes(
|
||||||
state.elements['root'],
|
state.elements['root'],
|
||||||
'Unknown query',
|
'Unknown query',
|
||||||
false,
|
false,
|
||||||
@@ -303,22 +303,22 @@ test('test the searchNode for non existent query', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('test the call method with getRoot', async () => {
|
test('test the call method with getRoot', async () => {
|
||||||
let proxyClient = new ProxyArchiveClient(state);
|
const proxyClient = new ProxyArchiveClient(state);
|
||||||
let root: Element = await proxyClient.call('getRoot');
|
const root: Element = await proxyClient.call('getRoot');
|
||||||
expect(root).toEqual(state.elements['root']);
|
expect(root).toEqual(state.elements['root']);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('test the call method with getAXRoot', async () => {
|
test('test the call method with getAXRoot', async () => {
|
||||||
state = constructPersistedState(true);
|
state = constructPersistedState(true);
|
||||||
populateChildren(state, true);
|
populateChildren(state, true);
|
||||||
let proxyClient = new ProxyArchiveClient(state);
|
const proxyClient = new ProxyArchiveClient(state);
|
||||||
let root: Element = await proxyClient.call('getAXRoot');
|
const root: Element = await proxyClient.call('getAXRoot');
|
||||||
expect(root).toEqual(state.AXelements['root']);
|
expect(root).toEqual(state.AXelements['root']);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('test the call method with getNodes', async () => {
|
test('test the call method with getNodes', async () => {
|
||||||
let proxyClient = new ProxyArchiveClient(state);
|
const proxyClient = new ProxyArchiveClient(state);
|
||||||
let nodes: Array<Element> = await proxyClient.call('getNodes', {
|
const nodes: Array<Element> = await proxyClient.call('getNodes', {
|
||||||
ids: ['child0_child1', 'child1_child0'],
|
ids: ['child0_child1', 'child1_child0'],
|
||||||
});
|
});
|
||||||
expect(nodes).toEqual({
|
expect(nodes).toEqual({
|
||||||
@@ -350,8 +350,8 @@ test('test the call method with getNodes', async () => {
|
|||||||
test('test the call method with getAXNodes', async () => {
|
test('test the call method with getAXNodes', async () => {
|
||||||
state = constructPersistedState(true);
|
state = constructPersistedState(true);
|
||||||
populateChildren(state, true);
|
populateChildren(state, true);
|
||||||
let proxyClient = new ProxyArchiveClient(state);
|
const proxyClient = new ProxyArchiveClient(state);
|
||||||
let nodes: Array<Element> = await proxyClient.call('getAXNodes', {
|
const nodes: Array<Element> = await proxyClient.call('getAXNodes', {
|
||||||
ids: ['child0_child1', 'child1_child0'],
|
ids: ['child0_child1', 'child1_child0'],
|
||||||
});
|
});
|
||||||
expect(nodes).toEqual({
|
expect(nodes).toEqual({
|
||||||
@@ -381,7 +381,7 @@ test('test the call method with getAXNodes', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('test different methods of calls with no params', async () => {
|
test('test different methods of calls with no params', async () => {
|
||||||
let proxyClient = new ProxyArchiveClient(state);
|
const proxyClient = new ProxyArchiveClient(state);
|
||||||
await expect(proxyClient.call('getNodes')).rejects.toThrow(
|
await expect(proxyClient.call('getNodes')).rejects.toThrow(
|
||||||
new Error('Called getNodes with no params'),
|
new Error('Called getNodes with no params'),
|
||||||
);
|
);
|
||||||
@@ -408,6 +408,6 @@ test('test different methods of calls with no params', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('test call method isConsoleEnabled', () => {
|
test('test call method isConsoleEnabled', () => {
|
||||||
let proxyClient = new ProxyArchiveClient(state);
|
const proxyClient = new ProxyArchiveClient(state);
|
||||||
return expect(proxyClient.call('isConsoleEnabled')).resolves.toBe(false);
|
return expect(proxyClient.call('isConsoleEnabled')).resolves.toBe(false);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export default class LeakCanary extends FlipperPlugin<State> {
|
|||||||
// collapsed state of the tree view
|
// collapsed state of the tree view
|
||||||
const newLeaks = processLeaks(results.leaks.slice(this.state.leaksCount));
|
const newLeaks = processLeaks(results.leaks.slice(this.state.leaksCount));
|
||||||
|
|
||||||
let leaks = this.state.leaks;
|
const leaks = this.state.leaks;
|
||||||
for (let i = 0; i < newLeaks.length; i++) {
|
for (let i = 0; i < newLeaks.length; i++) {
|
||||||
leaks.push(newLeaks[i]);
|
leaks.push(newLeaks[i]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ function generateFieldsList(
|
|||||||
lines: string[],
|
lines: string[],
|
||||||
i: number,
|
i: number,
|
||||||
): {|staticFields: {}, instanceFields: {}, packages: {}|} {
|
): {|staticFields: {}, instanceFields: {}, packages: {}|} {
|
||||||
let staticFields = {};
|
const staticFields = {};
|
||||||
let instanceFields = {};
|
const instanceFields = {};
|
||||||
|
|
||||||
let staticValues = {};
|
let staticValues = {};
|
||||||
let instanceValues = {};
|
let instanceValues = {};
|
||||||
@@ -62,7 +62,7 @@ function generateFieldsList(
|
|||||||
let elementId = -1;
|
let elementId = -1;
|
||||||
let elementIdStr = String(-1);
|
let elementIdStr = String(-1);
|
||||||
|
|
||||||
let packages = {};
|
const packages = {};
|
||||||
|
|
||||||
// Process everything between Details and Excluded Refs
|
// Process everything between Details and Excluded Refs
|
||||||
while (
|
while (
|
||||||
@@ -127,8 +127,8 @@ function processLeak(output: Leak[], leakInfo: string): Leak[] {
|
|||||||
|
|
||||||
// Elements shows a Object's classname and package, wheras elementsSimple shows
|
// Elements shows a Object's classname and package, wheras elementsSimple shows
|
||||||
// just its classname
|
// just its classname
|
||||||
let elements = {};
|
const elements = {};
|
||||||
let elementsSimple = {};
|
const elementsSimple = {};
|
||||||
|
|
||||||
let rootElementId = '';
|
let rootElementId = '';
|
||||||
|
|
||||||
|
|||||||
@@ -429,7 +429,7 @@ export default class LogTable extends FlipperDevicePlugin<
|
|||||||
if (highlightedRows.size <= 0) {
|
if (highlightedRows.size <= 0) {
|
||||||
// Check if the individual lines in the deeplinkPayload is matched or not.
|
// Check if the individual lines in the deeplinkPayload is matched or not.
|
||||||
const arr = deepLinkPayload.split('\n');
|
const arr = deepLinkPayload.split('\n');
|
||||||
for (let msg of arr) {
|
for (const msg of arr) {
|
||||||
for (let i = rows.length - 1; i >= 0; i--) {
|
for (let i = rows.length - 1; i >= 0; i--) {
|
||||||
if (rows[i].filterValue && rows[i].filterValue.includes(msg)) {
|
if (rows[i].filterValue && rows[i].filterValue.includes(msg)) {
|
||||||
highlightedRows.add(rows[i].key);
|
highlightedRows.add(rows[i].key);
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ test('convertRequestToCurlCommand: malicious POST data', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('convertRequestToCurlCommand: control characters', () => {
|
test('convertRequestToCurlCommand: control characters', () => {
|
||||||
let request: Request = {
|
const request: Request = {
|
||||||
id: 'request id',
|
id: 'request id',
|
||||||
timestamp: 1234567890,
|
timestamp: 1234567890,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
@@ -138,7 +138,7 @@ test('convertRequestToCurlCommand: control characters', () => {
|
|||||||
data: btoa('some=\u0007 \u0009 \u000C \u001B&other=param'),
|
data: btoa('some=\u0007 \u0009 \u000C \u001B&other=param'),
|
||||||
};
|
};
|
||||||
|
|
||||||
let command = convertRequestToCurlCommand(request);
|
const command = convertRequestToCurlCommand(request);
|
||||||
expect(command).toEqual(
|
expect(command).toEqual(
|
||||||
"curl -v -X GET 'https://fbflipper.com/' -d $'some=\\u07 \\u09 \\u0c \\u1b&other=param'",
|
"curl -v -X GET 'https://fbflipper.com/' -d $'some=\\u07 \\u09 \\u0c \\u1b&other=param'",
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -90,8 +90,8 @@ export default class extends FlipperPlugin<SharedPreferencesState> {
|
|||||||
|
|
||||||
reducers = {
|
reducers = {
|
||||||
UpdateSharedPreferences(state: SharedPreferencesState, results: Object) {
|
UpdateSharedPreferences(state: SharedPreferencesState, results: Object) {
|
||||||
let update = results.update;
|
const update = results.update;
|
||||||
let entry = state.sharedPreferences[update.name] || {changesList: []};
|
const entry = state.sharedPreferences[update.name] || {changesList: []};
|
||||||
entry.preferences = update.preferences;
|
entry.preferences = update.preferences;
|
||||||
state.sharedPreferences[update.name] = entry;
|
state.sharedPreferences[update.name] = entry;
|
||||||
return {
|
return {
|
||||||
@@ -170,7 +170,7 @@ export default class extends FlipperPlugin<SharedPreferencesState> {
|
|||||||
preferenceValue: newValue,
|
preferenceValue: newValue,
|
||||||
})
|
})
|
||||||
.then((results: SharedPreferences) => {
|
.then((results: SharedPreferences) => {
|
||||||
let update = {
|
const update = {
|
||||||
name: this.state.selectedPreferences,
|
name: this.state.selectedPreferences,
|
||||||
preferences: results,
|
preferences: results,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ const reducer = (state: State = INITAL_STATE, action: Action): State => {
|
|||||||
selectedPlugin: DEFAULT_PLUGIN,
|
selectedPlugin: DEFAULT_PLUGIN,
|
||||||
};
|
};
|
||||||
|
|
||||||
let canBeDefaultDevice = !DEFAULT_DEVICE_BLACKLIST.some(
|
const canBeDefaultDevice = !DEFAULT_DEVICE_BLACKLIST.some(
|
||||||
blacklistedDevice => payload instanceof blacklistedDevice,
|
blacklistedDevice => payload instanceof blacklistedDevice,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -272,7 +272,7 @@ const reducer = (state: State = INITAL_STATE, action: Action): State => {
|
|||||||
case 'CLIENT_REMOVED': {
|
case 'CLIENT_REMOVED': {
|
||||||
const {payload} = action;
|
const {payload} = action;
|
||||||
|
|
||||||
let selected = {};
|
const selected = {};
|
||||||
if (state.selectedApp === payload) {
|
if (state.selectedApp === payload) {
|
||||||
selected.selectedApp = null;
|
selected.selectedApp = null;
|
||||||
selected.selectedPlugin = DEFAULT_PLUGIN;
|
selected.selectedPlugin = DEFAULT_PLUGIN;
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ export default class Server extends EventEmitter {
|
|||||||
): Promise<RSocketServer> {
|
): Promise<RSocketServer> {
|
||||||
const server = this;
|
const server = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let rsServer;
|
let rsServer; // eslint-disable-line prefer-const
|
||||||
const serverFactory = onConnect => {
|
const serverFactory = onConnect => {
|
||||||
const transportServer = sslConfig
|
const transportServer = sslConfig
|
||||||
? tls.createServer(sslConfig, socket => {
|
? tls.createServer(sslConfig, socket => {
|
||||||
|
|||||||
@@ -18,56 +18,56 @@ function getAndroidLog(
|
|||||||
|
|
||||||
test('test shouldParseAndroidLog function for type error and tag is AndroidRuntime', () => {
|
test('test shouldParseAndroidLog function for type error and tag is AndroidRuntime', () => {
|
||||||
const referenceDate = new Date();
|
const referenceDate = new Date();
|
||||||
let log: DeviceLogEntry = getAndroidLog(
|
const log: DeviceLogEntry = getAndroidLog(
|
||||||
new Date(referenceDate.getTime() + 10000), //This log arrives 10 secs after the refernce time
|
new Date(referenceDate.getTime() + 10000), //This log arrives 10 secs after the refernce time
|
||||||
'error',
|
'error',
|
||||||
'AndroidRuntime',
|
'AndroidRuntime',
|
||||||
'Possible runtime crash',
|
'Possible runtime crash',
|
||||||
);
|
);
|
||||||
let shouldParseTheLog = shouldParseAndroidLog(log, referenceDate);
|
const shouldParseTheLog = shouldParseAndroidLog(log, referenceDate);
|
||||||
expect(shouldParseTheLog).toEqual(true);
|
expect(shouldParseTheLog).toEqual(true);
|
||||||
});
|
});
|
||||||
test('test shouldParseAndroidLog function for type non-error', () => {
|
test('test shouldParseAndroidLog function for type non-error', () => {
|
||||||
const referenceDate = new Date();
|
const referenceDate = new Date();
|
||||||
let log: DeviceLogEntry = getAndroidLog(
|
const log: DeviceLogEntry = getAndroidLog(
|
||||||
new Date(referenceDate.getTime() + 10000), //This log arrives 10 secs after the refernce time
|
new Date(referenceDate.getTime() + 10000), //This log arrives 10 secs after the refernce time
|
||||||
'debug',
|
'debug',
|
||||||
'fb4a.activitymanager',
|
'fb4a.activitymanager',
|
||||||
'Possible debug info in activitymanager',
|
'Possible debug info in activitymanager',
|
||||||
);
|
);
|
||||||
let shouldParseTheLog = shouldParseAndroidLog(log, referenceDate);
|
const shouldParseTheLog = shouldParseAndroidLog(log, referenceDate);
|
||||||
expect(shouldParseTheLog).toEqual(false);
|
expect(shouldParseTheLog).toEqual(false);
|
||||||
});
|
});
|
||||||
test('test shouldParseAndroidLog function for the older android log', () => {
|
test('test shouldParseAndroidLog function for the older android log', () => {
|
||||||
const referenceDate = new Date();
|
const referenceDate = new Date();
|
||||||
let log: DeviceLogEntry = getAndroidLog(
|
const log: DeviceLogEntry = getAndroidLog(
|
||||||
new Date(referenceDate.getTime() - 10000), //This log arrives 10 secs before the refernce time
|
new Date(referenceDate.getTime() - 10000), //This log arrives 10 secs before the refernce time
|
||||||
'error',
|
'error',
|
||||||
'fb4a.activitymanager',
|
'fb4a.activitymanager',
|
||||||
'Possible error info in activitymanager',
|
'Possible error info in activitymanager',
|
||||||
);
|
);
|
||||||
let shouldParseTheLog = shouldParseAndroidLog(log, referenceDate);
|
const shouldParseTheLog = shouldParseAndroidLog(log, referenceDate);
|
||||||
expect(shouldParseTheLog).toEqual(false);
|
expect(shouldParseTheLog).toEqual(false);
|
||||||
});
|
});
|
||||||
test('test shouldParseAndroidLog function for the fatal log', () => {
|
test('test shouldParseAndroidLog function for the fatal log', () => {
|
||||||
const referenceDate = new Date();
|
const referenceDate = new Date();
|
||||||
let log: DeviceLogEntry = getAndroidLog(
|
const log: DeviceLogEntry = getAndroidLog(
|
||||||
new Date(referenceDate.getTime() + 10000), //This log arrives 10 secs after the refernce time
|
new Date(referenceDate.getTime() + 10000), //This log arrives 10 secs after the refernce time
|
||||||
'fatal',
|
'fatal',
|
||||||
'arbitrary tag',
|
'arbitrary tag',
|
||||||
'Possible error info in activitymanager',
|
'Possible error info in activitymanager',
|
||||||
);
|
);
|
||||||
let shouldParseTheLog = shouldParseAndroidLog(log, referenceDate);
|
const shouldParseTheLog = shouldParseAndroidLog(log, referenceDate);
|
||||||
expect(shouldParseTheLog).toEqual(true);
|
expect(shouldParseTheLog).toEqual(true);
|
||||||
});
|
});
|
||||||
test('test shouldParseAndroidLog function for the error log which does not staisfy our tags check', () => {
|
test('test shouldParseAndroidLog function for the error log which does not staisfy our tags check', () => {
|
||||||
const referenceDate = new Date();
|
const referenceDate = new Date();
|
||||||
let log: DeviceLogEntry = getAndroidLog(
|
const log: DeviceLogEntry = getAndroidLog(
|
||||||
new Date(referenceDate.getTime() + 10000), //This log arrives 10 secs after the refernce time
|
new Date(referenceDate.getTime() + 10000), //This log arrives 10 secs after the refernce time
|
||||||
'error',
|
'error',
|
||||||
'arbitrary tag',
|
'arbitrary tag',
|
||||||
'Possible error info in fb4a',
|
'Possible error info in fb4a',
|
||||||
);
|
);
|
||||||
let shouldParseTheLog = shouldParseAndroidLog(log, referenceDate);
|
const shouldParseTheLog = shouldParseAndroidLog(log, referenceDate);
|
||||||
expect(shouldParseTheLog).toEqual(false);
|
expect(shouldParseTheLog).toEqual(false);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ function generateClientIdentifierWithSalt(
|
|||||||
identifier: string,
|
identifier: string,
|
||||||
salt: string,
|
salt: string,
|
||||||
): string {
|
): string {
|
||||||
let array = identifier.split('#');
|
const array = identifier.split('#');
|
||||||
const serial = array.pop();
|
const serial = array.pop();
|
||||||
return array.join('#') + '#' + salt + '-' + serial;
|
return array.join('#') + '#' + salt + '-' + serial;
|
||||||
}
|
}
|
||||||
@@ -198,7 +198,7 @@ test('test processStore function for an iOS device connected with client plugin
|
|||||||
expect(json).toBeDefined();
|
expect(json).toBeDefined();
|
||||||
//$FlowFixMe Flow doesn't that its a test and the assertion for null is already done
|
//$FlowFixMe Flow doesn't that its a test and the assertion for null is already done
|
||||||
const {pluginStates} = json.store;
|
const {pluginStates} = json.store;
|
||||||
let expectedPluginState = {
|
const expectedPluginState = {
|
||||||
[generateClientIdentifierWithSalt(clientIdentifier, 'salt')]: {
|
[generateClientIdentifierWithSalt(clientIdentifier, 'salt')]: {
|
||||||
msg: 'Test plugin',
|
msg: 'Test plugin',
|
||||||
},
|
},
|
||||||
@@ -258,7 +258,7 @@ test('test processStore function to have only the client for the selected device
|
|||||||
//$FlowFixMe Flow doesn't that its a test and the assertion for null is already added
|
//$FlowFixMe Flow doesn't that its a test and the assertion for null is already added
|
||||||
const {clients} = json;
|
const {clients} = json;
|
||||||
const {pluginStates} = json.store;
|
const {pluginStates} = json.store;
|
||||||
let expectedPluginState = {
|
const expectedPluginState = {
|
||||||
[generateClientIdentifierWithSalt(selectedDeviceClientIdentifier, 'salt') +
|
[generateClientIdentifierWithSalt(selectedDeviceClientIdentifier, 'salt') +
|
||||||
'#testapp']: {
|
'#testapp']: {
|
||||||
msg: 'Test plugin selected device',
|
msg: 'Test plugin selected device',
|
||||||
@@ -313,7 +313,7 @@ test('test processStore function to have multiple clients for the selected devic
|
|||||||
//$FlowFixMe Flow doesn't that its a test and the assertion for null is already added
|
//$FlowFixMe Flow doesn't that its a test and the assertion for null is already added
|
||||||
const {clients} = json;
|
const {clients} = json;
|
||||||
const {pluginStates} = json.store;
|
const {pluginStates} = json.store;
|
||||||
let expectedPluginState = {
|
const expectedPluginState = {
|
||||||
[generateClientIdentifierWithSalt(clientIdentifierApp1, 'salt') +
|
[generateClientIdentifierWithSalt(clientIdentifierApp1, 'salt') +
|
||||||
'#testapp1']: {
|
'#testapp1']: {
|
||||||
msg: 'Test plugin App1',
|
msg: 'Test plugin App1',
|
||||||
@@ -355,7 +355,7 @@ test('test processStore function for device plugin state and no clients', async
|
|||||||
//$FlowFixMe Flow doesn't that its a test and the assertion for null is already done
|
//$FlowFixMe Flow doesn't that its a test and the assertion for null is already done
|
||||||
const {pluginStates} = json.store;
|
const {pluginStates} = json.store;
|
||||||
const {clients} = json;
|
const {clients} = json;
|
||||||
let expectedPluginState = {
|
const expectedPluginState = {
|
||||||
'salt-serial#TestDevicePlugin': {msg: 'Test Device plugin'},
|
'salt-serial#TestDevicePlugin': {msg: 'Test Device plugin'},
|
||||||
};
|
};
|
||||||
expect(pluginStates).toEqual(expectedPluginState);
|
expect(pluginStates).toEqual(expectedPluginState);
|
||||||
|
|||||||
@@ -41,18 +41,18 @@ function mockPluginDefinition(name: string): PluginDefinition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test('getActivePluginNames with the plugins getting excluded', () => {
|
test('getActivePluginNames with the plugins getting excluded', () => {
|
||||||
let state = mockPluginState(
|
const state = mockPluginState(
|
||||||
[mockPluginDefinition('DevicePlugin1')],
|
[mockPluginDefinition('DevicePlugin1')],
|
||||||
[mockPluginDefinition('ClientPlugin1')],
|
[mockPluginDefinition('ClientPlugin1')],
|
||||||
[[mockPluginDefinition('DevicePlugin2'), 'DevicePlugin2']],
|
[[mockPluginDefinition('DevicePlugin2'), 'DevicePlugin2']],
|
||||||
);
|
);
|
||||||
let list = getActivePluginNames(state);
|
const list = getActivePluginNames(state);
|
||||||
expect(list).toEqual(['ClientPlugin2']);
|
expect(list).toEqual(['ClientPlugin2']);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('getActivePluginNames with the no plugins getting excluded', () => {
|
test('getActivePluginNames with the no plugins getting excluded', () => {
|
||||||
let state = mockPluginState([], [], []);
|
const state = mockPluginState([], [], []);
|
||||||
let list = getActivePluginNames(state);
|
const list = getActivePluginNames(state);
|
||||||
expect(list).toEqual([
|
expect(list).toEqual([
|
||||||
'ClientPlugin1',
|
'ClientPlugin1',
|
||||||
'ClientPlugin2',
|
'ClientPlugin2',
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
import promiseTimeout from '../promiseTimeout';
|
import promiseTimeout from '../promiseTimeout';
|
||||||
|
|
||||||
test('test promiseTimeout for timeout to happen', () => {
|
test('test promiseTimeout for timeout to happen', () => {
|
||||||
let promise = promiseTimeout(
|
const promise = promiseTimeout(
|
||||||
200,
|
200,
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
let id = setTimeout(() => {
|
const id = setTimeout(() => {
|
||||||
clearTimeout(id);
|
clearTimeout(id);
|
||||||
resolve();
|
resolve();
|
||||||
}, 500);
|
}, 500);
|
||||||
@@ -22,10 +22,10 @@ test('test promiseTimeout for timeout to happen', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('test promiseTimeout for timeout not to happen', () => {
|
test('test promiseTimeout for timeout not to happen', () => {
|
||||||
let promise = promiseTimeout(
|
const promise = promiseTimeout(
|
||||||
200,
|
200,
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
let id = setTimeout(() => {
|
const id = setTimeout(() => {
|
||||||
clearTimeout(id);
|
clearTimeout(id);
|
||||||
resolve();
|
resolve();
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|||||||
@@ -19,12 +19,12 @@ class TestObject extends Object {
|
|||||||
set: ?Set<any>;
|
set: ?Set<any>;
|
||||||
}
|
}
|
||||||
test('test makeObjectSerializable function for unnested object with no Set and Map', () => {
|
test('test makeObjectSerializable function for unnested object with no Set and Map', () => {
|
||||||
let obj = {key1: 'value1', key2: 'value2'};
|
const obj = {key1: 'value1', key2: 'value2'};
|
||||||
const output = makeObjectSerializable(obj);
|
const output = makeObjectSerializable(obj);
|
||||||
expect(output).toEqual(obj);
|
expect(output).toEqual(obj);
|
||||||
|
|
||||||
// Testing numbers
|
// Testing numbers
|
||||||
let obj2 = {key1: 1, key2: 2};
|
const obj2 = {key1: 1, key2: 2};
|
||||||
const output2 = makeObjectSerializable(obj2);
|
const output2 = makeObjectSerializable(obj2);
|
||||||
expect(output2).toEqual(obj2);
|
expect(output2).toEqual(obj2);
|
||||||
});
|
});
|
||||||
@@ -36,27 +36,27 @@ test('makeObjectSerializable function for unnested object with values which retu
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('test deserializeObject function for unnested object with no Set and Map', () => {
|
test('test deserializeObject function for unnested object with no Set and Map', () => {
|
||||||
let obj = {key1: 'value1', key2: 'value2'};
|
const obj = {key1: 'value1', key2: 'value2'};
|
||||||
const output = deserializeObject(obj);
|
const output = deserializeObject(obj);
|
||||||
expect(output).toEqual(obj);
|
expect(output).toEqual(obj);
|
||||||
|
|
||||||
// Testing numbers
|
// Testing numbers
|
||||||
let obj2 = {key1: 1, key2: 2};
|
const obj2 = {key1: 1, key2: 2};
|
||||||
const output2 = deserializeObject(obj2);
|
const output2 = deserializeObject(obj2);
|
||||||
expect(output2).toEqual(obj2);
|
expect(output2).toEqual(obj2);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('test makeObjectSerializable and deserializeObject function for nested object with no Set and Map', () => {
|
test('test makeObjectSerializable and deserializeObject function for nested object with no Set and Map', () => {
|
||||||
let subObj = {key1: 'value1', key2: 'value2'};
|
const subObj = {key1: 'value1', key2: 'value2'};
|
||||||
let subObj2 = {key21: 'value21', key22: 'value22'};
|
const subObj2 = {key21: 'value21', key22: 'value22'};
|
||||||
let obj = {key1: subObj, key2: subObj2};
|
const obj = {key1: subObj, key2: subObj2};
|
||||||
const output = makeObjectSerializable(obj);
|
const output = makeObjectSerializable(obj);
|
||||||
expect(output).toEqual(obj);
|
expect(output).toEqual(obj);
|
||||||
expect(deserializeObject(output)).toEqual(obj);
|
expect(deserializeObject(output)).toEqual(obj);
|
||||||
|
|
||||||
let subObjNum = {key1: 1, key2: 2};
|
const subObjNum = {key1: 1, key2: 2};
|
||||||
let subObjNum2 = {key21: 21, key22: 22};
|
const subObjNum2 = {key21: 21, key22: 22};
|
||||||
let obj2 = {key1: subObjNum, key2: subObjNum2};
|
const obj2 = {key1: subObjNum, key2: subObjNum2};
|
||||||
const output2 = makeObjectSerializable(obj2);
|
const output2 = makeObjectSerializable(obj2);
|
||||||
expect(output2).toEqual(obj2);
|
expect(output2).toEqual(obj2);
|
||||||
expect(deserializeObject(output2)).toEqual(obj2);
|
expect(deserializeObject(output2)).toEqual(obj2);
|
||||||
@@ -184,19 +184,19 @@ test('test makeObjectSerializable and deserializeObject function for custom Obje
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('test makeObjectSerializable and deserializeObject function for Array as input', () => {
|
test('test makeObjectSerializable and deserializeObject function for Array as input', () => {
|
||||||
let arr = [1, 2, 4, 5];
|
const arr = [1, 2, 4, 5];
|
||||||
const output = makeObjectSerializable(arr);
|
const output = makeObjectSerializable(arr);
|
||||||
expect(output).toEqual(arr);
|
expect(output).toEqual(arr);
|
||||||
expect(deserializeObject(output)).toEqual(arr);
|
expect(deserializeObject(output)).toEqual(arr);
|
||||||
|
|
||||||
let arrMap = [
|
const arrMap = [
|
||||||
new Map([['a1', 'v1'], ['a2', 'v2']]),
|
new Map([['a1', 'v1'], ['a2', 'v2']]),
|
||||||
new Map([['b1', 'v1'], ['b2', 'v2']]),
|
new Map([['b1', 'v1'], ['b2', 'v2']]),
|
||||||
new Map([['c1', 'v1'], ['c2', 'v2']]),
|
new Map([['c1', 'v1'], ['c2', 'v2']]),
|
||||||
new Map([['d1', 'v1'], ['d2', 'v2']]),
|
new Map([['d1', 'v1'], ['d2', 'v2']]),
|
||||||
];
|
];
|
||||||
|
|
||||||
let expectedArr = [
|
const expectedArr = [
|
||||||
{
|
{
|
||||||
__flipper_object_type__: 'Map',
|
__flipper_object_type__: 'Map',
|
||||||
data: [['a1', 'v1'], ['a2', 'v2']],
|
data: [['a1', 'v1'], ['a2', 'v2']],
|
||||||
@@ -218,7 +218,7 @@ test('test makeObjectSerializable and deserializeObject function for Array as in
|
|||||||
expect(outputMap).toEqual(expectedArr);
|
expect(outputMap).toEqual(expectedArr);
|
||||||
expect(deserializeObject(outputMap)).toEqual(arrMap);
|
expect(deserializeObject(outputMap)).toEqual(arrMap);
|
||||||
|
|
||||||
let arrStr = ['first', 'second', 'third', 'fourth'];
|
const arrStr = ['first', 'second', 'third', 'fourth'];
|
||||||
const outputStr = makeObjectSerializable(arrStr);
|
const outputStr = makeObjectSerializable(arrStr);
|
||||||
expect(outputStr).toEqual(arrStr);
|
expect(outputStr).toEqual(arrStr);
|
||||||
expect(deserializeObject(outputStr)).toEqual(arrStr);
|
expect(deserializeObject(outputStr)).toEqual(arrStr);
|
||||||
|
|||||||
@@ -70,8 +70,8 @@ export function processPluginStates(
|
|||||||
devicePlugins: Map<string, Class<FlipperDevicePlugin<>>>,
|
devicePlugins: Map<string, Class<FlipperDevicePlugin<>>>,
|
||||||
): PluginStatesState {
|
): PluginStatesState {
|
||||||
let pluginStates = {};
|
let pluginStates = {};
|
||||||
for (let key in allPluginStates) {
|
for (const key in allPluginStates) {
|
||||||
let keyArray = key.split('#');
|
const keyArray = key.split('#');
|
||||||
const pluginName = keyArray.pop();
|
const pluginName = keyArray.pop();
|
||||||
const filteredClients = clients.filter(client => {
|
const filteredClients = clients.filter(client => {
|
||||||
// Remove the last entry related to plugin
|
// Remove the last entry related to plugin
|
||||||
@@ -94,7 +94,7 @@ export function processNotificationStates(
|
|||||||
allActiveNotifications: Array<PluginNotification>,
|
allActiveNotifications: Array<PluginNotification>,
|
||||||
devicePlugins: Map<string, Class<FlipperDevicePlugin<>>>,
|
devicePlugins: Map<string, Class<FlipperDevicePlugin<>>>,
|
||||||
): Array<PluginNotification> {
|
): Array<PluginNotification> {
|
||||||
let activeNotifications = allActiveNotifications.filter(notif => {
|
const activeNotifications = allActiveNotifications.filter(notif => {
|
||||||
const filteredClients = clients.filter(client =>
|
const filteredClients = clients.filter(client =>
|
||||||
notif.client ? client.id.includes(notif.client) : false,
|
notif.client ? client.id.includes(notif.client) : false,
|
||||||
);
|
);
|
||||||
@@ -176,7 +176,7 @@ export const processStore = async (
|
|||||||
if (device) {
|
if (device) {
|
||||||
const {serial} = device;
|
const {serial} = device;
|
||||||
const processedClients = processClients(clients, serial);
|
const processedClients = processClients(clients, serial);
|
||||||
let processedPluginStates = processPluginStates(
|
const processedPluginStates = processPluginStates(
|
||||||
processedClients,
|
processedClients,
|
||||||
serial,
|
serial,
|
||||||
pluginStates,
|
pluginStates,
|
||||||
@@ -210,7 +210,7 @@ export async function fetchMetadata(
|
|||||||
const errorArray: Array<Error> = [];
|
const errorArray: Array<Error> = [];
|
||||||
const clients = store.getState().connections.clients;
|
const clients = store.getState().connections.clients;
|
||||||
const selectedDevice = store.getState().connections.selectedDevice;
|
const selectedDevice = store.getState().connections.selectedDevice;
|
||||||
for (let client of clients) {
|
for (const client of clients) {
|
||||||
if (
|
if (
|
||||||
!selectedDevice ||
|
!selectedDevice ||
|
||||||
selectedDevice.isArchived ||
|
selectedDevice.isArchived ||
|
||||||
@@ -218,7 +218,7 @@ export async function fetchMetadata(
|
|||||||
) {
|
) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (let plugin of client.plugins) {
|
for (const plugin of client.plugins) {
|
||||||
const pluginClass: ?Class<
|
const pluginClass: ?Class<
|
||||||
FlipperDevicePlugin<> | FlipperPlugin<>,
|
FlipperDevicePlugin<> | FlipperPlugin<>,
|
||||||
> = plugin ? pluginsMap.get(plugin) : null;
|
> = plugin ? pluginsMap.get(plugin) : null;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ async function exportMetrics(
|
|||||||
pluginsMap: Map<string, Class<FlipperDevicePlugin<> | FlipperPlugin<>>>,
|
pluginsMap: Map<string, Class<FlipperDevicePlugin<> | FlipperPlugin<>>>,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const metrics: ExportMetricType = {};
|
const metrics: ExportMetricType = {};
|
||||||
for (let key in pluginStates) {
|
for (const key in pluginStates) {
|
||||||
const pluginStateData = pluginStates[key];
|
const pluginStateData = pluginStates[key];
|
||||||
const arr = key.split('#');
|
const arr = key.split('#');
|
||||||
const pluginName = arr.pop();
|
const pluginName = arr.pop();
|
||||||
|
|||||||
@@ -46,12 +46,12 @@ export function getPersistedState<PersistedState>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getActivePluginNames(plugins: PluginsState): Array<string> {
|
export function getActivePluginNames(plugins: PluginsState): Array<string> {
|
||||||
let pluginsMap: Map<
|
const pluginsMap: Map<
|
||||||
string,
|
string,
|
||||||
Class<FlipperDevicePlugin<> | FlipperPlugin<>>,
|
Class<FlipperDevicePlugin<> | FlipperPlugin<>>,
|
||||||
> = pluginsClassMap(plugins);
|
> = pluginsClassMap(plugins);
|
||||||
|
|
||||||
let arr: Array<PluginDefinition> = plugins.disabledPlugins.concat(
|
const arr: Array<PluginDefinition> = plugins.disabledPlugins.concat(
|
||||||
plugins.gatekeepedPlugins,
|
plugins.gatekeepedPlugins,
|
||||||
);
|
);
|
||||||
arr.forEach((plugin: PluginDefinition) => {
|
arr.forEach((plugin: PluginDefinition) => {
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ export default function promiseTimeout<T>(
|
|||||||
timeoutMessage: ?string,
|
timeoutMessage: ?string,
|
||||||
): Promise<T> | Promise<void> {
|
): Promise<T> | Promise<void> {
|
||||||
// Create a promise that rejects in <ms> milliseconds
|
// Create a promise that rejects in <ms> milliseconds
|
||||||
let timeout = new Promise((resolve, reject) => {
|
const timeout = new Promise((resolve, reject) => {
|
||||||
let id = setTimeout(() => {
|
const id = setTimeout(() => {
|
||||||
clearTimeout(id);
|
clearTimeout(id);
|
||||||
reject(new Error(timeoutMessage || `Timed out in ${ms} ms.`));
|
reject(new Error(timeoutMessage || `Timed out in ${ms} ms.`));
|
||||||
}, ms);
|
}, ms);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ function processArray(
|
|||||||
dict: Map<any, any>,
|
dict: Map<any, any>,
|
||||||
): {childNeedsIteration: boolean, outputArr: Array<any>} {
|
): {childNeedsIteration: boolean, outputArr: Array<any>} {
|
||||||
// Adds the array item to the stack if it needs to undergo iteration to serialise it. Otherwise it adds the serialized version of the item to the memoization dict
|
// Adds the array item to the stack if it needs to undergo iteration to serialise it. Otherwise it adds the serialized version of the item to the memoization dict
|
||||||
let outputArr = [];
|
const outputArr = [];
|
||||||
let childNeedsIteration = false;
|
let childNeedsIteration = false;
|
||||||
for (const item of array) {
|
for (const item of array) {
|
||||||
const isItemInstanceOfObject = item instanceof Object;
|
const isItemInstanceOfObject = item instanceof Object;
|
||||||
@@ -116,7 +116,7 @@ export function makeObjectSerializable(obj: any): any {
|
|||||||
if (!(obj instanceof Object)) {
|
if (!(obj instanceof Object)) {
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
let stack = [obj];
|
const stack = [obj];
|
||||||
const dict: Map<any, any> = new Map();
|
const dict: Map<any, any> = new Map();
|
||||||
while (stack.length > 0) {
|
while (stack.length > 0) {
|
||||||
const element = stack[stack.length - 1];
|
const element = stack[stack.length - 1];
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ module.exports = async (
|
|||||||
}
|
}
|
||||||
watchChanges(plugins, reloadCallback, pluginCache, options);
|
watchChanges(plugins, reloadCallback, pluginCache, options);
|
||||||
const dynamicPlugins = [];
|
const dynamicPlugins = [];
|
||||||
for (let plugin of Object.values(plugins)) {
|
for (const plugin of Object.values(plugins)) {
|
||||||
const dynamicOptions = Object.assign(options, {force: false});
|
const dynamicOptions = Object.assign(options, {force: false});
|
||||||
const compiledPlugin = await compilePlugin(
|
const compiledPlugin = await compilePlugin(
|
||||||
plugin,
|
plugin,
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ const argv = yargs
|
|||||||
.help()
|
.help()
|
||||||
.parse(process.argv.slice(1));
|
.parse(process.argv.slice(1));
|
||||||
|
|
||||||
let {config, configPath, flipperDir} = setup(argv);
|
const {config, configPath, flipperDir} = setup(argv);
|
||||||
|
|
||||||
const pluginPaths = config.pluginPaths
|
const pluginPaths = config.pluginPaths
|
||||||
.concat(
|
.concat(
|
||||||
|
|||||||
@@ -5,10 +5,10 @@
|
|||||||
* @format
|
* @format
|
||||||
*/
|
*/
|
||||||
|
|
||||||
let babylon = require('@babel/parser');
|
const babylon = require('@babel/parser');
|
||||||
let fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
let electronStubs = babylon.parseExpression(
|
const electronStubs = babylon.parseExpression(
|
||||||
fs.readFileSync('static/electron-stubs.notjs').toString(),
|
fs.readFileSync('static/electron-stubs.notjs').toString(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user