Merge pull request #240 from quantified-uncertainty/hotfix-typescript-check
Hotfix Typescript checker failing
This commit is contained in:
commit
550acb552a
|
@ -51,7 +51,7 @@ See [here](https://github.com/NixOS/nixpkgs/issues/107375)
|
|||
|
||||
# Pull request protocol
|
||||
|
||||
Please work against `develop` branch. **Do not** work against `master`.
|
||||
Please work against `develop` branch. **Do not** work against `master`.
|
||||
|
||||
- For rescript code: Quinn and Ozzie are reviewers
|
||||
- For js or typescript code: Sam and Ozzie are reviewers
|
||||
|
@ -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.
|
||||
|
||||
# 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.
|
||||
|
||||
* 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**
|
||||
Bad:
|
||||
|
||||
```rescript
|
||||
foo
|
||||
-> E.O.fmap(r => {
|
||||
|
@ -83,7 +85,9 @@ Bad:
|
|||
r + a + b + c
|
||||
}
|
||||
```
|
||||
|
||||
Good:
|
||||
|
||||
```rescript
|
||||
let addingFn = (r => {
|
||||
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.
|
||||
|
||||
From https://rescript-lang.org/docs/manual/latest/function:
|
||||
|
||||
```rescript
|
||||
// radius can be omitted
|
||||
let drawCircle = (~color, ~radius=?, ()) => {
|
||||
|
@ -114,22 +119,23 @@ let drawCircle = (~color, ~radius=?, ()) => {
|
|||
|
||||
**Use named arguments**
|
||||
If a function is called externally (in a different file), and has either:
|
||||
|
||||
1. Two arguments of the same type
|
||||
2. Three paramaters or more.
|
||||
|
||||
**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.
|
||||
|
||||
**Module naming: Don't rename modules**
|
||||
We have some of this in the Reducer code, but generally discourage it.
|
||||
We have some of this in the Reducer code, but generally discourage it.
|
||||
|
||||
**Use interface files (.resi) for files with very public interfaces**
|
||||
|
||||
### Recommended Rescript resources
|
||||
- https://dev.to/yawaramin/a-modular-ocaml-project-structure-1ikd
|
||||
- https://github.com/avohq/reasonml-code-style-guide
|
||||
- https://cs.brown.edu/courses/cs017/content/docs/reasonml-style.pdf
|
||||
- https://github.com/ostera/reason-design-patterns/
|
||||
### Recommended Rescript resources
|
||||
|
||||
- https://dev.to/yawaramin/a-modular-ocaml-project-structure-1ikd
|
||||
- https://github.com/avohq/reasonml-code-style-guide
|
||||
- https://cs.brown.edu/courses/cs017/content/docs/reasonml-style.pdf
|
||||
- https://github.com/ostera/reason-design-patterns/
|
||||
|
|
|
@ -6,7 +6,7 @@ module Js = Reducer_Js
|
|||
module MathJs = Reducer_MathJs
|
||||
|
||||
@genType
|
||||
type expressionValue = Reducer_Expression.expressionValue
|
||||
type expressionValue = ReducerInterface_ExpressionValue.expressionValue
|
||||
|
||||
@genType
|
||||
let evaluate: string => result<expressionValue, Reducer_ErrorValue.errorValue>
|
||||
|
|
|
@ -32,7 +32,7 @@ let makeSampleSetDist = SampleSetDist.make
|
|||
let evaluate = Reducer.evaluate
|
||||
|
||||
@genType
|
||||
type expressionValue = Reducer_Expression.expressionValue
|
||||
type expressionValue = ReducerInterface_ExpressionValue.expressionValue
|
||||
|
||||
@genType
|
||||
type errorValue = Reducer_ErrorValue.errorValue
|
||||
|
|
Loading…
Reference in New Issue
Block a user