diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70a486c..2fc267e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,10 +24,12 @@ jobs: with: submodules: 'true' - - uses: erlef/setup-elixir@v1 + # Used to build prettier_eex_formatter + # Versions from prettier_eex_formatter/.tools_versions + - uses: erlef/setup-beam@v1 with: - otp-version: ${{ matrix.otp }} - elixir-version: ${{ matrix.elixir }} + otp-version: '21.3.8.22' + elixir-version: '1.8.2' - uses: actions/setup-node@v2 with: @@ -49,3 +51,14 @@ jobs: - run: yarn install --frozen-lockfile - run: yarn lint - run: yarn test + + - uses: erlef/setup-beam@v1 + with: + otp-version: ${{ matrix.otp }} + elixir-version: ${{ matrix.elixir }} + + - name: Test Elixir integration + run: | + cd tests_elixir + elixir --version + mix prettier diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c60478..4fe04ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ All notable changes to the prettier-plugin-eex will be documented in this file. - Return non 0 exit status when error formatting is unsuccessful - Use `print` function instead of `embed` to fix error logging - Fix formatting of files that consist of only a single expression +- Make `prettier_eex_formatter` work on 21 and 22 OTP ## v0.4.0 - 24 February 2021 diff --git a/README.md b/README.md index fb85294..2a7a4f0 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,11 @@ yarn add -D prettier prettier-plugin-eex ``` +## Supported versions + +- Elixir 1.8 minimum +- Erlang OTP 21 minimum + ## Config options * printWidth - used by Prettier directly diff --git a/prettier_eex_formatter b/prettier_eex_formatter index 7711940..954e0ef 160000 --- a/prettier_eex_formatter +++ b/prettier_eex_formatter @@ -1 +1 @@ -Subproject commit 771194035dee5f43fb4fc72d0881a10ecaa240e9 +Subproject commit 954e0efc4cb4b4e4930f15f4bb57d55db2d301c4 diff --git a/tests_elixir/.gitignore b/tests_elixir/.gitignore new file mode 100644 index 0000000..e022f16 --- /dev/null +++ b/tests_elixir/.gitignore @@ -0,0 +1,20 @@ +# The directory Mix will write compiled artifacts to. +/_build/ + +# If you run "mix test --cover", coverage assets end up here. +/cover/ + +# The directory Mix downloads your dependencies sources to. +/deps/ + +# Where third-party dependencies like ExDoc output generated docs. +/doc/ + +# Ignore .fetch files in case you like to edit your project deps locally. +/.fetch + +# If the VM crashes, it generates a dump, let's ignore it too. +erl_crash.dump + +# Also ignore archive artifacts (built via "mix archive.build"). +*.ez diff --git a/tests_elixir/formatted_views/multiline.html.eex b/tests_elixir/formatted_views/multiline.html.eex new file mode 100644 index 0000000..5882b3c --- /dev/null +++ b/tests_elixir/formatted_views/multiline.html.eex @@ -0,0 +1,6 @@ +<%= + link_to( + a: "b", + c: "e" + ) +%> diff --git a/tests_elixir/mix.exs b/tests_elixir/mix.exs new file mode 100644 index 0000000..7431ffe --- /dev/null +++ b/tests_elixir/mix.exs @@ -0,0 +1,18 @@ +defmodule TestsElixir.MixProject do + use Mix.Project + + def project do + [ + app: :tests_elixir, + version: "0.1.0", + elixir: "~> 1.8", + aliases: aliases() + ] + end + + def aliases do + [ + prettier: "cmd ../node_modules/.bin/prettier --plugin ../ --check ./formatted_views --color" + ] + end +end