Skip to content

Commit

Permalink
style: fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
veksen committed Aug 19, 2019
1 parent 71557fa commit e7f1f07
Show file tree
Hide file tree
Showing 23 changed files with 55 additions and 51 deletions.
4 changes: 2 additions & 2 deletions scripts/buildHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ module.exports = {
const avatar = target ? target.avatar : this.getDefaultAvatar(hash)

return {
name,
hash,
avatar,
hash,
name,
}
},
resolveAuthors(users, authors) {
Expand Down
6 changes: 5 additions & 1 deletion scripts/fetchUsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,27 @@ const writeS = (content, dest) => {
}

client.once("ready", async () => {
// tslint:disable-next-line no-console
console.log("Bot ready, fetching user list...")
const tph = client.guilds.get(TPH)
if (!tph) {
throw Error("Bot is not in TPH, cannot fetch users")
}
const guild = await tph.fetchMembers()
const memberInfo = guild.members.map(member => ({
identifier: `${member.user.username}#${member.user.discriminator}`,
avatar: member.user.displayAvatarURL,
identifier: `${member.user.username}#${member.user.discriminator}`,
}))
const wrs = fs.createWriteStream(DESTINATION)
// tslint:disable-next-line no-console
console.log(`Fetched ${memberInfo.length} users, writing to ${DESTINATION}`)
writeS(memberInfo, wrs).on("finish", () => {
// tslint:disable-next-line no-console
console.log("Finished writing list")
process.exit(0)
})
})

// tslint:disable-next-line no-console
console.log("Attempting to log in...")
client.login(process.env.BOT_TOKEN)
8 changes: 4 additions & 4 deletions src/SidebarProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import React, { useState } from "react"

interface SidebarProviderProps {
interface ISidebarProviderProps {
children: React.ReactNode
}

export interface SidebarContextInterface {
export interface ISidebarContextInterface {
current: number
setCurrent: (index: number) => void
}

export const SidebarContext = React.createContext<SidebarContextInterface | null>(
export const SidebarContext = React.createContext<ISidebarContextInterface | null>(
null
)

export function SidebarProvider({
children,
}: SidebarProviderProps): JSX.Element {
}: ISidebarProviderProps): JSX.Element {
const [current, setCurrent] = useState(0)

function selectFirstLevel(index: number) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Footer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"
import * as SC from "./styles"
import { Container } from "../Container"
import * as SC from "./styles"

export function Footer() {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Link } from "gatsby"
import React, { PropsWithChildren } from "react"
import { Container } from "../Container"
import logo from "../../images/tph-logo.png"
import { Container } from "../Container"
import * as SC from "./styles"

function MenuItem({ children, to }: PropsWithChildren<{ to: string }>) {
Expand Down
8 changes: 4 additions & 4 deletions src/components/Layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
* See: https://www.gatsbyjs.org/docs/use-static-query/
*/

import { graphql, useStaticQuery } from "gatsby"
import React, { PropsWithChildren } from "react"
import { useStaticQuery, graphql } from "gatsby"

import Scrollbar from "react-perfect-scrollbar"
import "react-perfect-scrollbar/dist/css/styles.css"
import { GlobalStyles } from "../../globalStyles"
import { Container } from "../Container"
import { Footer } from "../Footer"
import { Header } from "../Header"
import { GlobalStyles } from "../../globalStyles"
import * as SC from "./styles"
import Scrollbar from "react-perfect-scrollbar"
import "react-perfect-scrollbar/dist/css/styles.css"

export function Layout({ children }: PropsWithChildren<{}>) {
const data = useStaticQuery(graphql`
Expand Down
8 changes: 4 additions & 4 deletions src/components/Markdown/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from "react"
import * as SC from "./styles"
import Prism from "prismjs"
import "prismjs/components/prism-python"
import "prismjs/components/prism-markup-templating"
import "prismjs/components/prism-php"
import "prismjs/components/prism-python"
import "prismjs/plugins/line-numbers/prism-line-numbers.css"
import React from "react"
import * as SC from "./styles"

interface MarkdownProps {
interface IMarkdownProps {
content: string
}

Expand Down
6 changes: 3 additions & 3 deletions src/components/ResourceBreadcrumb/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from "react"

import { IFileOrFolder } from "../ResourcesSidebar/index"
import ChevronUp from "../../icons/chevron-up.svg"
import { traversePaths } from "../../utils"
import { IFileOrFolder } from "../ResourcesSidebar/index"
import * as SC from "./styles"

interface ResourceBreadcrumbProps {
interface IResourceBreadcrumbProps {
relativePath: any
}

Expand All @@ -24,7 +24,7 @@ function flatten([
return flatten([...currNode.children, ...previousNodes, currNode])
}

export function ResourceBreadcrumb({ relativePath }: ResourceBreadcrumbProps) {
export function ResourceBreadcrumb({ relativePath }: IResourceBreadcrumbProps) {
const paths = relativePath.split("/")
const breadcrumbItems = flatten([traversePaths(paths)])

Expand Down
2 changes: 1 addition & 1 deletion src/components/ResourceBreadcrumb/styles.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled from "styled-components"
import { Link } from "gatsby"
import styled from "styled-components"

export const ResourceBreadcrumbWrapper = styled.div`
display: flex;
Expand Down
4 changes: 2 additions & 2 deletions src/components/ResourceHeader/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { Fragment } from "react"

import { StackedAvatars } from "../StackedAvatars"
import ChevronUp from "../../icons/chevron-up.svg"
import { ResourceBreadcrumb } from "../ResourceBreadcrumb"
import { StackedAvatars } from "../StackedAvatars"
import * as SC from "./styles"

interface ResourceHeaderProps {
interface IResourceHeaderProps {
relativePath: any
title: any
authors: any
Expand Down
2 changes: 1 addition & 1 deletion src/components/ResourceHeader/styles.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled, { css } from "styled-components"
import { Link } from "gatsby"
import styled, { css } from "styled-components"
import { fontFamily, modularScale } from "../../design/typography"

export const ResourceHeaderWrapper = styled.div`
Expand Down
2 changes: 1 addition & 1 deletion src/components/ResourcesLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import React, { PropsWithChildren } from "react"

import { GlobalStyles } from "../../globalStyles"
import { SidebarProvider } from "../../SidebarProvider"
import { ResourcesSidebar } from "../ResourcesSidebar"
import * as SC from "./styles"
import { SidebarProvider } from "../../SidebarProvider"

export function ResourcesLayout({ children }: PropsWithChildren<{}>) {
return (
Expand Down
10 changes: 5 additions & 5 deletions src/components/ResourcesSidebar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useState, PropsWithChildren } from "react"
import { useStaticQuery, graphql, Link } from "gatsby"
import useBuildTree from "./useBuildTree"
import useSidebar from "./../../hooks/useSidebar"
import Banner from "../../images/tph-banner.svg"
import { graphql, Link, useStaticQuery } from "gatsby"
import React, { PropsWithChildren, useState } from "react"
import TriangleDown from "../../icons/triangle-down.svg"
import Banner from "../../images/tph-banner.svg"
import useSidebar from "./../../hooks/useSidebar"
import * as SC from "./styles"
import useBuildTree from "./useBuildTree"

export interface IFile {
title: string
Expand Down
2 changes: 1 addition & 1 deletion src/components/ResourcesSidebar/styles.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled from "styled-components"
import { Link } from "gatsby"
import styled from "styled-components"
import ChevronUp from "../../icons/chevron-up.svg"

export const ResourcesSidebarWrapper = styled.div`
Expand Down
10 changes: 5 additions & 5 deletions src/components/ResourcesSidebar/useBuildTree.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import partition from "ramda/es/partition"
import chain from "ramda/es/chain"
import partition from "ramda/es/partition"

import { traversePaths } from "../../utils"
import {
IFileOrFolder,
IFile,
IFolder,
IAllResourcesQuery,
IFile,
IFileOrFolder,
IFileQuery,
IFolder,
} from "./index"

function generateFolder({
Expand Down Expand Up @@ -44,7 +44,7 @@ function generateFile({
}

function join([head, ...tail]: IFileOrFolder[]): IFileOrFolder[] {
if (!head) return []
if (!head) { return [] }

const [similarFs, remaining] = partition(
obj => obj.title === head.title && obj.type === head.type,
Expand Down
4 changes: 2 additions & 2 deletions src/components/ResourcesSidebarSection/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React, { PropsWithChildren } from "react"
import * as SC from "./styles"

export interface ResourcesSidebarSectionProps {
export interface IResourcesSidebarSectionProps {
readonly title: string
}

export function ResourcesSidebarSection({
title,
children,
}: PropsWithChildren<ResourcesSidebarSectionProps>) {
}: PropsWithChildren<IResourcesSidebarSectionProps>) {
return (
<div>
<SC.SidebarTitle>{title}</SC.SidebarTitle>
Expand Down
6 changes: 3 additions & 3 deletions src/components/SEO/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { graphql, useStaticQuery } from "gatsby"
import React from "react"
import Helmet from "react-helmet"
import { useStaticQuery, graphql } from "gatsby"

interface SEOProps {
interface ISEOProps {
readonly description?: string
readonly lang?: string
readonly meta?: any[]
Expand All @@ -16,7 +16,7 @@ export function SEO({
meta = [],
keywords = [],
title,
}: SEOProps) {
}: ISEOProps) {
const { site } = useStaticQuery(
graphql`
query {
Expand Down
4 changes: 2 additions & 2 deletions src/components/StackedAvatars/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import React from "react"

import * as SC from "./styles"

interface StackedAvatarsProps {
interface IStackedAvatarsProps {
authors: any
}

export function StackedAvatars({ authors }: StackedAvatarsProps) {
export function StackedAvatars({ authors }: IStackedAvatarsProps) {
return (
<SC.StackedAvatarsWrapper count={authors.length}>
{authors.map((author, index) => (
Expand Down
4 changes: 2 additions & 2 deletions src/pages/about.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Fragment } from "react"
import { graphql } from "gatsby"
import { Markdown } from "../components/Markdown"
import React, { Fragment } from "react"
import { MarkdownRemark, Query } from "../../generated/graphql"
import { Markdown } from "../components/Markdown"
import { SEO } from "../components/SEO"

function AboutPage({ data }: ComponentQuery<{ md: MarkdownRemark }>) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Fragment } from "react"
import { Link } from "gatsby"
import React, { Fragment } from "react"

import { SEO } from "../components/SEO"

Expand Down
4 changes: 2 additions & 2 deletions src/pages/rules.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Fragment } from "react"
import { graphql } from "gatsby"
import { Markdown } from "../components/Markdown"
import React, { Fragment } from "react"
import { MarkdownRemark, Query } from "../../generated/graphql"
import { Markdown } from "../components/Markdown"
import { SEO } from "../components/SEO"

function RulesPage({ data }: ComponentQuery<{ md: MarkdownRemark }>) {
Expand Down
4 changes: 2 additions & 2 deletions src/templates/languagePost.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { Fragment } from "react"
import { graphql } from "gatsby"
import React, { Fragment } from "react"
import { Markdown } from "../components/Markdown"
import { SEO } from "../components/SEO"
import { ResourceHeader } from "../components/ResourceHeader"
import { SEO } from "../components/SEO"

// @todo maybe find alternative type for data
function LanguagePost({ data }: any) {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { IFileOrFolder } from "../components/ResourcesSidebar/index"

export function traversePaths(
[head, ...tail]: string[],
basePath = "/resources"
basePath: string = "/resources"
): IFileOrFolder {
const path = basePath + "/" + head
const isFile = !tail.length
Expand Down

0 comments on commit e7f1f07

Please sign in to comment.