@shun-shobon/style-guide 0.4.2 → 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/dist/prettier/index.js +18 -18
- package/dist/prettier/index.js.map +1 -1
- package/package.json +11 -13
- package/dist/eslint/index.cjs +0 -885
- package/dist/eslint/index.cjs.map +0 -1
- package/dist/eslint/index.d.cts +0 -131
- package/dist/prettier/index.cjs +0 -158
- package/dist/prettier/index.cjs.map +0 -1
- package/dist/prettier/index.d.cts +0 -53
package/dist/prettier/index.js
CHANGED
|
@@ -1,21 +1,7 @@
|
|
|
1
|
-
// src/prettier/utils.ts
|
|
2
|
-
import { createRequire } from "module";
|
|
3
|
-
var require2 = createRequire(import.meta.url);
|
|
4
|
-
function mergeConfig(...configs) {
|
|
5
|
-
return configs.reduce((acc, config) => {
|
|
6
|
-
return {
|
|
7
|
-
...acc,
|
|
8
|
-
...config,
|
|
9
|
-
overrides: [...acc.overrides ?? [], ...config.overrides ?? []],
|
|
10
|
-
plugins: [...acc.plugins ?? [], ...config.plugins ?? []]
|
|
11
|
-
};
|
|
12
|
-
}, {});
|
|
13
|
-
}
|
|
14
|
-
|
|
15
1
|
// src/prettier/configs/astro.ts
|
|
16
2
|
function astro() {
|
|
17
3
|
return {
|
|
18
|
-
plugins: [
|
|
4
|
+
plugins: [import.meta.resolve("prettier-plugin-astro")],
|
|
19
5
|
overrides: [
|
|
20
6
|
{
|
|
21
7
|
files: ["*.astro"],
|
|
@@ -69,7 +55,7 @@ function ignores(options = {}) {
|
|
|
69
55
|
// src/prettier/configs/jsdoc.ts
|
|
70
56
|
function jsdoc() {
|
|
71
57
|
return {
|
|
72
|
-
plugins: [
|
|
58
|
+
plugins: [import.meta.resolve("prettier-plugin-jsdoc")],
|
|
73
59
|
tsdoc: true,
|
|
74
60
|
jsdocPreferCodeFences: true,
|
|
75
61
|
jsdocCommentLineStrategy: "multiline"
|
|
@@ -79,20 +65,34 @@ function jsdoc() {
|
|
|
79
65
|
// src/prettier/configs/package-json.ts
|
|
80
66
|
function packageJson() {
|
|
81
67
|
return {
|
|
82
|
-
plugins: [
|
|
68
|
+
plugins: [import.meta.resolve("prettier-plugin-pkg")]
|
|
83
69
|
};
|
|
84
70
|
}
|
|
85
71
|
|
|
86
72
|
// src/prettier/configs/tailwindcss.ts
|
|
87
73
|
function tailwindcss() {
|
|
88
74
|
return {
|
|
89
|
-
plugins: [
|
|
75
|
+
plugins: [import.meta.resolve("prettier-plugin-tailwindcss")],
|
|
90
76
|
tailwindFunctions: ["twMerge", "clsx"]
|
|
91
77
|
};
|
|
92
78
|
}
|
|
93
79
|
|
|
94
80
|
// src/prettier/factory.ts
|
|
95
81
|
import { isPackageExists } from "local-pkg";
|
|
82
|
+
|
|
83
|
+
// src/prettier/utils.ts
|
|
84
|
+
function mergeConfig(...configs) {
|
|
85
|
+
return configs.reduce((acc, config) => {
|
|
86
|
+
return {
|
|
87
|
+
...acc,
|
|
88
|
+
...config,
|
|
89
|
+
overrides: [...acc.overrides ?? [], ...config.overrides ?? []],
|
|
90
|
+
plugins: [...acc.plugins ?? [], ...config.plugins ?? []]
|
|
91
|
+
};
|
|
92
|
+
}, {});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// src/prettier/factory.ts
|
|
96
96
|
function shun_shobon(options = {}, userConfig = {}) {
|
|
97
97
|
const {
|
|
98
98
|
tailwindcss: enableTailwindcss = isPackageExists("tailwindcss"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/prettier/
|
|
1
|
+
{"version":3,"sources":["../../src/prettier/configs/astro.ts","../../src/prettier/configs/base.ts","../../src/prettier/configs/ignores.ts","../../src/prettier/configs/jsdoc.ts","../../src/prettier/configs/package-json.ts","../../src/prettier/configs/tailwindcss.ts","../../src/prettier/factory.ts","../../src/prettier/utils.ts"],"sourcesContent":["import type { Config } from \"../types\";\n\nexport function astro(): Config {\n\treturn {\n\t\tplugins: [import.meta.resolve(\"prettier-plugin-astro\")],\n\n\t\toverrides: [\n\t\t\t{\n\t\t\t\tfiles: [\"*.astro\"],\n\t\t\t\toptions: {\n\t\t\t\t\tparser: \"astro\",\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t};\n}\n","import type { Config } from \"../types\";\n\nexport function base(): Config {\n\treturn {\n\t\tuseTabs: true,\n\t\tquoteProps: \"consistent\",\n\n\t\t// This is the default, but VSCode's Prettier plugin doesn't respect it.\n\t\ttrailingComma: \"all\",\n\n\t\toverrides: [\n\t\t\t{\n\t\t\t\tfiles: [\"tsconfig.json\", \"jsconfig.json\"],\n\t\t\t\toptions: {\n\t\t\t\t\tparser: \"jsonc\",\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t};\n}\n","import type { Config, OptionsIgnores } from \"../types\";\n\nconst DEFAULT_IGNORES = [\n\t\"**/package-lock.json\",\n\t\"**/pnpm-lock.yaml\",\n\t\"**/.yarn/**\",\n];\n\nexport function ignores(options: OptionsIgnores = {}): Config {\n\tconst { ignoreFiles = [] } = options;\n\n\treturn {\n\t\toverrides: [\n\t\t\t// https://github.com/prettier/prettier/issues/4708#issuecomment-1448705672\n\t\t\t{\n\t\t\t\tfiles: [...DEFAULT_IGNORES, ...ignoreFiles],\n\t\t\t\toptions: {\n\t\t\t\t\trequirePragma: true,\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t};\n}\n","import type { Config } from \"../types\";\n\nexport function jsdoc(): Config {\n\treturn {\n\t\tplugins: [import.meta.resolve(\"prettier-plugin-jsdoc\")],\n\n\t\ttsdoc: true,\n\t\tjsdocPreferCodeFences: true,\n\t\tjsdocCommentLineStrategy: \"multiline\",\n\t};\n}\n","import type { Config } from \"../types\";\n\nexport function packageJson(): Config {\n\treturn {\n\t\tplugins: [import.meta.resolve(\"prettier-plugin-pkg\")],\n\t};\n}\n","import type { Config } from \"../types\";\n\nexport function tailwindcss(): Config {\n\treturn {\n\t\tplugins: [import.meta.resolve(\"prettier-plugin-tailwindcss\")],\n\n\t\ttailwindFunctions: [\"twMerge\", \"clsx\"],\n\t};\n}\n","import { isPackageExists } from \"local-pkg\";\n\nimport {\n\tastro,\n\tbase,\n\tignores,\n\tjsdoc,\n\tpackageJson,\n\ttailwindcss,\n} from \"./configs\";\nimport type { Config, OptionsConfig } from \"./types\";\nimport { mergeConfig } from \"./utils\";\n\nexport function shun_shobon(\n\toptions: OptionsConfig = {},\n\tuserConfig: Config = {},\n): Config {\n\tconst {\n\t\ttailwindcss: enableTailwindcss = isPackageExists(\"tailwindcss\"),\n\t\tastro: enableAstro = isPackageExists(\"astro\"),\n\t\tignoreFiles = [],\n\t} = options;\n\n\tconst configs: Config[] = [];\n\n\t// basic configs\n\tconfigs.push(base(), packageJson(), jsdoc(), ignores({ ignoreFiles }));\n\n\tif (enableAstro) {\n\t\tconfigs.push(astro());\n\t}\n\n\t// パーサの都合上、Taliwind CSSは一番最後に追加する\n\tif (enableTailwindcss) {\n\t\tconfigs.push(tailwindcss());\n\t}\n\n\treturn mergeConfig(...configs, userConfig);\n}\n","import type { Config } from \"./types\";\n\nexport function mergeConfig(...configs: Config[]): Config {\n\treturn configs.reduce<Config>((acc, config) => {\n\t\treturn {\n\t\t\t...acc,\n\t\t\t...config,\n\t\t\toverrides: [...(acc.overrides ?? []), ...(config.overrides ?? [])],\n\t\t\tplugins: [...(acc.plugins ?? []), ...(config.plugins ?? [])],\n\t\t};\n\t}, {});\n}\n"],"mappings":";AAEO,SAAS,QAAgB;AAC/B,SAAO;AAAA,IACN,SAAS,CAAC,YAAY,QAAQ,uBAAuB,CAAC;AAAA,IAEtD,WAAW;AAAA,MACV;AAAA,QACC,OAAO,CAAC,SAAS;AAAA,QACjB,SAAS;AAAA,UACR,QAAQ;AAAA,QACT;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;;;ACbO,SAAS,OAAe;AAC9B,SAAO;AAAA,IACN,SAAS;AAAA,IACT,YAAY;AAAA;AAAA,IAGZ,eAAe;AAAA,IAEf,WAAW;AAAA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ACf,UAAyB,CAAC,GAC1B,aAAqB,CAAC,GACb;AACT,QAAM;AAAA,IACL,aAAa,oBAAoB,gBAAgB,aAAa;AAAA,IAC9D,OAAO,cAAc,gBAAgB,OAAO;AAAA,IAC5C,cAAc,CAAC;AAAA,EAChB,IAAI;AAEJ,QAAM,UAAoB,CAAC;AAG3B,UAAQ,KAAK,KAAK,GAAG,YAAY,GAAG,MAAM,GAAG,QAAQ,EAAE,YAAY,CAAC,CAAC;AAErE,MAAI,aAAa;AAChB,YAAQ,KAAK,MAAM,CAAC;AAAA,EACrB;AAGA,MAAI,mBAAmB;AACtB,YAAQ,KAAK,YAAY,CAAC;AAAA,EAC3B;AAEA,SAAO,YAAY,GAAG,SAAS,UAAU;AAC1C;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shun-shobon/style-guide",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "shun-shobon's engineering style guide",
|
|
6
6
|
"repository": {
|
|
@@ -12,12 +12,10 @@
|
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"exports": {
|
|
14
14
|
"./eslint": {
|
|
15
|
-
"import": "./dist/eslint/index.js"
|
|
16
|
-
"require": "./dist/eslint/index.cjs"
|
|
15
|
+
"import": "./dist/eslint/index.js"
|
|
17
16
|
},
|
|
18
17
|
"./prettier": {
|
|
19
|
-
"import": "./dist/prettier/index.js"
|
|
20
|
-
"require": "./dist/prettier/index.cjs"
|
|
18
|
+
"import": "./dist/prettier/index.js"
|
|
21
19
|
}
|
|
22
20
|
},
|
|
23
21
|
"files": [
|
|
@@ -40,33 +38,33 @@
|
|
|
40
38
|
"dependencies": {
|
|
41
39
|
"@eslint/js": "9.28.0",
|
|
42
40
|
"@next/eslint-plugin-next": "15.3.3",
|
|
43
|
-
"@typescript-eslint/parser": "8.
|
|
41
|
+
"@typescript-eslint/parser": "8.34.0",
|
|
44
42
|
"astro-eslint-parser": "1.2.2",
|
|
45
43
|
"eslint-config-flat-gitignore": "2.1.0",
|
|
46
44
|
"eslint-define-config": "2.1.0",
|
|
47
|
-
"eslint-import-resolver-typescript": "4.4.
|
|
45
|
+
"eslint-import-resolver-typescript": "4.4.3",
|
|
48
46
|
"eslint-plugin-astro": "1.3.1",
|
|
49
|
-
"eslint-plugin-import-x": "4.15.
|
|
47
|
+
"eslint-plugin-import-x": "4.15.1",
|
|
50
48
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
51
49
|
"eslint-plugin-n": "17.19.0",
|
|
52
50
|
"eslint-plugin-qwik": "1.14.1",
|
|
53
51
|
"eslint-plugin-react": "7.37.5",
|
|
54
52
|
"eslint-plugin-react-hooks": "5.2.0",
|
|
55
|
-
"eslint-plugin-regexp": "2.
|
|
53
|
+
"eslint-plugin-regexp": "2.9.0",
|
|
56
54
|
"eslint-plugin-simple-import-sort": "12.1.1",
|
|
57
|
-
"eslint-plugin-storybook": "9.0.
|
|
55
|
+
"eslint-plugin-storybook": "9.0.7",
|
|
58
56
|
"eslint-plugin-unicorn": "59.0.1",
|
|
59
57
|
"globals": "16.2.0",
|
|
60
58
|
"local-pkg": "1.1.1",
|
|
61
59
|
"prettier-plugin-astro": "0.14.1",
|
|
62
60
|
"prettier-plugin-jsdoc": "1.3.2",
|
|
63
|
-
"prettier-plugin-pkg": "0.
|
|
61
|
+
"prettier-plugin-pkg": "0.21.1",
|
|
64
62
|
"prettier-plugin-tailwindcss": "0.6.12",
|
|
65
|
-
"typescript-eslint": "8.
|
|
63
|
+
"typescript-eslint": "8.34.0"
|
|
66
64
|
},
|
|
67
65
|
"devDependencies": {
|
|
68
66
|
"@changesets/cli": "2.29.4",
|
|
69
|
-
"@types/node": "22.15.
|
|
67
|
+
"@types/node": "22.15.31",
|
|
70
68
|
"eslint": "9.28.0",
|
|
71
69
|
"prettier": "3.5.3",
|
|
72
70
|
"tsup": "8.5.0",
|