Skip to content

Commit

Permalink
chore(lint): Move prettier cache to project root (#720)
Browse files Browse the repository at this point in the history
  • Loading branch information
aifrak authored Feb 5, 2023
1 parent f5b070d commit 3efe5d1
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ jobs:
**/npm_cache
**/.cspellcache
**/.eslintcache
**/.prettier-cache
**/.stylelintcache
key: |
${{ runner.os }}-node-${{ steps.versions.outputs.NODE }}-${{ hashFiles('**/package-lock.json') }}
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ npm_cache/
# Docker compose
docker-compose.override.yml

# Cache for lints
# Cache for lints and formatters
.cspellcache
.eslintcache
.prettier-cache
.stylelintcache
.cspellcache

# Elixir
_build/
Expand Down
5 changes: 3 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
node_modules/
npm_cache/

# Cache for lints
# Cache for lints and formatters
.cspellcache
.eslintcache
.prettier-cache
.stylelintcache
.cspellcache

# Text is generated automatically.
# Also, as the file grows, it will take longer to lint and format.
Expand Down
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
// NodeJS
"**/node_modules/**": true,
"**/npm_cache/**": true,
// Cache for lints
"**/.prettier-cache": true,
// Elixir
"**/_build/**": true,
"**/.elixir_ls/**": true,
Expand All @@ -64,6 +66,8 @@
// NodeJS
"**/node_modules": true,
"**/npm_cache": true,
// Cache for lints
"**/.prettier-cache": true,
// Elixir
"**/_build": true,
"**/.elixir_ls": true,
Expand Down
1 change: 1 addition & 0 deletions cspell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ ignorePaths:
- "**/.git/**/!(COMMIT_EDITMSG)*"
- "**/.history/**"
- "**/.husky/_/**"
- "**/.prettier-cache"
- "**/.sobelow"
- "**/.stylelintcache"
- "**/.vscode-insiders/**"
Expand Down
11 changes: 9 additions & 2 deletions scripts/run/prettier.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,16 @@ EOF
}

function lint:prettier {
npx prettier --check "${@:-.}"
npx prettier \
--cache \
--cache-location="${APP_DIR}/.prettier-cache" \
--check "${@:-.}"
}

function format:prettier {
npx prettier --list-different --write "${@:-.}"
npx prettier \
--cache \
--cache-location="${APP_DIR}/.prettier-cache" \
--list-different \
--write "${@:-.}"
}

0 comments on commit 3efe5d1

Please sign in to comment.