Skip to content

Commit 1dda97d

Browse files
nusanamandynullwong
andcommitted
fixed eslint issues
Co-authored-by: Ruth <[email protected]> Co-authored-by: Andy Wong <[email protected]>
1 parent 48764d9 commit 1dda97d

16 files changed

+80
-71
lines changed

package/__tests__/astParser.test.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { exportAllDeclaration } from "@babel/types"
2-
import { configure, shallow } from 'enzyme';
1+
// import { configure, shallow } from 'enzyme';
32

4-
// Test 1: Should take in a function definition with 1 hook and return an object with the getter/setter
3+
// Test 1: Should take in a function definition with 1 hook
4+
// and return an object with the getter / setter
55
// EXAMPLE INPUT FOR TEST
66
/**
77
* function UseStateHookTest() {
@@ -25,13 +25,14 @@ import { configure, shallow } from 'enzyme';
2525
* }
2626
*/
2727

28-
// TEST 2: Should take in multiple function definitions with hooks and return an object with all 4 properties
29-
// TEST 3: Should ignore any non-hook definitions
30-
// Test 4: Should return an empty object if no hooks found
31-
// Test 5: Should throw an error if input is invalid javascript
28+
// TEST 2: Should take in multiple function definitions
29+
// with hooks and return an object with all 4 properties
30+
// TEST 3: Should ignore any non-hook definitions
31+
// Test 4: Should return an empty object if no hooks found
32+
// Test 5: Should throw an error if input is invalid javascript
3233

3334
describe('placeholder', () => {
34-
xit('placeholder for tests', () => {
35+
it.skip('placeholder for tests', () => {
3536
expect(1 + 1).toEqual(2);
36-
})
37-
})
37+
});
38+
});

package/__tests__/linkFiber.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable react/jsx-filename-extension */
2-
import React, { Component, useState } from 'react';
2+
import React, { Component } from 'react';
33
import { render } from 'react-dom';
44

55
const linkFiberRequire = require('../linkFiber');
@@ -20,12 +20,12 @@ class App extends Component {
2020
}
2121
}
2222

23-
// Need to create a functioanl component instance to test
23+
// Need to create a functioanl component instance to test
2424
// Would need to be revised but here's the gist
2525
// const funcComponent = () => {
26-
// const [ number, setNumber ] = useState(0);
27-
// const newNumber = setNumber(1);
28-
26+
// const [ number, setNumber ] = useState(0);
27+
// const newNumber = setNumber(1);
28+
2929
// return (
3030
// <div>{newNumber}</div>
3131
// )

package/__tests__/timeJump.test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable max-classes-per-file */
12
const timeJumpRequire = require('../timeJump');
23

34
class Component {
@@ -19,8 +20,8 @@ class FiberNode {
1920
}
2021
}
2122

22-
// MVP FEATURE: Additional Testing
23-
// Testing for useState and useContext
23+
// MVP FEATURE: Additional Testing
24+
// Testing for useState and useContext
2425

2526

2627
describe('unit testing for timeJump.js', () => {

package/astParser.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
const acorn = require('acorn');
22
const jsx = require('acorn-jsx');
3+
34
const JSXParser = acorn.Parser.extend(jsx());
45

56
// Helper function to grab the getters/setters from `elementType`
67
module.exports = elementType => {
78
// Initialize empty object to store the setters and getter
8-
let ast = JSXParser.parse(elementType);
9+
let ast = JSXParser.parse(elementType);
910
const hookState = {};
1011
// All module exports will always start off as a single 'FunctionDeclaration' type
1112
while (Object.hasOwnProperty.call(ast, 'body')) {
@@ -34,4 +35,4 @@ module.exports = elementType => {
3435
});
3536
}
3637
return hookState;
37-
}
38+
};

package/linkFiber.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ module.exports = (snap, mode) => {
1313

1414
function sendSnapshot() {
1515
// don't send messages while jumping or while paused
16-
// DEV: So that when we are jumping to an old snapshot it wouldn't think we want to create new snapshots
16+
// DEV: So that when we are jumping to an old snapshot it
17+
// wouldn't think we want to create new snapshots
1718
if (mode.jumping || mode.paused) return;
1819
const payload = snap.tree.getCopy();
1920
// console.log('payload', payload);
@@ -83,7 +84,7 @@ module.exports = (snap, mode) => {
8384

8485
function createTree(currentFiber, tree = new Tree('root')) {
8586
if (!currentFiber) return tree;
86-
87+
8788
const {
8889
sibling,
8990
stateNode,
@@ -103,9 +104,9 @@ module.exports = (snap, mode) => {
103104
// Check if the component uses hooks
104105
if (memoizedState && Object.hasOwnProperty.call(memoizedState, 'baseState')) {
105106
// Traverse through the currentFiber and extract the getters/setters
106-
astHooks = astParser(elementType);
107-
saveState(astHooks);
108-
// Create a traversed property and assign to the evaluated result of
107+
astHooks = astParser(elementType);
108+
saveState(astHooks);
109+
// Create a traversed property and assign to the evaluated result of
109110
// invoking traverseHooks with memoizedState
110111
memoizedState.traversed = traverseHooks(memoizedState);
111112
nextTree = tree.appendChild(memoizedState);
@@ -131,7 +132,7 @@ module.exports = (snap, mode) => {
131132
} = container;
132133
// only assign internal rootp if it actually exists
133134
fiberRoot = _internalRoot || _reactRootContainer;
134-
135+
135136
updateSnapShotTree();
136137
// send the initial snapshot once the content script has started up
137138
window.addEventListener('message', ({ data: { action } }) => {
@@ -145,5 +146,5 @@ module.exports = (snap, mode) => {
145146
// return getNextImport('./UseStateHook');
146147
// return 'Testing outside';
147148
// const OtherComponent = loadable(() => import('./OtherComponent'))
148-
}
149-
};
149+
};
150+
};

src/app/__tests__/Chart.test.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// Should call function 'update' at least once
2222

2323
describe('placeholder', () => {
24-
xit('placeholder for tests', () => {
24+
it.skip('placeholder for tests', () => {
2525
expect(1 + 1).toEqual(2);
26-
})
27-
})
26+
});
27+
});
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import React from 'react';
2-
import { configure, shallow } from 'enzyme';
3-
import SwitchState from '../components/SwitchState';
1+
// import React from 'react';
2+
// import { configure, shallow } from 'enzyme';
3+
// import SwitchState from '../components/SwitchState';
44

5-
// Should describe unit testing for SwitchState
6-
// Should create a shallow copy of SwitchState
7-
// The component should have an array of objects that have value
8-
// and the label should be the name of the state being captured
9-
10-
// If the label is selected, it should only display relevant components with the same state name
5+
// Should describe unit testing for SwitchState
6+
// Should create a shallow copy of SwitchState
7+
// The component should have an array of objects that have value
8+
// and the label should be the name of the state being captured
9+
10+
// If the label is selected, it should only display relevant components with the same state name
1111

1212

1313
describe('placeholder', () => {
14-
xit('placeholder for tests', () => {
15-
expect(1+1).toEqual(2);
16-
})
17-
})
14+
it.skip('placeholder for tests', () => {
15+
expect(1 + 1).toEqual(2);
16+
});
17+
});

src/app/components/Action.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import PropTypes from 'prop-types';
44
import { changeView, changeSlider } from '../actions/actions';
55

66
// Launch Feature: Figure out changeView vs changeSlider
7-
// Should we make the btn bigger instead and keep the functionality?
8-
// div onclick event triggers the changeView method
7+
// Should we make the btn bigger instead and keep the functionality?
8+
// div onclick event triggers the changeView method
99

1010
const Action = props => {
1111
const {

src/app/components/Diff.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import ReactHtmlParser from 'react-html-parser';
66
import { useStoreContext } from '../store';
77

88
function Diff({ snapshot, show }) {
9-
const [ mainState ] = useStoreContext();
9+
const [mainState] = useStoreContext();
1010
const { currentTab, tabs } = mainState;
1111
const { snapshots, viewIndex, sliderIndex } = tabs[currentTab];
1212
let previous;
@@ -27,7 +27,7 @@ function Diff({ snapshot, show }) {
2727
if (previous === undefined || delta === undefined) return <div> No state change detected. </div>;
2828
return (
2929
<div>
30-
{ ReactHtmlParser(html) }
30+
{ReactHtmlParser(html)}
3131
</div>
3232
);
3333
}

src/app/components/StateRoute.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
import Chart from './Chart';
88
import Tree from './Tree';
99

10+
// eslint-disable-next-line react/prop-types
1011
const StateRoute = ({ snapshot, hierarchy }) => (
1112
<Router>
1213
<div className="navbar">

0 commit comments

Comments
 (0)