style: fix lint issues

This commit is contained in:
Jean-Philippe Sirois
2019-08-18 23:58:11 -04:00
parent 71557fa75b
commit e7f1f0728a
23 changed files with 55 additions and 51 deletions
+2 -2
View File
@@ -33,9 +33,9 @@ module.exports = {
const avatar = target ? target.avatar : this.getDefaultAvatar(hash) const avatar = target ? target.avatar : this.getDefaultAvatar(hash)
return { return {
name,
hash,
avatar, avatar,
hash,
name,
} }
}, },
resolveAuthors(users, authors) { resolveAuthors(users, authors) {
+5 -1
View File
@@ -22,6 +22,7 @@ const writeS = (content, dest) => {
} }
client.once("ready", async () => { client.once("ready", async () => {
// tslint:disable-next-line no-console
console.log("Bot ready, fetching user list...") console.log("Bot ready, fetching user list...")
const tph = client.guilds.get(TPH) const tph = client.guilds.get(TPH)
if (!tph) { if (!tph) {
@@ -29,16 +30,19 @@ client.once("ready", async () => {
} }
const guild = await tph.fetchMembers() const guild = await tph.fetchMembers()
const memberInfo = guild.members.map(member => ({ const memberInfo = guild.members.map(member => ({
identifier: `${member.user.username}#${member.user.discriminator}`,
avatar: member.user.displayAvatarURL, avatar: member.user.displayAvatarURL,
identifier: `${member.user.username}#${member.user.discriminator}`,
})) }))
const wrs = fs.createWriteStream(DESTINATION) const wrs = fs.createWriteStream(DESTINATION)
// tslint:disable-next-line no-console
console.log(`Fetched ${memberInfo.length} users, writing to ${DESTINATION}`) console.log(`Fetched ${memberInfo.length} users, writing to ${DESTINATION}`)
writeS(memberInfo, wrs).on("finish", () => { writeS(memberInfo, wrs).on("finish", () => {
// tslint:disable-next-line no-console
console.log("Finished writing list") console.log("Finished writing list")
process.exit(0) process.exit(0)
}) })
}) })
// tslint:disable-next-line no-console
console.log("Attempting to log in...") console.log("Attempting to log in...")
client.login(process.env.BOT_TOKEN) client.login(process.env.BOT_TOKEN)
+4 -4
View File
@@ -1,21 +1,21 @@
import React, { useState } from "react" import React, { useState } from "react"
interface SidebarProviderProps { interface ISidebarProviderProps {
children: React.ReactNode children: React.ReactNode
} }
export interface SidebarContextInterface { export interface ISidebarContextInterface {
current: number current: number
setCurrent: (index: number) => void setCurrent: (index: number) => void
} }
export const SidebarContext = React.createContext<SidebarContextInterface | null>( export const SidebarContext = React.createContext<ISidebarContextInterface | null>(
null null
) )
export function SidebarProvider({ export function SidebarProvider({
children, children,
}: SidebarProviderProps): JSX.Element { }: ISidebarProviderProps): JSX.Element {
const [current, setCurrent] = useState(0) const [current, setCurrent] = useState(0)
function selectFirstLevel(index: number) { function selectFirstLevel(index: number) {
+1 -1
View File
@@ -1,6 +1,6 @@
import React from "react" import React from "react"
import * as SC from "./styles"
import { Container } from "../Container" import { Container } from "../Container"
import * as SC from "./styles"
export function Footer() { export function Footer() {
return ( return (
+1 -1
View File
@@ -1,7 +1,7 @@
import { Link } from "gatsby" import { Link } from "gatsby"
import React, { PropsWithChildren } from "react" import React, { PropsWithChildren } from "react"
import { Container } from "../Container"
import logo from "../../images/tph-logo.png" import logo from "../../images/tph-logo.png"
import { Container } from "../Container"
import * as SC from "./styles" import * as SC from "./styles"
function MenuItem({ children, to }: PropsWithChildren<{ to: string }>) { function MenuItem({ children, to }: PropsWithChildren<{ to: string }>) {
+4 -4
View File
@@ -5,16 +5,16 @@
* See: https://www.gatsbyjs.org/docs/use-static-query/ * See: https://www.gatsbyjs.org/docs/use-static-query/
*/ */
import { graphql, useStaticQuery } from "gatsby"
import React, { PropsWithChildren } from "react" 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 { Container } from "../Container"
import { Footer } from "../Footer" import { Footer } from "../Footer"
import { Header } from "../Header" import { Header } from "../Header"
import { GlobalStyles } from "../../globalStyles"
import * as SC from "./styles" import * as SC from "./styles"
import Scrollbar from "react-perfect-scrollbar"
import "react-perfect-scrollbar/dist/css/styles.css"
export function Layout({ children }: PropsWithChildren<{}>) { export function Layout({ children }: PropsWithChildren<{}>) {
const data = useStaticQuery(graphql` const data = useStaticQuery(graphql`
+4 -4
View File
@@ -1,12 +1,12 @@
import React from "react"
import * as SC from "./styles"
import Prism from "prismjs" import Prism from "prismjs"
import "prismjs/components/prism-python"
import "prismjs/components/prism-markup-templating" import "prismjs/components/prism-markup-templating"
import "prismjs/components/prism-php" import "prismjs/components/prism-php"
import "prismjs/components/prism-python"
import "prismjs/plugins/line-numbers/prism-line-numbers.css" import "prismjs/plugins/line-numbers/prism-line-numbers.css"
import React from "react"
import * as SC from "./styles"
interface MarkdownProps { interface IMarkdownProps {
content: string content: string
} }
+3 -3
View File
@@ -1,11 +1,11 @@
import React from "react" import React from "react"
import { IFileOrFolder } from "../ResourcesSidebar/index"
import ChevronUp from "../../icons/chevron-up.svg" import ChevronUp from "../../icons/chevron-up.svg"
import { traversePaths } from "../../utils" import { traversePaths } from "../../utils"
import { IFileOrFolder } from "../ResourcesSidebar/index"
import * as SC from "./styles" import * as SC from "./styles"
interface ResourceBreadcrumbProps { interface IResourceBreadcrumbProps {
relativePath: any relativePath: any
} }
@@ -24,7 +24,7 @@ function flatten([
return flatten([...currNode.children, ...previousNodes, currNode]) return flatten([...currNode.children, ...previousNodes, currNode])
} }
export function ResourceBreadcrumb({ relativePath }: ResourceBreadcrumbProps) { export function ResourceBreadcrumb({ relativePath }: IResourceBreadcrumbProps) {
const paths = relativePath.split("/") const paths = relativePath.split("/")
const breadcrumbItems = flatten([traversePaths(paths)]) const breadcrumbItems = flatten([traversePaths(paths)])
+1 -1
View File
@@ -1,5 +1,5 @@
import styled from "styled-components"
import { Link } from "gatsby" import { Link } from "gatsby"
import styled from "styled-components"
export const ResourceBreadcrumbWrapper = styled.div` export const ResourceBreadcrumbWrapper = styled.div`
display: flex; display: flex;
+2 -2
View File
@@ -1,11 +1,11 @@
import React, { Fragment } from "react" import React, { Fragment } from "react"
import { StackedAvatars } from "../StackedAvatars"
import ChevronUp from "../../icons/chevron-up.svg" import ChevronUp from "../../icons/chevron-up.svg"
import { ResourceBreadcrumb } from "../ResourceBreadcrumb" import { ResourceBreadcrumb } from "../ResourceBreadcrumb"
import { StackedAvatars } from "../StackedAvatars"
import * as SC from "./styles" import * as SC from "./styles"
interface ResourceHeaderProps { interface IResourceHeaderProps {
relativePath: any relativePath: any
title: any title: any
authors: any authors: any
+1 -1
View File
@@ -1,5 +1,5 @@
import styled, { css } from "styled-components"
import { Link } from "gatsby" import { Link } from "gatsby"
import styled, { css } from "styled-components"
import { fontFamily, modularScale } from "../../design/typography" import { fontFamily, modularScale } from "../../design/typography"
export const ResourceHeaderWrapper = styled.div` export const ResourceHeaderWrapper = styled.div`
+1 -1
View File
@@ -8,9 +8,9 @@
import React, { PropsWithChildren } from "react" import React, { PropsWithChildren } from "react"
import { GlobalStyles } from "../../globalStyles" import { GlobalStyles } from "../../globalStyles"
import { SidebarProvider } from "../../SidebarProvider"
import { ResourcesSidebar } from "../ResourcesSidebar" import { ResourcesSidebar } from "../ResourcesSidebar"
import * as SC from "./styles" import * as SC from "./styles"
import { SidebarProvider } from "../../SidebarProvider"
export function ResourcesLayout({ children }: PropsWithChildren<{}>) { export function ResourcesLayout({ children }: PropsWithChildren<{}>) {
return ( return (
+5 -5
View File
@@ -1,10 +1,10 @@
import React, { useState, PropsWithChildren } from "react" import { graphql, Link, useStaticQuery } from "gatsby"
import { useStaticQuery, graphql, Link } from "gatsby" import React, { PropsWithChildren, useState } from "react"
import useBuildTree from "./useBuildTree"
import useSidebar from "./../../hooks/useSidebar"
import Banner from "../../images/tph-banner.svg"
import TriangleDown from "../../icons/triangle-down.svg" 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 * as SC from "./styles"
import useBuildTree from "./useBuildTree"
export interface IFile { export interface IFile {
title: string title: string
+1 -1
View File
@@ -1,5 +1,5 @@
import styled from "styled-components"
import { Link } from "gatsby" import { Link } from "gatsby"
import styled from "styled-components"
import ChevronUp from "../../icons/chevron-up.svg" import ChevronUp from "../../icons/chevron-up.svg"
export const ResourcesSidebarWrapper = styled.div` export const ResourcesSidebarWrapper = styled.div`
@@ -1,13 +1,13 @@
import partition from "ramda/es/partition"
import chain from "ramda/es/chain" import chain from "ramda/es/chain"
import partition from "ramda/es/partition"
import { traversePaths } from "../../utils" import { traversePaths } from "../../utils"
import { import {
IFileOrFolder,
IFile,
IFolder,
IAllResourcesQuery, IAllResourcesQuery,
IFile,
IFileOrFolder,
IFileQuery, IFileQuery,
IFolder,
} from "./index" } from "./index"
function generateFolder({ function generateFolder({
@@ -44,7 +44,7 @@ function generateFile({
} }
function join([head, ...tail]: IFileOrFolder[]): IFileOrFolder[] { function join([head, ...tail]: IFileOrFolder[]): IFileOrFolder[] {
if (!head) return [] if (!head) { return [] }
const [similarFs, remaining] = partition( const [similarFs, remaining] = partition(
obj => obj.title === head.title && obj.type === head.type, obj => obj.title === head.title && obj.type === head.type,
@@ -1,14 +1,14 @@
import React, { PropsWithChildren } from "react" import React, { PropsWithChildren } from "react"
import * as SC from "./styles" import * as SC from "./styles"
export interface ResourcesSidebarSectionProps { export interface IResourcesSidebarSectionProps {
readonly title: string readonly title: string
} }
export function ResourcesSidebarSection({ export function ResourcesSidebarSection({
title, title,
children, children,
}: PropsWithChildren<ResourcesSidebarSectionProps>) { }: PropsWithChildren<IResourcesSidebarSectionProps>) {
return ( return (
<div> <div>
<SC.SidebarTitle>{title}</SC.SidebarTitle> <SC.SidebarTitle>{title}</SC.SidebarTitle>
+3 -3
View File
@@ -1,8 +1,8 @@
import { graphql, useStaticQuery } from "gatsby"
import React from "react" import React from "react"
import Helmet from "react-helmet" import Helmet from "react-helmet"
import { useStaticQuery, graphql } from "gatsby"
interface SEOProps { interface ISEOProps {
readonly description?: string readonly description?: string
readonly lang?: string readonly lang?: string
readonly meta?: any[] readonly meta?: any[]
@@ -16,7 +16,7 @@ export function SEO({
meta = [], meta = [],
keywords = [], keywords = [],
title, title,
}: SEOProps) { }: ISEOProps) {
const { site } = useStaticQuery( const { site } = useStaticQuery(
graphql` graphql`
query { query {
+2 -2
View File
@@ -2,11 +2,11 @@ import React from "react"
import * as SC from "./styles" import * as SC from "./styles"
interface StackedAvatarsProps { interface IStackedAvatarsProps {
authors: any authors: any
} }
export function StackedAvatars({ authors }: StackedAvatarsProps) { export function StackedAvatars({ authors }: IStackedAvatarsProps) {
return ( return (
<SC.StackedAvatarsWrapper count={authors.length}> <SC.StackedAvatarsWrapper count={authors.length}>
{authors.map((author, index) => ( {authors.map((author, index) => (
+2 -2
View File
@@ -1,7 +1,7 @@
import React, { Fragment } from "react"
import { graphql } from "gatsby" import { graphql } from "gatsby"
import { Markdown } from "../components/Markdown" import React, { Fragment } from "react"
import { MarkdownRemark, Query } from "../../generated/graphql" import { MarkdownRemark, Query } from "../../generated/graphql"
import { Markdown } from "../components/Markdown"
import { SEO } from "../components/SEO" import { SEO } from "../components/SEO"
function AboutPage({ data }: ComponentQuery<{ md: MarkdownRemark }>) { function AboutPage({ data }: ComponentQuery<{ md: MarkdownRemark }>) {
+1 -1
View File
@@ -1,5 +1,5 @@
import React, { Fragment } from "react"
import { Link } from "gatsby" import { Link } from "gatsby"
import React, { Fragment } from "react"
import { SEO } from "../components/SEO" import { SEO } from "../components/SEO"
+2 -2
View File
@@ -1,7 +1,7 @@
import React, { Fragment } from "react"
import { graphql } from "gatsby" import { graphql } from "gatsby"
import { Markdown } from "../components/Markdown" import React, { Fragment } from "react"
import { MarkdownRemark, Query } from "../../generated/graphql" import { MarkdownRemark, Query } from "../../generated/graphql"
import { Markdown } from "../components/Markdown"
import { SEO } from "../components/SEO" import { SEO } from "../components/SEO"
function RulesPage({ data }: ComponentQuery<{ md: MarkdownRemark }>) { function RulesPage({ data }: ComponentQuery<{ md: MarkdownRemark }>) {
+2 -2
View File
@@ -1,8 +1,8 @@
import React, { Fragment } from "react"
import { graphql } from "gatsby" import { graphql } from "gatsby"
import React, { Fragment } from "react"
import { Markdown } from "../components/Markdown" import { Markdown } from "../components/Markdown"
import { SEO } from "../components/SEO"
import { ResourceHeader } from "../components/ResourceHeader" import { ResourceHeader } from "../components/ResourceHeader"
import { SEO } from "../components/SEO"
// @todo maybe find alternative type for data // @todo maybe find alternative type for data
function LanguagePost({ data }: any) { function LanguagePost({ data }: any) {
+1 -1
View File
@@ -2,7 +2,7 @@ import { IFileOrFolder } from "../components/ResourcesSidebar/index"
export function traversePaths( export function traversePaths(
[head, ...tail]: string[], [head, ...tail]: string[],
basePath = "/resources" basePath: string = "/resources"
): IFileOrFolder { ): IFileOrFolder {
const path = basePath + "/" + head const path = basePath + "/" + head
const isFile = !tail.length const isFile = !tail.length