Skip to content

Commit

Permalink
chore: replace tslint with eslint (#1380)
Browse files Browse the repository at this point in the history
  • Loading branch information
darthtrevino committed Jun 7, 2019
1 parent 497afda commit fc44aee
Show file tree
Hide file tree
Showing 42 changed files with 168 additions and 130 deletions.
5 changes: 5 additions & 0 deletions .eslintignore
@@ -0,0 +1,5 @@
**/node_modules/
**/lib/
**/dist/
**/public/
**/static/
35 changes: 35 additions & 0 deletions .eslintrc
@@ -0,0 +1,35 @@
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "react-hooks"],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/@typescript-eslint"
],
"settings": {
"react": {
"version": "16.8"
}
},
"env": {
"browser": true,
"jest": true,
"es6": true,
"node": true
},
"rules": {
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-var-requires": 0,
"@typescript-eslint/no-parameter-properties": 0,
"@typescript-eslint/explicit-member-accessibility": 0,
"@typescript-eslint/no-object-literal-type-assertion": 0,
"@typescript-eslint/no-non-null-assertion": 0,
"@typescript-eslint/array-type": 0,
"@typescript-eslint/no-use-before-define": 0,
"react/prop-types": 0,
"react/display-name": 0
}
}
5 changes: 1 addition & 4 deletions .vscode/extensions.json
@@ -1,6 +1,3 @@
{
"recommendations": [
"ms-vscode.vscode-typescript-tslint-plugin",
"esbenp.prettier-vscode"
]
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
}
15 changes: 9 additions & 6 deletions package.json
Expand Up @@ -38,7 +38,7 @@
"unit_test": "jest",
"jest:watch": "jest --watch",
"jest:cov": "jest --coverage",
"lint": "tslint \"packages/**/*.{ts,tsx}\" -e \"**/{lib,node_modules}/**\"",
"lint": "eslint .",
"test_modules": "lerna run test --stream",
"publish_docs": "lerna run publish --scope react-dnd-documentation",
"test": "run-s lint build test_modules jest:cov",
Expand All @@ -58,8 +58,15 @@
"@commitlint/cli": "^8.0.0",
"@commitlint/config-conventional": "^8.0.0",
"@types/jest": "^24.0.13",
"@typescript-eslint/eslint-plugin": "^1.9.0",
"@typescript-eslint/parser": "^1.9.0",
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.11.2",
"eslint": "^5.16.0",
"eslint-config-prettier": "^4.3.0",
"eslint-plugin-prettier": "^3.1.0",
"eslint-plugin-react": "^7.13.0",
"eslint-plugin-react-hooks": "^1.6.0",
"husky": "^2.3.0",
"jest": "^24.8.0",
"jest-environment-jsdom": "^24.8.0",
Expand All @@ -71,10 +78,6 @@
"react": "^16.8.6",
"react-dom": "^16.8.6",
"ts-jest": "^24.0.2",
"tslint": "^5.17.0",
"tslint-config-prettier": "^1.18.0",
"tslint-react": "^4.0.0",
"tslint-react-hooks": "^2.1.0",
"typescript": "^3.5.1"
},
"jest": {
Expand Down Expand Up @@ -125,7 +128,7 @@
"git add"
],
"*.{ts,tsx}": [
"tslint --fix",
"eslint --fix",
"prettier --write",
"git add"
]
Expand Down
5 changes: 1 addition & 4 deletions packages/dnd-core/src/__tests__/sources.ts
@@ -1,5 +1,3 @@
// tslint:disable max-classes-per-file

import DragSource from './DragSourceImpl'
import { DragDropMonitor } from '../interfaces'

Expand Down Expand Up @@ -42,8 +40,7 @@ export class BadItemSource extends DragSource {
}

export class NumberSource extends DragSource {
// tslint:disable-next-line variable-name
constructor(public number: number, public allowDrag: boolean) {
public constructor(public number: number, public allowDrag: boolean) {
super()
}

Expand Down
2 changes: 0 additions & 2 deletions packages/dnd-core/src/__tests__/targets.ts
@@ -1,5 +1,3 @@
// tslint:disable max-classes-per-file

import DropTarget from './DropTargetImpl'
import { DragDropMonitor } from '../interfaces'

Expand Down
1 change: 1 addition & 0 deletions packages/documentation/gatsby-config.js
@@ -1,3 +1,4 @@
/* eslint-disable */
const siteMetadata = {
title: 'React DnD',
githubUrl: 'https://github.com/react-dnd/react-dnd/',
Expand Down
1 change: 1 addition & 0 deletions packages/documentation/gatsby-node.js
@@ -1,3 +1,4 @@
/* eslint-disable */
const path = require('path')

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/documentation/src/components/doc.tsx
Expand Up @@ -13,7 +13,7 @@ const Doc: React.FC<DocProps> = ({ docPage }) => {
return (
<Container>
<Gutter />
<HtmlContainer>{renderAst(docPage.htmlAst)}</HtmlContainer>>
<HtmlContainer>{renderAst(docPage.htmlAst)}</HtmlContainer>
<Gutter />
</Container>
)
Expand Down
1 change: 0 additions & 1 deletion packages/documentation/src/components/layout.tsx
@@ -1,4 +1,3 @@
// tslint:disable jsx-no-lambda
declare var require: any

import * as React from 'react'
Expand Down
1 change: 0 additions & 1 deletion packages/documentation/src/components/navbar.tsx
@@ -1,4 +1,3 @@
// tslint:disable jsx-no-lambda
import * as React from 'react'
import { Link as GatsbyLink } from 'gatsby'
import styled from 'styled-components'
Expand Down
1 change: 1 addition & 0 deletions packages/documentation/write_sample_boilerplate.js
@@ -1,3 +1,4 @@
/* eslint-disable */
const fs = require('fs')
const path = require('path')

Expand Down
5 changes: 5 additions & 0 deletions packages/examples-hooks/.eslintrc
@@ -0,0 +1,5 @@
{
"rules": {
"react/display-name": 0
}
}
Expand Up @@ -76,7 +76,6 @@ const Container: React.FC = () => {
<Dustbin
accept={accepts}
lastDroppedItem={lastDroppedItem}
// tslint:disable-next-line jsx-no-lambda
onDrop={item => handleDrop(index, item)}
key={index}
/>
Expand Down
@@ -1,10 +1,7 @@
declare var require: any

import React from 'react'
import {
__EXPERIMENTAL_DND_HOOKS_THAT_MAY_CHANGE_AND_BREAK_MY_BUILD__,
DragDropContextProvider,
} from 'react-dnd'
import { DragDropContextProvider } from 'react-dnd'
import HTML5Backend from 'react-dnd-html5-backend'
import Dustbin from './Dustbin'
import Box from './Box'
Expand All @@ -25,7 +22,6 @@ const FrameBindingContext: React.FC = ({ children }) => (
)

// Don't use the decorator, embed the DnD context within the iframe
// tslint:disable-next-line max-classes-per-file
export default function Container() {
// The react-frame-component will pass the iframe's 'window' global as a context value
// to the DragDropContext provider. You could also directly inject it in via a prop.
Expand Down
@@ -1,4 +1,3 @@
// tslint:disable jsx-no-lambda
declare var require: any
import React, { useState, useEffect, useCallback } from 'react'
import { NativeTypes } from 'react-dnd-html5-backend'
Expand Down
@@ -1,4 +1,3 @@
// tslint:disable max-classes-per-file jsx-no-lambda
import React, { useState, useCallback, useMemo } from 'react'
import {
__EXPERIMENTAL_DND_HOOKS_THAT_MAY_CHANGE_AND_BREAK_MY_BUILD__,
Expand Down
@@ -1,4 +1,3 @@
// tslint:disable max-classes-per-file
import React, { useState, useCallback } from 'react'
import { __EXPERIMENTAL_DND_HOOKS_THAT_MAY_CHANGE_AND_BREAK_MY_BUILD__ } from 'react-dnd'
import Colors from './Colors'
Expand Down
Expand Up @@ -29,7 +29,6 @@ function buildCardData() {
}

export default class Container extends React.Component<{}, ContainerState> {
// tslint:disable-next-line ban-types
private pendingUpdateFn: any
private requestedFrame: number | undefined

Expand Down Expand Up @@ -64,7 +63,6 @@ export default class Container extends React.Component<{}, ContainerState> {
)
}

// tslint:disable-next-line ban-types
private scheduleUpdate(updateFn: any) {
this.pendingUpdateFn = updateFn

Expand Down
5 changes: 5 additions & 0 deletions packages/examples/.eslintrc
@@ -0,0 +1,5 @@
{
"rules": {
"react/display-name": 0
}
}
Expand Up @@ -76,7 +76,6 @@ const Container: React.FC = () => {
<Dustbin
accepts={accepts}
lastDroppedItem={lastDroppedItem}
// tslint:disable-next-line jsx-no-lambda
onDrop={item => handleDrop(index, item)}
key={index}
/>
Expand Down
1 change: 0 additions & 1 deletion packages/examples/src/01-dustbin/stress-test/index.tsx
@@ -1,4 +1,3 @@
// tslint:disable jsx-no-lambda
declare var require: any
import React, { useState, useEffect, useCallback } from 'react'
import { NativeTypes } from 'react-dnd-html5-backend'
Expand Down
@@ -1,4 +1,3 @@
// tslint:disable max-classes-per-file jsx-no-lambda
import React, { useState, useCallback } from 'react'
import {
DragSource,
Expand Down
@@ -1,4 +1,3 @@
// tslint:disable max-classes-per-file
import React, { useState, useCallback } from 'react'
import { DropTarget, ConnectDropTarget, DropTargetMonitor } from 'react-dnd'
import Colors from './Colors'
Expand Down
1 change: 1 addition & 0 deletions packages/examples/src/04-sortable/stress-test/Card.tsx
Expand Up @@ -33,6 +33,7 @@ const Card: React.FC<CardProps> = memo(
)
},
)
Card.displayName = 'Card'

export default DropTarget(
ItemTypes.CARD,
Expand Down
2 changes: 0 additions & 2 deletions packages/examples/src/04-sortable/stress-test/Container.tsx
Expand Up @@ -13,7 +13,6 @@ export interface ContainerState {
}

export default class Container extends React.Component<{}, ContainerState> {
// tslint:disable-next-line ban-types
private pendingUpdateFn: any
private requestedFrame: number | undefined

Expand Down Expand Up @@ -58,7 +57,6 @@ export default class Container extends React.Component<{}, ContainerState> {
)
}

// tslint:disable-next-line ban-types
private scheduleUpdate(updateFn: any) {
this.pendingUpdateFn = updateFn

Expand Down
1 change: 0 additions & 1 deletion packages/react-dnd-html5-backend/src/BrowserDetector.ts
@@ -1,7 +1,6 @@
import { memoize } from './utils/discount_lodash'

declare global {
// tslint:disable-next-line interface-name
interface Window extends HTMLElement {
safari: any
}
Expand Down
1 change: 0 additions & 1 deletion packages/react-dnd-html5-backend/src/HTML5Backend.ts
Expand Up @@ -22,7 +22,6 @@ import { HTML5BackendContext } from './interfaces'
import { NativeDragSource } from './NativeDragSources/NativeDragSource'

declare global {
// tslint:disable-next-line interface-name
interface Window {
__isReactDndBackendSetUp: boolean | undefined
}
Expand Down
Expand Up @@ -11,7 +11,7 @@ export class NativeDragSource {
configurable: true, // This is needed to allow redefining it later
enumerable: true,
get() {
// tslint:disable-next-line no-console
// eslint-disable-next-line no-console
console.warn(
`Browser doesn't allow reading "${property}" until the drop event.`,
)
Expand Down
1 change: 0 additions & 1 deletion packages/react-dnd/src/DragDropContext.tsx
@@ -1,4 +1,3 @@
/* tslint:disable no-shadowed-variable */
declare var require: any
import * as React from 'react'
import {
Expand Down
1 change: 1 addition & 0 deletions packages/react-dnd/src/DragPreviewImage.tsx
Expand Up @@ -18,5 +18,6 @@ const DragPreviewImage: React.FC<DragPreviewImageProps> = React.memo(
return null
},
)
DragPreviewImage.displayName = 'DragPreviewImage'

export default DragPreviewImage
2 changes: 1 addition & 1 deletion packages/react-dnd/src/SourceConnector.ts
Expand Up @@ -57,7 +57,7 @@ export default class SourceConnector implements Connector {
private lastConnectedDragPreview: any = null
private lastConnectedDragPreviewOptions: any = null

constructor(private backend: Backend) {}
public constructor(private backend: Backend) {}

public receiveHandlerId(newHandlerId: Identifier | null) {
if (this.handlerId === newHandlerId) {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dnd/src/TargetConnector.ts
Expand Up @@ -31,7 +31,7 @@ export default class TargetConnector implements Connector {
private lastConnectedDropTarget: any = null
private lastConnectedDropTargetOptions: any = null

constructor(private backend: Backend) {}
public constructor(private backend: Backend) {}

public get connectTarget() {
return this.dropTarget
Expand Down
1 change: 0 additions & 1 deletion packages/react-dnd/src/__tests__/DragDropContext.spec.tsx
@@ -1,4 +1,3 @@
// tslint:disable max-classes-per-file
import { createDragDropManager } from 'dnd-core'
import * as React from 'react'
import * as TestUtils from 'react-dom/test-utils'
Expand Down
1 change: 0 additions & 1 deletion packages/react-dnd/src/__tests__/DragLayer.spec.tsx
@@ -1,4 +1,3 @@
// tslint:disable max-classes-per-file
import * as React from 'react'
import { DragLayer } from '../index'

Expand Down
1 change: 0 additions & 1 deletion packages/react-dnd/src/__tests__/DragSource.spec.tsx
@@ -1,4 +1,3 @@
// tslint:disable max-classes-per-file
import * as React from 'react'
import * as TestUtils from 'react-dom/test-utils'
import { DragSource } from '../index'
Expand Down
1 change: 0 additions & 1 deletion packages/react-dnd/src/__tests__/DropTarget.spec.tsx
@@ -1,4 +1,3 @@
// tslint:disable max-classes-per-file
import * as React from 'react'
import * as TestUtils from 'react-dom/test-utils'
import { DropTarget } from '../index'
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dnd/src/utils/checkDecoratorArguments.ts
Expand Up @@ -8,7 +8,7 @@ export default function checkDecoratorArguments(
if (process.env.NODE_ENV !== 'production') {
for (const arg of args) {
if (arg && arg.prototype && arg.prototype.render) {
// tslint:disable-next-line no-console
// eslint-disable-next-line no-console
console.error(
'You seem to be applying the arguments in the wrong order. ' +
`It should be ${functionName}(${signature})(Component), not the other way around. ` +
Expand Down
Expand Up @@ -8,7 +8,7 @@ export class CompositeDisposable {
private isDisposed = false
private disposables: Disposable[]

constructor(...disposables: Disposable[]) {
public constructor(...disposables: Disposable[]) {
this.disposables = disposables
}

Expand Down
2 changes: 1 addition & 1 deletion packages/react-dnd/src/utils/disposables/Disposable.ts
Expand Up @@ -37,7 +37,7 @@ export class Disposable {
private isDisposed = false
private action: () => void

constructor(action: any) {
public constructor(action: any) {
this.action = isFunction(action) ? action : noop
}

Expand Down
23 changes: 0 additions & 23 deletions tslint.json

This file was deleted.

0 comments on commit fc44aee

Please sign in to comment.