@dlzn-ui/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 (3) hide show
  1. package/LICENSE +21 -0
  2. package/index.ts +32 -0
  3. package/package.json +18 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dlzn-ui
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/index.ts ADDED
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @description: https://prettier.io/docs/en/options
3
+ * @description: 还有些是 prettier-plugin-tailwindcss 的配置 https://github.com/tailwindlabs/prettier-plugin-tailwindcss
4
+ */
5
+
6
+ import type { Config as _Config } from 'prettier'
7
+ import type { PluginOptions } from 'prettier-plugin-tailwindcss'
8
+
9
+ export type Config = _Config & PluginOptions
10
+ export default {
11
+ $schema: 'https://json.schemastore.org/prettierrc',
12
+ arrowParens: 'always', // 单参数箭头函数参数周围使用圆括号-eg: (x) => x
13
+ bracketSameLine: false, // 会把多行的 HTML (包括 HTML、JSX、Vue 和 Angular) 元素的 `>` 放在最后一个属性的末尾,而不是另起一行(自闭合标签不受该选项控制)。
14
+ bracketSpacing: true, // 在对象前后添加空格-eg: { foo: bar }
15
+ embeddedLanguageFormatting: 'auto', // 控制嵌入的其他语言代码格式化。
16
+ endOfLine: 'lf', // 结束行形式
17
+ htmlWhitespaceSensitivity: 'css', // 对HTML全局空白不敏感
18
+ insertPragma: false, // 在已被preitter格式化的文件顶部加上标注
19
+ jsxSingleQuote: false, // jsx中使用单引号
20
+ plugins: ['prettier-plugin-tailwindcss'],
21
+ printWidth: 100, // 单行长度
22
+ proseWrap: 'preserve', // 保留原有的换行符,不进行任何修改
23
+ quoteProps: 'as-needed', // 仅在必需时为对象的key添加引号
24
+ requirePragma: false, // 无需顶部注释即可格式化
25
+ semi: false, // 句末使用分号
26
+ singleAttributePerLine: false, // 会在 HTML、JSX、Vue 和 Angular 中格式化为每个属性单独占一行。
27
+ singleQuote: true, // 使用单引号
28
+ tabWidth: 2, // 缩进长度
29
+ trailingComma: 'all',
30
+ useTabs: false, // 使用空格代替tab缩进
31
+ vueIndentScriptAndStyle: false, // 不对vue中的script及style标签缩进
32
+ } satisfies Config
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@dlzn-ui/prettier-config",
3
+ "type": "module",
4
+ "license": "MIT",
5
+ "version": "1.0.0",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "exports": {
10
+ ".": {
11
+ "import": "./index.ts"
12
+ }
13
+ },
14
+ "peerDependencies": {
15
+ "prettier": "^3.9.6",
16
+ "prettier-plugin-tailwindcss": "^0.8.1"
17
+ }
18
+ }