Skip to content

Commit

Permalink
Update code formatting CI job to fix failures and run prettier (#2046)
Browse files Browse the repository at this point in the history
* Run npm install during format check step.

* Run prettier on existing code.
  • Loading branch information
rocketnova authored Sep 15, 2023
1 parent bb594a2 commit 5c61309
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16
- run: npm install
- run: npm run check-format
build:
runs-on: ubuntu-latest
Expand Down
12 changes: 3 additions & 9 deletions src/api/plugin-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,25 +358,19 @@ export class DataviewApi {
* execution via `result.successful` and obtain `result.value` or `result.error` resultingly. If
* you'd rather this method throw on an error, use `dv.tryEvaluate`.
*/
public evaluate(
expression: string,
context?: DataObject,
originFile?: string): Result<Literal, string> {
public evaluate(expression: string, context?: DataObject, originFile?: string): Result<Literal, string> {
let field = EXPRESSION.field.parse(expression);
if (!field.status) return Result.failure(`Failed to parse expression "${expression}"`);

let evaluationContext = originFile
? new Context(defaultLinkHandler(this.index, originFile), this.settings)
: this.evaluationContext
: this.evaluationContext;

return evaluationContext.evaluate(field.value, context);
}

/** Error-throwing version of `dv.evaluate`. */
public tryEvaluate(
expression: string,
context?: DataObject,
originFile?: string): Literal {
public tryEvaluate(expression: string, context?: DataObject, originFile?: string): Literal {
return this.evaluate(expression, context, originFile).orElseThrow();
}

Expand Down

0 comments on commit 5c61309

Please sign in to comment.