From 2b2990a9dfbf0fba152e898dd65e980cedb5d8ff Mon Sep 17 00:00:00 2001 From: Michael Mason Date: Sat, 10 Apr 2021 23:29:03 +0100 Subject: [PATCH] Add prettier config --- .editorconfig | 2 ++ README.md | 44 ++++++++++++++++++++++++++++++++++++++++++-- index.js | 19 +++++++++++++++++++ package.json | 11 +++++++++++ 4 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 .editorconfig create mode 100644 index.js create mode 100644 package.json diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e9d21fd --- /dev/null +++ b/.editorconfig @@ -0,0 +1,2 @@ +[*] +indent_size = 2 \ No newline at end of file diff --git a/README.md b/README.md index 1d33f15..da86088 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,42 @@ -# prettier-config -Reusable Prettier config +# @devsht/prettier-config + +Reusable prettier config + +## Installation + +```bash +npm i -D @devsht/prettier-config +``` + +or + +``` +yarn add --dev @devsht/prettier-config +``` + +## Usage + +Add a key in your **package.json** file. + +``` +"prettier": "@devsht/prettier-config" +``` + +**OR** + +Create a **.prettierrc** , **.prettierrc.yaml** , **.prettierrc.yml** or **.prettierrc.json** file and export a string. + +``` +"@devsht/prettier-config" +``` + +**OR** + +Create a **prettier.config.js** or **.prettierrc.js** file and export an object. + +``` +module.exports = { + ...require("@devsht/prettier-config"), + tabWidth: 2, +}; +``` diff --git a/index.js b/index.js new file mode 100644 index 0000000..47327c0 --- /dev/null +++ b/index.js @@ -0,0 +1,19 @@ +module.exports = { + arrowParens: "always", + bracketSpacing: true, + embeddedLanguageFormatting: "auto", + endOfLine: "lf", + htmlWhitespaceSensitivity: "css", + insertPragma: false, + jsxBracketSameLine: false, + jsxSingleQuote: false, + printWidth: 120, // Default: 80 + proseWrap: "preserve", + quoteProps: "consistent", // Default: 'as-needed' + requirePragma: false, + semi: true, + singleQuote: true, // Default: false + tabWidth: 2, + trailingComma: "all", // Default 'es5' + useTabs: false, +}; \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..2341713 --- /dev/null +++ b/package.json @@ -0,0 +1,11 @@ +{ + "name": "@devsht/prettier-config", + "version": "0.0.0", + "description": "Reusable prettier config", + "main": "index.js", + "repository": "git@github.com:devsht/prettier-config.git", + "author": "Michael Mason ", + "peerDependencies": { + "prettier": "*" + } +} \ No newline at end of file