Skip to content

Commit

Permalink
Cleanup Flow typings
Browse files Browse the repository at this point in the history
* Add explicit Flow typings alongside Typescript typings
* Changed test file suffix
* Changed test file location
* Changed package.json script names for type checking
* Changed Flow config to actually work
* Changed CircleCI config
* Fixed Flow declaration to provide correct and stricter typings
* Removed `lib/` from package.json files
* Removed a bunch of unused Flow types
  • Loading branch information
gf3 committed Mar 6, 2018
1 parent 9c0fa1f commit ea6a1f6
Show file tree
Hide file tree
Showing 32 changed files with 275 additions and 4,465 deletions.
3 changes: 2 additions & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
[ignore]

[include]
declarations/

[libs]
declarations/

[options]
esproposal.class_instance_fields=enable
esproposal.class_static_fields=enable
suppress_comment=.*\\$FlowFixMe
suppress_comment=.*\\$FlowIssue
module.name_mapper='^moment-range$' -> '<PROJECT_ROOT>/lib/moment-range'
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
declarations/
flow-typed/
lib/moment-range_test.js
lib/tests/*
*.test.js
typing-tests/
package-lock.json
karma.conf.js
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
* Added note about supporting older browsers with links to polyfills to the README
* Added moment extension `rangeFromISOString`, changed name from `parseZoneRange`
* Added `snapTo()` method
* Added explicit Flow typing tests

### Changed

Expand All @@ -40,10 +41,26 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
* Changed `prepublish`, `preversion`, `version` scripts to support typescript definitions
* Changed CircleCI config to also run typescript tests
* Changed `parseZoneRange` to `rangeFromISOString` to follow naming conventions. Deprecated `parseZoneRange`.
* Changed typing tests to be grouped by type-checker (flow, typescript)
* Changed test suffix (`_test.js``.test.js`)
* Changed test file location (`./lib/``./lib/tests/`)
* Changed package json script names:
- `flow``check:flow`
- `typescript-test``check:typescript`
* Changed CircleCI to use Node 8.2.0
* Changed CircleCI to use Yarn
* Changed Flow config to find correct declarations
* Changed location of Flow declaration (`./declarations/``./lib/`)

### Fixed

* Fixed `intersect` not creating a new DateRange instance in all cases
* Fixed Flow declaration to provide correct and stricter typings

### Removed

* Removed `lib/` from package.json files
* Removed a bunch of unused Flow types

## [3.1.1]
### Fixed
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,7 @@ yarn install
Do all the things!

``` sh
yarn run check
yarn run test
yarn run lint
```
Expand Down
14 changes: 8 additions & 6 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
machine:
node:
version: 6.1.0
version: 8.2.0
dependencies:
pre:
- npm install --global flow-bin
override:
- yarn
test:
override:
- yarn test
pre:
- npm run lint
- npm run flow
- npm run typescript-test
- yarn lint
- yarn check:flow
- yarn check:typescript
1 change: 1 addition & 0 deletions declarations/moment-range.js.flow
6 changes: 3 additions & 3 deletions declarations/moment.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,12 @@ declare class moment$Moment {
fn: Object;
static range(interval: string): DateRange;
static range(start: Date, end: Date): DateRange;
static range(start: Moment, end: Moment): DateRange;
static range(start: moment$Moment, end: moment$Moment): DateRange;
static isRange(range: any): bool;
range(interval: string): DateRange;
range(start: Date, end: Date): DateRange;
range(start: Moment, end: Moment): DateRange;
rangeFromInterval(interval: string, count?: number, date?: Date|Moment|string): DateRange;
range(start: moment$Moment, end: moment$Moment): DateRange;
rangeFromInterval(interval: string, count?: number, date?: Date|moment$Moment|string): DateRange;
rangeFromISOString(isoTimeInterval: string): DateRange;
within(range: DateRange): bool;

Expand Down
192 changes: 0 additions & 192 deletions flow-typed/npm/babel-core_vx.x.x.js

This file was deleted.

73 changes: 0 additions & 73 deletions flow-typed/npm/babel-eslint_vx.x.x.js

This file was deleted.

Loading

0 comments on commit ea6a1f6

Please sign in to comment.