Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Commit

Permalink
enable object shorthand plugin for properties
Browse files Browse the repository at this point in the history
Summary:
This inconsistency bothered me for a bit thus enabling the plugin

See changes in eslintrc, the rest is autofix from eslint

Reviewed By: passy

Differential Revision: D55967900

fbshipit-source-id: 285360d61773c6064190e561e62c80a994ae7182
  • Loading branch information
antonk52 authored and facebook-github-bot committed Apr 11, 2024
1 parent e104b6f commit 2a80446
Show file tree
Hide file tree
Showing 49 changed files with 85 additions and 84 deletions.
1 change: 1 addition & 0 deletions desktop/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ module.exports = {
'no-bitwise': 0, // bitwise operations needed in some places
'consistent-return': 0,
'no-var': 2,
'object-shorthand': ['error', 'properties'],
'prefer-const': [2, {destructuring: 'all'}],
'prefer-spread': 1,
'prefer-rest-params': 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default createESLintRule<Options, MessageIds>({
Program(node) {
if (isTs) {
context.report({
node: node,
node,
messageId: 'noTsFileExtension',
});
}
Expand Down
2 changes: 1 addition & 1 deletion desktop/flipper-common/src/clientUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export function deconstructPluginKey(pluginKey: string): PluginKeyConstituents {
type: 'client',
...deconstructClientId(clientId),
client: clientId,
pluginName: pluginName,
pluginName,
};
}
}
2 changes: 1 addition & 1 deletion desktop/flipper-plugin/src/ui/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export const Dialog = {
...rest,
defaultValue: true,
children: () => message,
onConfirm: onConfirm,
onConfirm,
});
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export function tableContextMenuFactory<T extends object>(
onChange={(color: string) => {
dispatch({
type: 'setSearchHighlightColor',
color: color,
color,
});
}}>
{Object.entries(theme.searchHighlightBackground).map(
Expand Down
2 changes: 1 addition & 1 deletion desktop/flipper-plugin/src/ui/data-table/TableSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const TableSearch = memo(function TableSearch({
);
const toggleSearchDropdown = useCallback(
(show: boolean) => {
dispatch({type: 'showSearchDropdown', show: show});
dispatch({type: 'showSearchDropdown', show});
},
[dispatch],
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ export class ServerController

const info = {
client,
connection: connection,
connection,
};

recorder.log(
Expand Down
4 changes: 2 additions & 2 deletions desktop/flipper-server/src/app-connectivity/ServerRSocket.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ class ServerRSocket extends ServerWebSocketBase {
? this._trustedRequestHandler
: this._untrustedRequestHandler,
transport: new RSocketTCPServer({
port: port,
serverFactory: serverFactory,
port,
serverFactory,
}),
});
rawServer.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,6 @@ export default class AndroidCertificateProvider extends CertificateProvider {
].map((s) => this.santitizeString(s));

const isMatch = sanitizedDeviceCsr === sanitizedClientCsr;
return {isMatch: isMatch, foundCsr: sanitizedDeviceCsr};
return {isMatch, foundCsr: sanitizedDeviceCsr};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export function parseAndroidCrash(content: string, logDate?: Date) {
}
const crash: CrashLog = {
callstack: content,
name: name,
reason: reason,
name,
reason,
date: logDate?.getTime(),
};
return crash;
Expand Down
4 changes: 2 additions & 2 deletions desktop/flipper-server/src/server/startFlipperServer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ export async function startFlipperServer(
appPath,
homePath: os.homedir(),
execPath,
staticPath: staticPath,
staticPath,
tempPath: os.tmpdir(),
desktopPath: desktopPath,
desktopPath,
},
launcherSettings,
processConfig: loadProcessConfig(env),
Expand Down
2 changes: 1 addition & 1 deletion desktop/flipper-server/src/server/startServer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ async function startHTTPServer(
debug: !isProduction(),
graphSecret: GRAPH_SECRET,
appVersion: environmentInfo.appVersion,
sessionId: sessionId,
sessionId,
unixname: environmentInfo.os.unixname,
authToken: token,
};
Expand Down
2 changes: 1 addition & 1 deletion desktop/flipper-ui/src/chrome/ConsoleLogs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type ConsoleFeedLogMessage = {

export function enableConsoleHook() {
addLogTailer((level, ...data) => {
const logMessage = {method: level, data: data, id: v4()};
const logMessage = {method: level, data, id: v4()};
exportLogs.push(logMessage);

if (level === 'debug') {
Expand Down
4 changes: 2 additions & 2 deletions desktop/flipper-ui/src/chrome/ListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@ export default class ListView extends Component<Props, State> {
let selectedElements: Set<string> = new Set([]);
if (this.props.type === 'single') {
if (!selected) {
this.setState({selectedElements: selectedElements});
this.setState({selectedElements});
this.props.onChange([...selectedElements]);
} else {
selectedElements.add(id);
this.setState({selectedElements: selectedElements});
this.setState({selectedElements});
this.props.onChange([...selectedElements]);
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion desktop/flipper-ui/src/dispatcher/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default (store: Store, logger: Logger) => {
const isFocused = document.hasFocus();
store.dispatch({
type: 'windowIsFocused',
payload: {isFocused: isFocused, time: Date.now()},
payload: {isFocused, time: Date.now()},
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ function devicePlugin(client: DevicePluginClient) {
initialized = true;

return {
activateStub: activateStub,
deactivateStub: deactivateStub,
activateStub,
deactivateStub,
destroyStub,
};
}
Expand Down
2 changes: 1 addition & 1 deletion desktop/flipper-ui/src/reducers/connections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ export default (state: State = INITAL_STATE, action: Actions): State => {
state.userPreferredApp,
selectedPlugin,
userPreferredPlugin: selectedPlugin,
deepLinkPayload: deepLinkPayload,
deepLinkPayload,
};
}

Expand Down
2 changes: 1 addition & 1 deletion desktop/flipper-ui/src/reducers/pluginDownloads.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default function reducer(
return produce(state, (draft) => {
draft[installationDir] = {
plugin,
startedByUser: startedByUser,
startedByUser,
status: PluginDownloadStatus.QUEUED,
};
});
Expand Down
2 changes: 1 addition & 1 deletion desktop/flipper-ui/src/sandy-chrome/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ export function NavbarButton({
if (count !== undefined) {
return (
<Badge
style={{zIndex: zIndex}}
style={{zIndex}}
{...{onClick}}
dot={count === true}
count={count}
Expand Down
2 changes: 1 addition & 1 deletion desktop/flipper-ui/src/sandy-chrome/RatingButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class FeedbackComponent extends Component<
};
onSubmitRating(newRating: number) {
const nextAction = newRating <= 2 ? 'leave-comment' : 'finished';
this.setState({rating: newRating, nextAction: nextAction});
this.setState({rating: newRating, nextAction});
this.props.submitRating(newRating);
if (nextAction === 'finished') {
setTimeout(this.props.close, 5000);
Expand Down
2 changes: 1 addition & 1 deletion desktop/flipper-ui/src/sandy-chrome/SandyApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export function SandyApp() {
) : (
<ContentContainer>
{React.createElement(staticView, {
logger: logger,
logger,
})}
</ContentContainer>
)}
Expand Down
4 changes: 2 additions & 2 deletions desktop/flipper-ui/src/ui/components/TooltipProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,15 @@ const TooltipProvider: React.FC<{}> = memo(function TooltipProvider({
setTooltip({
rect: node.getBoundingClientRect(),
title,
options: options,
options,
});
}, options.delay);
return;
}
setTooltip({
rect: node.getBoundingClientRect(),
title,
options: options,
options,
});
},
close() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export default function Searchable(
? this.props.defaultSearchTerm
: savedState.searchTerm || this.state.searchTerm;
this.setState({
searchTerm: searchTerm,
searchTerm,
filters: savedState.filters || this.state.filters,
regexEnabled: savedState.regexEnabled || this.state.regexEnabled,
contentSearchEnabled:
Expand Down
2 changes: 1 addition & 1 deletion desktop/flipper-ui/src/utils/__tests__/exportData.node.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@ test('test determinePluginsToProcess to ignore archived clients', async () => {
pluginKey: `${client.id}#TestPlugin`,
pluginId: 'TestPlugin',
pluginName: 'TestPlugin',
client: client,
client,
},
]);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,6 @@ test('queue will be cleaned up when it exceeds maximum size', () => {
});
expect(state[pluginKey][newLength - 1]).toEqual({
method: 'test',
params: {i: i}, // ~50001
params: {i}, // ~50001
});
});
2 changes: 1 addition & 1 deletion desktop/flipper-ui/src/utils/exportData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ async function addSaltToDeviceSerial({
flipperReleaseRevision: revision,
clients: updatedClients,
device: {...newDevice.toJSON(), pluginStates: devicePluginStates},
deviceScreenshot: deviceScreenshot,
deviceScreenshot,
store: {
activeNotifications: updatedPluginNotifications,
},
Expand Down
6 changes: 3 additions & 3 deletions desktop/flipper-ui/src/utils/testUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function createMockDownloadablePluginDetails(
const name = params.name || `flipper-plugin-${lowercasedID}`;
const details: DownloadablePluginDetails = {
name: name || `flipper-plugin-${lowercasedID}`,
id: id,
id,
buildId,
bugs: {
email: 'bugs@localhost',
Expand All @@ -63,9 +63,9 @@ export function createMockDownloadablePluginDetails(
specVersion: 2,
pluginType: 'client',
title: title ?? id,
version: version,
version,
downloadUrls: [`http://localhost/${lowercasedID}/${version}`],
lastUpdated: lastUpdated,
lastUpdated,
isActivatable: false,
isEnabledByDefault: false,
};
Expand Down
4 changes: 2 additions & 2 deletions desktop/plugins/public/cpu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ export function devicePlugin(client: PluginClient<{}, {}>) {
}
cpuState.set({
cpuCount: count,
cpuFreq: cpuFreq,
cpuFreq,
monitoring: false,
hardwareInfo: '',
temperatureMap: {},
Expand Down Expand Up @@ -520,7 +520,7 @@ function buildAvailableGovList(freq: CPUFrequency): string {

function buildSidebarRow(key: string, val: any) {
return {
key: key,
key,
value: val,
};
}
Expand Down
2 changes: 1 addition & 1 deletion desktop/plugins/public/crash_reporter/crash-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function showCrashNotification(
id: crash.notificationID,
message: msg,
severity: 'error',
title: title,
title,
action: crash.notificationID,
category: crash.reason || 'Unknown reason',
});
Expand Down
4 changes: 2 additions & 2 deletions desktop/plugins/public/databases/DatabasesPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ const QueryHistory = React.memo(({history}: {history: Array<Query>}) => {
const value = query.value;
rows.push({
key: `${i}`,
columns: {time: {value: time}, query: {value: value}},
columns: {time: {value: time}, query: {value}},
});
}
}
Expand Down Expand Up @@ -445,7 +445,7 @@ export function Component() {

const onGoToRow = useCallback(
(row: number, _count: number) => {
instance.goToRow({row: row});
instance.goToRow({row});
},
[instance],
);
Expand Down
20 changes: 10 additions & 10 deletions desktop/plugins/public/databases/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export function plugin(client: PluginClient<Events, Methods>) {
...state,
databases,
outdatedDatabaseList: false,
selectedDatabase: selectedDatabase,
selectedDatabase,
selectedDatabaseTable: selectedTable,
pageRowNumber: 0,
currentPage: sameTableSelected ? state.currentPage : null,
Expand Down Expand Up @@ -402,13 +402,13 @@ export function plugin(client: PluginClient<Events, Methods>) {
databaseId: newState.selectedDatabase,
order: newState.currentSort?.key,
reverse: (newState.currentSort?.direction || 'up') === 'down',
table: table,
table,
start: newState.pageRowNumber,
})
.then((data) => {
updatePage({
databaseId: databaseId,
table: table,
databaseId,
table,
columns: data.columns,
rows: data.values,
start: data.start,
Expand All @@ -426,13 +426,13 @@ export function plugin(client: PluginClient<Events, Methods>) {
if (newState.currentStructure === null && databaseId && table) {
client
.send('getTableStructure', {
databaseId: databaseId,
table: table,
databaseId,
table,
})
.then((data) => {
updateStructure({
databaseId: databaseId,
table: table,
databaseId,
table,
columns: data.structureColumns,
rows: data.structureValues,
indexesColumns: data.indexesColumns,
Expand All @@ -453,8 +453,8 @@ export function plugin(client: PluginClient<Events, Methods>) {
) {
client
.send('getTableInfo', {
databaseId: databaseId,
table: table,
databaseId,
table,
})
.then((data) => {
updateTableInfo({
Expand Down
4 changes: 2 additions & 2 deletions desktop/plugins/public/layout/InspectorSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const Sidebar: React.FC<Props> = (props: Props) => {
sectionDefs.push({
key: extraSection,
id: extraSection,
data: data,
data,
});
}
} else {
Expand All @@ -156,7 +156,7 @@ const Sidebar: React.FC<Props> = (props: Props) => {
name: props.element?.name,
})
.then((response) => {
setElementSnapshot({element: element, snapshot: response.snapshot});
setElementSnapshot({element, snapshot: response.snapshot});
})
.catch((e) => {
console.log(
Expand Down
Loading

0 comments on commit 2a80446

Please sign in to comment.