@decampsrenan/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.
- package/README.md +48 -0
- package/package.json +40 -0
- package/prettier-astro.mjs +18 -0
- package/prettier-default.mjs +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Personal config files
|
|
2
|
+
|
|
3
|
+
I use this config in all my projects. No need to copy/paste anymore 😄
|
|
4
|
+
|
|
5
|
+
## Supported tools
|
|
6
|
+
|
|
7
|
+
- [x] Prettier
|
|
8
|
+
- [ ] ESLint
|
|
9
|
+
- [ ] Typescript
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npm i -D @decampsrenan/config
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### Prettier
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
// package.json
|
|
23
|
+
{
|
|
24
|
+
"name": "...",
|
|
25
|
+
"prettier": "@decampsrenan/config/prettier-default"
|
|
26
|
+
// Use "prettier-astro" to format astro files
|
|
27
|
+
// "prettier": "@decampsrenan/config/prettier-astro"
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Or if you need more control on the settings:
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
// .prettierrc.mjs
|
|
35
|
+
import config from "@decampsrenan/config/prettier-default"
|
|
36
|
+
|
|
37
|
+
export default {
|
|
38
|
+
...config
|
|
39
|
+
// Override with your custom needs here
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Then run the following commands to check or update files if needed:
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
npx prettier -c ./ # Check if there is some files to update
|
|
47
|
+
npx prettier -w ./ # Update files
|
|
48
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@decampsrenan/config",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Personal config files",
|
|
5
|
+
"exports": {
|
|
6
|
+
"./prettier-default": "./prettier-default.mjs",
|
|
7
|
+
"./prettier-astro": "./prettier-astro.mjs"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "true",
|
|
11
|
+
"release": "np",
|
|
12
|
+
"dev": "chokidar \"**/*.{mjs,json}\" -c \"yalc publish --push\""
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"prettier",
|
|
17
|
+
"prettier-config",
|
|
18
|
+
"config",
|
|
19
|
+
"style"
|
|
20
|
+
],
|
|
21
|
+
"author": {
|
|
22
|
+
"name": "Renan Decamps",
|
|
23
|
+
"email": "renan.decamps@gmail.com",
|
|
24
|
+
"url": "https://github.com/decampsrenan"
|
|
25
|
+
},
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@trivago/prettier-plugin-sort-imports": "4.3.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"chokidar-cli": "3.0.0",
|
|
32
|
+
"np": "10.1.0",
|
|
33
|
+
"prettier": "3.1.1",
|
|
34
|
+
"yalc": "1.0.0-pre.53"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"prettier": "^3.1.1",
|
|
38
|
+
"prettier-plugin-astro": "^0.14.1"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import defaultConfig from './prettier-default.mjs'
|
|
2
|
+
|
|
3
|
+
/** @type {import("prettier").Config} */
|
|
4
|
+
export default {
|
|
5
|
+
...defaultConfig,
|
|
6
|
+
plugins: [
|
|
7
|
+
...defaultConfig.plugins,
|
|
8
|
+
'prettier-plugin-astro'
|
|
9
|
+
],
|
|
10
|
+
overrides: [
|
|
11
|
+
{
|
|
12
|
+
files: '*.astro',
|
|
13
|
+
options: {
|
|
14
|
+
parser: 'astro',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** @type {import("prettier").Config} */
|
|
2
|
+
export default {
|
|
3
|
+
printWidth: 100,
|
|
4
|
+
tabWidth: 2,
|
|
5
|
+
useTabs: false,
|
|
6
|
+
semi: true,
|
|
7
|
+
singleQuote: true,
|
|
8
|
+
quoteProps: 'as-needed',
|
|
9
|
+
jsxSingleQuote: false,
|
|
10
|
+
trailingComma: 'all',
|
|
11
|
+
bracketSpacing: true,
|
|
12
|
+
bracketSameLine: false,
|
|
13
|
+
arrowParens: 'always',
|
|
14
|
+
proseWrap: 'preserve',
|
|
15
|
+
htmlWhitespaceSensitivity: 'strict',
|
|
16
|
+
endOfLine: 'lf',
|
|
17
|
+
plugins: ['@trivago/prettier-plugin-sort-imports'],
|
|
18
|
+
|
|
19
|
+
// @trivago/prettier-plugin-sort-imports
|
|
20
|
+
importOrder: [
|
|
21
|
+
// react related packages
|
|
22
|
+
'^react$',
|
|
23
|
+
'^react-dom',
|
|
24
|
+
'^react-.*$',
|
|
25
|
+
|
|
26
|
+
// plasmo packages grouped together
|
|
27
|
+
'^@plasmohq/.+$',
|
|
28
|
+
|
|
29
|
+
// npm packages
|
|
30
|
+
"<THIRD_PARTY_MODULES>",
|
|
31
|
+
|
|
32
|
+
// aliases path ('@/components/etc..', '~lib/etc...')
|
|
33
|
+
'^(@/|~)(.+)$',
|
|
34
|
+
|
|
35
|
+
// loader specific imports ('raw:../', 'data-text:../')
|
|
36
|
+
'^(.+:.+)$',
|
|
37
|
+
|
|
38
|
+
// relative imports
|
|
39
|
+
"^[./]"
|
|
40
|
+
],
|
|
41
|
+
importOrderSeparation: true,
|
|
42
|
+
importOrderSortSpecifiers: true,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
|