Skip to content

Commit

Permalink
Add editorconfig and markdown formatter script
Browse files Browse the repository at this point in the history
  • Loading branch information
webmaster128 committed Jul 29, 2024
1 parent 61201ce commit 9f5dc10
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 120

[*.rs]
indent_size = 4
max_line_length = 100

[*.{md,mdx}]
max_line_length = 100
14 changes: 14 additions & 0 deletions scripts/format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
set -o errexit -o nounset -o pipefail
command -v shellcheck >/dev/null && shellcheck "$0"

# Running with -c makes the script only validate instead of editing in place.
op="write"
while getopts c option; do
case "${option}" in
c) op="check" ;;
*) ;;
esac
done

npx [email protected] --$op --no-config "./src/**/*.md" "./src/**/*.mdx"

0 comments on commit 9f5dc10

Please sign in to comment.