mirror of
https://github.com/Mastermindzh/code-style-conventions.git
synced 2024-11-23 07:13:49 +01:00
first version
This commit is contained in:
parent
bfaacbd2f9
commit
3d77415801
47
README.md
47
README.md
@ -1,2 +1,45 @@
|
||||
# prettier-config
|
||||
My preferred prettier config
|
||||
# @mastermindzh/prettier-config
|
||||
|
||||
My preferred prettier configuration.
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
- [Installation](#installation)
|
||||
- [Configuration](#configuration)
|
||||
- [package.json](#packagejson)
|
||||
- [.prettierrc.js](#prettierrcjs)
|
||||
|
||||
<!-- tocstop -->
|
||||
|
||||
## 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
|
||||
};
|
||||
```
|
||||
|
43
index.js
Normal file
43
index.js
Normal file
@ -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 everwhere 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
|
||||
jsxBracketSameLine: 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
|
||||
};
|
32
package.json
Normal file
32
package.json
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "@mastermindzh/prettier-config",
|
||||
"version": "1.0.0",
|
||||
"description": "My preferred 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' && git push && npm publish --access public",
|
||||
"release-patch": "npm run patch && npm run release",
|
||||
"release-minor": "npm run minor && npm run release",
|
||||
"release-major": "npm run major && npm run release"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Mastermindzh/prettier-config.git"
|
||||
},
|
||||
"keywords": [
|
||||
"prettier",
|
||||
"config",
|
||||
"mastermindzh",
|
||||
"rick van lieshout",
|
||||
"lieshout"
|
||||
],
|
||||
"author": "Rick van Lieshout",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/Mastermindzh/prettier-config/issues"
|
||||
},
|
||||
"homepage": "https://github.com/Mastermindzh/prettier-config#readme"
|
||||
}
|
Loading…
Reference in New Issue
Block a user