@zayne-labs/prettier-config 0.7.8 → 0.8.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 ADDED
@@ -0,0 +1,72 @@
1
+ # @zayne-labs/prettier-config
2
+
3
+ Shared Prettier configuration used across Zayne Labs projects.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add -D @zayne-labs/prettier-config
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ The package exports two configurations:
14
+
15
+ - `baseConfig`: Basic Prettier configuration
16
+ - `configWithTailwind`: Extended configuration with Tailwind CSS support (includes plugins)
17
+
18
+ In your `.prettierrc.js` | `.prettierrc.mjs` | `prettier.config.js` | `prettier.config.mjs`:
19
+
20
+ ```js
21
+ import { baseConfig } from '@zayne-labs/prettier-config';
22
+
23
+ // Use base config
24
+ export default baseConfig;
25
+
26
+ // You can extend the base config with additional options
27
+ export default {
28
+ ...baseConfig,
29
+ // Add your custom options here
30
+ };
31
+ ```
32
+
33
+ ```js
34
+ import { configWithTailwind } from '@zayne-labs/prettier-config';
35
+
36
+ // OR use Tailwind config
37
+ export default configWithTailwind;
38
+
39
+ // You can extend the Tailwind config with additional options
40
+ export default {
41
+ ...configWithTailwind,
42
+ // Add your custom options here
43
+ };
44
+ ```
45
+
46
+ ### Base Configuration
47
+
48
+ The base configuration includes:
49
+
50
+ ```js
51
+ {
52
+ experimentalOperatorPosition: "start",
53
+ jsxSingleQuote: false,
54
+ printWidth: 107,
55
+ singleQuote: false,
56
+ tabWidth: 3,
57
+ trailingComma: "es5",
58
+ useTabs: true
59
+ }
60
+ ```
61
+
62
+ ### Tailwind Configuration
63
+
64
+ The Tailwind configuration extends the base config and adds support for:
65
+
66
+ - Tailwind CSS class sorting
67
+ - Class merging utilities
68
+ - Custom attributes and functions for class management
69
+
70
+ ## License
71
+
72
+ MIT © Zayne Labs
package/dist/index.d.ts CHANGED
@@ -2,13 +2,13 @@ import { AnyString } from '@zayne-labs/toolkit-type-helpers';
2
2
  import { Config } from 'prettier';
3
3
 
4
4
  declare const baseConfig: {
5
- readonly experimentalOperatorPosition: "start";
6
- readonly jsxSingleQuote: false;
7
- readonly printWidth: 107;
8
- readonly singleQuote: false;
9
- readonly tabWidth: 3;
10
- readonly trailingComma: "es5";
11
- readonly useTabs: true;
5
+ experimentalOperatorPosition: "start";
6
+ jsxSingleQuote: false;
7
+ printWidth: 107;
8
+ singleQuote: false;
9
+ tabWidth: 3;
10
+ trailingComma: "es5";
11
+ useTabs: true;
12
12
  };
13
13
  type ConfigWithTailwind = Omit<Config, "plugins"> & {
14
14
  customAttributes?: string[];
@@ -28,22 +28,49 @@ type ConfigWithTailwind = Omit<Config, "plugins"> & {
28
28
  * @docs
29
29
  * - [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss)
30
30
  * - [prettier-plugin-classnames](https://github.com/ony3000/prettier-plugin-classnames)
31
+ * - [prettier-plugin-merge](https://github.com/ony3000/prettier-plugin-merge)
31
32
  */
32
33
  declare const configWithTailwind: {
33
- readonly customAttributes: ["classNames", "classes"];
34
- readonly customFunctions: ["cnMerge", "cnJoin", "cn", "tv"];
35
- readonly endingPosition: "absolute-with-indent";
36
- readonly plugins: ["prettier-plugin-tailwindcss", "prettier-plugin-classnames", "prettier-plugin-merge"];
37
- readonly tailwindAttributes: ["classNames", "classes"];
38
- readonly tailwindFunctions: ["cnMerge", "cnJoin", "cn", "tv"];
39
- readonly tailwindStylesheet: "./tailwind.css";
40
- readonly experimentalOperatorPosition: "start";
41
- readonly jsxSingleQuote: false;
42
- readonly printWidth: 107;
43
- readonly singleQuote: false;
44
- readonly tabWidth: 3;
45
- readonly trailingComma: "es5";
46
- readonly useTabs: true;
34
+ customAttributes: ["classNames", "classes"];
35
+ customFunctions: ["cnMerge", "cnJoin", "cn", "tv"];
36
+ endingPosition: "absolute-with-indent";
37
+ plugins: ["prettier-plugin-tailwindcss", "prettier-plugin-classnames", "prettier-plugin-merge"];
38
+ tailwindAttributes: ["classNames", "classes"];
39
+ tailwindFunctions: ["cnMerge", "cnJoin", "cn", "tv"];
40
+ tailwindStylesheet: "./tailwind.css";
41
+ experimentalOperatorPosition: "start";
42
+ jsxSingleQuote: false;
43
+ printWidth: 107;
44
+ singleQuote: false;
45
+ tabWidth: 3;
46
+ trailingComma: "es5";
47
+ useTabs: true;
48
+ };
49
+ type ConfigWithAstro = Omit<Config, "plugins"> & {
50
+ astroAllowShorthand?: boolean;
51
+ astroSkipFrontmatter?: boolean;
52
+ plugins?: Array<"prettier-plugin-astro" | AnyString>;
53
+ };
54
+ /**
55
+ * @description Prettier configuration with Astro support.
56
+ *
57
+ * @docs [prettier-plugin-astro](https://github.com/withastro/prettier-plugin-astro#configuration)
58
+ */
59
+ declare const configWithAstro: {
60
+ overrides: [{
61
+ files: "*.astro";
62
+ options: {
63
+ parser: "astro";
64
+ };
65
+ }];
66
+ plugins: ["prettier-plugin-astro"];
67
+ experimentalOperatorPosition: "start";
68
+ jsxSingleQuote: false;
69
+ printWidth: 107;
70
+ singleQuote: false;
71
+ tabWidth: 3;
72
+ trailingComma: "es5";
73
+ useTabs: true;
47
74
  };
48
75
 
49
- export { type ConfigWithTailwind, baseConfig, configWithTailwind };
76
+ export { type ConfigWithAstro, type ConfigWithTailwind, baseConfig, configWithAstro, configWithTailwind };
package/dist/index.js CHANGED
@@ -1,5 +1,7 @@
1
+ import { defineEnum, defineEnumDeep } from '@zayne-labs/toolkit-type-helpers';
2
+
1
3
  // src/configs.ts
2
- var baseConfig = {
4
+ var baseConfig = defineEnum({
3
5
  experimentalOperatorPosition: "start",
4
6
  jsxSingleQuote: false,
5
7
  printWidth: 107,
@@ -7,8 +9,8 @@ var baseConfig = {
7
9
  tabWidth: 3,
8
10
  trailingComma: "es5",
9
11
  useTabs: true
10
- };
11
- var configWithTailwind = {
12
+ });
13
+ var configWithTailwind = defineEnumDeep({
12
14
  ...baseConfig,
13
15
  customAttributes: ["classNames", "classes"],
14
16
  customFunctions: ["cnMerge", "cnJoin", "cn", "tv"],
@@ -17,8 +19,20 @@ var configWithTailwind = {
17
19
  tailwindAttributes: ["classNames", "classes"],
18
20
  tailwindFunctions: ["cnMerge", "cnJoin", "cn", "tv"],
19
21
  tailwindStylesheet: "./tailwind.css"
20
- };
22
+ });
23
+ var configWithAstro = defineEnumDeep({
24
+ ...baseConfig,
25
+ overrides: [
26
+ {
27
+ files: "*.astro",
28
+ options: {
29
+ parser: "astro"
30
+ }
31
+ }
32
+ ],
33
+ plugins: ["prettier-plugin-astro"]
34
+ });
21
35
 
22
- export { baseConfig, configWithTailwind };
36
+ export { baseConfig, configWithAstro, configWithTailwind };
23
37
  //# sourceMappingURL=index.js.map
24
38
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/configs.ts"],"names":[],"mappings":";AAGO,IAAM,UAAa,GAAA;AAAA,EACzB,4BAA8B,EAAA,OAAA;AAAA,EAC9B,cAAgB,EAAA,KAAA;AAAA,EAChB,UAAY,EAAA,GAAA;AAAA,EACZ,WAAa,EAAA,KAAA;AAAA,EACb,QAAU,EAAA,CAAA;AAAA,EACV,aAAe,EAAA,KAAA;AAAA,EACf,OAAS,EAAA;AACV;AAyBO,IAAM,kBAAqB,GAAA;AAAA,EACjC,GAAG,UAAA;AAAA,EACH,gBAAA,EAAkB,CAAC,YAAA,EAAc,SAAS,CAAA;AAAA,EAC1C,eAAiB,EAAA,CAAC,SAAW,EAAA,QAAA,EAAU,MAAM,IAAI,CAAA;AAAA,EACjD,cAAgB,EAAA,sBAAA;AAAA,EAChB,OAAS,EAAA,CAAC,6BAA+B,EAAA,4BAAA,EAA8B,uBAAuB,CAAA;AAAA,EAC9F,kBAAA,EAAoB,CAAC,YAAA,EAAc,SAAS,CAAA;AAAA,EAC5C,iBAAmB,EAAA,CAAC,SAAW,EAAA,QAAA,EAAU,MAAM,IAAI,CAAA;AAAA,EACnD,kBAAoB,EAAA;AACrB","file":"index.js","sourcesContent":["import type { AnyString } from \"@zayne-labs/toolkit-type-helpers\";\nimport type { Config } from \"prettier\";\n\nexport const baseConfig = {\n\texperimentalOperatorPosition: \"start\",\n\tjsxSingleQuote: false,\n\tprintWidth: 107,\n\tsingleQuote: false,\n\ttabWidth: 3,\n\ttrailingComma: \"es5\",\n\tuseTabs: true,\n} as const satisfies Config;\n\nexport type ConfigWithTailwind = Omit<Config, \"plugins\"> & {\n\tcustomAttributes?: string[];\n\tcustomFunctions?: string[];\n\tendPosition?: \"absolute-with-indent\" | \"absolute\" | \"relative\";\n\tplugins?: Array<\n\t\t// eslint-disable-next-line perfectionist/sort-union-types -- prettier-plugin-tailwindcss should come before prettier-plugin-classnames\n\t\t\"prettier-plugin-tailwindcss\" | \"prettier-plugin-classnames\" | \"prettier-plugin-merge\" | AnyString\n\t>;\n\ttailwindAttributes?: string[];\n\ttailwindConfig?: `./${string}`;\n\ttailwindFunctions?: string[];\n\ttailwindPreserveDuplicates?: boolean;\n\ttailwindPreserveWhitespace?: boolean;\n\ttailwindStylesheet?: `./${string}`;\n};\n\n/**\n * @description Prettier configuration with Tailwind CSS support.\n *\n * @docs\n * - [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss)\n * - [prettier-plugin-classnames](https://github.com/ony3000/prettier-plugin-classnames)\n */\nexport const configWithTailwind = {\n\t...baseConfig,\n\tcustomAttributes: [\"classNames\", \"classes\"],\n\tcustomFunctions: [\"cnMerge\", \"cnJoin\", \"cn\", \"tv\"],\n\tendingPosition: \"absolute-with-indent\",\n\tplugins: [\"prettier-plugin-tailwindcss\", \"prettier-plugin-classnames\", \"prettier-plugin-merge\"],\n\ttailwindAttributes: [\"classNames\", \"classes\"],\n\ttailwindFunctions: [\"cnMerge\", \"cnJoin\", \"cn\", \"tv\"],\n\ttailwindStylesheet: \"./tailwind.css\",\n} as const satisfies ConfigWithTailwind;\n"]}
1
+ {"version":3,"sources":["../src/configs.ts"],"names":[],"mappings":";;;AAGO,IAAM,aAAa,UAAW,CAAA;AAAA,EACpC,4BAA8B,EAAA,OAAA;AAAA,EAC9B,cAAgB,EAAA,KAAA;AAAA,EAChB,UAAY,EAAA,GAAA;AAAA,EACZ,WAAa,EAAA,KAAA;AAAA,EACb,QAAU,EAAA,CAAA;AAAA,EACV,aAAe,EAAA,KAAA;AAAA,EACf,OAAS,EAAA;AACV,CAAC;AA0BM,IAAM,qBAAqB,cAAe,CAAA;AAAA,EAChD,GAAG,UAAA;AAAA,EAEH,gBAAA,EAAkB,CAAC,YAAA,EAAc,SAAS,CAAA;AAAA,EAC1C,eAAiB,EAAA,CAAC,SAAW,EAAA,QAAA,EAAU,MAAM,IAAI,CAAA;AAAA,EACjD,cAAgB,EAAA,sBAAA;AAAA,EAChB,OAAS,EAAA,CAAC,6BAA+B,EAAA,4BAAA,EAA8B,uBAAuB,CAAA;AAAA,EAC9F,kBAAA,EAAoB,CAAC,YAAA,EAAc,SAAS,CAAA;AAAA,EAC5C,iBAAmB,EAAA,CAAC,SAAW,EAAA,QAAA,EAAU,MAAM,IAAI,CAAA;AAAA,EACnD,kBAAoB,EAAA;AACrB,CAAC;AAcM,IAAM,kBAAkB,cAAe,CAAA;AAAA,EAC7C,GAAG,UAAA;AAAA,EAEH,SAAW,EAAA;AAAA,IACV;AAAA,MACC,KAAO,EAAA,SAAA;AAAA,MACP,OAAS,EAAA;AAAA,QACR,MAAQ,EAAA;AAAA;AACT;AACD,GACD;AAAA,EACA,OAAA,EAAS,CAAC,uBAAuB;AAClC,CAAC","file":"index.js","sourcesContent":["import { type AnyString, defineEnum, defineEnumDeep } from \"@zayne-labs/toolkit-type-helpers\";\nimport type { Config } from \"prettier\";\n\nexport const baseConfig = defineEnum({\n\texperimentalOperatorPosition: \"start\",\n\tjsxSingleQuote: false,\n\tprintWidth: 107,\n\tsingleQuote: false,\n\ttabWidth: 3,\n\ttrailingComma: \"es5\",\n\tuseTabs: true,\n}) satisfies Config;\n\nexport type ConfigWithTailwind = Omit<Config, \"plugins\"> & {\n\tcustomAttributes?: string[];\n\tcustomFunctions?: string[];\n\tendPosition?: \"absolute-with-indent\" | \"absolute\" | \"relative\";\n\tplugins?: Array<\n\t\t// eslint-disable-next-line perfectionist/sort-union-types -- prettier-plugin-tailwindcss should come before prettier-plugin-classnames\n\t\t\"prettier-plugin-tailwindcss\" | \"prettier-plugin-classnames\" | \"prettier-plugin-merge\" | AnyString\n\t>;\n\ttailwindAttributes?: string[];\n\ttailwindConfig?: `./${string}`;\n\ttailwindFunctions?: string[];\n\ttailwindPreserveDuplicates?: boolean;\n\ttailwindPreserveWhitespace?: boolean;\n\ttailwindStylesheet?: `./${string}`;\n};\n\n/**\n * @description Prettier configuration with Tailwind CSS support.\n *\n * @docs\n * - [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss)\n * - [prettier-plugin-classnames](https://github.com/ony3000/prettier-plugin-classnames)\n * - [prettier-plugin-merge](https://github.com/ony3000/prettier-plugin-merge)\n */\nexport const configWithTailwind = defineEnumDeep({\n\t...baseConfig,\n\n\tcustomAttributes: [\"classNames\", \"classes\"],\n\tcustomFunctions: [\"cnMerge\", \"cnJoin\", \"cn\", \"tv\"],\n\tendingPosition: \"absolute-with-indent\",\n\tplugins: [\"prettier-plugin-tailwindcss\", \"prettier-plugin-classnames\", \"prettier-plugin-merge\"],\n\ttailwindAttributes: [\"classNames\", \"classes\"],\n\ttailwindFunctions: [\"cnMerge\", \"cnJoin\", \"cn\", \"tv\"],\n\ttailwindStylesheet: \"./tailwind.css\",\n}) satisfies ConfigWithTailwind;\n\nexport type ConfigWithAstro = Omit<Config, \"plugins\"> & {\n\tastroAllowShorthand?: boolean;\n\tastroSkipFrontmatter?: boolean;\n\tplugins?: Array<\"prettier-plugin-astro\" | AnyString>;\n};\n\n/**\n * @description Prettier configuration with Astro support.\n *\n * @docs [prettier-plugin-astro](https://github.com/withastro/prettier-plugin-astro#configuration)\n */\n\nexport const configWithAstro = defineEnumDeep({\n\t...baseConfig,\n\n\toverrides: [\n\t\t{\n\t\t\tfiles: \"*.astro\",\n\t\t\toptions: {\n\t\t\t\tparser: \"astro\",\n\t\t\t},\n\t\t},\n\t],\n\tplugins: [\"prettier-plugin-astro\"],\n}) satisfies ConfigWithAstro;\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zayne-labs/prettier-config",
3
3
  "type": "module",
4
- "version": "0.7.8",
4
+ "version": "0.8.0",
5
5
  "description": "Zayne Labs' Prettier config",
6
6
  "author": "Ryan Zayne",
7
7
  "license": "MIT",
@@ -32,7 +32,7 @@
32
32
  "node": ">=18.x"
33
33
  },
34
34
  "dependencies": {
35
- "@zayne-labs/toolkit-type-helpers": "^0.8.48"
35
+ "@zayne-labs/toolkit-type-helpers": "^0.9.2"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@arethetypeswrong/cli": "^0.17.4",
@@ -43,13 +43,11 @@
43
43
  "clsx": "^2.1.1",
44
44
  "concurrently": "^9.1.2",
45
45
  "cross-env": "^7.0.3",
46
- "publint": "^0.3.7",
46
+ "publint": "^0.3.10",
47
47
  "size-limit": "^11.2.0",
48
- "terser": "^5.39.0",
49
48
  "tsup": "^8.4.0",
50
- "typescript": "5.8.2",
51
- "vitest": "3.0.7",
52
- "@zayne-labs/tsconfig": "0.7.8"
49
+ "typescript": "5.8.3",
50
+ "@zayne-labs/tsconfig": "0.8.0"
53
51
  },
54
52
  "publishConfig": {
55
53
  "access": "public",
@@ -68,7 +66,8 @@
68
66
  "build:test": "concurrently --prefix-colors \"yellow.bold,#7da4f8.bold,magenta\" --names PUBLINT,TSUP 'pnpm:lint:publint' 'pnpm:build:dev'",
69
67
  "dev": "pnpm build:dev --watch",
70
68
  "lint:attw": "attw --pack . --ignore-rules=cjs-resolves-to-esm",
71
- "lint:publint": "publint --strict .",
69
+ "lint:eslint": "eslint . --max-warnings 0",
70
+ "lint:publint": "publint --strict . ",
72
71
  "lint:size": "size-limit",
73
72
  "lint:type-check": "tsc --pretty -p tsconfig.json",
74
73
  "release": "pnpm publish --no-git-checks",