From d277291741c4d91ecedd32e2907af59ac42e4e86 Mon Sep 17 00:00:00 2001 From: Mastermindzh Date: Sun, 14 Aug 2022 22:26:00 +0200 Subject: [PATCH] moved to separate repo --- .editorconfig | 24 ++++++++++++++++++++++++ README.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++---- index.js | 43 +++++++++++++++++++++++++++++++++++++++++++ package.json | 26 ++++++++++++++++++++++++++ 4 files changed, 139 insertions(+), 4 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..b1116ef --- /dev/null +++ b/.editorconfig @@ -0,0 +1,24 @@ +root = true + +[*] +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +indent_style = space +indent_size = 2 +charset = utf-8 + +[Makefile] +indent_style = tab +indent_size = 8 + +[{deps,tools,build}/**] +indent_style = ignore +indent_size = ignore +end_of_line = ignore +trim_trailing_whitespace = ignore +charset = ignore + +[{test/fixtures,deps,build,tools/eslint,tools/gyp,tools/icu,tools/msvs}/**] +insert_final_newline = false \ No newline at end of file diff --git a/README.md b/README.md index 1b3dfc2..1a259ca 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,47 @@ -# mastermindzh-prettier-config +# @mastermindzh/prettier-config -@mastermindzh/prettier-config - -My prettier config \ No newline at end of file +My preferred prettier configuration. + +## Table of contents + + + +- [Installation](#installation) +- [Configuration](#configuration) + - [package.json](#packagejson) + - [.prettierrc.js](#prettierrcjs) + + + +## Installation + +Simply install the package with npm: + +`npm install --save-dev @mastermindzh/prettier-config` + +## Configuration + +Configuring your project to use `@mastermindzh/prettier-config` can be done in several ways. +The easiest is the [package.json](#packagejson) solution, the most extensible is the [.prettierrc.js](#prettierrcjs) version. + +### package.json + +Simply add a "prettier" key with the package name: + +```json +{ + "prettier": "@mastermindzh/prettier-config" +} +``` + +### .prettierrc.js + +This solution requires you to put a `.prettierrc.js` file at the root of your project with the following code: + +```js +module.exports = { + ...require("@mastermindzh/prettier-config"), + // optional overrides: + jsxBracketSameLine: true, +}; +``` diff --git a/index.js b/index.js new file mode 100644 index 0000000..d62e97a --- /dev/null +++ b/index.js @@ -0,0 +1,43 @@ +module.exports = { + // line length + printWidth: 100, + + // indentation type + useTabs: false, + + // whether to prefer ' over " + singleQuote: false, + + // whether we want to quote props (only-if-they-have-a-dash) + quoteProps: "as-needed", + + // add trailing comma's everywhere as long as it's supported by es5 + trailingComma: "es5", + + // space brackets method ( param1, param2 ) { } + bracketSpacing: true, + + // places the > sign on a newline when closing a long html tag + bracketSameLine: false, + + // always add parentheses on arrow functions (x) => { } + arrowParens: "always", + + // ignore pragma, run prettier on all files + requirePragma: false, + + // preserve markdown text as-is + proseWrap: "preserve", + + // make css leading in whitespace sensitivity + htmlWhitespaceSensitivity: "css", + + // always end lines with lf + endOfLine: "lf", + + // tabs are 2 spaces. + tabWidth: 2, + + // always end statements with a semicolon + semi: true, +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..7c6641c --- /dev/null +++ b/package.json @@ -0,0 +1,26 @@ +{ + "name": "@mastermindzh/prettier-config", + "version": "1.0.0", + "description": "@mastermindzh/prettier-config", + "main": "index.js", + "scripts": { + "patch": "npm --no-git-tag-version version patch", + "minor": "npm --no-git-tag-version version minor", + "major": "npm --no-git-tag-version version major", + "release": "git add -A && git commit -m 'version bump and build' && npm publish --access public && echo 'All done, don't forget to push!'", + "release-patch": "npm run patch && npm run release", + "release-minor": "npm run minor && npm run release", + "release-major": "npm run major && npm run release", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git@git.mastermindzh.tech:mastermindzh/mastermindzh-prettier-config.git" + }, + "keywords": [ + "prettier", + "mastermindzh" + ], + "author": "Mastermindzh (http://rickvanlieshout.com/)", + "license": "MIT" +} \ No newline at end of file