@merkle-open/prettier-config 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +77 -0
  3. package/index.js +75 -0
  4. package/package.json +17 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Merkle Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,77 @@
1
+ # Shared prettier config [![npm](https://img.shields.io/npm/v/@merkle-open/prettier-config.svg)](https://www.npmjs.com/package/@merkle-open/prettier-config)
2
+
3
+ > reusable prettier config
4
+
5
+ ## Usage
6
+
7
+ `npm install --save-dev prettier @merkle-open/prettier-config`
8
+
9
+ **.prettierrc.js**
10
+
11
+ ```js
12
+ module.exports = require('@merkle-open/prettier-config');
13
+ ```
14
+
15
+ **.prettierignore**
16
+
17
+ ```
18
+ # Node
19
+ **/node_modules
20
+ **/package.json
21
+ **/package-lock.json
22
+
23
+ # Generated
24
+ **/bower.json
25
+ **/lerna.json
26
+
27
+ # Build
28
+ **/build
29
+ **/dist
30
+ **/public
31
+ **/coverage
32
+ **/storybook-static
33
+
34
+ # Nitro
35
+ **/project/blueprints
36
+ **/.yo-rc.json
37
+ ```
38
+
39
+ **package.json**
40
+
41
+ ```json
42
+ ...
43
+ "scripts": {
44
+ "prettier": "prettier --write \"**/*.*(gql|graphql|js|jsx|json|md|mdx|ts|tsx|yml|yaml)\"",
45
+ ...
46
+ },
47
+ ...
48
+ ```
49
+
50
+ ## We recommend to use prettier together with lint-staged and husky
51
+
52
+ `npm install --save-dev husky lint-staged`
53
+
54
+ **package.json**
55
+
56
+ ```json
57
+ ...
58
+ "lint-staged": {
59
+ "*.{gql,graphql,js,jsx,json,md,mdx,ts,tsx,yml,yaml}": [
60
+ "prettier --write"
61
+ ]
62
+ },
63
+ "scripts": {
64
+ "prettier": "prettier --write \"**/*.*(gql|graphql|js|jsx|json|md|mdx|ts|tsx|yml|yaml)\"",
65
+ ...
66
+ },
67
+ "husky": {
68
+ "hooks": {
69
+ "pre-commit": "lint-staged"
70
+ }
71
+ },
72
+ ...
73
+ ```
74
+
75
+ ## License
76
+
77
+ [MIT License](./LICENSE)
package/index.js ADDED
@@ -0,0 +1,75 @@
1
+ module.exports = {
2
+ printWidth: 120,
3
+ tabWidth: 4,
4
+ useTabs: true,
5
+ endOfLine: 'auto',
6
+ semi: true,
7
+ singleQuote: true,
8
+ trailingComma: 'es5',
9
+ bracketSpacing: true,
10
+ bracketSameLine: false,
11
+ arrowParens: 'always',
12
+ overrides: [
13
+ {
14
+ files: ['*.gql', '*.graphql'],
15
+ options: {
16
+ parser: 'graphql',
17
+ },
18
+ },
19
+ {
20
+ files: ['*.js', '*.jsx'],
21
+ options: {
22
+ parser: 'babel',
23
+ },
24
+ },
25
+ {
26
+ files: '*.json',
27
+ options: {
28
+ parser: 'json',
29
+ },
30
+ },
31
+ {
32
+ files: '*.md',
33
+ options: {
34
+ parser: 'markdown',
35
+ useTabs: false,
36
+ tabWidth: 2,
37
+ printWidth: 60,
38
+ },
39
+ },
40
+ {
41
+ files: '*.mdx',
42
+ options: {
43
+ parser: 'mdx',
44
+ useTabs: false,
45
+ tabWidth: 2,
46
+ printWidth: 60,
47
+ },
48
+ },
49
+ {
50
+ files: ['*.ts', '*.tsx'],
51
+ options: {
52
+ parser: 'typescript',
53
+ },
54
+ },
55
+ {
56
+ // use 2 spaces and 80 with because stories also used in documentation
57
+ files: ['*.stories.ts', '*.stories.tsx'],
58
+ options: {
59
+ parser: 'typescript',
60
+ useTabs: false,
61
+ tabWidth: 2,
62
+ printWidth: 60,
63
+ },
64
+ },
65
+ {
66
+ files: ['*.yml', '*.yaml'],
67
+ options: {
68
+ parser: 'yaml',
69
+ singleQuote: false,
70
+ useTabs: false,
71
+ tabWidth: 2,
72
+ },
73
+ },
74
+ ],
75
+ };
package/package.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "@merkle-open/prettier-config",
3
+ "description": "Shared prettier config",
4
+ "version": "1.0.0",
5
+ "repository": "https://github.com/merkle-open/frontend-defaults",
6
+ "license": "MIT",
7
+ "author": "Merkle Inc.",
8
+ "private": false,
9
+ "engines": {
10
+ "node": ">=14"
11
+ },
12
+ "main": "./index.js",
13
+ "files": ["README.md", "LICENSE", "index.js"],
14
+ "peerDependencies": {
15
+ "prettier": ">=2 <3"
16
+ }
17
+ }