-
Notifications
You must be signed in to change notification settings - Fork 1
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
Implement the beautifier #1
base: master
Are you sure you want to change the base?
Changes from 6 commits
c6c80fa
168b505
0c69896
4599ab1
963e0df
d455ee8
e0cba27
f69894c
a94710b
e2b99bc
bbda22a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
version: "2" | ||
checks: | ||
argument-count: | ||
enabled: true | ||
config: | ||
threshold: 3 | ||
complex-logic: | ||
enabled: true | ||
config: | ||
threshold: 4 | ||
file-lines: | ||
enabled: false | ||
config: | ||
threshold: 250 | ||
method-complexity: | ||
enabled: true | ||
config: | ||
threshold: 5 | ||
method-count: | ||
enabled: true | ||
config: | ||
threshold: 20 | ||
method-lines: | ||
enabled: true | ||
config: | ||
threshold: 50 | ||
nested-control-flow: | ||
enabled: true | ||
config: | ||
threshold: 4 | ||
return-statements: | ||
enabled: true | ||
config: | ||
threshold: 4 | ||
similar-code: | ||
enabled: true | ||
config: | ||
threshold: #language-specific defaults. overrides affect all languages. | ||
identical-code: | ||
enabled: true | ||
config: | ||
threshold: #language-specific defaults. overrides affect all languages. | ||
exclude_patterns: | ||
- "dist/" | ||
- "**/node_modules/" | ||
- "/test/" | ||
- "**/*.d.ts" | ||
plugins: | ||
fixme: | ||
enabled: true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!dist/**/* |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
env: | ||
global: | ||
- CC_TEST_REPORTER_ID= | ||
language: node_js | ||
node_js: | ||
- "8" | ||
- "10" | ||
os: | ||
- linux | ||
- osx | ||
cache: | ||
directories: | ||
- node_modules | ||
before_script: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You need to install elm as well There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to the Travis build log, at least There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, the error is being written to stdout for some reason.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I would send the projectPath into the beautify method, then include There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Discussion about Elm version number is ongoing in #2 |
||
- npm install -g elm-format | ||
- which elm-format | ||
- elm-format --help | ||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then | ||
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter; | ||
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then | ||
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-darwin-amd64 > ./cc-test-reporter; | ||
lassik marked this conversation as resolved.
Show resolved
Hide resolved
|
||
else | ||
echo Error:TRAVIS_OS_NAME && exit 1; | ||
fi | ||
- chmod +x ./cc-test-reporter | ||
- ./cc-test-reporter before-build | ||
script: | ||
|
||
lassik marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- npm test | ||
after_script: | ||
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT | ||
notifications: | ||
email: | ||
on_success: never | ||
on_failure: change |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
TypeScript: | ||
beautifiers: ["Prettier"] | ||
align_assignments: false | ||
arrow_parens: "as-needed" | ||
break_chained_methods: true | ||
end_with_comma: true | ||
end_with_semicolon: true | ||
indent_char: " " | ||
indent_size: 2 | ||
jsx_brackets: false | ||
multiline_ternary: true | ||
object_curly_spacing: true | ||
quotes: "double" | ||
space_after_anon_function: false | ||
wrap_line_length: 80 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
|
||
{ | ||
"type": "node", | ||
"name": "Jest Tests", | ||
"request": "launch", | ||
"args": [ | ||
"--config", | ||
"jest.config.js", | ||
"--runInBand", | ||
"--coverage", | ||
"false" | ||
], | ||
"runtimeArgs": [ | ||
"--nolazy" | ||
], | ||
"sourceMaps": true, | ||
"cwd": "${workspaceFolder}", | ||
"protocol": "inspector", | ||
"program": "${workspaceFolder}/node_modules/jest/bin/jest", | ||
"outFiles": ["${workspaceRoot}/dist/"] | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +0,0 @@ | ||
MIT License | ||
lassik marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Copyright (c) 2018 Unibeautify | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,19 @@ | ||
# beautifier-elm-format | ||
Elm-format beautifier for Unibeautify | ||
|
||
[](https://travis-ci.com/Unibeautify/beautifier-elm-format) [](https://renovateapp.com/) | ||
|
||
> [elm-format](https://github.com/avh4/elm-format) beautifier for [Unibeautify](https://github.com/Unibeautify) | ||
|
||
## Installation | ||
|
||
```bash | ||
npm install --global @unibeautify/beautifier-elm-format | ||
``` | ||
|
||
## Contributing | ||
|
||
See [CONTRIBUTING.md](CONTRIBUTING.md) | ||
|
||
## Usage | ||
|
||
See [`unibeautify-cli`](https://github.com/Unibeautify/unibeautify-cli) for details. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
"use strict"; | ||
|
||
module.exports = { | ||
transform: { | ||
"^.+\\.tsx?$": "ts-jest" | ||
}, | ||
testRegex: "test/.+\\.(test|spec)\\.ts$", | ||
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"], | ||
collectCoverage: true, | ||
coverageReporters: ["json", "lcov", "text", "html"] | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ID is: 0288dbd5e8a04d83f7e4e86710d77c540968fc4e791afe95e5d3aa79e20b90f9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Committed