From 9be5597f4b27f2dc17a7b067034e3d2612fda395 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Mon, 22 Jun 2020 21:29:21 -0700 Subject: [PATCH] chore: Lint shared directory --- .../Sidebar/components/SidebarLink.js | 2 +- package.json | 2 +- shared/components/Branding.js | 6 +- shared/components/Breadcrumb.js | 34 ++-- shared/components/BreadcrumbMenu.js | 6 +- shared/components/Flex.js | 30 +-- shared/components/GithubLogo.js | 4 +- shared/components/GoogleLogo.js | 4 +- shared/components/Notice.js | 4 +- shared/components/OutlineLogo.js | 4 +- shared/components/SlackLogo.js | 4 +- shared/components/TeamLogo.js | 2 +- shared/components/Time.js | 10 +- shared/styles/animations.js | 2 +- shared/styles/globals.js | 4 +- shared/styles/theme.js | 118 +++++------ shared/utils/domains.js | 140 ++++++------- shared/utils/domains.test.js | 188 +++++++++--------- shared/utils/getQueryVariable.js | 11 +- shared/utils/naturalSort.js | 8 +- shared/utils/parseDocumentIds.js | 10 +- shared/utils/parseDocumentIds.test.js | 16 +- shared/utils/parseTitle.js | 8 +- shared/utils/parseTitle.test.js | 28 +-- shared/utils/routeHelpers.js | 30 +-- shared/utils/slugify.js | 4 +- shared/utils/unescape.js | 4 +- 27 files changed, 342 insertions(+), 341 deletions(-) diff --git a/app/components/Sidebar/components/SidebarLink.js b/app/components/Sidebar/components/SidebarLink.js index dd969513b..346544007 100644 --- a/app/components/Sidebar/components/SidebarLink.js +++ b/app/components/Sidebar/components/SidebarLink.js @@ -142,7 +142,7 @@ const StyledNavLink = styled(NavLink)` &:focus { color: ${props => props.theme.text}; - background: ${props => props.theme.sidebarItemBackground}; + background: ${props => props.theme.black05}; outline: none; } diff --git a/package.json b/package.json index de9e76d40..b47a227e2 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "build": "npm run clean && npm run build:webpack", "start": "NODE_ENV=production node index.js", "dev": "NODE_ENV=development nodemon --watch server index.js", - "lint": "eslint app server", + "lint": "eslint app server shared", "flow": "flow", "deploy": "git push heroku master", "heroku-postbuild": "npm run build && npm run sequelize:migrate", diff --git a/shared/components/Branding.js b/shared/components/Branding.js index 59b331eba..610d7c7e0 100644 --- a/shared/components/Branding.js +++ b/shared/components/Branding.js @@ -1,7 +1,7 @@ // @flow -import * as React from 'react'; -import styled from 'styled-components'; -import OutlineLogo from './OutlineLogo'; +import * as React from "react"; +import styled from "styled-components"; +import OutlineLogo from "./OutlineLogo"; type Props = { href?: string, diff --git a/shared/components/Breadcrumb.js b/shared/components/Breadcrumb.js index 5696a1844..baae01d77 100644 --- a/shared/components/Breadcrumb.js +++ b/shared/components/Breadcrumb.js @@ -1,17 +1,17 @@ // @flow -import * as React from 'react'; -import { observer, inject } from 'mobx-react'; -import breakpoint from 'styled-components-breakpoint'; -import styled from 'styled-components'; -import { Link } from 'react-router-dom'; -import { PadlockIcon, GoToIcon, MoreIcon } from 'outline-icons'; +import * as React from "react"; +import { observer, inject } from "mobx-react"; +import breakpoint from "styled-components-breakpoint"; +import styled from "styled-components"; +import { Link } from "react-router-dom"; +import { PadlockIcon, GoToIcon, MoreIcon } from "outline-icons"; -import Document from 'models/Document'; -import CollectionsStore from 'stores/CollectionsStore'; -import { collectionUrl } from 'utils/routeHelpers'; -import Flex from 'shared/components/Flex'; -import BreadcrumbMenu from './BreadcrumbMenu'; -import CollectionIcon from 'components/CollectionIcon'; +import Document from "models/Document"; +import CollectionsStore from "stores/CollectionsStore"; +import { collectionUrl } from "utils/routeHelpers"; +import Flex from "shared/components/Flex"; +import BreadcrumbMenu from "./BreadcrumbMenu"; +import CollectionIcon from "components/CollectionIcon"; type Props = { document: Document, @@ -30,7 +30,7 @@ const Breadcrumb = observer(({ document, collections, onlyText }: Props) => { {collection.private && ( - {' '} + {" "} )} {collection.name} @@ -51,7 +51,7 @@ const Breadcrumb = observer(({ document, collections, onlyText }: Props) => { return ( - {' '} + {" "} {collection.name} {isNestedDocument && ( @@ -61,7 +61,7 @@ const Breadcrumb = observer(({ document, collections, onlyText }: Props) => { )} {lastPath && ( - {' '} + {" "} {lastPath.title} @@ -74,7 +74,7 @@ const Breadcrumb = observer(({ document, collections, onlyText }: Props) => { const Wrapper = styled(Flex)` display: none; - ${breakpoint('tablet')` + ${breakpoint("tablet")` display: flex; `}; `; @@ -130,4 +130,4 @@ const CollectionName = styled(Link)` overflow: hidden; `; -export default inject('collections')(Breadcrumb); +export default inject("collections")(Breadcrumb); diff --git a/shared/components/BreadcrumbMenu.js b/shared/components/BreadcrumbMenu.js index be2c61123..18aacf2ac 100644 --- a/shared/components/BreadcrumbMenu.js +++ b/shared/components/BreadcrumbMenu.js @@ -1,7 +1,7 @@ // @flow -import * as React from 'react'; -import { Link } from 'react-router-dom'; -import { DropdownMenu, DropdownMenuItem } from 'components/DropdownMenu'; +import * as React from "react"; +import { Link } from "react-router-dom"; +import { DropdownMenu, DropdownMenuItem } from "components/DropdownMenu"; type Props = { label: React.Node, diff --git a/shared/components/Flex.js b/shared/components/Flex.js index 9c0d22624..cb9d7967f 100644 --- a/shared/components/Flex.js +++ b/shared/components/Flex.js @@ -1,20 +1,20 @@ // @flow -import * as React from 'react'; -import styled from 'styled-components'; +import * as React from "react"; +import styled from "styled-components"; type JustifyValues = - | 'center' - | 'space-around' - | 'space-between' - | 'flex-start' - | 'flex-end'; + | "center" + | "space-around" + | "space-between" + | "flex-start" + | "flex-end"; type AlignValues = - | 'stretch' - | 'center' - | 'baseline' - | 'flex-start' - | 'flex-end'; + | "stretch" + | "center" + | "baseline" + | "flex-start" + | "flex-end"; type Props = { column?: ?boolean, @@ -33,11 +33,11 @@ const Flex = (props: Props) => { const Container = styled.div` display: flex; - flex: ${({ auto }) => (auto ? '1 1 auto' : 'initial')}; - flex-direction: ${({ column }) => (column ? 'column' : 'row')}; + flex: ${({ auto }) => (auto ? "1 1 auto" : "initial")}; + flex-direction: ${({ column }) => (column ? "column" : "row")}; align-items: ${({ align }) => align}; justify-content: ${({ justify }) => justify}; - flex-shrink: ${({ shrink }) => (shrink ? 1 : 'initial')}; + flex-shrink: ${({ shrink }) => (shrink ? 1 : "initial")}; min-height: 0; min-width: 0; `; diff --git a/shared/components/GithubLogo.js b/shared/components/GithubLogo.js index 47c8d23cd..7b63aaf6e 100644 --- a/shared/components/GithubLogo.js +++ b/shared/components/GithubLogo.js @@ -1,5 +1,5 @@ // @flow -import * as React from 'react'; +import * as React from "react"; type Props = { size?: number, @@ -7,7 +7,7 @@ type Props = { className?: string, }; -function GithubLogo({ size = 34, fill = '#FFF', className }: Props) { +function GithubLogo({ size = 34, fill = "#FFF", className }: Props) { return ( props.muted ? props.theme.sidebarBackground : props.theme.yellow}; color: ${props => - props.muted ? props.theme.sidebarText : 'hsla(46, 100%, 20%, 1)'}; + props.muted ? props.theme.sidebarText : "hsla(46, 100%, 20%, 1)"}; padding: 10px 12px; border-radius: 4px; `; diff --git a/shared/components/OutlineLogo.js b/shared/components/OutlineLogo.js index c35510f11..79602477b 100644 --- a/shared/components/OutlineLogo.js +++ b/shared/components/OutlineLogo.js @@ -1,5 +1,5 @@ // @flow -import * as React from 'react'; +import * as React from "react"; type Props = { size?: number, @@ -7,7 +7,7 @@ type Props = { className?: string, }; -function OutlineLogo({ size = 32, fill = '#333', className }: Props) { +function OutlineLogo({ size = 32, fill = "#333", className }: Props) { return ( { render() { return (