Skip to content
This repository has been archived by the owner on Jan 24, 2025. It is now read-only.

Commit

Permalink
chore: change to use eslint instead of tslint
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Apr 30, 2019
1 parent 5911cce commit 428d9b5
Show file tree
Hide file tree
Showing 67 changed files with 340 additions and 242 deletions.
6 changes: 6 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": [
"@commitlint/config-conventional",
"@commitlint/config-lerna-scopes"
]
}
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/dist
6 changes: 6 additions & 0 deletions .huskyrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"hooks": {
"pre-commit": "lerna run precommit --parallel",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
10 changes: 8 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"javascript.validate.enable": false,
"typescript.tsdk": "node_modules/typescript/lib"
"typescript.tsdk": "node_modules/typescript/lib",
"eslint.autoFixOnSave": true,
"eslint.validate": [
"javascript",
"javascriptreact",
{ "language": "typescript", "autoFix": true },
{ "language": "typescriptreact", "autoFix": true }
]
}
3 changes: 3 additions & 0 deletions core/docz-core/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['eslint-config-docz'],
}
3 changes: 3 additions & 0 deletions core/docz-core/.lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"*.{ts,tsx}": ["yarn fix", "git add"]
}
9 changes: 4 additions & 5 deletions core/docz-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
"scripts": {
"dev": "cross-env NODE_ENV=development yarn build -w",
"build": "cross-env NODE_ENV=production rollup -c",
"fix": "run-s fix:*",
"fix:prettier": "prettier \"src/**/*.{ts,tsx,md,mdx,js,jsx,json}\" --write",
"fix:tslint": "tslint --fix --project .",
"tslint": "tslint --project ."
"fix": "yarn lint --fix",
"lint": "eslint . --ext .ts,.tsx",
"precommit": "lint-staged"
},
"dependencies": {
"@babel/core": "7.4.3",
Expand Down Expand Up @@ -70,7 +69,7 @@
"terser-webpack-plugin": "^1.2.3",
"thread-loader": "^2.1.2",
"titleize": "^2.1.0",
"typescript": "3.4.5",
"typescript": "3.3.4000",
"url-loader": "^1.1.2",
"webpack": "^4.30.0",
"webpack-bundle-analyzer": "^3.3.2",
Expand Down
1 change: 1 addition & 0 deletions core/docz-core/src/bundler/config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/camelcase */
import * as path from 'path'
import { Configuration } from 'webpack'
import * as envDotProp from 'env-dot-prop'
Expand Down
1 change: 1 addition & 0 deletions core/docz-core/src/bundler/minifier.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/camelcase */
import Config from 'webpack-chain'
import * as TerserPlugin from 'terser-webpack-plugin'

Expand Down
1 change: 0 additions & 1 deletion core/docz-core/src/utils/open-browser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* tslint:disable */
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
Expand Down
3 changes: 0 additions & 3 deletions core/docz-core/tslint.json

This file was deleted.

3 changes: 3 additions & 0 deletions core/docz-rollup/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['eslint-config-docz'],
}
3 changes: 3 additions & 0 deletions core/docz-rollup/.lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"*.js": ["yarn fix", "git add"]
}
5 changes: 3 additions & 2 deletions core/docz-rollup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
"package.json"
],
"scripts": {
"fix": "run-s fix:*",
"fix:prettier": "prettier \"src/**/*.{ts,tsx,md,mdx,js,jsx,json}\" --write"
"fix": "yarn lint --fix",
"lint": "eslint . --ext .js",
"precommit": "lint-staged"
},
"dependencies": {
"@pedronauck/rollup-plugin-typescript2": "0.18.3",
Expand Down
3 changes: 3 additions & 0 deletions core/docz-theme-default/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['eslint-config-docz'],
}
3 changes: 3 additions & 0 deletions core/docz-theme-default/.lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"*.{ts,tsx}": ["yarn fix", "git add"]
}
7 changes: 3 additions & 4 deletions core/docz-theme-default/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
"scripts": {
"dev": "cross-env NODE_ENV=development yarn build -w",
"build": "cross-env NODE_ENV=production rollup -c",
"fix": "run-s fix:*",
"fix:prettier": "prettier \"src/**/*.{ts,tsx,md,mdx,js,jsx,json}\" --write",
"fix:tslint": "tslint --fix --project .",
"tslint": "tslint --project ."
"fix": "yarn lint --fix",
"lint": "eslint . --ext .ts,.tsx",
"precommit": "lint-staged"
},
"dependencies": {
"@loadable/component": "^5.9.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,5 @@ export const MenuLink = React.forwardRef<any, LinkProps>(
)
}
)

MenuLink.displayName = 'MenuLink'
2 changes: 1 addition & 1 deletion core/docz-theme-default/src/components/ui/NotFound.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const NotFound = () => (
<Wrapper>
<Title>Page Not Found</Title>
<Subtitle>
Check if you haven't changed the document route or deleted it!
Check if you changed the document route or deleted it!
</Subtitle>
</Wrapper>
</Main>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ export const Playground: SFC<PlaygroundProps> = ({
topLeft: false,
},
handleComponent: {
// eslint-disable-next-line
right: () => <Handle full={fullscreen} horizontal />,
// eslint-disable-next-line
bottom: () => <Handle full={fullscreen} horizontal={false} />,
},
onResizeStop: (e: any, direction: any, ref: any, d: any) => {
Expand Down
15 changes: 3 additions & 12 deletions core/docz-theme-default/src/components/ui/Props/PropsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const Line = styled.div`
}
`


const Column = styled.div`
min-width: 0;
padding: 2px 15px;
Expand Down Expand Up @@ -109,14 +108,10 @@ export const PropsTable: React.SFC<PropsComponentProps> = ({
<Line key={key}>
<Content>
<ColumnName>
<PropName>
{key}
</PropName>
<PropName>{key}</PropName>
</ColumnName>
<ColumnType>
<PropType>
{getPropType(prop)}
</PropType>
<PropType>{getPropType(prop)}</PropType>
</ColumnType>
<ColumnValue>
{prop.defaultValue && (
Expand All @@ -135,11 +130,7 @@ export const PropsTable: React.SFC<PropsComponentProps> = ({
)}
</ColumnValue>
</Content>
{prop.description && (
<Paragraph>
{prop.description}
</Paragraph>
)}
{prop.description && <Paragraph>{prop.description}</Paragraph>}
</Line>
)
})}
Expand Down
44 changes: 21 additions & 23 deletions core/docz-theme-default/src/components/ui/Props/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ export const Props: React.SFC<PropsComponentProps> = ({
isToggle,
...props
}) => {
const [isOpen, setIsOpen] = useState(true);
const [isOpen, setIsOpen] = useState(true)

const components = useComponents()
const Title = useMemo(
() => styled(components.H3 || 'h3')`
padding: 8px 0;
position: relative;
${!isRaw ? 'margin-bottom: 0;' : ''}
${!isOpen || isRaw
? 'border-bottom: 1px solid rgba(0, 0, 0, 0.1);'
: ''}
${!isOpen || isRaw ? 'border-bottom: 1px solid rgba(0, 0, 0, 0.1);' : ''}
${isToggle ? `
${
isToggle
? `
cursor: pointer;
padding-right: 40px;
Expand All @@ -36,40 +36,38 @@ export const Props: React.SFC<PropsComponentProps> = ({
position: absolute;
top: 50%;
right: 16px;
transform: translateY(-50%) ${isOpen ? 'rotate(-135deg)' : 'rotate(45deg)'};
transform: translateY(-50%) ${
isOpen ? 'rotate(-135deg)' : 'rotate(45deg)'
};
${!isOpen ? 'margin-top: -2px;' : ''}
width: 8px;
height: 8px;
border-bottom: 2px solid;
border-right: 2px solid;
}
`: ''}
`
: ''
}
`,
[isOpen]
)

const titleProps = isToggle ? {
onClick: () => setIsOpen(open => !open),
onkeydown: () => setIsOpen(open => !open),
role: 'button',
tabindex: 0,
}{}
const titleProps = isToggle
? {
onClick: () => setIsOpen(open => !open),
onkeydown: () => setIsOpen(open => !open),
role: 'button',
tabindex: 0,
}
: {}

return (
<Container>
{(!!title || isToggle) && (
<Title {...titleProps}>
{title || 'Component props'}
</Title>
<Title {...titleProps}>{title || 'Component props'}</Title>
)}
{isOpen && (
<div>
{isRaw ? (
<PropsRaw {...props} />
): (
<PropsTable {...props} />
)}
</div>
<div>{isRaw ? <PropsRaw {...props} /> : <PropsTable {...props} />}</div>
)}
</Container>
)
Expand Down
6 changes: 0 additions & 6 deletions core/docz-theme-default/tslint.json

This file was deleted.

3 changes: 3 additions & 0 deletions core/docz-utils/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['eslint-config-docz'],
}
3 changes: 3 additions & 0 deletions core/docz-utils/.lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"*.{ts,tsx}": ["yarn fix", "git add"]
}
7 changes: 3 additions & 4 deletions core/docz-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
"scripts": {
"dev": "cross-env NODE_ENV=development yarn build -w",
"build": "trash lib && cross-env NODE_ENV=production rollup -c",
"fix": "run-s fix:*",
"fix:prettier": "prettier \"src/**/*.{ts,tsx,md,mdx,js,jsx,json}\" --write",
"fix:tslint": "tslint --fix --project .",
"tslint": "tslint --project ."
"fix": "yarn lint --fix",
"lint": "eslint . --ext .ts,.tsx",
"precommit": "lint-staged"
},
"dependencies": {
"@babel/generator": "^7.4.0",
Expand Down
3 changes: 0 additions & 3 deletions core/docz-utils/tslint.json

This file was deleted.

3 changes: 3 additions & 0 deletions core/docz/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['eslint-config-docz'],
}
3 changes: 3 additions & 0 deletions core/docz/.lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"*.{ts,tsx}": ["yarn fix", "git add"]
}
7 changes: 3 additions & 4 deletions core/docz/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
"scripts": {
"dev": "cross-env NODE_ENV=development yarn build -w",
"build": "cross-env NODE_ENV=production rollup -c",
"fix": "run-s fix:*",
"fix:prettier": "prettier \"src/**/*.{ts,tsx,md,mdx,js,jsx,json}\" --write",
"fix:tslint": "tslint --fix --project .",
"tslint": "tslint --project ."
"fix": "yarn lint --fix",
"lint": "eslint . --ext .ts,.tsx",
"precommit": "lint-staged"
},
"dependencies": {
"@loadable/component": "^5.9.0",
Expand Down
14 changes: 7 additions & 7 deletions core/docz/src/components/Props.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ export type ComponentWithDocGenInfo = ComponentType & {
}

export interface PropsProps {
title?: Node,
isRaw?: boolean,
isToggle?: boolean,
title?: Node
isRaw?: boolean
isToggle?: boolean
of: ComponentWithDocGenInfo
}

Expand All @@ -91,11 +91,11 @@ export const getPropType = (prop: Prop) => {
}

export interface PropsComponentProps {
title?: Node,
isRaw?: boolean,
isToggle?: boolean,
title?: Node
isRaw?: boolean
isToggle?: boolean
props: Record<string, Prop>
getPropType(prop: Prop): string,
getPropType(prop: Prop): string
}

export const Props: SFC<PropsProps> = ({
Expand Down
5 changes: 2 additions & 3 deletions core/docz/src/state.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// tslint:disable-next-line
import { create } from './utils/createState'
import { ComponentType } from 'react'

Expand Down Expand Up @@ -44,8 +43,8 @@ export interface Config {
base?: string
}

export type Entries = Array<{ key: string; value: Entry }>
export type Props = Array<{ key: string; value: any }>
export type Entries = { key: string; value: Entry }[]
export type Props = { key: string; value: any }[]
export type TransformFn = (config: ThemeConfig) => ThemeConfig

export interface Database {
Expand Down
1 change: 1 addition & 0 deletions core/docz/src/theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export function theme(
)
})

Theme.displayName = WrappedComponent.displayName || 'DoczTheme'
return Theme
}
}
3 changes: 0 additions & 3 deletions core/docz/tslint.json

This file was deleted.

1 change: 1 addition & 0 deletions core/gatsby-theme-docz/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/templates
3 changes: 3 additions & 0 deletions core/gatsby-theme-docz/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['eslint-config-docz'],
}
3 changes: 0 additions & 3 deletions core/gatsby-theme-docz/.eslintrc.json

This file was deleted.

3 changes: 3 additions & 0 deletions core/gatsby-theme-docz/.lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"*.js": ["yarn fix", "git add"]
}
Loading

0 comments on commit 428d9b5

Please sign in to comment.