@hiddenability/opinionated-defaults 0.0.9 → 0.0.11

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 CHANGED
@@ -7,6 +7,18 @@ A collection of opinionated tooling configurations.
7
7
  - Elysia.js
8
8
  - Next.js
9
9
 
10
+ #### Exports:
11
+ - eslintConfigAstro (Astro)
12
+ - eslintConfigElysia (Elysia.js)
13
+ - eslintConfigNext (Next.js)
14
+ - eslintConfigTurbo (Turborepo)
15
+ - eslintConfigBase (General rules for every project)
16
+ - eslintConfigFunctional (Enforces functional style)
17
+ - eslintConfigPrettier (Runs prettier as ESLint rules)
18
+ - eslintConfigReact (General rules for React)
19
+ - eslintConfigRelative (Enforces the use of absolute import paths using path aliases)
20
+ - eslintConfigStylistic (Enforces code-style through ESLint rules)
21
+
10
22
  #### Included plugins:
11
23
  - [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier)
12
24
  - [eslint-plugin-no-relative-import-paths](https://github.com/MelvinVermeer/eslint-plugin-no-relative-import-paths)
@@ -24,11 +36,18 @@ A collection of opinionated tooling configurations.
24
36
  - Next.js
25
37
  - +Opinionated defaults
26
38
 
39
+ #### Exports:
40
+ - prettierConfigAstro (Astro prettier rules with Tailwind class ordering)
41
+ - prettierConfigNext (Rules for Next.js with Tailwind class ordering)
42
+ - prettierConfigBase (General rules for every project)
43
+ - configMerge (used to merge configurations)
44
+
27
45
  #### Included plugins:
28
46
  - [prettier-plugin-astro](https://github.com/withastro/prettier-plugin-astro)
29
47
  - [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss)
30
48
 
31
49
  ## Installation:
50
+
32
51
  ```
33
52
  bun add @hiddenability/opinionated-defaults -d
34
53
  ```
@@ -38,7 +57,9 @@ npm i @hiddenability/opinionated-defaults -D
38
57
  ```
39
58
 
40
59
  ## Usage:
60
+
41
61
  ### Eslint:
62
+
42
63
  ```ts
43
64
  // eslint.config.ts
44
65
  import { eslintConfigConfigName } from "@hiddenability/opinionated-defaults/eslint";
@@ -48,19 +69,8 @@ const eslintConfig = [...eslintConfigConfigName];
48
69
  export default eslintConfig;
49
70
  ```
50
71
 
51
- #### Exports:
52
- - eslintConfigAstro (Astro)
53
- - eslintConfigElysia (Elysia.js)
54
- - eslintConfigNext (Next.js)
55
- - eslintConfigTurbo (Turborepo)
56
- - eslintConfigBase (General rules for every project)
57
- - eslintConfigFunctional (Enforces functional style)
58
- - eslintConfigPrettier (Runs prettier as ESLint rules)
59
- - eslintConfigReact (General rules for React)
60
- - eslintConfigRelative (Enforces the use of absolute import paths using path aliases)
61
- - eslintConfigStylistic (Enforces code-style through ESLint rules)
62
-
63
72
  ### Prettier:
73
+
64
74
  ```ts
65
75
  // prettier.config.mjs
66
76
  import { prettierConfigConfigName } from "@hiddenability/opinionated-defaults/prettier";
@@ -69,15 +79,16 @@ const prettierConfig = {...prettierConfigConfigName};
69
79
 
70
80
  export default prettierConfig;
71
81
  ```
82
+
72
83
  #### Extending/Combining Prettier Configs:
73
- Since prettier uses a configuration object instead of a flat config like ESLint,
74
- to extend or combine configurations, you need to use the provided merge function.
84
+ Since prettier uses a configuration object instead of a flat config like ESLint, to extend or combine configurations, you need to use the provided merge function.
85
+
75
86
  ```ts
76
87
  // prettier.config.mjs
77
88
  import {
78
89
  prettierConfig1,
79
90
  prettierConfig2,
80
- configMerge,
91
+ merge,
81
92
  } from "@hiddenability/opinionated-defaults/prettier";
82
93
 
83
94
  const prettierConfig = merge(prettierConfig1, prettierConfig2, {/* your custom rules */} /*...*/);
@@ -85,11 +96,8 @@ const prettierConfig = merge(prettierConfig1, prettierConfig2, {/* your custom r
85
96
  export default prettierConfig;
86
97
  ```
87
98
 
88
- #### Exports:
89
- - prettierConfigAstro (Astro prettier rules with Tailwind class ordering)
90
- - prettierConfigNext (Rules for Next.js with Tailwind class ordering)
91
- - prettierConfigBase (General rules for every project)
92
- - configMerge (used to merge configurations)
99
+ > [!NOTE]
100
+ > When using prettierConfigTailwind, it needs to come first in the merge function. Read more [here](https://github.com/tailwindlabs/prettier-plugin-tailwindcss#compatibility-with-other-prettier-plugins)
93
101
 
94
102
  ## TODO:
95
103
  - Improve repository structure (How to manage configuration options within eslint dir?).
@@ -1,5 +1,6 @@
1
1
  import baseConfig from "./base.mjs";
2
- import { merge } from "lodash";
2
+ import lodash from "lodash";
3
+ const { merge } = lodash;
3
4
  const astroConfig = merge(
4
5
  {
5
6
  plugins: ["prettier-plugin-astro"],
@@ -1,4 +1,4 @@
1
1
  export { default as prettierConfigBase } from './base';
2
2
  export { default as prettierConfigAstro } from './astro';
3
3
  export { default as prettierConfigTailwind } from './tailwind';
4
- export { default as configMerge } from 'lodash/merge';
4
+ export declare const merge: any;
@@ -1,4 +1,5 @@
1
+ import lodash from "lodash";
1
2
  export { default as prettierConfigBase } from "./base.mjs";
2
3
  export { default as prettierConfigAstro } from "./astro.mjs";
3
4
  export { default as prettierConfigTailwind } from "./tailwind.mjs";
4
- export { default as configMerge } from "lodash/merge";
5
+ export const { merge } = lodash;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hiddenability/opinionated-defaults",
3
3
  "description": "Opinionated default configurations for dev tools.",
4
- "version": "0.0.9",
4
+ "version": "0.0.11",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -51,7 +51,7 @@
51
51
  "typescript-eslint": "^8.34.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@hiddenability/opinionated-defaults": "^0.0.8",
54
+ "@hiddenability/opinionated-defaults": "^0.0.10",
55
55
  "jiti": "^2.4.2",
56
56
  "typescript": "^5.8.3",
57
57
  "unbuild": "^3.5.0"