Fix prettier related ESLint issues (#1493)

* add quotes

* add prettier dev-dep

* run prettier on src

* add eslint-prettier-plugin to install
This commit is contained in:
Severiano Badajoz
2020-05-26 09:33:59 -07:00
committed by GitHub
parent 4d100d4507
commit 271e7a1e76
16 changed files with 115 additions and 109 deletions
+2 -2
View File
@@ -4,7 +4,7 @@ on:
push: push:
branches: master branches: master
pull_request: pull_request:
branches: * branches: '*'
env: env:
JEST_ENV: prod JEST_ENV: prod
@@ -32,7 +32,7 @@ jobs:
run: | run: |
pip install flake8 pip install flake8
cd client cd client
npm i "eslint" "eslint-config-airbnb" "eslint-config-prettier" "eslint-loader" "eslint-plugin-filenames" "eslint-plugin-import" "eslint-plugin-jest" "eslint-plugin-jsx-a11y" "eslint-plugin-react" "eslint-plugin-react-hooks" npm i "eslint" "eslint-config-airbnb" "eslint-config-prettier" "eslint-loader" "eslint-plugin-filenames" "eslint-plugin-import" "eslint-plugin-jest" "eslint-plugin-jsx-a11y" "eslint-plugin-react" "eslint-plugin-react-hooks" "eslint-plugin-prettier"
- name: Lint with flake8 - name: Lint with flake8
run: | run: |
make lint-server make lint-server
+6
View File
@@ -14581,6 +14581,12 @@
"integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=",
"dev": true "dev": true
}, },
"prettier": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz",
"integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==",
"dev": true
},
"prettier-linter-helpers": { "prettier-linter-helpers": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz",
+1
View File
@@ -99,6 +99,7 @@
"lint-staged": "^10.2.4", "lint-staged": "^10.2.4",
"mini-css-extract-plugin": "^0.9.0", "mini-css-extract-plugin": "^0.9.0",
"optimize-css-assets-webpack-plugin": "^5.0.3", "optimize-css-assets-webpack-plugin": "^5.0.3",
"prettier": "^2.0.5",
"puppeteer": "^2.1.1", "puppeteer": "^2.1.1",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"serve-favicon": "^2.5.0", "serve-favicon": "^2.5.0",
+15 -17
View File
@@ -21,7 +21,6 @@ import actions from "../actions";
graphRenderCounter: state.controls.graphRenderCounter, graphRenderCounter: state.controls.graphRenderCounter,
})) }))
class App extends React.Component { class App extends React.Component {
componentDidMount() { componentDidMount() {
const { dispatch } = this.props; const { dispatch } = this.props;
@@ -68,22 +67,21 @@ class App extends React.Component {
error loading error loading
</div> </div>
) : null} ) : null}
{loading ? null : <Layout> {loading ? null : (
<LeftSideBar/> <Layout>
{viewportRef => <LeftSideBar />
<> {(viewportRef) => (
<MenuBar/> <>
<Autosave/> <MenuBar />
<TermsOfServicePrompt/> <Autosave />
<Legend viewportRef={viewportRef}/> <TermsOfServicePrompt />
<Graph <Legend viewportRef={viewportRef} />
key={graphRenderCounter} <Graph key={graphRenderCounter} viewportRef={viewportRef} />
viewportRef={viewportRef} </>
/> )}
</> <RightSideBar />
} </Layout>
<RightSideBar/> )}
</Layout>}
</Container> </Container>
); );
} }
@@ -105,10 +105,12 @@ const continuous = (selectorId, colorscale, colorAccessor) => {
colorScale: state.colors.scale, colorScale: state.colors.scale,
})) }))
class ContinuousLegend extends React.Component { class ContinuousLegend extends React.Component {
componentDidUpdate(prevProps) { componentDidUpdate(prevProps) {
const { colorAccessor, colorScale } = this.props; const { colorAccessor, colorScale } = this.props;
if (prevProps.colorAccessor !== colorAccessor || prevProps.colorScale !== colorScale) { if (
prevProps.colorAccessor !== colorAccessor ||
prevProps.colorScale !== colorScale
) {
/* always remove it, if it's not continuous we don't put it back. */ /* always remove it, if it's not continuous we don't put it back. */
d3.select("#continuous_legend").selectAll("*").remove(); d3.select("#continuous_legend").selectAll("*").remove();
} }
@@ -130,7 +132,9 @@ class ContinuousLegend extends React.Component {
return ( return (
<div <div
id="continuous_legend" id="continuous_legend"
ref={ref => {this.ref = ref}} ref={(ref) => {
this.ref = ref;
}}
style={{ style={{
display: colorAccessor ? "inherit" : "none", display: colorAccessor ? "inherit" : "none",
position: "absolute", position: "absolute",
+15 -13
View File
@@ -2,19 +2,21 @@
import React from "react"; import React from "react";
function Container(props) { function Container(props) {
const {children} = props; const { children } = props;
return <div return (
className="container" <div
style={{ className="container"
height: "calc(100vh - (100vh - 100%))", style={{
width: "calc(100vw - (100vw - 100%))", height: "calc(100vh - (100vh - 100%))",
position: "absolute", width: "calc(100vw - (100vw - 100%))",
top: 0, position: "absolute",
left: 0, top: 0,
}} left: 0,
> }}
{children} >
</div> {children}
</div>
);
} }
export default Container; export default Container;
+54 -50
View File
@@ -2,9 +2,7 @@
import React from "react"; import React from "react";
import * as globals from "../../globals"; import * as globals from "../../globals";
class Layout extends React.Component { class Layout extends React.Component {
/* /*
Layout - this react component contains all the layout style and logic for the application once it has loaded. Layout - this react component contains all the layout style and logic for the application once it has loaded.
@@ -26,60 +24,66 @@ class Layout extends React.Component {
render() { render() {
const { children } = this.props; const { children } = this.props;
const [ leftSidebar, renderGraph, rightSidebar ] = children; const [leftSidebar, renderGraph, rightSidebar] = children;
return <div return (
style={{ <div
display: "grid", style={{
gridTemplateColumns: ` display: "grid",
[left-sidebar-start] ${globals.leftSidebarWidth+1}px gridTemplateColumns: `
[left-sidebar-start] ${globals.leftSidebarWidth + 1}px
[left-sidebar-end graph-start] auto [left-sidebar-end graph-start] auto
[graph-end right-sidebar-start] ${globals.rightSidebarWidth+1}px [right-sidebar-end] [graph-end right-sidebar-start] ${
globals.rightSidebarWidth + 1
}px [right-sidebar-end]
`, `,
gridTemplateRows: "[top] auto [bottom]", gridTemplateRows: "[top] auto [bottom]",
gridTemplateAreas: "left-sidebar | graph | right-sidebar", gridTemplateAreas: "left-sidebar | graph | right-sidebar",
columnGap: "0px", columnGap: "0px",
justifyItems: "stretch", justifyItems: "stretch",
alignItems: "stretch", alignItems: "stretch",
height: "inherit",
width: "inherit",
position: "relative",
top: 0,
left: 0,
minWidth: "1240px",
}}
>
<div
style={{
gridArea: "top / left-sidebar-start / bottom / left-sidebar-end",
position: "relative",
height: "inherit", height: "inherit",
overflowY: "auto" width: "inherit",
position: "relative",
top: 0,
left: 0,
minWidth: "1240px",
}} }}
> >
{leftSidebar} <div
style={{
gridArea: "top / left-sidebar-start / bottom / left-sidebar-end",
position: "relative",
height: "inherit",
overflowY: "auto",
}}
>
{leftSidebar}
</div>
<div
style={{
zIndex: 0,
gridArea: "top / graph-start / bottom / graph-end",
position: "relative",
height: "inherit",
}}
ref={(ref) => {
this.viewportRef = ref;
}}
>
{this.viewportRef ? renderGraph(this.viewportRef) : null}
</div>
<div
style={{
gridArea: "top / right-sidebar-start / bottom / right-sidebar-end",
position: "relative",
height: "inherit",
overflowY: "auto",
}}
>
{rightSidebar}
</div>
</div> </div>
<div );
style={{
zIndex: 0,
gridArea: "top / graph-start / bottom / graph-end",
position: "relative",
height: "inherit",
}}
ref={ref => { this.viewportRef = ref; }}
>
{this.viewportRef ? renderGraph(this.viewportRef) : null}
</div>
<div
style={{
gridArea: "top / right-sidebar-start / bottom / right-sidebar-end",
position: "relative",
height: "inherit",
overflowY: "auto"
}}
>
{rightSidebar}
</div>
</div>;
} }
} }
@@ -14,7 +14,7 @@ export default (
handleDragAction, handleDragAction,
handleEndAction, handleEndAction,
handleCancelAction, handleCancelAction,
viewport, viewport
) => { ) => {
const svg = d3.select("#graph-wrapper").select("#lasso-layer"); const svg = d3.select("#graph-wrapper").select("#lasso-layer");
@@ -23,7 +23,7 @@ export default (
.brush() .brush()
.extent([ .extent([
[0, 0], [0, 0],
[viewport.width, viewport.height] [viewport.width, viewport.height],
]) ])
.on("start", handleStartAction) .on("start", handleStartAction)
.on("brush", handleDragAction) .on("brush", handleDragAction)
@@ -11,7 +11,6 @@ import TopLeftLogoAndTitle from "./topLeftLogoAndTitle";
scatterplotYYaccessor: state.controls.scatterplotYYaccessor, scatterplotYYaccessor: state.controls.scatterplotYYaccessor,
})) }))
class LeftSideBar extends React.Component { class LeftSideBar extends React.Component {
render() { render() {
const { scatterplotXXaccessor, scatterplotYYaccessor } = this.props; const { scatterplotXXaccessor, scatterplotYYaccessor } = this.props;
return ( return (
+1 -3
View File
@@ -35,9 +35,7 @@ function Clip(props) {
: ""; : "";
return ( return (
<div <div className={`bp3-button-group ${styles.menubarButton}`}>
className={`bp3-button-group ${styles.menubarButton}`}
>
<Popover <Popover
target={ target={
<Tooltip <Tooltip
+1 -3
View File
@@ -6,9 +6,7 @@ import styles from "./menubar.css";
function InformationMenu(props) { function InformationMenu(props) {
const { libraryVersions, aboutLink, tosURL, privacyURL } = props; const { libraryVersions, aboutLink, tosURL, privacyURL } = props;
return ( return (
<div <div className={`bp3-button-group ${styles.menubarButton}`}>
className={`bp3-button-group ${styles.menubarButton}`}
>
<Popover <Popover
content={ content={
<Menu> <Menu>
+3 -3
View File
@@ -1,4 +1,4 @@
:local(.menubarButton) { :local(.menubarButton) {
margin-top: 8px; margin-top: 8px;
margin-left: 8px; margin-left: 8px;
} }
+2 -4
View File
@@ -12,9 +12,7 @@ function Subset(props) {
} = props; } = props;
return ( return (
<ButtonGroup <ButtonGroup className={styles.menubarButton}>
className={styles.menubarButton}
>
<Tooltip <Tooltip
content="Subset to currently selected cells and associated metadata" content="Subset to currently selected cells and associated metadata"
position="bottom" position="bottom"
@@ -26,7 +24,7 @@ function Subset(props) {
disabled={!subsetPossible} disabled={!subsetPossible}
icon="pie-chart" icon="pie-chart"
onClick={handleSubset} onClick={handleSubset}
/> />
</Tooltip> </Tooltip>
<Tooltip <Tooltip
content="Undo subset and show all cells and associated metadata" content="Undo subset and show all cells and associated metadata"
+1 -3
View File
@@ -7,9 +7,7 @@ import styles from "./menubar.css";
function InformationMenu(props) { function InformationMenu(props) {
const { undoDisabled, redoDisabled, dispatch } = props; const { undoDisabled, redoDisabled, dispatch } = props;
return ( return (
<div <div className={`bp3-button-group ${styles.menubarButton}`}>
className={`bp3-button-group ${styles.menubarButton}`}
>
<Tooltip <Tooltip
content="Undo" content="Undo"
position="bottom" position="bottom"
+2 -3
View File
@@ -5,12 +5,11 @@ import Continuous from "../continuous/continuous";
import GeneExpression from "../geneExpression"; import GeneExpression from "../geneExpression";
import * as globals from "../../globals"; import * as globals from "../../globals";
@connect(state => ({ @connect((state) => ({
scatterplotXXaccessor: state.controls.scatterplotXXaccessor, scatterplotXXaccessor: state.controls.scatterplotXXaccessor,
scatterplotYYaccessor: state.controls.scatterplotYYaccessor, scatterplotYYaccessor: state.controls.scatterplotYYaccessor,
})) }))
class RightSidebar extends React.Component { class RightSidebar extends React.Component {
render() { render() {
return ( return (
<div <div
@@ -22,7 +21,7 @@ class RightSidebar extends React.Component {
position: "relative", position: "relative",
overflowY: "inherit", overflowY: "inherit",
height: "inherit", height: "inherit",
width: "inherit" width: "inherit",
}} }}
> >
<GeneExpression /> <GeneExpression />
@@ -203,8 +203,9 @@ export function pruneVarDataCache(varData, needed) {
export function subsetAndResetGeneLists(state) { export function subsetAndResetGeneLists(state) {
const { userDefinedGenes, diffexpGenes } = state; const { userDefinedGenes, diffexpGenes } = state;
const newUserDefinedGenes = _.uniq([].concat(userDefinedGenes, diffexpGenes)) const newUserDefinedGenes = _.uniq(
.slice(0, globals.maxGenes); [].concat(userDefinedGenes, diffexpGenes)
).slice(0, globals.maxGenes);
const newDiffExpGenes = []; const newDiffExpGenes = [];
return [newUserDefinedGenes, newDiffExpGenes]; return [newUserDefinedGenes, newDiffExpGenes];
} }