Implement the beautifier - #1
Conversation
beautifier-template commit 1bc3ac0aed659b8d33a04e1c76995923efc83d86
Includes a basic test that passes.
Consider using something like: https://www.npmjs.com/package/strip-ansi |
|
@Glavin001 please give me more access to this so I can add to CodeClimate. |
|
It would be really nice to make do without us caring about ANSI colors. Since this is still work in progress, I'll try to persuade upstream to take care of it so we get plain text output without ANSI. |
|
@lassik I'll add this to the beautifier-template as well, but could you please add a |
| cache: | ||
| directories: | ||
| - node_modules | ||
| before_script: |
There was a problem hiding this comment.
According to the Travis build log, at least elm-format --help is running fine when we have only elm-format installed without the rest of the Elm toolchain. Does it show an error somewhere?
There was a problem hiding this comment.
Yeah, the error is being written to stdout for some reason.
"I couldn't figure out what version of Elm you are using!
You should either run elm-format from the directory containing
your elm.json (for Elm 0.19) or elm-package.json (for Elm 0.18),
or tell me which version of Elm with --elm-version=0.19 or --elm-version=0.18
"
There was a problem hiding this comment.
Awesome that you noticed that, I didn't notice at all and still can't find it :-D Tried grepping the raw logs of the latest build. Anyway, I think it's saying we need an Elm project file or a command line option to let it know the Elm version. Probably we don't actually need to have that version of Elm installed. I'll try adding --elm-version= to the unit test.
There was a problem hiding this comment.
If it's reporting an error to stdout when you try to format stdin->stdout, we need to file a bug report about that..
There was a problem hiding this comment.
I'll try adding --elm-version= to the unit test.
I would send the projectPath into the beautify method, then include cwd: projectPath in the options
There was a problem hiding this comment.
That might work. The latest version of elm-format supports both Elm 0.18 and Elm 0.19. It determines the version based on the presence of elm-package.json (0.18) or elm.json (0.19) in the current directory. That means strictly the current directory only - it doesn't look in parent directories. There's also a command line flag to control the Elm version but that seems like a more difficult solution for end users.
There was a problem hiding this comment.
I've been debating whether elm-format should check the elm version for each file starting at the file and traversing up directories until it finds elm.json or elm-package.json, instead of looking in the current directory. It seems like that would probably be more correct for more cases. What do you think? (In any case, that would be in elm-format 0.8.2 at the earliest)
There was a problem hiding this comment.
Great to see you here @avh4. You really care about your project! You already seem to have an issue about this at avh4/elm-format#561 so let's continue discussion there to make sure everyone can find it :) For this plugin, the most useful missing elm-format feature would be using isatty() (in Haskell, queryTerminal) to disable ANSI output when stderr is not going a terminal.
There was a problem hiding this comment.
Discussion about Elm version number is ongoing in #2
|
@stevenzeck Try now, you should be an Admin 👍 . |
| @@ -0,0 +1,35 @@ | |||
| env: | |||
| global: | |||
| - CC_TEST_REPORTER_ID= | |||
There was a problem hiding this comment.
The ID is: 0288dbd5e8a04d83f7e4e86710d77c540968fc4e791afe95e5d3aa79e20b90f9
Glavin001
left a comment
There was a problem hiding this comment.
Tests running within Travis CI are currently failing.
|
To make the test pass, we need to decide how to pass the Elm version number. |
|
Until we do a language version option in Unibeautify core, I think you'll need to have those config json files. |
|
Yeah, I guess we could add an empty |
|
Then again, maybe the failing test is a good reminder that we have to solve the problem properly at some point. |
It may take a little while before I have time to implement Unibeautify/unibeautify#196 I think adding a note in this README that |
Uh oh!
There was an error while loading. Please reload this page.