Skip to content

Commit

Permalink
some more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
zth committed Nov 18, 2022
1 parent b7ff499 commit 6ad2b0f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ module ReScriptTransformer = {
| (#property, Some([{typ: #string, value: Some(name)}, rawValue])) =>
switch (name->Js.Json.decodeString, rawValue->transformNode(~ctx)) {
| (Some(name), Some(value)) =>
let _ = properties->Array.push({
properties->Array.push({
loc: child->rangeFromNode(~lineLookup=ctx.lineLookup),
name,
value,
Expand Down Expand Up @@ -206,7 +206,7 @@ module Path = {
},
text: currentCtx.paramName,
}
let _ = foundPathParams->Array.push(
foundPathParams->Array.push(
if currentCtx.matchBranches->Array.length > 0 {
PathParamWithMatchBranches(textNode, currentCtx.matchBranches)
} else {
Expand Down Expand Up @@ -425,7 +425,7 @@ module Path = {
}
ctx.addDecodeError(~loc=queryParamLoc, ~message)
| Ok(queryParam) =>
let _ = foundQueryParams->Array.push({
foundQueryParams->Array.push({
name: {
text: key,
loc: keyLoc,
Expand Down Expand Up @@ -519,8 +519,7 @@ module Path = {
->Array.forEach(param => {
switch queryParamsResult->Array.some(p => p.name.text == param.name.text) {
| true => ()
| false =>
let _ = queryParamsResult->Array.push(param)
| false => queryParamsResult->Array.push(param)
}
})

Expand Down Expand Up @@ -629,10 +628,8 @@ module Decode = {

children->Array.forEach(child =>
switch child->decodeRouteChild(~ctx, ~siblings=foundChildren, ~parentContext) {
| Error(parseError) =>
let _ = ctx.addDecodeError(~loc=parseError.loc, ~message=parseError.message)
| Ok(routeChild) =>
let _ = foundChildren->Array.push(routeChild)
| Error(parseError) => ctx.addDecodeError(~loc=parseError.loc, ~message=parseError.message)
| Ok(routeChild) => foundChildren->Array.push(routeChild)
}
)

Expand Down Expand Up @@ -720,8 +717,7 @@ module Decode = {
->Array.forEach(param =>
switch params->Array.includes(param) {
| true => ()
| false =>
let _ = params->Array.push(param)
| false => params->Array.push(param)
}
)

Expand Down Expand Up @@ -911,7 +907,7 @@ let rec parseRouteFile = (
routeFileName,
lineLookup,
addDecodeError: (~loc, ~message) => {
let _ = decodeErrors->Array.push({
decodeErrors->Array.push({
routeFileName,
loc,
message,
Expand Down Expand Up @@ -970,7 +966,7 @@ let rec parseRouteFile = (
->Option.forEach(parseError => {
let linesAndColumns = Bindings.LinesAndColumns.make(content)

let _ = decodeErrors->Array.push({
decodeErrors->Array.push({
routeFileName,
message: switch parseError.error
->JsoncParser.decodeParseErrorCode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ let rec routeChildrenToPrintable = (routeChildren: array<routeChild>): array<pri
and mapRouteChild = (child, ~routes) => {
switch child {
| Include({content}) => content->Array.forEach(child => mapRouteChild(child, ~routes))
| RouteEntry(routeEntry) =>
let _ = routes->Array.push(parsedToPrintable(routeEntry))
| RouteEntry(routeEntry) => routes->Array.push(parsedToPrintable(routeEntry))
}
}
and parsedToPrintable = (routeEntry: routeEntry): printableRoute => {
Expand Down
4 changes: 2 additions & 2 deletions packages/rescript-relay-router/cli/lsp/Lsp.res
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ let start = (~mode, ~config: config) => {
CurrentContext.getCurrentRouteStructure(lspResolveContext).errors
->Resolvers.diagnostics
->Array.forEach(((fileName, diagnostics)) => {
let _ = currentFilesWithDiagnostics->Array.push(fileName)
currentFilesWithDiagnostics->Array.push(fileName)

PublishDiagnostics({
uri: Utils.pathInRoutesFolder(
Expand Down Expand Up @@ -567,7 +567,7 @@ let start = (~mode, ~config: config) => {
->send
} else {
shutdownRequestAlreadyReceived := true
let _ = theWatcher->Bindings.Chokidar.Watcher.close
theWatcher->Bindings.Chokidar.Watcher.close->Promise.done
Message.Response.make(~id=msg->Message.getId, ~result=Message.Result.null(), ())
->Message.Response.asMessage
->send
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ let codeLens = (routeStructure: routeStructure, ~ctx: lspResolveContext): option
> => {
let lenses: array<LspProtocol.codeLens> = []
let addLens = (~range, ~command, ()) => {
let _ = lenses->Array.push(LspProtocol.makeCodeLensItem(~command, ~range))
lenses->Array.push(LspProtocol.makeCodeLensItem(~command, ~range))
}

let rec traverse = (routeChild, ~ctx) => {
Expand Down Expand Up @@ -453,7 +453,7 @@ let documentLinks = (routeStructure: routeStructure, ~ctx: lspResolveContext): o

@live
let addDocumentLink = (~range, ~fileUri, ~tooltip=?, ()) => {
let _ = documentLinks->Array.push(LspProtocol.makeDocumentLink(~range, ~fileUri, ~tooltip?, ()))
documentLinks->Array.push(LspProtocol.makeDocumentLink(~range, ~fileUri, ~tooltip?, ()))
}

let rec traverse = (routeChild, ~ctx: lspResolveContext) => {
Expand Down

0 comments on commit 6ad2b0f

Please sign in to comment.