Skip to content

Commit b5c1f52

Browse files
committed
added semi-colons and eslint spacing
1 parent 809753e commit b5c1f52

File tree

6 files changed

+19
-36
lines changed

6 files changed

+19
-36
lines changed

src/extension.ts

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Parser } from './parser';
44
import { Tree } from './types/tree';
55

66
let tree: Parser | undefined = undefined;
7-
let panel: vscode.WebviewPanel | undefined = undefined
7+
let panel: vscode.WebviewPanel | undefined = undefined;
88

99
// This method is called when your extension is activated
1010
// Your extension is activated the very first time the command is executed
@@ -14,34 +14,28 @@ function activate(context: vscode.ExtensionContext) {
1414
let columnToShowIn : vscode.ViewColumn | undefined = vscode.window.activeTextEditor
1515
? vscode.window.activeTextEditor.viewColumn
1616
: undefined;
17-
1817

1918
// Command that allows for User to select the root file of their React application.
2019
const pickFile: vscode.Disposable = vscode.commands.registerCommand('myExtension.pickFile', async () => {
21-
2220
// Check if there is an existing webview panel, if so display it.
23-
if(panel) {
24-
panel.reveal(columnToShowIn)
21+
if (panel) {
22+
panel.reveal(columnToShowIn);
2523
}
2624

27-
2825
// Opens window for the User to select the root file of React application
2926
const fileArray: vscode.Uri[] = await vscode.window.showOpenDialog({ canSelectFolders: false, canSelectFiles: true, canSelectMany: false });
30-
3127

3228
// Throw error message if no file was selected
3329
if (!fileArray || fileArray.length === 0) {
3430
vscode.window.showErrorMessage('No file selected');
3531
return;
3632
}
37-
3833

3934
// Create Tree to be inserted into returned HTML
4035
tree = new Parser(fileArray[0].path);
4136
tree.parse();
4237
const data: Tree = tree.getTree();
4338

44-
4539
// Check if panel currently has a webview, if it does dispose of it and create another with updated root file selected.
4640
// Otherwise create a new webview to display root file selected.
4741
if(!panel) {
@@ -54,23 +48,19 @@ function activate(context: vscode.ExtensionContext) {
5448
// Listens for when webview is closed and disposes of webview resources
5549
panel.onDidDispose(
5650
() => {
57-
console.log("Before: ", panel)
58-
panel.dispose()
51+
panel.dispose();
5952
panel = undefined;
6053
columnToShowIn = undefined;
61-
console.log("After: ", panel)
6254
},
6355
null,
6456
context.subscriptions
65-
);
57+
);
6658
});
6759

68-
6960
// Command to show panel if it is hidden
7061
const showPanel: vscode.Disposable = vscode.commands.registerCommand('myExtension.showPanel', () => {
71-
panel.reveal(columnToShowIn)
72-
});
73-
62+
panel.reveal(columnToShowIn);
63+
});
7464

7565
context.subscriptions.push(pickFile, showPanel);
7666
}

src/parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ export class Parser {
423423
childNodes,
424424
);
425425

426-
// Case for finding components passed in as props e.g. <Route component={App} />
426+
// Case for finding components passed in as props e.g. <Route component={App} />
427427
} else if (
428428
astTokens[i].type.label === 'jsxName' &&
429429
(astTokens[i].value === 'Component' ||

src/test/suite/parser.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,22 @@ describe('Parser Test Suite', () => {
4848
});
4949
});
5050

51+
// these are the 14 tests we need to test for
52+
5153
// TEST 1: NESTED CHILDREN
5254
// TEST 2: THIRD PARTY, REACT ROUTER, DESTRUCTURED IMPORTS
5355
// TEST 3: IDENTIFIES REDUX STORE CONNECTION
5456
// TEST 4: ALIASED IMPORTS
5557
// TEST 5: MISSING EXTENSIONS AND UNUSED IMPORTS
56-
57-
// ashley
5858
// TEST 6: BAD IMPORT OF APP2 FROM APP1 COMPONENT
5959
// TEST 7: SYNTAX ERROR IN APP FILE CAUSES PARSER ERROR
6060
// TEST 8: MULTIPLE PROPS ON ONE COMPONENT
6161
// TEST 9: FINDING DIFFERENT PROPS ACROSS TWO OR MORE IDENTICAL COMPONENTS
62-
6362
// TEST 10: CHECK CHILDREN WORKS AND COMPONENTS WORK
6463
// TEST 11: PARSER DOESN'T BREAK UPON RECURSIVE COMPONENTS
6564
// TEST 12: NEXT.JS APPS (pages version & app router version)
6665
// TEST 13: Variable Declaration Imports and React.lazy Imports
6766
// TEST 14: CHECK IF COMPONENT IS CLIENT OR SERVER (USING HOOKS) => RENDERS A CERTAIN COLOR (priority)
6867

69-
// LOU - EXTENSION TEST
68+
// LOU is doing EXTENSION TEST in extension.test.ts
7069
});

src/webview/Flow.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,19 @@ const OverviewFlow = () => {
2424

2525
useEffect(() => {
2626
window.addEventListener('message', (e: MessageEvent) => {
27-
2827
// Object containing type prop and value prop
2928
const msg: MessageEvent = e;
30-
const flowBuilder = new FlowBuilder
29+
const flowBuilder = new FlowBuilder;
3130

3231
switch (msg.data.type) {
3332
case 'parsed-data': {
3433
let data: Tree | undefined = msg.data.value;
3534

3635
// Creates our Tree structure
37-
flowBuilder.mappedData(data, initialNodes, initialEdges)
36+
flowBuilder.mappedData(data, initialNodes, initialEdges);
3837

3938
setEdges(initialEdges);
40-
setNodes(initialNodes)
39+
setNodes(initialNodes);
4140
break;
4241
}
4342
}

src/webview/flowBuilder.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ConnectionLineType, Edge, Node } from 'reactflow';
22
import { Tree } from '../types/tree';
33
import { getNonce } from '../getNonce';
4-
import * as d3 from 'd3'
4+
import * as d3 from 'd3';
55

66
// Contructs our family tree for React application root file that was selected
77

@@ -10,19 +10,17 @@ class FlowBuilder {
1010
public mappedData(data: Tree, nodes: Node[], edges: Edge[]): void {
1111

1212
// Create a holder for the heirarchical data (msg.value), data comes in an object of all the Trees
13-
const root: d3.HierarchyNode<Tree> = d3.hierarchy(data)
13+
const root: d3.HierarchyNode<Tree> = d3.hierarchy(data);
1414

1515
// Dynamically adjust height and width of display depending on the amount of nodes
1616
const totalNodes: number = root.descendants().length;
1717
const width: number = Math.max(totalNodes * 100, 800);
1818
const height = Math.max(totalNodes * 20, 500)
1919

20-
2120
//create tree layout and give nodes their positions and
2221
const treeLayout: d3.TreeLayout<unknown> = d3.tree()
2322
.size([width, height])
24-
.separation((a: d3.HierarchyPointNode<Node>, b: d3.HierarchyPointNode<Node>) => (a.parent == b.parent ? 2 : 2.5))
25-
23+
.separation((a: d3.HierarchyPointNode<Node>, b: d3.HierarchyPointNode<Node>) => (a.parent == b.parent ? 2 : 2.5));
2624

2725
treeLayout(root);
2826
// Iterate through each Tree and create a node
@@ -55,19 +53,17 @@ class FlowBuilder {
5553
animated: true,
5654
};
5755

58-
5956
// Check if the edge already exists before adding
6057
const edgeExists: boolean = edges.some(
6158
edge => edge.source === newEdge.source && edge.target === newEdge.target
6259
);
6360

6461
// If edge does not exist, add to our edges array
6562
if (!edgeExists) {
66-
edges.push(newEdge)
63+
edges.push(newEdge);
6764
}
6865
}
69-
}
70-
)
66+
});
7167
}
7268
}
7369

src/webview/style.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ body,
1515
text-align: center;
1616
}
1717

18-
1918
.react-flow__handle.connectionindicator {
2019
pointer-events: none !important;
2120
}

0 commit comments

Comments
 (0)