Skip to content
This repository has been archived by the owner on Dec 3, 2024. It is now read-only.

Commit

Permalink
Revert "chore: eslint migration (#186)"
Browse files Browse the repository at this point in the history
This reverts commit 9efcdbb.
  • Loading branch information
lkappeler committed May 27, 2020
1 parent b8ddd58 commit 9d737e1
Show file tree
Hide file tree
Showing 55 changed files with 554 additions and 1,977 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

3 changes: 0 additions & 3 deletions .eslintrc.js

This file was deleted.

15 changes: 9 additions & 6 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
/* tslint:disable:object-literal-sort-keys */
module.exports = {
globals: {
"ts-jest": {
diagnostics: { warnOnly: true },
},
diagnostics: { warnOnly: true }
}
},
moduleFileExtensions: ["js", "ts", "tsx", "node"],
moduleNameMapper: {
"assets/(.*).(jpe?g|png|gif|ico|svg)$":
"<rootDir>/src/__mocks__/fileMock.js",
"\\.(css|less)$": "<rootDir>/src/__mocks__/styleMock.js",
"\\.(css|less)$": "<rootDir>/src/__mocks__/styleMock.js"
},
setupFiles: ["<rootDir>/src/__tests__/setup/setupGlobalMocks.ts"],
setupFiles: [
"<rootDir>/src/__tests__/setup/setupGlobalMocks.ts"
],
testMatch: ["**/__tests__/**/*.test.ts?(x)"],
transform: {
"\\.tsx?$": "ts-jest",
},
"\\.tsx?$": "ts-jest"
}
}
1,934 changes: 266 additions & 1,668 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"version": "npm run build",
"dev": "npm run build:tailwind && start-storybook -p 6006",
"test": "jest",
"lint": "eslint --ext ts,js,tsx,jsx,json .",
"format": "npm run lint -- --fix",
"lint": "tslint --project tsconfig.json",
"format": "tslint --project tsconfig.json --fix",
"build": "npm run build:tailwind && pika build",
"build:tailwind": "tsc --project tsconfig.tailwind.json",
"build:storybook": "npm run build:tailwind && build-storybook",
Expand Down Expand Up @@ -39,9 +39,9 @@
"use-deep-compare-effect": "^1.3.0"
},
"devDependencies": {
"@babel/core": "^7.8.4",
"@carforyou/eslint-config": "1.1.0",
"@babel/core": "^7.8.3",
"@carforyou/pika-plugin-build-standalone-node": "^1.0.0",
"@carforyou/tslint-rules": "^3.0.0",
"@percy/storybook": "^3.2.0",
"@pika/pack": "^0.5.0",
"@pika/plugin-build-web": "^0.9.0",
Expand All @@ -68,14 +68,16 @@
"marked-terminal": "^4.1.0",
"postcss-easy-import": "^3.0.0",
"postcss-loader": "^3.0.0",
"prettier": "^2.0.5",
"react": "^16.12.0",
"react-docgen-typescript-loader": "^3.6.0",
"react-dom": "^16.12.0",
"react-docgen-typescript-loader": "^3.6.0",
"react-test-renderer": "^16.12.0",
"semantic-release": "^17.0.0",
"svgo": "^1.3.2",
"tailwindcss": "^1.2.0",
"ts-jest": "^25.0.0",
"tslint": "^5.20.1",
"typescript": "^3.7.5"
},
"@pika/pack": {
Expand Down
6 changes: 3 additions & 3 deletions release.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ module.exports = {
"master",
{
name: "!(+([0-9])?(.{+([0-9]),x}).x|master)",
prerelease: "${ name }" + `-${process.env.CIRCLE_SHA1}`,
},
prerelease: "${ name }" + `-${process.env.CIRCLE_SHA1}`
}
],
pkgRoot: "pkg",
pkgRoot: "pkg"
}
12 changes: 6 additions & 6 deletions src/__tests__/setup/setupGlobalMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ window.matchMedia =
window.matchMedia ||
(() => {
return {
addListener: jest.fn(),
addListener: () => {}, // tslint:disable-line: no-empty
matches: false,
removeListener: jest.fn(),
removeListener: () => {}, // tslint:disable-line: no-empty
media: "test",
onchange: jest.fn(),
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
dispatchEvent: () => true,
onchange: () => {}, // tslint:disable-line: no-empty
addEventListener: () => {}, // tslint:disable-line: no-empty
removeEventListener: () => {}, // tslint:disable-line: no-empty
dispatchEvent: () => true, // tslint:disable-line: no-empty
}
})

Expand Down
2 changes: 1 addition & 1 deletion src/components/checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface CheckboxProps {
disabled?: boolean
error?: string
renderLabel?: () => JSX.Element
onChange?: (e: ChangeEvent<HTMLInputElement>) => void
onChange?: (e: ChangeEvent<any>) => void
}

interface PositionedLabelProps extends CheckboxProps {
Expand Down
2 changes: 1 addition & 1 deletion src/components/dropdown/buttonToggle.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactChild, ReactElement } from "react"
import React, { ReactChild, FC, ReactElement } from "react"

interface Props<T> {
placeholder?: string
Expand Down
2 changes: 1 addition & 1 deletion src/components/dropdown/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class Menu<T> extends Component<Props<T>> {
)

return (
// eslint-disable-next-line react/jsx-key
// tslint:disable-next-line:jsx-key
<li
{...getItemProps({
"data-testid": item.name,
Expand Down
2 changes: 1 addition & 1 deletion src/components/dropdown/withAutosuggest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const filterOptions = (noResults) => (allOptions, text) => {
return allOptions
}

const specialChars = /[-/\\^$*+?.()|[\]{}]/g
const specialChars = /[-\/\\^$*+?.()|[\]{}]/g
const cleanedText = text.replace(specialChars, "\\$&")
const regex = new RegExp(cleanedText, "i")
const startsWith = new RegExp(`^${cleanedText}`, "i")
Expand Down
4 changes: 2 additions & 2 deletions src/components/header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import useModal from "../../hooks/useModal"
interface Props {
theme?: HeaderTheme
mobileMenuText?: string
links?: Array<JSX.Element>
links?: JSX.Element[]
ctaButton?: JSX.Element
iconButtons: Array<JSX.Element>
iconButtons: JSX.Element[]
profile?: {
renderWelcomeMessage: () => JSX.Element
renderContent: () => JSX.Element
Expand Down
7 changes: 3 additions & 4 deletions src/components/input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ interface InputProps {
onChange: <T extends { target: { name: string; value: string | number } }>(
e: T
) => void
onBlur?: (e: FocusEvent) => void
onKeyDown?: (e: KeyboardEvent) => void
onFocus?: (e: FocusEvent) => void
onBlur?: (e: FocusEvent<any>) => void
onKeyDown?: (e: KeyboardEvent<any>) => void
onFocus?: (e: FocusEvent<any>) => void
step?: number
min?: number
max?: number
Expand Down Expand Up @@ -93,7 +93,6 @@ const Input = forwardRef<HTMLInputElement, Props>(
value={value || ""}
placeholder={placeholder || ""}
className={classNames("w-12/12", className, {
// eslint-disable-next-line @typescript-eslint/naming-convention
input_withClearButton: hasClearButton,
"floatingLabel-input": labelProps.floating,
})}
Expand Down
4 changes: 3 additions & 1 deletion src/components/input/inputField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ interface Props extends InputHTMLAttributes<HTMLInputElement> {
disabled?: boolean
required?: boolean
onChange?: (e: { target: { value: string | number } }) => void
onBlur?: (e: FocusEvent) => void
onBlur?: (e: FocusEvent<any>) => void
debounce?: number
}

Expand Down Expand Up @@ -93,13 +93,15 @@ const InputField = forwardRef<HTMLInputElement, Props>(
className={className}
inputMode={mode !== "text" ? mode : null}
onKeyDown={(e) => {
// tslint:disable:no-unused-expression
mode === "numeric"
? validateNumber(e)
: mode === "decimal"
? validateDecimal(e)
: null

onKeyDown && onKeyDown(e)
// tslint:enable:no-unused-expression
}}
onChange={debounceCallback(onChange, debounce)}
onBlur={onBlur}
Expand Down
1 change: 0 additions & 1 deletion src/components/intercom/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const loadIntercom = (settings) => {
if (!window.Intercom) {
;((w, d, id, s, _x) => {
function i() {
// eslint-disable-next-line prefer-rest-params
i.c(arguments)
}
i.q = []
Expand Down
2 changes: 1 addition & 1 deletion src/components/pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface Props {
previousLabel: string
nextLabel: string
rangePageLabel: string
onPageChange: (data) => void
onPageChange: (data: any) => void
forcePage: number
query?: object
pageLinkBuilder?: (page: number, params: object) => string
Expand Down
2 changes: 1 addition & 1 deletion src/components/radioButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface Props<T> {
error?: string
renderLabel?: () => JSX.Element
labelPosition?: "left" | "right"
onChange?: (e: ChangeEvent<HTMLInputElement>) => void
onChange?: (e: ChangeEvent<any>) => void
}

function RadioButton<T>({
Expand Down
2 changes: 1 addition & 1 deletion src/components/segmentedControl/button.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, ReactNode, createElement } from "react"
import React, { FC, ReactNode, createElement } from "react"
import classnames from "classnames"

import { wrapLink } from "../../lib/buttonHelper"
Expand Down
4 changes: 0 additions & 4 deletions src/components/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ interface SimpleSelect<T> extends BaseProps<T> {

type Props<T> = AutosuggestSelect<T> | SimpleSelect<T>

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const Select = forwardRef<HTMLInputElement, Props<any>>(
(
{
Expand Down Expand Up @@ -179,7 +178,6 @@ const Select = forwardRef<HTMLInputElement, Props<any>>(
return {
select_open: showOpenedIcon && !selected,
select_closed: !isOpen && !selected,
// eslint-disable-next-line @typescript-eslint/naming-convention
select_withSearchIcon: showOpenedIcon && !selected && showSearchIcon,
}
}
Expand Down Expand Up @@ -213,11 +211,9 @@ const Select = forwardRef<HTMLInputElement, Props<any>>(
<>
{"withAutosuggest" in rest && rest.withAutosuggest ? (
<DropdownWithAutosuggest
// eslint-disable-next-line @typescript-eslint/no-explicit-any
{...(dropdownProps as DropdownWithAutosuggestProps<any>)}
/>
) : (
// eslint-disable-next-line @typescript-eslint/no-explicit-any
<Dropdown {...(dropdownProps as DropdownProps<any>)} />
)}
</>
Expand Down
2 changes: 1 addition & 1 deletion src/components/textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface Props {
disabled?: boolean
required?: boolean
onChange: (e: { target: { value: string } }) => void
onBlur: (e: FocusEvent) => void
onBlur: (e: FocusEvent<any>) => void
rows?: number
cols?: number
maxLength?: number
Expand Down
6 changes: 3 additions & 3 deletions src/lib/debounceHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
* @note: Currently only supports callbacks with a single parameter (for form input events)
*/
function debounce(
callback?: (event) => void,
callback?: (event: any) => void,
delay?: number
): (event) => void | undefined {
): (event: any) => void | undefined {
if (!callback || !delay) {
return callback
}
let timer
return (event): void => {
return (event: any): void => {
clearTimeout(timer)
timer = setTimeout(() => {
timer = null
Expand Down
2 changes: 1 addition & 1 deletion src/tailwind/defaultConfig.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* tslint:disable:object-literal-sort-keys */
import TransformPlugin from "./plugins/transform"
/*
Tailwind - The Utility-First CSS Framework
Expand Down Expand Up @@ -604,6 +605,5 @@ export default {
transitionDuration: ["responsive", "hover"],
},
corePlugins: {},
// eslint-disable-next-line @typescript-eslint/no-var-requires
plugins: [TransformPlugin, require("tailwindcss-gradients")()],
}
3 changes: 1 addition & 2 deletions src/tailwind/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export interface TailwindConfig {
theme?: TailwindTheme
options?: { [key: string]: string | number | boolean }
modules?: { [key: string]: string[] }
// eslint-disable-next-line @typescript-eslint/no-explicit-any
plugins?: any[]
}

Expand All @@ -50,7 +49,7 @@ const resolveConfig = (config) => {
}

for (const conf in config.theme) {
if (Object.prototype.hasOwnProperty.call(config.theme, conf)) {
if (config.theme.hasOwnProperty(conf)) {
theme[conf] =
typeof config.theme[conf] === "function"
? config.theme[conf](getKey)
Expand Down
Loading

0 comments on commit 9d737e1

Please sign in to comment.