@d-zero/prettier-config 5.0.0-dev.93 → 5.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 D-ZERO Co., Ltd.
3
+ Copyright (c) 2024 D-ZERO Co., Ltd.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,4 +1,54 @@
1
1
  # `@d-zero/prettier-config`
2
2
 
3
- - 使用: 🆗 使用可
4
- - 解説: 🚧 準備中
3
+ ## 個別インストール
4
+
5
+ ```sh
6
+ npm install -D @d-zero/prettier-config @prettier/plugin-pug
7
+ ```
8
+
9
+ `@d-zero/prettier-config/base`を利用する場合は、`@prettier/plugin-pug`をインストールする必要はありません。
10
+
11
+ ## 使い方
12
+
13
+ `.prettierrc.mjs`を作成し、設定を読み込みエクスポートします。
14
+
15
+ ```js
16
+ import config from '@d-zero/prettier-config';
17
+ export default config;
18
+ ```
19
+
20
+ ### 拡張
21
+
22
+ プロジェクトに合わせて設定を追加します。
23
+
24
+ ```js
25
+ import config from '@d-zero/prettier-config';
26
+ export default {
27
+ ...config,
28
+ // 例: タブをスペースに変換しない
29
+ useTabs: false,
30
+ };
31
+ ```
32
+
33
+ ## 種類別プリセット
34
+
35
+ | パッケージパス | 用途 |
36
+ | ------------------------------ | -------------------------- |
37
+ | `@d-zero/prettier-config` | フルセット(ベース + Pug) |
38
+ | `@d-zero/prettier-config/base` | 基本セット(Pugなし) |
39
+ | `@d-zero/prettier-config/pug` | Pug関連設定のみ |
40
+
41
+ `@d-zero/prettier-config`はすべての設定を含んでいるので、一部の設定のみを利用する場合は、それぞれ種類別のものを利用します。
42
+
43
+ ```js
44
+ import baseConfig from '@d-zero/prettier-config/base';
45
+ import pugConfig from '@d-zero/prettier-config/pug';
46
+
47
+ export default {
48
+ ...baseConfig,
49
+ // 既存の設定を上書き
50
+ printWidth: 120,
51
+ // Pug設定を追加
52
+ ...pugConfig,
53
+ };
54
+ ```
package/base.js ADDED
@@ -0,0 +1,33 @@
1
+ export default {
2
+ arrowParens: 'always',
3
+ bracketSameLine: true,
4
+ bracketSpacing: true,
5
+ jsxSingleQuote: false,
6
+ printWidth: 90,
7
+ quoteProps: 'as-needed',
8
+ semi: true,
9
+ singleQuote: true,
10
+ tabWidth: 2,
11
+ trailingComma: 'all',
12
+ useTabs: true,
13
+ overrides: [
14
+ {
15
+ files: '.*rc',
16
+ options: { parser: 'json' },
17
+ },
18
+ {
19
+ files: '*.html',
20
+ options: {
21
+ printWidth: 100_000,
22
+ },
23
+ },
24
+ {
25
+ files: '*.mdc',
26
+ options: { parser: 'markdown' },
27
+ },
28
+ {
29
+ files: '.clinerules',
30
+ options: { parser: 'markdown' },
31
+ },
32
+ ],
33
+ };
package/index.js CHANGED
@@ -1,30 +1,9 @@
1
+ import base from './base.js';
2
+ import pug from './pug.js';
3
+
1
4
  export default {
2
- plugins: ['@prettier/plugin-pug'],
3
- arrowParens: 'always',
4
- bracketSameLine: true,
5
- bracketSpacing: true,
6
- jsxSingleQuote: false,
7
- printWidth: 90,
8
- quoteProps: 'as-needed',
9
- semi: true,
10
- singleQuote: true,
11
- tabWidth: 2,
12
- trailingComma: 'all',
13
- useTabs: true,
14
- pugAttributeSeparator: 'as-needed',
15
- pugSingleQuote: false,
16
- pugEmptyAttributes: 'none',
17
- pugCommentPreserveSpaces: 'trim-all',
18
- pugSortAttributesBeginning: ['class'],
19
- pugSortAttributesEnd: ['id'],
20
- overrides: [
21
- {
22
- files: '.*rc',
23
- options: { parser: 'json' },
24
- },
25
- {
26
- files: '.html',
27
- printWidth: 400,
28
- },
29
- ],
5
+ ...base,
6
+ ...pug,
7
+ plugins: [...(base.plugins ?? []), ...(pug.plugins ?? [])],
8
+ overrides: [...(base.overrides ?? []), ...(pug.overrides ?? [])],
30
9
  };
package/package.json CHANGED
@@ -1,26 +1,39 @@
1
1
  {
2
2
  "name": "@d-zero/prettier-config",
3
- "version": "5.0.0-dev.93+c6646f2",
3
+ "version": "5.0.0",
4
4
  "description": "Configurations of Prettier",
5
- "repository": "https://github.com/d-zero-dev/node-dev-env.git",
5
+ "repository": "https://github.com/d-zero-dev/linters.git",
6
6
  "author": "D-ZERO Co., Ltd.",
7
7
  "license": "MIT",
8
- "private": false,
9
8
  "publishConfig": {
10
9
  "access": "public"
11
10
  },
11
+ "engines": {
12
+ "node": ">=22.0.0"
13
+ },
12
14
  "type": "module",
13
15
  "exports": {
14
16
  ".": {
15
17
  "import": "./index.js"
18
+ },
19
+ "./base": {
20
+ "import": "./base.js"
21
+ },
22
+ "./pug": {
23
+ "import": "./pug.js"
16
24
  }
17
25
  },
18
26
  "files": [
19
- "index.js"
27
+ "*.js"
20
28
  ],
21
29
  "dependencies": {
22
- "@prettier/plugin-pug": "3.0.0",
23
- "prettier": "3.1.1"
30
+ "prettier": "3.7.4"
31
+ },
32
+ "optionalDependencies": {
33
+ "@prettier/plugin-pug": ">=3.0.0"
34
+ },
35
+ "devDependencies": {
36
+ "@prettier/plugin-pug": "3.4.2"
24
37
  },
25
- "gitHead": "c6646f2425c257367f106e5e2cee276c42aef9d5"
38
+ "gitHead": "7f635ad8bbb1455d0d362fe00478a2f7bd216924"
26
39
  }
package/pug.js ADDED
@@ -0,0 +1,9 @@
1
+ export default {
2
+ plugins: ['@prettier/plugin-pug'],
3
+ pugAttributeSeparator: 'as-needed',
4
+ pugCommentPreserveSpaces: 'trim-all',
5
+ pugEmptyAttributes: 'none',
6
+ pugSingleQuote: false,
7
+ pugSortAttributesBeginning: ['class'],
8
+ pugSortAttributesEnd: ['id'],
9
+ };