Skip to content

Commit

Permalink
chore: replace prettier with dprint
Browse files Browse the repository at this point in the history
  • Loading branch information
steabert committed Mar 18, 2023
1 parent 539538c commit 264f8c6
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .yarn/cache/dprint-npm-0.35.3-eb4361e662-1a4ce6a184.zip
Git LFS file not shown
3 changes: 0 additions & 3 deletions .yarn/cache/prettier-npm-2.8.4-ba64a351d1-c173064bf3.zip

This file was deleted.

28 changes: 28 additions & 0 deletions dprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"lineWidth": 80,
"typescript": {
"jsx.quoteStyle": "preferDouble",
"arguments.trailingCommas": "never",
"parameters.trailingCommas": "never",
"quoteStyle": "preferSingle",
"semiColons": "asi",
"module.sortImportDeclarations": "maintain"
},
"json": {},
"markdown": {},
"dockerfile": {},
"includes": ["**/*.{ts,tsx,cjs,mjs,json}"],
"excludes": [
"**/build",
"**/buildinfo*.json",
"**/node_modules",
".vscode",
".yarn"
],
"plugins": [
"https://plugins.dprint.dev/typescript-0.81.1.wasm",
"https://plugins.dprint.dev/json-0.17.0.wasm",
"https://plugins.dprint.dev/markdown-0.15.2.wasm",
"https://plugins.dprint.dev/dockerfile-0.3.0.wasm"
]
}
20 changes: 10 additions & 10 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,33 @@ build: _build-streams _build-player _build-overlay
@changed:
git diff --diff-filter=d --name-only $(git merge-base --fork-point origin/main)

# format or check files with dprint (default formats all matching files)
dprint +args="fmt":
cd {{ invocation_directory() }} && dprint {{ args }}

# run esbuild, WORKSPACE=(overlay|player|streams)
esbuild workspace *args:
cd {{ workspace }} && node esbuild.mjs {{ args }}

# run eslint
eslint +ARGS=invocation_directory():
eslint *args:
# FIXME: add --no-warning-on-ignored-files when https://github.com/eslint/rfcs/pull/90 is released
# to avoid warnings when running as part of the lint/format command against changed files.
eslint --ext "cjs,js,json,jsx,mjs,ts,tsx" --no-error-on-unmatched-pattern {{ ARGS }}
cd {{ invocation_directory() }} && eslint --ext "cjs,js,json,jsx,mjs,ts,tsx" --no-error-on-unmatched-pattern --no-cache {{ args }}

# autofix and format changed files
format +FILES="`just changed`":
just eslint --fix {{ FILES }}
just prettier --write {{ FILES }}
just dprint fmt {{ FILES }}

# install dependencies
install:
CYPRESS_INSTALL_BINARY=0 && yarn install --immutable --immutable-cache

# check lint rules and formatting for changed files
lint +FILES="`just changed`":
just eslint {{ FILES }}
just prettier {{ FILES }}

# check files with prettier, use --write to format, --no-cache to disable cache
prettier +args=invocation_directory():
prettier --ignore-unknown --no-error-on-unmatched-pattern --check {{ args }}
lint workspace:
just eslint {{ workspace }}
cd {{ workspace }} && just dprint check

# create a prerelease commit, KIND=(new|nightly)
release kind='patch':
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"c8": "7.13.0",
"cypress": "10.11.0",
"dpdm": "3.12.0",
"dprint": "0.35.3",
"eslint": "8.36.0",
"eslint-plugin-deprecation": "1.3.3",
"eslint-plugin-functional": "4.4.1",
Expand All @@ -29,7 +30,6 @@
"http-server": "14.1.1",
"license-checker": "25.0.1",
"media-stream-library": "workspace:*",
"prettier": "2.8.4",
"semver": "7.3.8",
"stylelint": "14.16.1",
"tsx": "3.12.5",
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Git LFS file not shown

0 comments on commit 264f8c6

Please sign in to comment.