Skip to content

Commit

Permalink
chore(lint): Do not lint and format eex and leex anymore (#718)
Browse files Browse the repository at this point in the history
  • Loading branch information
aifrak authored Feb 5, 2023
1 parent 955050a commit ec7f1ff
Show file tree
Hide file tree
Showing 12 changed files with 0 additions and 175 deletions.
1 change: 0 additions & 1 deletion .check.exs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
# —————————————————————————————————————————————— #
{:lint_css, "./run lint:css"},
{:lint_dockerfile, "./run lint:dockerfile"},
{:lint_elixir_eex, "./run lint:eex"},
{:lint_html, "./run lint:html"},
{:lint_js, "./run lint:js"},
{:lint_staged, "./run lint:staged"},
Expand Down
1 change: 0 additions & 1 deletion .check_format.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# Custom tools
{:format_css, "./run format:css"},
{:format_dockerfile, "./run format:dockerfile"},
{:format_eex, "./run format:eex", deps: [:format_css, :format_js]},
{:format_elixir, "./run format:elixir"},
{:format_js, "./run format:js"},
{:format_prettier, "./run format:prettier", deps: [:format_css, :format_js]},
Expand Down
3 changes: 0 additions & 3 deletions .lintstagedrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
- ./run lint:js
- ./run lint:prettier

"*.html.{eex,leex}":
- ./run lint:eex

"{run,.husky/*,*.sh}":
- ./run lint:shell

Expand Down
4 changes: 0 additions & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,3 @@ doc/

# Dialyzer
dialyzer/plts/

# see ./docs/setup.md in "Known issues" section
*.eex
*.leex
35 changes: 0 additions & 35 deletions .prettierignore-eex

This file was deleted.

6 changes: 0 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

// Files:
"files.associations": {
".prettierignore-eex": "ignore",
".markdownlintignore": "ignore",
".sobelow-conf": "elixir",
"**/.husky/*": "shellscript",
Expand Down Expand Up @@ -223,11 +222,6 @@
"icon": "markdownlint",
"extensions": [".markdownlintignore"],
"filename": true
},
{
"icon": "prettier",
"extensions": [".prettierignore-eex"],
"filename": true
}
]
}
19 changes: 0 additions & 19 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,25 +110,6 @@
"detail": "Lint Elixir files"
},
/* ———————————————————————————————————————————— */
/* EEx */
/* ———————————————————————————————————————————— */
{
"label": "format:eex",
"type": "shell",
"command": "./run",
"args": ["format:eex"],
"problemMatcher": [],
"detail": "Format Embedded Elixir files"
},
{
"label": "lint:eex",
"type": "shell",
"command": "./run",
"args": ["lint:eex"],
"problemMatcher": [],
"detail": "Lint Embedded Elixir files"
},
/* ———————————————————————————————————————————— */
/* Shell */
/* ———————————————————————————————————————————— */
{
Expand Down
21 changes: 0 additions & 21 deletions docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,6 @@ export USER_UID=1000 USER_GID=1000; ./run dev:code
Note: On Linux, VSCode container handles user's UID/GID by itself. Read the
description of `remoteUser` and `updateRemoteUserUID` on this [page](https://code.visualstudio.com/docs/remote/devcontainerjson-reference#_devcontainerjson-properties).

## Known issues

1. `*.eex` files are not formatted or not correctly formatted in VSCode.

**Answer**: `prettier-plugin-eex` supports `prettier` up to `2.2.x` only.

**Temporary solution**: Run `./run format:eex` to format all `*.eex` files.
([more info](https://github.com/adamzapasnik/prettier-plugin-eex/issues/51))

For this reason, two versions of `prettier` are installed with two `.prettierignore`:

- `^2.3.x`:
1. used for all accepted files but `*.eex` and `*.leex` files
1. uses `.prettierignore`
1. used by VSCode
- `~2.2.x`:
1. used only for `*.eex`; all other extensions are excluded
1. uses `.prettierignore-eex`, a copy from `.prettierignore` without
ignoring `*.eex` and `*.leex` files
1. **not** used by VSCode

## FAQ

1. `husky` pre-commit is not triggered.
Expand Down
1 change: 0 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ defmodule App.MixProject do
--only format_css \
--only format_dockerfile \
--only format_elixir \
--only format_eex \
--only format_js \
--only format_prettier \
--only format_shell \
Expand Down
58 changes: 0 additions & 58 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
"lint-staged": "^13.1.0",
"markdownlint-cli": "^0.33.0",
"prettier": "^2.8.3",
"prettier-plugin-eex": "^0.6.0",
"prettier2.2": "npm:prettier@~2.2.1",
"release-it": "^15.6.0",
"stylelint": "^14.16.1",
"stylelint-at-rule-no-children": "^0.3.1",
Expand Down
24 changes: 0 additions & 24 deletions scripts/run/elixir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ Elixir commands:
test:elixir Test Elixir files
version:elixir Show Elixir version
EEx commands:
format:eex Format Embedded Elixir files
lint:eex Lint Embedded Elixir files
Erlang commands:
version:erlang Show Erlang version
EOF
Expand Down Expand Up @@ -72,26 +68,6 @@ function version:elixir {
--no-start \
-e "IO.puts(System.version)"
}
# —————————————————————————————————————————————— #
# EEx #
# —————————————————————————————————————————————— #

# NOTE: Avoid error "No files matching the pattern were found" by adding prettierrc.yml
eex_glob="**/*.{eex,leex,prettierrc.yml}"

# Prettier 2.2 version for Embedded Elixir files
function prettier-eex {
./node_modules/prettier2.2/bin-prettier.js \
--ignore-path=./.prettierignore-eex "${@}"
}

function lint:eex {
prettier-eex --check "${@:-${eex_glob}}"
}

function format:eex {
prettier-eex --list-different --write "${@:-${eex_glob}}"
}

# —————————————————————————————————————————————— #
# Erlang #
Expand Down

0 comments on commit ec7f1ff

Please sign in to comment.