From 71d4dbaa3cb22d98193fceea43b0ab8be00cbc25 Mon Sep 17 00:00:00 2001 From: phga Date: Sun, 20 Nov 2022 22:17:14 +0100 Subject: [PATCH] init: prettier & editorconfig --- .editorconfig | 27 +++++++++++++++++++++++++++ .prettierrc.json | 7 +++++++ README.org | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 .editorconfig create mode 100644 .prettierrc.json create mode 100644 README.org diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..1fd2e96 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,27 @@ +# Some docs: https://EditorConfig.org +root = true # top-most EditorConfig file + +[*] +end_of_line = lf # unix style line endings +insert_final_newline = false # newline at end of file +charset = utf-8 # encoding +max_line_length = 90 # Suggested maximum of 90 characters per line + +[*.js?] # .js and .jsx +indent_style = space +indent_size = 2 +quote_type = single + +[*.ts?] # .ts and .tsx +indent_style = space +indent_size = 2 +quote_type = single + +[*.py] +indent_style = space +indent_size = 4 +quote_type = single + +[*.json] +indent_style = space +indent_size = 2 diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..33608f5 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,7 @@ +{ + "printWidth": 90, + "tabWidth": 2, + "singleQuote": true, + "trailingComma": "es5", + "jsxSingleQuote": true +} diff --git a/README.org b/README.org new file mode 100644 index 0000000..7d70578 --- /dev/null +++ b/README.org @@ -0,0 +1,48 @@ +* Example Configs for Several Useful Modes + +For example configs take a look at the files provided in this repo. + +** Editorconfig + +Official Documentation: https://editorconfig.org/ + +The file ~.editorconfig~ can be placed somewhere in the directory tree above the files you +want the config to take affect in. + +#+begin_example +├── .editorconfig +├── org1 +│ └── my-app1 +│ └──── index.html <- takes affect here +└── org2 + └── my-app2 + └──── index.html <- takes affect here as well +#+end_example + +*** Requirements + +#+begin_src emacs-lisp :results output scalar +(straight-use-package 'editorconfig) +(editorconfig-mode t) +#+end_src + +** Prettier (JS/TS Code Formatter) + +Official Documentation: https://prettier.io/ + +#+begin_example +├── .prettierrc.json +├── org1 +│ └── my-app1 +│ └──── index.tsx <- takes affect here +└── org2 + └── my-app2 + └──── index.jsx <- takes affect here as well +#+end_example + +*** Requirements + +#+begin_src emacs-lisp :results output scalar +(straight-use-package 'prettier-js) +(add-hook 'web-tide-mode-hook 'prettier-js-mode) +#+end_src