Skip to content

Commit

Permalink
[@dagster-io/eslint-config] Enable object-shorthand (#7423)
Browse files Browse the repository at this point in the history
## Summary

I've been meaning to do this for a while. Enable `object-shorthand` in our lint config.

## Test Plan

Buildkite
  • Loading branch information
hellendag committed Apr 13, 2022
1 parent 0e46052 commit 9f9db4e
Show file tree
Hide file tree
Showing 36 changed files with 75 additions and 68 deletions.
6 changes: 0 additions & 6 deletions js_modules/dagit/packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@
"test": "react-scripts test",
"ts": "tsc -p ."
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
Expand Down
2 changes: 1 addition & 1 deletion js_modules/dagit/packages/core/src/app/LayoutProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const LayoutProvider: React.FC = (props) => {
() => ({
nav: {
isOpen: navOpen,
isCollapsible: isCollapsible,
isCollapsible,
open: () => setNavOpen(true),
close: () => setNavOpen(false),
},
Expand Down
4 changes: 2 additions & 2 deletions js_modules/dagit/packages/core/src/asset-graph/Utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const buildGraphData = (assetNodes: AssetNode[]) => {
});

data.nodes[id] = {
id: id,
id,
assetKey: definition.assetKey,
definition,
};
Expand All @@ -90,7 +90,7 @@ export const buildGraphDataFromSingleNode = (assetNode: AssetNodeDefinitionFragm
},
nodes: {
[id]: {
id: id,
id,
assetKey: assetNode.assetKey,
definition: {...assetNode, dependencyKeys: [], dependedByKeys: []},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ const buildGraphQueryItems = (nodes: AssetNode[]) => {
for (const node of nodes) {
const name = tokenForAssetKey(node.assetKey);
items[name] = {
node: node,
name: name,
node,
name,
inputs: node.dependencyKeys.map((key) => ({
dependsOn: [{solid: {name: tokenForAssetKey(key)}}],
})),
Expand Down
4 changes: 2 additions & 2 deletions js_modules/dagit/packages/core/src/assets/AssetEvents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ function useRecentAssetEvents(
variables: loadUsingPartitionKeys
? {
assetKey: {path: assetKey.path},
before: before,
before,
partitionInLast: 120,
}
: {
assetKey: {path: assetKey.path},
before: before,
before,
limit: 100,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const AssetValueGraph: React.FC<{
}

const graphData = {
labels: labels,
labels,
datasets: [
{
label: props.label,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ const LaunchAssetChoosePartitionsDialogBody: React.FC<Props> = ({
executionParams: {
runConfigData,
mode: partition.mode,
stepKeys: stepKeys,
stepKeys,
selector: {
repositoryLocationName: repoAddress.location,
repositoryName: repoAddress.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const groupByPartition = (

return {
all: sorted,
latest: latest,
latest,
timestamp: latest?.timestamp,
partition: key,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export class ConfigEditor extends React.Component<ConfigEditorProps> {
const offsetFromTop = 20;

this._editor?.scrollIntoView({
left: left,
left,
right: left,
top: top - offsetFromTop,
bottom: top + (clientHeight - offsetFromTop),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function parentsAddingChildKeyToLast(parents: IParseStateParent[], key: string)
function parentsAddingChildKeyAtIndent(parents: IParseStateParent[], key: string, indent: number) {
parents = parentsPoppingItemsDeeperThan(parents, indent);
parents = parentsAddingChildKeyToLast(parents, key);
parents = [...parents, {key, indent: indent, childKeys: []}];
parents = [...parents, {key, indent, childKeys: []}];
return parents;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const buildLayout = (params: BuildLayoutParams) => {
!g.inputs.some((i) => i.dependsOn.some((s) => nodes.find((o) => o.name === s.solid.name)));

const boxes: GanttChartBox[] = nodes.filter(hasNoDependencies).map((node) => ({
node: node,
node,
key: node.name,
state: undefined,
children: [],
Expand Down
4 changes: 2 additions & 2 deletions js_modules/dagit/packages/core/src/graph/asyncGraphLayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export function useOpLayout(ops: ILayoutOp[], parentOp?: ILayoutOp) {
const layout = await asyncGetFullOpLayout(ops, parentOp);
dispatch({
type: 'layout',
payload: {layout: layout, cacheKey},
payload: {layout, cacheKey},
});
}

Expand Down Expand Up @@ -136,7 +136,7 @@ export function useAssetLayout(graphData: GraphData) {
const layout = await asyncGetFullAssetLayout(graphData);
dispatch({
type: 'layout',
payload: {layout: layout, cacheKey},
payload: {layout, cacheKey},
});
}

Expand Down
2 changes: 1 addition & 1 deletion js_modules/dagit/packages/core/src/graph/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ export function layoutOp(op: ILayoutOp, root: IPoint): OpLayout {
y: accY + PORT_INSET_Y,
},
layout: {
x: x,
x,
y: accY,
width: IO_MINI_WIDTH,
height: IO_HEIGHT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export const LiveTickTimeline: React.FC<{
tooltip: {
displayColors: false,
callbacks: {
label: function (tooltipItem: TooltipItem<any>) {
label(tooltipItem: TooltipItem<any>) {
if (!tooltipItem.datasetIndex) {
// this is the current time
return 'Current time';
Expand Down
4 changes: 2 additions & 2 deletions js_modules/dagit/packages/core/src/launchpad/OpSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const OpSelector = (props: IOpSelectorProps) => {
const repo = useRepository(repoAddress);
const isJob = isThisThingAJob(repo, pipelineName);
const {data, loading} = useQuery<OpSelectorQuery>(SOLID_SELECTOR_QUERY, {
variables: {selector: selector, requestScopeHandleID: flattenGraphs ? undefined : ''},
variables: {selector, requestScopeHandleID: flattenGraphs ? undefined : ''},
fetchPolicy: 'cache-and-network',
});

Expand Down Expand Up @@ -147,7 +147,7 @@ export const OpSelector = (props: IOpSelectorProps) => {
linkToPreview={{
repoName: repoAddress.name,
repoLocation: repoAddress.location,
pipelineName: pipelineName,
pipelineName,
isJob,
}}
flattenGraphsEnabled={flattenGraphsEnabled}
Expand Down
2 changes: 1 addition & 1 deletion js_modules/dagit/packages/core/src/ops/OpCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const OpCard: React.FC<OpCardProps> = (props) => {
const {name, inputDefinitions, outputDefinitions} = props.definition;
const layout = layoutOp(
{
name: name,
name,
inputs: inputDefinitions.map((d) => ({
definition: d,
dependsOn: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function assembleIntoSpans(keys: string[], keyTestFn: (key: string) => bo
for (let ii = 0; ii < keys.length; ii++) {
const status = keyTestFn(keys[ii]);
if (!spans.length || spans[spans.length - 1].status !== status) {
spans.push({startIdx: ii, endIdx: ii, status: status});
spans.push({startIdx: ii, endIdx: ii, status});
} else {
spans[spans.length - 1].endIdx = ii;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ function buildOpHandles(opNames: string[], deps: string[]) {
__typename: 'SolidHandle',
handleID: name,
solid: {
name: name,
name,
definition: {
__typename: 'SolidDefinition',
name: name,
name,
},
inputs: [],
outputs: [],
Expand Down Expand Up @@ -83,11 +83,11 @@ function buildRun(
const startTime = new Date(isoDateString).getTime() / 1000;
const result: PartitionSetLoaderRunFragment = {
__typename: 'Run',
id: id,
id,
runId: id,
status: RunStatus.SUCCESS,
stats: {
id: id,
id,
startTime,
endTime: startTime + 1,
materializations: 0,
Expand All @@ -96,13 +96,13 @@ function buildRun(
stepStats: Object.entries(statuses).map(([key, status]) => ({
__typename: 'RunStepStats',
stepKey: key,
status: status,
startTime: startTime,
status,
startTime,
endTime: startTime + 1,
materializations: [],
expectationResults: [],
})),
tags: tags,
tags,
};

return result;
Expand Down Expand Up @@ -266,7 +266,7 @@ export const LargeDataset = () => {
}
results.push({
name: date.format('YYYY-MM-DD'),
runs: runs,
runs,
});
}
return results;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export function useChunkedPartitionsQuery(
partitionSetName,
repositorySelector,
reverse: true,
cursor: cursor,
cursor,
limit: pageSize === 'all' ? 100000 : pageSize,
},
});
Expand Down Expand Up @@ -254,7 +254,7 @@ export function useChunkedPartitionsQuery(
runs: [],
});
setPaginationState({
pageSize: pageSize,
pageSize,
cursorStack: cursorStack.slice(0, cursorStack.length - 1),
cursor: cursorStack.length ? cursorStack[cursorStack.length - 1] : null,
});
Expand All @@ -267,7 +267,7 @@ export function useChunkedPartitionsQuery(
runs: [],
});
setPaginationState({
pageSize: pageSize,
pageSize,
cursorStack: cursor ? [...cursorStack, cursor] : cursorStack,
cursor: dataState.partitionNames[0],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const useSidebarOpQuery = (
repositoryLocationName: repoAddress?.location || '',
pipelineName: name,
},
handleID: handleID,
handleID,
},
fetchPolicy: 'cache-and-network',
skip: isGraph,
Expand All @@ -63,7 +63,7 @@ const useSidebarOpQuery = (
repositoryLocationName: repoAddress?.location || '',
graphName: name,
},
handleID: handleID,
handleID,
},
fetchPolicy: 'cache-and-network',
skip: !isGraph,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ export const SidebarOpExecutionGraphs: React.FC<{
SIDEBAR_OP_GRAPHS_QUERY,
{
variables: {
handleID: handleID,
handleID,
selector: {
repositoryName: repoAddress.name,
repositoryLocationName: repoAddress.location,
pipelineName: pipelineName,
pipelineName,
},
},
fetchPolicy: 'cache-and-network',
Expand Down Expand Up @@ -61,7 +61,7 @@ export const SidebarOpExecutionGraphs: React.FC<{
const ys = values.map((v) => v.y).filter((v) => !isNaN(v));
const data: AssetValueGraphData = {
xAxis: 'time',
values: values,
values,
minXNumeric: Math.min(...xs),
maxXNumeric: Math.max(...xs),
minY: Math.min(...ys),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const SidebarPipelineOrJobOverview: React.FC<{
{
fetchPolicy: 'cache-and-network',
partialRefetch: true,
variables: {pipelineSelector: pipelineSelector},
variables: {pipelineSelector},
},
);

Expand Down
4 changes: 2 additions & 2 deletions js_modules/dagit/packages/core/src/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import * as sql from '../plugins/sql';
import {RepoAddress} from '../workspace/types';

const plugins = {
sql: sql,
ipynb: ipynb,
sql,
ipynb,
snowflake: sql,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function filterLogs(logs: LogsProviderLogs, filter: LogFilter, filterStepKeys: s

return {
filteredNodes: hasTextFilter && filter.hideNonMatches ? textMatchNodes : filteredNodes,
textMatchNodes: textMatchNodes,
textMatchNodes,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function useCursorPaginatedQuery<T, TVars extends CursorPaginationQueryVa

const queryVars: any = {
...options.variables,
cursor: cursor,
cursor,
limit: options.pageSize + 1,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const SchedulesRoot = ({repoAddress}: {repoAddress: RepoAddress}) => {

const queryResult = useQuery<SchedulesRootQuery>(SCHEDULES_ROOT_QUERY, {
variables: {
repositorySelector: repositorySelector,
repositorySelector,
instigationType: InstigationType.SCHEDULE,
},
fetchPolicy: 'cache-and-network',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const TimestampDisplay = (props: Props) => {
timestamp: {unix: timestamp},
locale,
timezone: timezone || userTimezone,
timeFormat: timeFormat,
timeFormat,
})}
</TabularNums>
{timezone && timezone !== userTimezone ? (
Expand Down
2 changes: 1 addition & 1 deletion js_modules/dagit/packages/core/src/sensors/SensorsRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const SensorsRoot = (props: Props) => {

const queryResult = useQuery<SensorsRootQuery>(SENSORS_ROOT_QUERY, {
variables: {
repositorySelector: repositorySelector,
repositorySelector,
instigationType: InstigationType.SENSOR,
},
fetchPolicy: 'cache-and-network',
Expand Down
4 changes: 2 additions & 2 deletions js_modules/dagit/packages/core/src/testing/SVGMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const MOCKS: CachedGraphQLRequest[] = [
'airline_demo_ingest_pipeline',
'airline_demo_warehouse_pipeline',
].map((name) => ({
name: name,
name,
query: PIPELINE_EXPLORER_ROOT_QUERY,
variables: {
pipelineSelector: {
Expand Down Expand Up @@ -44,7 +44,7 @@ MOCKS.push({

MOCKS.push(
...['composition', 'log_spew', 'many_events'].map((name) => ({
name: name,
name,
query: PIPELINE_EXPLORER_ROOT_QUERY,
variables: {
pipelineSelector: {
Expand Down
3 changes: 3 additions & 0 deletions js_modules/dagit/packages/eslint-config/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: './index.js',
};

1 comment on commit 9f9db4e

@vercel
Copy link

@vercel vercel bot commented on 9f9db4e Apr 13, 2022

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

dagit-storybook – ./js_modules/dagit/packages/ui

dagit-storybook.vercel.app
dagit-storybook-git-master-elementl.vercel.app
dagit-storybook-elementl.vercel.app

Please sign in to comment.