Skip to content

Commit

Permalink
chore: Upgrade Looker estlint and prettier config (#683)
Browse files Browse the repository at this point in the history
Knock on effects:
1. eslint needed to be upgraded
2. prettier needed to be upgraded
3. new rules required quite a lot of code changes :(

In addition removed prettier and eslint configs from access-token-server package.json as not needed there.
  • Loading branch information
bryans99 authored May 14, 2021
1 parent 952ed30 commit 8c75bba
Show file tree
Hide file tree
Showing 50 changed files with 302 additions and 293 deletions.
63 changes: 0 additions & 63 deletions examples/access-token-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,79 +21,16 @@
"google-auth-library": "^6.1.0"
},
"devDependencies": {
"@looker/eslint-config": "^0.9.14",
"@looker/prettier-config": "^0.9.1",
"@types/crypto-js": "^3.1.47",
"@types/express": "^4.17.8",
"@types/jest": "^26.0.14",
"@types/jsonwebtoken": "^8.5.0",
"@types/node": "^14.11.2",
"eslint": "^7.10.0",
"eslint-plugin-header": "^3.1.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-mdx": "^1.8.2",
"eslint-plugin-prettier": "^3.1.4",
"jest": "^26.4.2",
"node-fetch": "^2.6.1",
"nodemon": "^2.0.4",
"test": "^0.6.0",
"ts-jest": "^26.4.1",
"ts-node": "^9.0.0"
},
"eslintConfig": {
"extends": [
"@looker/eslint-config/no-type-checking"
],
"plugins": [
"header",
"prettier"
],
"rules": {
"prettier/prettier": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
"args": "all",
"argsIgnorePattern": "^_"
}
],
"sort-keys-fix/sort-keys-fix": "off",
"no-useless-constructor": "off",
"@typescript-eslint/no-empty-interface": "off",
"header/header": [
2,
"config/license-header.js"
],
"import/default": "off",
"sort-keys": "off"
},
"settings": {
"import/resolver": {
"typescript": {
"directory": "./tsconfig.json"
}
}
},
"overrides": [
{
"files": [
"*.js"
],
"rules": {
"@typescript-eslint/no-var-requires": "off"
}
}
]
},
"prettier": "@looker/prettier-config",
"prettierConfig": {
"overrides": {
"rules": {
"trailingComma": "all"
}
}
}
}
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@
"@babel/preset-typescript": "^7.13.0",
"@babel/runtime": "^7.14.0",
"@babel/runtime-corejs3": "^7.14.0",
"@looker/eslint-config": "^0.10.4",
"@looker/prettier-config": "^0.10.4",
"@looker/eslint-config": "^1.1.5",
"@looker/prettier-config": "^1.1.5",
"@testing-library/jest-dom": "^5.11.6",
"@types/blueimp-md5": "^2.7.0",
"@types/ini": "^1.3.30",
Expand All @@ -91,11 +91,12 @@
"core-js": "^3.6.5",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"eslint": "^7.19.0",
"eslint": "^7.26.0",
"eslint-import-resolver-typescript": "^2.0.0",
"eslint-import-resolver-webpack": "^0.12.1",
"eslint-plugin-header": "^3.0.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jest-dom": "^3.9.0",
"eslint-plugin-mdx": "^1.6.8",
"eslint-plugin-prettier": "^3.1.3",
"jest": "^26.6.3",
Expand All @@ -112,7 +113,7 @@
"npm-run-all": "^4.1.5",
"openapi3-ts": "^1.3.0",
"pre-commit": "1.2.2",
"prettier": "^2.1.1",
"prettier": "^2.3.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"styled-components": "^5.2.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import React from 'react'
import styled from 'styled-components'
import { Icon, Status } from '@looker/components'
import { Beaker } from '@looker/icons'
import { VisibilityOff } from '@styled-icons/material'
import { VisibilityOff } from '@styled-icons/material/VisibilityOff'

/**
* Return a Status react element based on an endpoint's status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import React from 'react'
import { fireEvent, screen, waitFor } from '@testing-library/react'
import { IdeFileManifest } from '@looker/icons'
import { Toc } from '@styled-icons/material'
import { Tag } from '@styled-icons/material-rounded'
import { Toc } from '@styled-icons/material/Toc'
import { Tag } from '@styled-icons/material-rounded/Tag'
import { api } from '../../test-data'
import { renderWithSearchAndRouter } from '../../test-utils'
import { ExploreProperty, ExplorePropertyDetail, typeIcon } from '.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ import {
Tooltip,
Space,
} from '@looker/components'
import { Done, Lock, Remove } from '@styled-icons/material'
import { Done } from '@styled-icons/material/Done'
import { Lock } from '@styled-icons/material/Lock'
import { Remove } from '@styled-icons/material/Remove'
import { IProperty } from '@looker/sdk-codegen'
import ReactMarkdown from 'react-markdown'
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@

import React from 'react'
import { FieldString, IdeFileManifest } from '@looker/icons'
import { CalendarToday, Code } from '@styled-icons/material'
import { Tag } from '@styled-icons/material-rounded'
import { CalendarToday } from '@styled-icons/material/CalendarToday'
import { Code } from '@styled-icons/material/Code'
import { Tag } from '@styled-icons/material-rounded/Tag'
import { api40 as api } from '../../test-data'
import { expandable, pickType, pickTypeProps, typeIcon } from './exploreUtils'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@
import React from 'react'
import { IconType } from '@looker/components'
import { FieldString, IdeFileManifest, IdeParameter } from '@looker/icons'
import {
CalendarToday,
Check,
Code,
Link,
Toc,
VpnKey,
} from '@styled-icons/material'
import { CalendarToday } from '@styled-icons/material/CalendarToday'
import { Check } from '@styled-icons/material/Check'
import { Code } from '@styled-icons/material/Code'
import { Link } from '@styled-icons/material/Link'
import { Toc } from '@styled-icons/material/Toc'
import { VpnKey } from '@styled-icons/material/VpnKey'
import { Tag } from '@styled-icons/material-rounded'
import { Email } from '@styled-icons/material-outlined'
import { IType, TypeOfType, typeOfType } from '@looker/sdk-codegen'
Expand Down
3 changes: 2 additions & 1 deletion packages/api-explorer/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ import {
Header as SemanticHeader,
} from '@looker/components'
import { LookerLogo } from '@looker/icons'
import { ChangeHistory, Menu } from '@styled-icons/material'
import { ChangeHistory } from '@styled-icons/material/ChangeHistory'
import { Menu } from '@styled-icons/material/Menu'

import { SpecList } from '@looker/sdk-codegen'
import { SpecState, SpecAction } from '../../reducers'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
PopoverContent,
FieldCheckbox,
} from '@looker/components'
import { FilterList } from '@styled-icons/material'
import { FilterList } from '@styled-icons/material/FilterList'
import { SearchCriterion } from '@looker/sdk-codegen'
import React, { useContext, FC, BaseSyntheticEvent } from 'react'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import React, { FC } from 'react'
import { ISearchResult } from '@looker/sdk-codegen'
import { Heading, Icon, Flex } from '@looker/components'
import { Error } from '@styled-icons/material'
import { Error } from '@styled-icons/material/Error'

interface SearchMessageProps {
search?: ISearchResult
Expand Down
4 changes: 2 additions & 2 deletions packages/api-explorer/src/components/SideNav/SideNav.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ import { SideNav } from './SideNav'
import { countMethods } from './searchUtils'

describe('SideNav', () => {
const testApi = ({
const testApi = {
tags: pick(api.tags, ['Auth', 'ApiAuth']),
types: pick(api.types, ['WriteDashboard', 'WriteQuery']),
} as unknown) as ApiModel
} as unknown as ApiModel
const allTagsPattern = /^(Auth|ApiAuth)$/
const allTypesPattern = /^(WriteDashboard|WriteQuery)$/

Expand Down
2 changes: 1 addition & 1 deletion packages/api-explorer/src/scenes/DiffScene/DiffScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
Select,
SelectMulti,
} from '@looker/components'
import { SyncAlt } from '@styled-icons/material'
import { SyncAlt } from '@styled-icons/material/SyncAlt'
import { getDefaultSpecKey } from '../../reducers/spec/utils'
import { diffPath } from '../../utils'
import { ApixSection } from '../../components'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
import React, { FC } from 'react'
import { DiffCount } from '@looker/sdk-codegen'
import { Code, Flex, Icon, Space } from '@looker/components'
import { Add, ChangeHistory, Remove } from '@styled-icons/material'
import { Add } from '@styled-icons/material/Add'
import { ChangeHistory } from '@styled-icons/material/ChangeHistory'
import { Remove } from '@styled-icons/material/Remove'

interface DiffLegendProps {
count: DiffCount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,10 @@ export const ExtensionProvider: React.FC<ExtensionProviderProps> = ({
{} as ExtensionContextData
)
const connectedCallback = (extensionHost: ExtensionHostApi) => {
const core31SDK: Looker31SDK = LookerExtensionSDK.create31Client(
extensionHost
)
const core40SDK: Looker40SDK = LookerExtensionSDK.create40Client(
extensionHost
)
const core31SDK: Looker31SDK =
LookerExtensionSDK.create31Client(extensionHost)
const core40SDK: Looker40SDK =
LookerExtensionSDK.create40Client(extensionHost)
// Provide global access for use by redux if needed
registerCore31SDK(core31SDK)
registerCore40SDK(core40SDK)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ import {
/**
* React context provider for extension API and SDK
*/
export const ExtensionContextBase = React.createContext<BaseExtensionContextData>(
undefined as any // no one will ever see this undefined!
)
export const ExtensionContextBase =
React.createContext<BaseExtensionContextData>(
undefined as any // no one will ever see this undefined!
)

/**
* ExtensionProviderBase component. Provides access to the extension API but no SDK is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ export const setupClosePopoversListener = (extensionSDK?: ExtensionSDK) => {
extensionSDK.closeHostPopovers()
}
}
const body: HTMLBodyElement | undefined | null = document.querySelector(
'body'
)
const body: HTMLBodyElement | undefined | null =
document.querySelector('body')
if (body) {
body.addEventListener('mousedown', onBodyMousedown)
}
Expand Down
7 changes: 2 additions & 5 deletions packages/extension-sdk/src/connect/extension_host_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,8 @@ export class ExtensionHostApiImpl implements ExtensionHostApi {

constructor(configuration: ExtensionHostApiConfiguration) {
this._configuration = configuration
const {
chattyHost,
setInitialRoute,
hostChangedRoute,
} = this._configuration
const { chattyHost, setInitialRoute, hostChangedRoute } =
this._configuration
this.chattyHost = chattyHost
this.setInitialRoute = setInitialRoute
this.hostChangedRoute = hostChangedRoute
Expand Down
4 changes: 2 additions & 2 deletions packages/extension-sdk/src/connect/fetch_proxy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ describe('extension_host_api tests', () => {
let extensionFetchProxySpy: Required<any>

beforeEach(() => {
mockExtensionSdk = ({
mockExtensionSdk = {
fetchProxy: () => {
// noop
},
} as unknown) as ExtensionHostApiImpl
} as unknown as ExtensionHostApiImpl
extensionFetchProxySpy = jest.spyOn(mockExtensionSdk, 'fetchProxy')
})

Expand Down
7 changes: 5 additions & 2 deletions packages/hackathon/src/components/SideNav/SideNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ import React, { FC } from 'react'
import styled from 'styled-components'
import { Box, MenuList, MenuItem } from '@looker/components'
import { Beaker } from '@looker/icons'
import { Map, Settings } from '@styled-icons/material'
import { Home, Group, FactCheck } from '@styled-icons/material-outlined'
import { Map } from '@styled-icons/material/Map'
import { Settings } from '@styled-icons/material/Settings'
import { Home } from '@styled-icons/material-outlined/Home'
import { Group } from '@styled-icons/material-outlined/Group'
import { FactCheck } from '@styled-icons/material-outlined/FactCheck'
import { NavLink } from 'react-router-dom'
import { Routes } from '../../routes/AppRouter'

Expand Down
7 changes: 4 additions & 3 deletions packages/hackathon/src/data/admin/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ export type AdminAction =
| SaveUserAttributesRequestAction
| SaveUserAttributesResponseAction

export const loadUserAttributesRequest = (): LoadUserAttributesRequestAction => ({
type: Actions.LOAD_USER_ATTRIBUTES_REQUEST,
})
export const loadUserAttributesRequest =
(): LoadUserAttributesRequestAction => ({
type: Actions.LOAD_USER_ATTRIBUTES_REQUEST,
})

export const loadUserAttributesResponse = (
adminUserAttributes: AdminUserAttributes
Expand Down
4 changes: 3 additions & 1 deletion packages/hackathon/src/data/sheets_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,9 @@ class SheetsClient {
return await hackathons.find(hackathonId, '_id')
} else {
const data = this.getSheetData()
return await (await data).currentHackathon
return await (
await data
).currentHackathon
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/hackathon/src/models/Hackathons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class Hackathons extends WhollySheet<Hackathon, IHackathonProps> {
}

typeRow<Hackathon>(values?: any) {
return (new Hackathon(values) as unknown) as Hackathon
return new Hackathon(values) as unknown as Hackathon
}

getCurrentHackathon(): Hackathon | undefined {
Expand Down
4 changes: 2 additions & 2 deletions packages/hackathon/src/models/Judgings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class Judging extends SheetRow<IJudging> {
this.coolness,
this.impact
)
return (this as unknown) as IJudging
return this as unknown as IJudging
}

toObject(): IJudgingProps {
Expand All @@ -153,7 +153,7 @@ export class Judgings extends WhollySheet<Judging, IJudgingProps> {
typeRow<Judging>(values?: any) {
const j = new Judging(values)
j.load(this.data)
return (j as unknown) as Judging
return j as unknown as Judging
}

filterBy(hackathon: Hackathon, hacker?: Hacker): Judging[] {
Expand Down
2 changes: 1 addition & 1 deletion packages/hackathon/src/models/Projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ export class Projects extends WhollySheet<Project, IProjectProps> {
typeRow<Project>(values?: any) {
const project = new Project(values)
// this.getMembers(project)
return (project as unknown) as Project
return project as unknown as Project
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/hackathon/src/models/Registrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class Registrations extends WhollySheet<
}

typeRow<Registration>(values?: any) {
return (new Registration(values) as unknown) as Registration
return new Registration(values) as unknown as Registration
}

hackRegs(hackathon: Hackathon) {
Expand Down
Loading

0 comments on commit 8c75bba

Please sign in to comment.