Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StringConstant printed twice #646

Closed
nojaf opened this issue Jan 21, 2020 · 1 comment · Fixed by #764
Closed

StringConstant printed twice #646

nojaf opened this issue Jan 21, 2020 · 1 comment · Fixed by #764

Comments

@nojaf
Copy link
Contributor

nojaf commented Jan 21, 2020

Issue created from fantomas-ui

The word Yarn is repeated under "Yarn" ==> "Format".

Code

#r "paket: groupref build //"
#load ".fake/build.fsx/intellisense.fsx"

open System.IO
open Fake.Core
open Fake.Core.TargetOperators
open Fake.IO
open Fake.IO.Globbing.Operators
open Fake.IO.FileSystemOperators
open Fantomas.FormatConfig
open Fantomas
open Fake.JavaScript

let pwd = Shell.pwd()
let clientDir = pwd </> "src" </> "client"
let yarnSetParams = (fun (c: Yarn.YarnParams) -> { c with WorkingDirectory = clientDir })

let fantomasConfig =
    match CodeFormatter.ReadConfiguration(Shell.pwd()) with
    | Success c -> c
    | _ -> failwith "Cannot parse fantomas-config.json"

let fsharpFiles = !!"src/**/*.fs" -- "src/**/obj/**" -- "src/**/node_modules/**" -- "src/**/.fable/**"

Target.create "Format" (fun _ ->
    fsharpFiles
    |> FakeHelpers.formatCode fantomasConfig
    |> Async.RunSynchronously
    |> printfn "Formatted F# files: %A"

    Yarn.exec "prettier webpack.config.js --write" yarnSetParams)

Target.create "CheckCodeFormat" (fun _ ->
    let needFormatting =
        fsharpFiles
        |> checkCodeAndReport fantomasConfig
        |> Async.RunSynchronously

    match Array.length needFormatting with
    | 0 -> Trace.log "No files need formatting"
    | _ ->
        Trace.log "The following files need formatting:"
        needFormatting |> Array.iter Trace.log
        failwith "Some files need formatting, check output for more info"

    Yarn.exec "prettier webpack.config.js --check" yarnSetParams)

Target.create "Yarn" (fun _ -> Yarn.installFrozenLockFile yarnSetParams)

"Yarn" ==> "Format"

"Yarn" ==> "CheckCodeFormat"

Target.runOrDefault "CheckCodeFormat"

Result

#r "paket: groupref build //"
#load ".fake/build.fsx/intellisense.fsx"

open System.IO
open Fake.Core
open Fake.Core.TargetOperators
open Fake.IO
open Fake.IO.Globbing.Operators
open Fake.IO.FileSystemOperators
open Fantomas.FormatConfig
open Fantomas
open Fake.JavaScript

let pwd = Shell.pwd()
let clientDir = pwd </> "src" </> "client"
let yarnSetParams = (fun (c: Yarn.YarnParams) -> { c with WorkingDirectory = clientDir })

let fantomasConfig =
    match CodeFormatter.ReadConfiguration(Shell.pwd()) with
    | Success c -> c
    | _ -> failwith "Cannot parse fantomas-config.json"

let fsharpFiles = !!"src/**/*.fs" -- "src/**/obj/**" -- "src/**/node_modules/**" -- "src/**/.fable/**"

Target.create "Format" (fun _ ->
    fsharpFiles
    |> FakeHelpers.formatCode fantomasConfig
    |> Async.RunSynchronously
    |> printfn "Formatted F# files: %A"

    Yarn.exec "prettier webpack.config.js --write" yarnSetParams)

Target.create "CheckCodeFormat" (fun _ ->
    let needFormatting =
        fsharpFiles
        |> checkCodeAndReport fantomasConfig
        |> Async.RunSynchronously

    match Array.length needFormatting with
    | 0 -> Trace.log "No files need formatting"
    | _ ->
        Trace.log "The following files need formatting:"
        needFormatting |> Array.iter Trace.log
        failwith "Some files need formatting, check output for more info"

    Yarn.exec "prettier webpack.config.js --check" yarnSetParams)

Target.create "Yarn" (fun _ -> Yarn.installFrozenLockFile yarnSetParams)

"Yarn" ==> "Format"
"Yarn"

"Yarn" ==> "CheckCodeFormat"

Target.runOrDefault "CheckCodeFormat"

Options

Fantomas 3.1.0

Name Value
IndentOnTryWith false
IndentSpaceNum 4
KeepNewlineAfter true
MaxIfThenElseShortWidth 40
PageWidth 120
ReorderOpenDeclaration false
SemicolonAtEndOfLine false
SpaceAfterComma true
SpaceAfterSemicolon true
SpaceAroundDelimiter true
SpaceBeforeArgument true
SpaceBeforeColon false
StrictMode false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant