Skip to content

Commit fc75afb

Browse files
committed
added circleci configuration
1 parent a472a65 commit fc75afb

File tree

8 files changed

+64
-12
lines changed

8 files changed

+64
-12
lines changed

.circleci/config.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: 2
2+
jobs:
3+
build:
4+
docker:
5+
- image: circleci/node:12
6+
7+
working_directory: ~/repo
8+
9+
steps:
10+
- checkout
11+
- restore_cache:
12+
keys:
13+
- v1-dependencies-{{ checksum "package.json" }}
14+
- v1-dependencies-
15+
16+
- run: yarn install
17+
18+
- save_cache:
19+
paths:
20+
- node_modules
21+
key: v1-dependencies-{{ checksum "package.json" }}
22+
23+
- run: yarn test

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"eslint-plugin-prettier": "^3.2.0",
5252
"eslint-plugin-react": "^7.21.5",
5353
"eslint-plugin-react-hooks": "^4.2.0",
54-
"prettier": "^2.2.1"
54+
"prettier": "^2.2.1",
55+
"test": "^0.6.0"
5556
}
5657
}

src/App.test.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/Cell.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1+
/* eslint-disable react/prop-types */
2+
/* eslint-disable jsx-a11y/no-static-element-interactions */
3+
/* eslint-disable jsx-a11y/click-events-have-key-events */
14
import React, { useRef, useEffect } from "react";
5+
// eslint-disable-next-line import/no-extraneous-dependencies
6+
import PropTypes from "prop-types";
27
import CodeMirror from "react-codemirror";
38
import { Remarkable } from "remarkable";
49

@@ -30,12 +35,14 @@ export default function Cell({
3035
}
3136
} else {
3237
const cellstate = { ...cell, input: refCode.current.value };
38+
// eslint-disable-next-line no-use-before-define
3339
showOutput();
3440
dispatch({ type: "CHANGE_CELL", payload: cellstate });
3541
}
3642
};
3743

3844
const setId = () => {
45+
// eslint-disable-next-line radix
3946
const id = currentCell || parseInt(cell.id.split("_")[1]);
4047
setCurrentCell(id);
4148
};
@@ -56,15 +63,18 @@ export default function Cell({
5663

5764
const upCell = (type) => {
5865
const id = cellId - 1;
66+
// eslint-disable-next-line no-use-before-define
5967
newCell(id, type);
6068
};
6169

6270
const downCell = (type) => {
6371
const id = cellId;
72+
// eslint-disable-next-line no-use-before-define
6473
newCell(id, type);
6574
};
6675

6776
const newCell = (id, type) => {
77+
// eslint-disable-next-line no-shadow
6878
const newCell = {
6979
id: `cell_${currentCell + 1}`,
7080
input: "",
@@ -97,7 +107,6 @@ export default function Cell({
97107
const deleteCell = () => {
98108
dispatch({ type: "DELETE_CELL", payload: cell.id });
99109
};
100-
101110
return (
102111
<>
103112
<button
@@ -169,3 +178,8 @@ export default function Cell({
169178
function TextCell({ refText }) {
170179
return <textarea ref={refText}></textarea>;
171180
}
181+
182+
TextCell.propTypes = {
183+
refText: PropTypes.element,
184+
id: PropTypes.string,
185+
};

src/__tests__/App.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { render, screen } from "@testing-library/react";
2+
import App from "../App";
3+
4+
test("App doesn't crash", () => {
5+
// eslint-disable-next-line react/react-in-jsx-scope
6+
const div = document.createElement("div");
7+
render(<App />, div);
8+
});

src/reducer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable import/prefer-default-export */
2+
// eslint-disable-next-line consistent-return
13
export const reducer = (state, action) => {
24
if (action.type === "CHANGE_CELL") {
35
const stateCells = state.cells.map((cell) => {
@@ -15,7 +17,6 @@ export const reducer = (state, action) => {
1517
if (action.type === "ADD_CELL") {
1618
const newCell = [...state.cells];
1719
newCell.splice(action.currentId, 0, action.payload);
18-
console.log(newCell);
1920
return {
2021
...state,
2122
cells: newCell,
@@ -34,7 +35,6 @@ export const reducer = (state, action) => {
3435
}
3536

3637
if (action.type === "LOAD_NOTE") {
37-
console.log("action payload", action.payload);
3838
return { ...state, cells: action.payload };
3939
}
4040
};

src/utils.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-plusplus */
12
export function print_val(val) {
23
/// Neeed refactoring. Lot of duplicated line of code
34
if (Array.isArray(val[0])) {
@@ -96,6 +97,7 @@ function table(df) {
9697
body += b_String;
9798
});
9899

100+
// eslint-disable-next-line no-shadow
99101
const table = `
100102
<div style="overflow: auto; max-height: 300px;"><table class="df-table" border="1">
101103
<thead>

yarn.lock

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2221,6 +2221,11 @@ ansi-escapes@^4.2.1, ansi-escapes@^4.3.1:
22212221
dependencies:
22222222
type-fest "^0.11.0"
22232223

2224+
ansi-font@0.0.2:
2225+
version "0.0.2"
2226+
resolved "https://registry.yarnpkg.com/ansi-font/-/ansi-font-0.0.2.tgz#890301bd5841462fd39c0b7709afd1f525143331"
2227+
integrity sha1-iQMBvVhBRi/TnAt3Ca/R9SUUMzE=
2228+
22242229
ansi-html@0.0.7, ansi-html@^0.0.7:
22252230
version "0.0.7"
22262231
resolved "https://registry.yarnpkg.com/ansi-html/-/ansi-html-0.0.7.tgz#813584021962a9e9e6fd039f940d12f56ca7859e"
@@ -10619,6 +10624,13 @@ test-exclude@^6.0.0:
1061910624
glob "^7.1.4"
1062010625
minimatch "^3.0.4"
1062110626

10627+
test@^0.6.0:
10628+
version "0.6.0"
10629+
resolved "https://registry.yarnpkg.com/test/-/test-0.6.0.tgz#5986ac445ec17754322512d104ba32c8a63e938e"
10630+
integrity sha1-WYasRF7Bd1QyJRLRBLoyyKY+k44=
10631+
dependencies:
10632+
ansi-font "0.0.2"
10633+
1062210634
text-table@0.2.0, text-table@^0.2.0:
1062310635
version "0.2.0"
1062410636
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"

0 commit comments

Comments
 (0)