@hiddenability/opinionated-defaults 0.0.18 → 0.0.20
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 +25 -9
- package/dist/eslint/prettier.mjs +1 -6
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
# 
|
|
2
|
+
|
|
2
3
|
A collection of opinionated tooling configurations.
|
|
3
4
|
|
|
4
5
|
## Supported Framework Configurations:
|
|
6
|
+
|
|
5
7
|
### Eslint:
|
|
8
|
+
|
|
6
9
|
- Astro
|
|
7
10
|
- Elysia.js
|
|
8
11
|
- Next.js
|
|
9
12
|
|
|
10
|
-
####
|
|
13
|
+
#### Exports:
|
|
14
|
+
|
|
11
15
|
- eslintConfigAstro (Astro)
|
|
12
16
|
- eslintConfigElysia (Elysia.js)
|
|
13
17
|
- eslintConfigNext (Next.js)
|
|
@@ -20,6 +24,7 @@ A collection of opinionated tooling configurations.
|
|
|
20
24
|
- eslintConfigStylistic (Enforces code-style through ESLint rules)
|
|
21
25
|
|
|
22
26
|
#### Included plugins:
|
|
27
|
+
|
|
23
28
|
- [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier)
|
|
24
29
|
- [eslint-plugin-no-relative-import-paths](https://github.com/MelvinVermeer/eslint-plugin-no-relative-import-paths)
|
|
25
30
|
- [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react)
|
|
@@ -32,17 +37,20 @@ A collection of opinionated tooling configurations.
|
|
|
32
37
|
- [eslint-stylistic](https://github.com/eslint-stylistic/eslint-stylistic)
|
|
33
38
|
|
|
34
39
|
### Prettier:
|
|
40
|
+
|
|
35
41
|
- Astro
|
|
36
42
|
- Next.js
|
|
37
43
|
- +Opinionated defaults
|
|
38
44
|
|
|
39
45
|
#### Exports:
|
|
46
|
+
|
|
40
47
|
- prettierConfigAstro (Astro prettier rules with Tailwind class ordering)
|
|
41
48
|
- prettierConfigNext (Rules for Next.js with Tailwind class ordering)
|
|
42
49
|
- prettierConfigBase (General rules for every project)
|
|
43
50
|
- configMerge (used to merge configurations)
|
|
44
51
|
|
|
45
52
|
#### Included plugins:
|
|
53
|
+
|
|
46
54
|
- [prettier-plugin-astro](https://github.com/withastro/prettier-plugin-astro)
|
|
47
55
|
- [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss)
|
|
48
56
|
|
|
@@ -62,7 +70,7 @@ npm i @hiddenability/opinionated-defaults -D
|
|
|
62
70
|
|
|
63
71
|
```ts
|
|
64
72
|
// eslint.config.ts
|
|
65
|
-
import { eslintConfigConfigName } from
|
|
73
|
+
import { eslintConfigConfigName } from '@hiddenability/opinionated-defaults/eslint';
|
|
66
74
|
|
|
67
75
|
const eslintConfig = [...eslintConfigConfigName];
|
|
68
76
|
|
|
@@ -73,30 +81,38 @@ export default eslintConfig;
|
|
|
73
81
|
|
|
74
82
|
```ts
|
|
75
83
|
// prettier.config.mjs
|
|
76
|
-
import { prettierConfigConfigName } from
|
|
84
|
+
import { prettierConfigConfigName } from '@hiddenability/opinionated-defaults/prettier';
|
|
77
85
|
|
|
78
|
-
const prettierConfig = {...prettierConfigConfigName};
|
|
86
|
+
const prettierConfig = { ...prettierConfigConfigName };
|
|
79
87
|
|
|
80
88
|
export default prettierConfig;
|
|
81
89
|
```
|
|
82
90
|
|
|
83
91
|
#### Extending/Combining Prettier Configs:
|
|
92
|
+
|
|
84
93
|
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
94
|
|
|
86
|
-
```ts
|
|
95
|
+
```ts
|
|
87
96
|
// prettier.config.mjs
|
|
88
|
-
import {
|
|
97
|
+
import {
|
|
98
|
+
merge,
|
|
89
99
|
prettierConfig1,
|
|
90
100
|
prettierConfig2,
|
|
91
|
-
|
|
92
|
-
} from "@hiddenability/opinionated-defaults/prettier";
|
|
101
|
+
} from '@hiddenability/opinionated-defaults/prettier';
|
|
93
102
|
|
|
94
|
-
const prettierConfig = merge(
|
|
103
|
+
const prettierConfig = merge(
|
|
104
|
+
prettierConfig1,
|
|
105
|
+
prettierConfig2,
|
|
106
|
+
{
|
|
107
|
+
/* your custom rules */
|
|
108
|
+
} /*...*/,
|
|
109
|
+
);
|
|
95
110
|
|
|
96
111
|
export default prettierConfig;
|
|
97
112
|
```
|
|
98
113
|
|
|
99
114
|
## TODO:
|
|
115
|
+
|
|
100
116
|
- Improve repository structure (How to manage configuration options within eslint dir?).
|
|
101
117
|
- Maybe convert into monorepo with one package per tool instead of multiple exports from one package.
|
|
102
118
|
- Prevent importing overlapping configurations (i.e., Next.js ESLint config contains base config).
|
package/dist/eslint/prettier.mjs
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
|
|
2
|
-
const eslintPrettierConfig = [
|
|
3
|
-
eslintPluginPrettierRecommended,
|
|
4
|
-
{
|
|
5
|
-
"prettier/prettier": ["error", { usePrettierrc: true }]
|
|
6
|
-
}
|
|
7
|
-
];
|
|
2
|
+
const eslintPrettierConfig = [eslintPluginPrettierRecommended];
|
|
8
3
|
export default eslintPrettierConfig;
|
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.
|
|
4
|
+
"version": "0.0.20",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"eslint": "^9.29.0",
|
|
32
32
|
"prettier": "3.5.3",
|
|
33
33
|
"@eslint/js": "^9.29.0",
|
|
34
|
-
"@next/eslint-plugin-next": "^15.4.0-canary.
|
|
34
|
+
"@next/eslint-plugin-next": "^15.4.0-canary.93",
|
|
35
35
|
"@stylistic/eslint-plugin": "^4.4.1",
|
|
36
36
|
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
|
|
37
37
|
"@types/lodash": "^4.17.18",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"lodash": "^4.17.21",
|
|
51
51
|
"prettier-plugin-astro": "^0.14.1",
|
|
52
52
|
"prettier-plugin-tailwindcss": "0.6.12",
|
|
53
|
-
"typescript-eslint": "^8.
|
|
53
|
+
"typescript-eslint": "^8.35.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@hiddenability/opinionated-defaults": "^0.0.
|
|
56
|
+
"@hiddenability/opinionated-defaults": "^0.0.18",
|
|
57
57
|
"@types/bun": "^1.2.17",
|
|
58
58
|
"typescript": "^5.8.3",
|
|
59
59
|
"unbuild": "^3.5.0",
|