From 8215d7f447aeb43e835c2db4840bbd05414dfbd5 Mon Sep 17 00:00:00 2001 From: soulwu Date: Tue, 21 Jan 2020 11:37:47 +0800 Subject: [PATCH] fix: fix type lint (#628) * fix: fix type * feat: add @typescript-eslint/no-unused-vars to eslint * fix: fix lint --- packages/.eslintrc | 20 ++++++-------------- packages/next/src/fields/table.tsx | 14 ++++++-------- packages/next/src/types.ts | 7 +------ packages/react-schema-editor/src/index.tsx | 2 +- packages/shared/src/deprecate.ts | 1 + 5 files changed, 15 insertions(+), 29 deletions(-) diff --git a/packages/.eslintrc b/packages/.eslintrc index 9e971f60cda..471c9a89a3e 100644 --- a/packages/.eslintrc +++ b/packages/.eslintrc @@ -3,7 +3,7 @@ "extends": [ "plugin:react/recommended", "plugin:@typescript-eslint/recommended", - "prettier/@typescript-eslint", + "prettier/@typescript-eslint" ], "env": { "browser": true, @@ -11,12 +11,7 @@ "jest": true, "commonjs": true }, - "plugins": [ - "@typescript-eslint", - "react", - "react-hooks", - "prettier" - ], + "plugins": ["@typescript-eslint", "react", "react-hooks", "prettier"], "parserOptions": { "project": "./tsconfig.json", "sourceType": "module", @@ -27,7 +22,7 @@ }, "settings": { "react": { - "version": "detect", + "version": "detect" } }, "rules": { @@ -50,15 +45,12 @@ "@typescript-eslint/array-type": 0, "@typescript-eslint/no-object-literal-type-assertion": 0, "@typescript-eslint/no-use-before-define": 0, + "@typescript-eslint/no-unused-vars": 2, "no-console": [ "error", { - "allow": [ - "warn", - "error", - "info" - ] + "allow": ["warn", "error", "info"] } ] } -} \ No newline at end of file +} diff --git a/packages/next/src/fields/table.tsx b/packages/next/src/fields/table.tsx index 367e6b2c00e..ef9016ff707 100644 --- a/packages/next/src/fields/table.tsx +++ b/packages/next/src/fields/table.tsx @@ -1,4 +1,4 @@ -import React, { forwardRef, useRef } from 'react' +import React, { forwardRef } from 'react' import { registerFormField, ISchemaFieldComponentProps, @@ -12,11 +12,9 @@ import { Table, Form, Icon } from '@alifd/next' import styled from 'styled-components' import { CompatNextFormItemProps } from '../compat/FormItem' import cls from 'classnames' -import { - IDragableRowProps, - IDragableTableProps, - IDragHandlerCellProps -} from '../types' +import { IDragableRowProps, IDragHandlerCellProps } from '../types' + +const SelectionRow = (Table as any).SelectionRow const ArrayComponents = { Wrapper: Table, @@ -76,9 +74,9 @@ const DragableRow = forwardRef( const [firstCol, ...otherCols] = columns return ( - {} + const handleCodeChange = () => {} const isRoot = selectedPath === 'root' diff --git a/packages/shared/src/deprecate.ts b/packages/shared/src/deprecate.ts index 48a7c39bb35..a830bd2ebd7 100644 --- a/packages/shared/src/deprecate.ts +++ b/packages/shared/src/deprecate.ts @@ -8,6 +8,7 @@ export function deprecate( help?: string ) { if (isFn(method)) { + // eslint-disable-next-line @typescript-eslint/no-unused-vars return function(p1?: P1, p2?: P2, p3?: P3, p4?: P4, p5?: P5) { deprecate(message, help) return method.apply(this, arguments)