Hotfix Typescript checker failing

This commit is contained in:
Sam Nolan 2022-04-13 10:07:33 +10:00
parent 263c4271bf
commit f2f885f269
2 changed files with 16 additions and 10 deletions

View File

@ -60,7 +60,8 @@ Please work against `develop` branch. **Do not** work against `master`.
Autopings are set up: if you are not autopinged, you are welcome to comment, but please do not use the formal review feature, send approvals, rejections, or merges. Autopings are set up: if you are not autopinged, you are welcome to comment, but please do not use the formal review feature, send approvals, rejections, or merges.
# Code Quality # Code Quality
- Aim for at least 8/10* quality in ``/packages/squiggle-lang``, and 7/10 quality in ``/packages/components``.
- Aim for at least 8/10\* quality in `/packages/squiggle-lang`, and 7/10 quality in `/packages/components`.
- If you submit a PR that is under a 7, for some reason, describe the reasoning for this in the PR. - If you submit a PR that is under a 7, for some reason, describe the reasoning for this in the PR.
* This quality score is subjective. * This quality score is subjective.
@ -74,6 +75,7 @@ Note: Our codebase used to use `|>`, so there's a lot of that in the system. We'
**Don't use anonymous functions with over three lines** **Don't use anonymous functions with over three lines**
Bad: Bad:
```rescript ```rescript
foo foo
-> E.O.fmap(r => { -> E.O.fmap(r => {
@ -83,7 +85,9 @@ Bad:
r + a + b + c r + a + b + c
} }
``` ```
Good: Good:
```rescript ```rescript
let addingFn = (r => { let addingFn = (r => {
let a = 34; let a = 34;
@ -101,6 +105,7 @@ We'll try this for one month (ending May 5, 2022), then revisit.
Rescript is clever about function inputs. There's custom syntax for default and optional arguments. In the cases where this applies, use it. Rescript is clever about function inputs. There's custom syntax for default and optional arguments. In the cases where this applies, use it.
From https://rescript-lang.org/docs/manual/latest/function: From https://rescript-lang.org/docs/manual/latest/function:
```rescript ```rescript
// radius can be omitted // radius can be omitted
let drawCircle = (~color, ~radius=?, ()) => { let drawCircle = (~color, ~radius=?, ()) => {
@ -114,11 +119,12 @@ let drawCircle = (~color, ~radius=?, ()) => {
**Use named arguments** **Use named arguments**
If a function is called externally (in a different file), and has either: If a function is called externally (in a different file), and has either:
1. Two arguments of the same type 1. Two arguments of the same type
2. Three paramaters or more. 2. Three paramaters or more.
**Module naming: Use x_y as module names** **Module naming: Use x_y as module names**
For example: ``Myname_Myproject_Add.res``. Rescript/Ocaml both require files to have unique names, so long names are needed to keep different parts separate from each other. For example: `Myname_Myproject_Add.res`. Rescript/Ocaml both require files to have unique names, so long names are needed to keep different parts separate from each other.
See [this page](https://dev.to/yawaramin/a-modular-ocaml-project-structure-1ikd) for more information. (Though note that they use two underscores, and we do one. We might refactor that later. See [this page](https://dev.to/yawaramin/a-modular-ocaml-project-structure-1ikd) for more information. (Though note that they use two underscores, and we do one. We might refactor that later.
@ -128,8 +134,8 @@ We have some of this in the Reducer code, but generally discourage it.
**Use interface files (.resi) for files with very public interfaces** **Use interface files (.resi) for files with very public interfaces**
### Recommended Rescript resources ### Recommended Rescript resources
- https://dev.to/yawaramin/a-modular-ocaml-project-structure-1ikd - https://dev.to/yawaramin/a-modular-ocaml-project-structure-1ikd
- https://github.com/avohq/reasonml-code-style-guide - https://github.com/avohq/reasonml-code-style-guide
- https://cs.brown.edu/courses/cs017/content/docs/reasonml-style.pdf - https://cs.brown.edu/courses/cs017/content/docs/reasonml-style.pdf
- https://github.com/ostera/reason-design-patterns/ - https://github.com/ostera/reason-design-patterns/

View File

@ -32,7 +32,7 @@ let makeSampleSetDist = SampleSetDist.make
let evaluate = Reducer.evaluate let evaluate = Reducer.evaluate
@genType @genType
type expressionValue = Reducer_Expression.expressionValue type expressionValue = ReducerInterface_ExpressionValue.expressionValue
@genType @genType
type errorValue = Reducer_ErrorValue.errorValue type errorValue = Reducer_ErrorValue.errorValue