Skip to content

Commit 621cb99

Browse files
authored
Merge pull request #2075 from nteract/dependencies
2 parents 40ae34b + f0eae86 commit 621cb99

27 files changed

+118
-131
lines changed

.eslintrc.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2-
"extends": "eslint-config-atomic",
2+
"extends": [
3+
"eslint-config-atomic",
4+
"plugin:you-dont-need-lodash-underscore/compatible"
5+
],
36
"ignorePatterns": ["dist/", "node_modules/"]
47
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ package-lock.json
1212

1313
# Build directories
1414
dist
15+
.parcel-cache/

lib/code-manager.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Point, Range, TextEditor } from "atom";
22
import escapeStringRegexp from "escape-string-regexp";
33
import stripIndent from "strip-indent";
4-
import _ from "lodash";
4+
import compact from "lodash/compact";
55
import {
66
log,
77
isMultilanguageGrammar,
@@ -92,7 +92,7 @@ export function removeCommentsMarkdownCell(
9292
const lines = text.split("\n");
9393
const editedLines = [];
9494

95-
_.forEach(lines, (line) => {
95+
lines.forEach((line) => {
9696
if (line.startsWith(commentStartString)) {
9797
// Remove comment from start of line
9898
editedLines.push(line.slice(commentStartString.length));
@@ -109,7 +109,7 @@ export function getSelectedText(editor: TextEditor) {
109109
export function isComment(editor: TextEditor, position: Point) {
110110
const scope = editor.scopeDescriptorForBufferPosition(position);
111111
const scopeString = scope.getScopeChain();
112-
return _.includes(scopeString, "comment.line");
112+
return scopeString.includes("comment.line");
113113
}
114114
export function isBlank(editor: TextEditor, row: number) {
115115
return editor.getBuffer().isRowBlank(row);
@@ -272,7 +272,7 @@ function isEmbeddedCode(
272272
const scopes = editor
273273
.scopeDescriptorForBufferPosition(new Point(row, 0))
274274
.getScopesArray();
275-
return _.includes(scopes, referenceScope);
275+
return scopes.includes(referenceScope);
276276
}
277277

278278
function getCurrentFencedCodeBlock(editor: TextEditor) {
@@ -323,8 +323,8 @@ export function getCellsForBreakPoints(
323323
start = new Point(match.range.start.row, 0);
324324
match.stop();
325325
});
326-
return _.compact(
327-
_.map(breakpoints, (end) => {
326+
return compact(
327+
breakpoints.map((end) => {
328328
const cell = end.isEqual(start) ? null : new Range(start, end);
329329
start = new Point(end.row + 1, 0);
330330
return cell;

lib/commands.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
import {
2-
log,
3-
reactFactory,
4-
INSPECTOR_URI,
5-
OUTPUT_AREA_URI,
6-
openOrShowDock,
7-
} from "./utils";
1+
import { log, INSPECTOR_URI, OUTPUT_AREA_URI, openOrShowDock } from "./utils";
82
import { getCodeToInspect } from "./code-manager";
93
import OutputPane from "./panes/output-area";
104
type store = typeof import("./store").default;

lib/components/kernel-monitor.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React from "react";
22
import ReactTable, { ReactTableDefaults } from "react-table";
33

44
import { observer } from "mobx-react";
5-
import _ from "lodash";
65
import tildify from "tildify";
76
type store = typeof import("../store").default;
87
import Kernel from "../kernel";
@@ -105,7 +104,7 @@ const KernelMonitor = observer(({ store }: { store: store }) => {
105104
);
106105
}
107106

108-
const data = _.map(store.runningKernels, (kernel, key: number) => {
107+
const data = store.runningKernels.map((kernel, key: number) => {
109108
return {
110109
gateway: kernel.transport.gatewayName || "Local",
111110
kernelInfo: {

lib/components/result-view/plotly.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @NOTE: This `PlotlyTransform` component could be used exactly same as the original `PlotlyTransform` component of @nteract/transform-plotly,
1010
* except that this file adds the ability to download a plot from an electron context.
1111
*/
12-
import { cloneDeep } from "lodash";
12+
import cloneDeep from "lodash/cloneDeep";
1313
import * as React from "react";
1414
interface Props {
1515
data: string | Record<string, any>;

lib/components/result-view/result-view.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class ResultViewComponent extends React.Component<Props> {
122122
userSelect: "text",
123123
};
124124

125-
if (outputs.length === 0 || this.props.showResult === false) {
125+
if (outputs.length === 0 || !this.props.showResult) {
126126
const kernel = this.props.kernel;
127127
return (
128128
<Status
@@ -220,8 +220,8 @@ class ResultViewComponent extends React.Component<Props> {
220220
scrollToBottom() {
221221
if (
222222
!this.el ||
223-
this.expanded === true ||
224-
this.props.store.isPlain === true ||
223+
this.expanded ||
224+
this.props.store.isPlain ||
225225
atom.config.get(`Hydrogen.autoScroll`) === false
226226
) {
227227
return;

lib/components/watch-sidebar/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import { CompositeDisposable } from "atom";
21
import React from "react";
32
import { observer } from "mobx-react";
43
import Watch from "./watch";
54
import { WATCHES_URI, EmptyMessage } from "../../utils";
6-
import type Kernel from "../../kernel";
75
type store = typeof import("../../store").default;
86
const Watches = observer(({ store: { kernel } }: { store: store }) => {
97
if (!kernel) {

lib/existing-kernel-picker.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Panel } from "atom";
2-
import SelectListView from "atom-select-list";
2+
import SelectListView, { SelectListProperties } from "atom-select-list";
33
import store from "./store";
4-
import _ from "lodash";
54
import tildify from "tildify";
65
import {
76
kernelSpecProvidesGrammar,
@@ -29,14 +28,14 @@ export default class ExistingKernelPicker {
2928
constructor() {
3029
this.selectListView = new SelectListView({
3130
itemsClassList: ["mark-active"],
32-
items: [],
33-
filterKeyForItem: (kernel) => getName(kernel),
34-
elementForItem: (kernel) => {
31+
items: [] as Kernel[],
32+
filterKeyForItem: (kernel: Kernel) => getName(kernel),
33+
elementForItem: (kernel: Kernel) => {
3534
const element = document.createElement("li");
3635
element.textContent = getName(kernel);
3736
return element;
3837
},
39-
didConfirmSelection: (kernel) => {
38+
didConfirmSelection: (kernel: Kernel) => {
4039
const { filePath, editor, grammar } = store;
4140
if (!filePath || !editor || !grammar) {
4241
return this.cancel();
@@ -86,7 +85,7 @@ export default class ExistingKernelPicker {
8685
items: store.runningKernels.filter((kernel) =>
8786
kernelSpecProvidesGrammar(kernel.kernelSpec, store.grammar)
8887
),
89-
});
88+
} as SelectListProperties);
9089
const markers = store.markers;
9190
if (markers) {
9291
markers.clear();

lib/import-notebook.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { TextEditor, Grammar } from "atom";
22
import * as path from "path";
33
import { promises } from "fs";
44
const { readFile } = promises;
5-
import _ from "lodash";
65
import type { HydrogenCellType } from "./hydrogen";
76

87
import { remote } from "electron";
@@ -42,7 +41,7 @@ export function ipynbOpener(uri: string) {
4241
*/
4342
export function importNotebook(event?: CustomEvent) {
4443
// Use selected filepath if called from tree-view context menu
45-
const filenameFromTreeView = _.get(event, "target.dataset.path");
44+
const filenameFromTreeView = event.target.dataset?.path;
4645

4746
if (filenameFromTreeView && path.extname(filenameFromTreeView) === ".ipynb") {
4847
return _loadNotebook(
@@ -265,8 +264,8 @@ function getGrammarForFileExtension(ext: string): Grammar | null | undefined {
265264
}
266265
ext = ext.startsWith(".") ? ext.slice(1) : ext;
267266
const grammars = atom.grammars.getGrammars();
268-
return _.find(grammars, (grammar) => {
269-
return _.includes(grammar.fileTypes, ext);
267+
return grammars.find((grammar) => {
268+
return grammar.fileTypes.includes(ext);
270269
});
271270
}
272271

0 commit comments

Comments
 (0)