-
Notifications
You must be signed in to change notification settings - Fork 25
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
Introduce prettier to format JavaScript (.js) and Sass (.scss) files #594
Changes from all commits
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 |
---|---|---|
@@ -1,4 +1,11 @@ | ||
# rhino 1.8.0 | ||
# rhino (development version) | ||
|
||
1. Introduce `format_js()` and `format_sass()` powered by [prettier](https://prettier.io). | ||
* **Note:** `lint_js()` and `lint_sass()` report styling errors. | ||
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. Please add an entry for the migration guide (remove |
||
They _might_ complain about formatting done with `format_js()` and `format_sass()` functions; however, we haven't spotted any issues so far. | ||
If you face any problems with this, then please [raise an issue on GitHub](https://github.com/Appsilon/rhino/issues/new/choose) | ||
|
||
# [rhino 1.8.0](https://github.com/Appsilon/rhino/releases/tag/v1.8.0) | ||
|
||
1. All linter functions migrated to `box.linters`. New rhino projects will be configured to use linters from `box.linters`. | ||
2. Updated GitHub Workflow template triggers. | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** @type {import("prettier").Config} */ | ||
export default { | ||
overrides: [ | ||
{ | ||
files: "../app/js/**/*.js", | ||
options: { | ||
singleQuote: true, | ||
}, | ||
}, | ||
], | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
rhino::format_js() | ||
|
||
# Create bad scripts and test if formatting returns the expected result | ||
test_file_path <- fs::path("app", "js", "bad-style.js") | ||
cat('const someFunction = (a ,b) => a+ b + "asdf"', file = test_file_path) | ||
rhino::format_js() | ||
testthat::expect_identical( | ||
readLines(test_file_path), | ||
"const someFunction = (a, b) => a + b + 'asdf';" | ||
) | ||
|
||
# Clean up | ||
file.remove(test_file_path) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
rhino::format_sass() | ||
|
||
# Create bad scripts and test if formatting returns the expected result | ||
test_file_path <- fs::path("app", "styles", "bad-style.scss") | ||
cat("@import 'asdf';\nx+y{ color: red}", file = test_file_path) | ||
rhino::format_sass() | ||
testthat::expect_identical( | ||
readLines(test_file_path), | ||
c( | ||
'@import "asdf";', | ||
"x + y {", | ||
" color: red;", | ||
"}" | ||
) | ||
) | ||
|
||
# Clean up | ||
file.remove(test_file_path) |
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.
Please bum the package version.