You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: www/README.md
+24-24Lines changed: 24 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -46,10 +46,10 @@ To run the development build, simply run:
46
46
$ yarn start
47
47
```
48
48
49
-
This will start webpack dev server, which will automatically rebuild and reload any code and components that you have changed. If your editor or IDE has built in support for Flow/ESLint/StyleLint, you can disable them to speed up the build process.
49
+
This will start Webpack dev server, which will automatically rebuild and reload any code and components that you have changed. If your editor or IDE has built in support for ESLint/StyleLint, you can disable them to speed up the build process.
@@ -250,7 +254,7 @@ class MyComponent extends Component<Props> {
250
254
return<ErrorPage />;
251
255
}
252
256
253
-
if (!data) {
257
+
if (data==null) {
254
258
return<LoadingSpinner />;
255
259
}
256
260
@@ -271,21 +275,16 @@ If you need to access the status of a request from outside the component which i
271
275
272
276
NUSMods tries to be as lean as possible. Adding external dependencies should be done with care to avoid bloating our bundle. Use [Bundlephobia][bundlephobia] to ensure the new dependency is reasonably sized, or if the dependency is limited to one specific page/component, use code splitting to ensure the main bundle's size is not affected.
273
277
274
-
#### Flow libdef
278
+
#### TypeScript libdef
275
279
276
-
When adding a JavaScript package, Flow requires a library definition, or libdef. To try to install one from the [community repository][flow-typed], use the `flow-typed` command. If a community libdef is not available, the same command can also be used to create a stub libdef which you can use immediately in a pinch, or edit to fill in the correct definitions.
280
+
When adding a JavaScript package, Flow requires a library definition, or libdef. To try to install one from the [community repository][definitely-typed], install `@types/<package name>`. Make sure the installed libdef's version matches that of the package.
277
281
278
-
```sh
279
-
# Use ./node_modules/.bin/flow-typed if you don't want to use npx
If a community libdef is not available, you can try writing your own and placing it in `js/types/vendor`.
281
283
282
-
# Use create-stub for packages without community libdef
283
-
npx flow-typed create-stub my-dep
284
-
```
285
284
286
285
### Testing and Linting
287
286
288
-
We use [Jest][jest] with [Enzyme][enzyme] to test our code and React components, [Flow][flow] for typechecking, [Stylelint][stylelint] and [ESLint][eslint] using [Airbnb config][eslint-airbnb] and [Prettier][prettier] for linting and formatting.
287
+
We use [Jest][jest] with [Enzyme][enzyme] to test our code and React components, [TypeScript][ts] for typechecking, [Stylelint][stylelint] and [ESLint][eslint] using [Airbnb config][eslint-airbnb] and [Prettier][prettier] for linting and formatting.
289
288
290
289
```sh
291
290
# Run all tests once with code coverage
@@ -305,8 +304,8 @@ $ yarn lint:code
305
304
# p.s. Use yarn lint:styles --fix withcare (it's experimental),
306
305
# remember to reset changes for themes.scss.
307
306
308
-
# Run Flow type checking
309
-
$ yarn flow
307
+
# Run TypeScript type checking
308
+
$ yarn typecheck
310
309
```
311
310
312
311
#### End to End testing
@@ -366,7 +365,8 @@ $ yarn promote-staging # Promote ./dist to production
366
365
│ │ ├── test-utils - Utilities for testing - this directory is not counted
367
366
│ │ │ for test coverage
368
367
│ │ ├── timetable-export - Entry point for timetable only build for exports
369
-
│ │ ├── types - Flow type definitions
368
+
│ │ ├── types - Type definitions
369
+
│ │ └── vendor - Types for third party libaries
370
370
│ │ ├── utils - Utility functions and classes
371
371
│ │ └── views
372
372
│ │ ├── components - Reusable components
@@ -411,7 +411,7 @@ Components should keep their styles and tests in the same directory with the sam
0 commit comments