-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate from TSLint to ESLint (#128)
* ci: move from tslint->eslint * fix: addressing eslint errors * fix: remove passing of unused variable * ci: remove unnecessary prettier config
- Loading branch information
Showing
42 changed files
with
393 additions
and
437 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
src/generated/ | ||
.dist/ | ||
dist/ | ||
node_modules/ | ||
.vscode/ | ||
tsd/ | ||
package.json | ||
webpack.config.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,26 @@ | ||
// We are using eslint with the typescript parser plugin only to validate things | ||
// which are not supported in tslint, such as react hooks | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
jsx: true, | ||
sourceType: 'module' | ||
root: true, | ||
env: { | ||
browser: true, | ||
es6: true, | ||
node: true | ||
}, | ||
plugins: ['react-hooks'], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['@typescript-eslint', 'react-hooks', 'jest'], | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:react-hooks/recommended', | ||
'plugin:jest/recommended', | ||
'prettier', | ||
'prettier/@typescript-eslint' | ||
], | ||
rules: { | ||
'react-hooks/rules-of-hooks': 'error' | ||
'no-case-declarations': 'warn', | ||
'jest/no-mocks-import': 'off', | ||
'jest/valid-title': 'off', | ||
'@typescript-eslint/no-var-requires': 'off', | ||
'@typescript-eslint/ban-types': 'warn', | ||
'@typescript-eslint/no-empty-function': 'warn' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,9 +12,8 @@ | |
"build": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' webpack --config webpack.config.ts --mode=development", | ||
"clean": "rm -rf dist", | ||
"codecov": "codecov -f .coverage/coverage-final.json", | ||
"lint": "tslint --project .", | ||
"lint-fix": "tslint --fix --project . && prettier --write './**/*.{js,json}'", | ||
"lint:hooks": "eslint \"src/**/*.{ts,tsx}\"", | ||
"lint": "eslint . --ext .js,.ts,.tsx", | ||
"lint-fix": "eslint . --ext .js,.ts,.tsx --fix", | ||
"mockApi": "node ./mockApi", | ||
"prebuild": "yarn run clean", | ||
"start": "node -r dotenv/config index.js", | ||
|
@@ -36,13 +35,8 @@ | |
"author": "Lyft <[email protected]>", | ||
"license": "Apache-2.0", | ||
"lint-staged": { | ||
"*.{ts,tsx}": [ | ||
"eslint", | ||
"tslint --fix", | ||
"git add" | ||
], | ||
"*.{js,json}": [ | ||
"prettier --write", | ||
"*.{js,ts,tsx}": [ | ||
"eslint --fix", | ||
"git add" | ||
] | ||
}, | ||
|
@@ -131,7 +125,8 @@ | |
"@types/webpack-dev-middleware": "^1.9.2", | ||
"@types/webpack-env": "^1.13.1", | ||
"@types/webpack-hot-middleware": "^2.15.0", | ||
"@typescript-eslint/parser": "^1.0.0", | ||
"@typescript-eslint/eslint-plugin": "^4.9.1", | ||
"@typescript-eslint/parser": "^4.9.1", | ||
"@xstate/react": "^1.0.0", | ||
"add-asset-html-webpack-plugin": "^2.1.3", | ||
"autoprefixer": "^8.3.0", | ||
|
@@ -150,8 +145,11 @@ | |
"d3-shape": "^1.2.2", | ||
"debug": "^3.1.0", | ||
"dom-helpers": "^3.4.0", | ||
"eslint": "^5.12.1", | ||
"eslint-plugin-react-hooks": "^2.3.0", | ||
"eslint": "^7.15.0", | ||
"eslint-config-prettier": "^7.0.0", | ||
"eslint-plugin-jest": "^24.1.3", | ||
"eslint-plugin-react": "^7.21.5", | ||
"eslint-plugin-react-hooks": "^4.2.0", | ||
"favicons-webpack-plugin": "^1.0.2", | ||
"file-loader": "^1.1.11", | ||
"fork-ts-checker-webpack-plugin": "^4.0.3", | ||
|
@@ -193,12 +191,7 @@ | |
"ts-jest": "^26.3.0", | ||
"ts-loader": "^6.2.1", | ||
"ts-node": "^8.0.2", | ||
"tslint": "^5.20.1", | ||
"tslint-config-airbnb": "^5.11.2", | ||
"tslint-config-prettier": "^1.18.0", | ||
"tslint-plugin-prettier": "^2.0.1", | ||
"tslint-react": "^4.1.0", | ||
"typescript": "^4.0.0", | ||
"typescript": "^4.1.2", | ||
"uglifyjs-webpack-plugin": "^1.2.5", | ||
"url-search-params": "^0.10.0", | ||
"use-react-router": "^1.0.7", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
import { RefObject } from 'react'; | ||
import { correctInputErrors } from './constants'; | ||
import { WorkflowLaunchContext } from './launchMachine'; | ||
import { LaunchFormInputsRef } from './types'; | ||
|
||
export async function validate( | ||
formInputsRef: RefObject<LaunchFormInputsRef>, | ||
{}: WorkflowLaunchContext | ||
) { | ||
formInputsRef: RefObject<LaunchFormInputsRef> | ||
): Promise<boolean> { | ||
if (formInputsRef.current === null) { | ||
throw new Error('Unexpected empty form inputs ref'); | ||
} | ||
|
||
if (!formInputsRef.current.validate()) { | ||
throw new Error(correctInputErrors); | ||
} | ||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.