Skip to content

Commit

Permalink
remove flow infra and use TS
Browse files Browse the repository at this point in the history
  • Loading branch information
saihaj authored and IvanGoncharov committed Dec 14, 2021
1 parent e0db753 commit 08a4a87
Show file tree
Hide file tree
Showing 22 changed files with 172 additions and 1,186 deletions.
2 changes: 1 addition & 1 deletion .babelrc-npm.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"plugins": ["@babel/plugin-transform-flow-strip-types"],
"plugins": ["@babel/plugin-transform-typescript"],
"presets": [
[
"@babel/preset-env",
Expand Down
2 changes: 1 addition & 1 deletion .babelrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"plugins": ["@babel/plugin-transform-flow-strip-types"],
"plugins": ["@babel/plugin-transform-typescript"],
"presets": [
[
"@babel/preset-env",
Expand Down
3 changes: 0 additions & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,3 @@
node_modules
coverage
npmDist

# Ignore Flow typings for 3rd-party libraries
/flow-typed
65 changes: 5 additions & 60 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -428,61 +428,6 @@ rules:
yield-star-spacing: off

overrides:
- files: 'src/**/*.js'
parser: '@babel/eslint-parser'
parserOptions:
sourceType: module
plugins:
- flowtype

rules:
##############################################################################
# `eslint-plugin-flowtype` rule list based on `v5.3.x`
# https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype
##############################################################################

flowtype/array-style-complex-type: error
flowtype/array-style-simple-type: error
flowtype/define-flow-type: error
flowtype/newline-after-flow-annotation: error
flowtype/no-dupe-keys: error
flowtype/no-existential-type: off # checked by Flow
flowtype/no-flow-fix-me-comments: off
flowtype/no-mixed: off
flowtype/no-mutable-array: off
flowtype/no-primitive-constructor-types: error
flowtype/no-types-missing-file-annotation: off
flowtype/no-unused-expressions: off
flowtype/no-weak-types: [error, { any: false }]
flowtype/require-compound-type-alias: off
flowtype/require-exact-type: [error, never]
flowtype/require-indexer-name: error
flowtype/require-inexact-type: off # checked by Flow
flowtype/require-parameter-type: off
flowtype/require-readonly-react-props: off
flowtype/require-return-type: off
flowtype/require-types-at-top: off
flowtype/require-valid-file-annotation: off
flowtype/require-variable-type: off
flowtype/sort-keys: off
flowtype/spread-exact-type: off
flowtype/type-id-match: [error, '^[A-Z]']
flowtype/type-import-style: [error, declaration]
flowtype/use-flow-type: error

# Bellow rules are disabled because coflicts with Prettier, see:
# https://github.com/prettier/eslint-config-prettier/blob/master/flowtype.js
flowtype/arrow-parens: off
flowtype/boolean-style: off
flowtype/delimiter-dangle: off
flowtype/generic-spacing: off
flowtype/object-type-curly-spacing: off
flowtype/object-type-delimiter: off
flowtype/semi: off
flowtype/space-after-type-colon: off
flowtype/space-before-generic-bracket: off
flowtype/space-before-type-colon: off
flowtype/union-intersection-spacing: off
- files: '**/*.ts'
parser: '@typescript-eslint/parser'
parserOptions:
Expand All @@ -505,7 +450,7 @@ overrides:
'@typescript-eslint/ban-ts-comment': [error, { 'ts-expect-error': false }]
'@typescript-eslint/ban-tslint-comment': error
'@typescript-eslint/ban-types': error
'@typescript-eslint/class-literal-property-style': off # TODO enable after TS conversion
'@typescript-eslint/class-literal-property-style': error
'@typescript-eslint/consistent-indexed-object-style': off # TODO enable after TS conversion
'@typescript-eslint/consistent-type-assertions':
[error, { assertionStyle: as, objectLiteralTypeAssertions: never }]
Expand All @@ -527,7 +472,7 @@ overrides:
'@typescript-eslint/no-extraneous-class': off # TODO consider
'@typescript-eslint/no-floating-promises': error
'@typescript-eslint/no-for-in-array': error
'@typescript-eslint/no-implicit-any-catch': off # TODO: Enable after TS convertion
'@typescript-eslint/no-implicit-any-catch': error
'@typescript-eslint/no-implied-eval': error
'@typescript-eslint/no-inferrable-types':
[error, { ignoreParameters: true, ignoreProperties: true }]
Expand All @@ -542,7 +487,7 @@ overrides:
'@typescript-eslint/no-this-alias': error
'@typescript-eslint/no-type-alias': off # TODO consider
'@typescript-eslint/no-unnecessary-boolean-literal-compare': error
'@typescript-eslint/no-unnecessary-condition': error
'@typescript-eslint/no-unnecessary-condition': off # TODO temporarily disabled
'@typescript-eslint/no-unnecessary-qualifier': error
'@typescript-eslint/no-unnecessary-type-arguments': error
'@typescript-eslint/no-unnecessary-type-assertion': error
Expand All @@ -555,7 +500,7 @@ overrides:
'@typescript-eslint/non-nullable-type-assertion-style': error
'@typescript-eslint/prefer-as-const': off # TODO consider
'@typescript-eslint/prefer-enum-initializers': off # TODO consider
'@typescript-eslint/prefer-for-of': off # TODO switch to error after TS migration
'@typescript-eslint/prefer-for-of': error
'@typescript-eslint/prefer-function-type': error
'@typescript-eslint/prefer-includes': off # TODO switch to error after IE11 drop
'@typescript-eslint/prefer-literal-enum-member': error
Expand Down Expand Up @@ -630,7 +575,7 @@ overrides:
'@typescript-eslint/require-await': error
'@typescript-eslint/return-await': error

# Disable for JS, Flow and TS
# Disable for JS and TS
'@typescript-eslint/init-declarations': off
'@typescript-eslint/no-magic-numbers': off
'@typescript-eslint/no-use-before-define': off
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Lint ESLint
run: npm run lint

- name: Lint Flow
- name: Check TypeScript
run: npm run check

- name: Lint Prettier
Expand Down
2 changes: 1 addition & 1 deletion .mocharc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
throw-deprecation: true
check-leaks: true
require:
- '@babel/register'
- 'resources/ts-register.js'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ After cloning this repo, ensure dependencies are installed by running:
npm install
```

This library is written in ES6 and uses [Babel](https://babeljs.io/) for ES5 transpilation and [Flow](https://flow.org/) for type safety. Widely consumable JavaScript can be produced by running:
This library is written in ES6 and uses [Babel](https://babeljs.io/) for ES5 transpilation and [TypeScript](https://www.typescriptlang.org/) for type safety. Widely consumable JavaScript can be produced by running:

```sh
npm run build
Expand Down
1 change: 0 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"npmDist",

// Excluded from spelling check
"flow-typed",
"cspell.json",
"package.json",
"package-lock.json",
Expand Down
Loading

0 comments on commit 08a4a87

Please sign in to comment.