@hiddenability/opinionated-defaults 0.0.7 → 0.0.9

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
@@ -41,14 +41,14 @@ npm i @hiddenability/opinionated-defaults -D
41
41
  ### Eslint:
42
42
  ```ts
43
43
  // eslint.config.ts
44
- import {eslintConfigConfigName} from "reasonable-defaults/eslint"
44
+ import { eslintConfigConfigName } from "@hiddenability/opinionated-defaults/eslint";
45
45
 
46
46
  const eslintConfig = [...eslintConfigConfigName];
47
47
 
48
48
  export default eslintConfig;
49
49
  ```
50
50
 
51
- ##### Supported Imports:
51
+ #### Exports:
52
52
  - eslintConfigAstro (Astro)
53
53
  - eslintConfigElysia (Elysia.js)
54
54
  - eslintConfigNext (Next.js)
@@ -63,17 +63,33 @@ export default eslintConfig;
63
63
  ### Prettier:
64
64
  ```ts
65
65
  // prettier.config.mjs
66
- import {prettierConfigConfigName} from "reasonable-defaults/prettier"
66
+ import { prettierConfigConfigName } from "@hiddenability/opinionated-defaults/prettier";
67
67
 
68
68
  const prettierConfig = {...prettierConfigConfigName};
69
69
 
70
+ export default prettierConfig;
71
+ ```
72
+ #### 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.
75
+ ```ts
76
+ // prettier.config.mjs
77
+ import {
78
+ prettierConfig1,
79
+ prettierConfig2,
80
+ configMerge,
81
+ } from "@hiddenability/opinionated-defaults/prettier";
82
+
83
+ const prettierConfig = merge(prettierConfig1, prettierConfig2, {/* your custom rules */} /*...*/);
84
+
70
85
  export default prettierConfig;
71
86
  ```
72
87
 
73
- ##### Supported Imports:
88
+ #### Exports:
74
89
  - prettierConfigAstro (Astro prettier rules with Tailwind class ordering)
75
90
  - prettierConfigNext (Rules for Next.js with Tailwind class ordering)
76
91
  - prettierConfigBase (General rules for every project)
92
+ - configMerge (used to merge configurations)
77
93
 
78
94
  ## TODO:
79
95
  - Improve repository structure (How to manage configuration options within eslint dir?).
@@ -1,7 +1,7 @@
1
1
  import baseConfig from "./base.mjs";
2
- import eslintPluginAstro from "eslint-plugin-astro";
3
- import tsConfig from "./typescript.mjs";
4
2
  import relativeConfig from "./relative.mjs";
3
+ import tsConfig from "./typescript.mjs";
4
+ import eslintPluginAstro from "eslint-plugin-astro";
5
5
  const astroConfig = [
6
6
  ...baseConfig,
7
7
  ...tsConfig,
@@ -1,6 +1,6 @@
1
- import eslintPluginUnicorn from "eslint-plugin-unicorn";
2
1
  import js from "@eslint/js";
3
2
  import preferArrowFunctions from "eslint-plugin-prefer-arrow-functions";
3
+ import eslintPluginUnicorn from "eslint-plugin-unicorn";
4
4
  const config = [
5
5
  js.configs.recommended,
6
6
  eslintPluginUnicorn.configs.recommended,
@@ -1,7 +1,7 @@
1
1
  import baseConfig from "./base.mjs";
2
- import tsConfig from "./typescript.mjs";
3
2
  import functionalConfig from "./functional.mjs";
4
3
  import relativeConfig from "./relative.mjs";
4
+ import tsConfig from "./typescript.mjs";
5
5
  const elysiaConfig = [
6
6
  ...baseConfig,
7
7
  ...tsConfig,
@@ -1,8 +1,8 @@
1
- import pluginNext from "@next/eslint-plugin-next";
2
1
  import baseConfig from "./base.mjs";
3
- import tsConfig from "./typescript.mjs";
4
2
  import reactConfig from "./react.mjs";
5
3
  import relativeConfig from "./relative.mjs";
4
+ import tsConfig from "./typescript.mjs";
5
+ import pluginNext from "@next/eslint-plugin-next";
6
6
  const nextJsConfig = [
7
7
  ...baseConfig,
8
8
  ...reactConfig,
@@ -1,5 +1,5 @@
1
- import pluginReactHooks from "eslint-plugin-react-hooks";
2
1
  import pluginReact from "eslint-plugin-react";
2
+ import pluginReactHooks from "eslint-plugin-react-hooks";
3
3
  const reactConfig = [
4
4
  pluginReact.configs.flat["recommended"],
5
5
  pluginReact.configs.flat["jsx-runtime"],
@@ -1,12 +1,15 @@
1
1
  import baseConfig from "./base.mjs";
2
- const astroConfig = {
3
- ...baseConfig,
4
- plugins: ["prettier-plugin-astro"],
5
- overrides: [
6
- {
7
- files: "*.astro",
8
- options: { parser: "astro" }
9
- }
10
- ]
11
- };
2
+ import { merge } from "lodash";
3
+ const astroConfig = merge(
4
+ {
5
+ plugins: ["prettier-plugin-astro"],
6
+ overrides: [
7
+ {
8
+ files: "*.astro",
9
+ options: { parser: "astro" }
10
+ }
11
+ ]
12
+ },
13
+ baseConfig
14
+ );
12
15
  export default astroConfig;
@@ -1,3 +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';
@@ -1,3 +1,4 @@
1
1
  export { default as prettierConfigBase } from "./base.mjs";
2
2
  export { default as prettierConfigAstro } from "./astro.mjs";
3
3
  export { default as prettierConfigTailwind } from "./tailwind.mjs";
4
+ export { default as configMerge } from "lodash/merge";
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.7",
4
+ "version": "0.0.9",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -34,6 +34,7 @@
34
34
  "@next/eslint-plugin-next": "^15.4.0-canary.83",
35
35
  "@stylistic/eslint-plugin": "^4.4.1",
36
36
  "@trivago/prettier-plugin-sort-imports": "^5.2.2",
37
+ "@types/lodash": "^4.17.17",
37
38
  "eslint-config-prettier": "^10.1.5",
38
39
  "eslint-plugin-astro": "^1.3.1",
39
40
  "eslint-plugin-functional": "^9.0.2",
@@ -44,12 +45,13 @@
44
45
  "eslint-plugin-react-hooks": "^5.2.0",
45
46
  "eslint-plugin-turbo": "^2.5.4",
46
47
  "eslint-plugin-unicorn": "^59.0.1",
48
+ "lodash": "^4.17.21",
47
49
  "prettier-plugin-astro": "^0.14.1",
48
50
  "prettier-plugin-tailwindcss": "0.6.12",
49
51
  "typescript-eslint": "^8.34.0"
50
52
  },
51
53
  "devDependencies": {
52
- "@hiddenability/opinionated-defaults": "^0.0.6",
54
+ "@hiddenability/opinionated-defaults": "^0.0.8",
53
55
  "jiti": "^2.4.2",
54
56
  "typescript": "^5.8.3",
55
57
  "unbuild": "^3.5.0"