@hiddenability/opinionated-defaults 0.0.26 → 0.1.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.
Files changed (44) hide show
  1. package/README.md +30 -22
  2. package/dist/eslint/astro.d.ts +2 -1
  3. package/dist/eslint/base.d.ts +2 -1
  4. package/dist/eslint/elysia.d.ts +2 -1
  5. package/dist/eslint/functional.d.ts +2 -1
  6. package/dist/eslint/index.d.ts +15 -13
  7. package/dist/eslint/index.js +240 -0
  8. package/dist/eslint/next.d.ts +2 -1
  9. package/dist/eslint/perfectionist.d.ts +2 -1
  10. package/dist/eslint/prettier.d.ts +2 -1
  11. package/dist/eslint/react.d.ts +2 -1
  12. package/dist/eslint/relative.d.ts +2 -10
  13. package/dist/eslint/solid.d.ts +2 -1
  14. package/dist/eslint/stylistic.d.ts +2 -8
  15. package/dist/eslint/turbo.d.ts +2 -14
  16. package/dist/eslint/typescript.d.ts +2 -1
  17. package/dist/prettier/astro.d.ts +1 -1
  18. package/dist/prettier/base.d.ts +1 -1
  19. package/dist/prettier/index.d.ts +5 -5
  20. package/dist/prettier/index.js +63 -0
  21. package/dist/prettier/merge.d.ts +2 -2
  22. package/dist/prettier/sort-imports.d.ts +1 -1
  23. package/dist/prettier/tailwind.d.ts +1 -1
  24. package/package.json +14 -14
  25. package/dist/eslint/astro.mjs +0 -11
  26. package/dist/eslint/base.mjs +0 -47
  27. package/dist/eslint/elysia.mjs +0 -11
  28. package/dist/eslint/functional.mjs +0 -13
  29. package/dist/eslint/index.mjs +0 -13
  30. package/dist/eslint/next.mjs +0 -21
  31. package/dist/eslint/perfectionist.mjs +0 -3
  32. package/dist/eslint/prettier.mjs +0 -3
  33. package/dist/eslint/react.mjs +0 -8
  34. package/dist/eslint/relative.mjs +0 -15
  35. package/dist/eslint/solid.mjs +0 -3
  36. package/dist/eslint/stylistic.mjs +0 -10
  37. package/dist/eslint/turbo.mjs +0 -3
  38. package/dist/eslint/typescript.mjs +0 -30
  39. package/dist/prettier/astro.mjs +0 -16
  40. package/dist/prettier/base.mjs +0 -13
  41. package/dist/prettier/index.mjs +0 -5
  42. package/dist/prettier/merge.mjs +0 -13
  43. package/dist/prettier/sort-imports.mjs +0 -6
  44. package/dist/prettier/tailwind.mjs +0 -5
package/README.md CHANGED
@@ -12,6 +12,7 @@ A collection of opinionated tooling configurations.
12
12
 
13
13
  #### Exports:
14
14
 
15
+ - eslintConfig (Used to provide autocomplete)
15
16
  - eslintConfigAstro (Astro)
16
17
  - eslintConfigBase (General rules for every project)
17
18
  - eslintConfigElysia (Elysia.js)
@@ -45,11 +46,11 @@ A collection of opinionated tooling configurations.
45
46
 
46
47
  #### Exports:
47
48
 
49
+ - prettierConfig (Used to merge configurations and provide autocomplete)
48
50
  - prettierConfigAstro (Astro prettier rules with Tailwind class ordering)
49
51
  - prettierConfigNext (Rules for Next.js with Tailwind class ordering)
50
52
  - prettierConfigBase (General rules for every project)
51
53
  - prettierConfigSortImports (Prettier-based import sorting)
52
- - configMerge (used to merge configurations)
53
54
 
54
55
  #### Included plugins:
55
56
 
@@ -73,46 +74,50 @@ npm i @hiddenability/opinionated-defaults -D
73
74
 
74
75
  ```ts
75
76
  // eslint.config.ts
76
- import { eslintConfigConfigName } from '@hiddenability/opinionated-defaults/eslint';
77
-
78
- const eslintConfig = [...eslintConfigConfigName];
79
-
80
- export default eslintConfig;
77
+ import {
78
+ eslintConfig,
79
+ eslintConfigBase,
80
+ } from '@hiddenability/opinionated-defaults/eslint';
81
+
82
+ export default eslintConfig([
83
+ ...eslintConfigBase,
84
+ // ...eslintConfigPrettier, // other configs fit right in!
85
+ // { /* your rules here */ },
86
+ ]);
81
87
  ```
82
88
 
83
89
  ### Prettier:
84
90
 
85
91
  ```ts
86
92
  // prettier.config.mjs
87
- import { prettierConfigConfigName } from '@hiddenability/opinionated-defaults/prettier';
88
-
89
- const prettierConfig = { ...prettierConfigConfigName };
93
+ import {
94
+ prettierConfig,
95
+ prettierConfigBase,
96
+ } from '@hiddenability/opinionated-defaults/prettier';
90
97
 
91
- export default prettierConfig;
98
+ export default prettierConfig(prettierConfigBase);
92
99
  ```
93
100
 
94
101
  #### Extending/Combining Prettier Configs:
95
102
 
96
- 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.
103
+ Since Prettier uses a configuration object instead of a flat config like ESLint, to extend or combine configurations, the `prettierConfig` function will merge configs for you.
97
104
 
98
105
  ```ts
99
106
  // prettier.config.mjs
100
107
  import {
101
- merge,
108
+ prettierConfig,
102
109
  prettierConfig1,
103
110
  prettierConfig2,
104
111
  } from '@hiddenability/opinionated-defaults/prettier';
105
112
 
106
- const prettierConfig = merge(
113
+ export default prettierConfig(
107
114
  prettierConfig1,
108
115
  prettierConfig2,
109
116
  {
110
117
  /* your custom rules */
111
118
  },
112
- /*...*/
119
+ /*...*/
113
120
  );
114
-
115
- export default prettierConfig;
116
121
  ```
117
122
 
118
123
  #### TailwindCSS Plugin:
@@ -120,6 +125,7 @@ export default prettierConfig;
120
125
  When using `prettier-config-tailwind`, make sure to specify the CSS file that contains the `@import "tailwindcss"` directive.
121
126
 
122
127
  For example, given the following css file:
128
+
123
129
  ```css
124
130
  // /app/styles.css
125
131
  @import 'tailwindcss';
@@ -129,14 +135,16 @@ This should be a minimal version of your Prettier config:
129
135
 
130
136
  ```ts
131
137
  // prettier.config.mjs
132
- import { prettierConfigTailwind } from '@hiddenability/opinionated-defaults/prettier';
133
-
134
- const prettierConfig = merge(
138
+ import {
139
+ prettierConfig,
140
+ prettierConfigBase,
135
141
  prettierConfigTailwind,
136
- { tailwindStylesheet: './app/styles.css' }
137
- );
138
- ```
142
+ } from '@hiddenability/opinionated-defaults/prettier';
139
143
 
144
+ export default prettierConfig(prettierConfigBase, prettierConfigTailwind, {
145
+ tailwindStylesheet: `./app/styles.css`,
146
+ });
147
+ ```
140
148
 
141
149
  ## TODO:
142
150
 
@@ -1,2 +1,3 @@
1
- declare const astroConfig: any[];
1
+ import type { ConfigArray } from "typescript-eslint";
2
+ declare const astroConfig: ConfigArray;
2
3
  export default astroConfig;
@@ -1,2 +1,3 @@
1
- declare const config: any[];
1
+ import type { ConfigArray } from "typescript-eslint";
2
+ declare const config: ConfigArray;
2
3
  export default config;
@@ -1,2 +1,3 @@
1
- declare const elysiaConfig: any[];
1
+ import type { ConfigArray } from "typescript-eslint";
2
+ declare const elysiaConfig: ConfigArray;
2
3
  export default elysiaConfig;
@@ -1,2 +1,3 @@
1
- declare const functionalConfig: any[];
1
+ import type { ConfigArray } from "typescript-eslint";
2
+ declare const functionalConfig: ConfigArray;
2
3
  export default functionalConfig;
@@ -1,13 +1,15 @@
1
- export { default as eslintConfigAstro } from './astro';
2
- export { default as eslintConfigBase } from './base';
3
- export { default as eslintConfigElysia } from './elysia';
4
- export { default as eslintConfigFunctional } from './functional';
5
- export { default as eslintConfigNext } from './next';
6
- export { default as eslintConfigPerfectionist } from './perfectionist';
7
- export { default as eslintConfigPrettier } from './prettier';
8
- export { default as eslintConfigReact } from './react';
9
- export { default as eslintConfigRelative } from './relative';
10
- export { default as eslintConfigSolid } from './solid';
11
- export { default as eslintConfigStylistic } from './stylistic';
12
- export { default as eslintConfigTurbo } from './turbo';
13
- export { default as eslintConfigTypescript } from './typescript';
1
+ import type { ConfigArray } from "typescript-eslint";
2
+ export { default as eslintConfigAstro } from "./astro";
3
+ export { default as eslintConfigBase } from "./base";
4
+ export { default as eslintConfigElysia } from "./elysia";
5
+ export { default as eslintConfigFunctional } from "./functional";
6
+ export { default as eslintConfigNext } from "./next";
7
+ export { default as eslintConfigPerfectionist } from "./perfectionist";
8
+ export { default as eslintConfigPrettier } from "./prettier";
9
+ export { default as eslintConfigReact } from "./react";
10
+ export { default as eslintConfigRelative } from "./relative";
11
+ export { default as eslintConfigSolid } from "./solid";
12
+ export { default as eslintConfigStylistic } from "./stylistic";
13
+ export { default as eslintConfigTurbo } from "./turbo";
14
+ export { default as eslintConfigTypescript } from "./typescript";
15
+ export declare const eslintConfig: (config: ConfigArray) => ConfigArray;
@@ -0,0 +1,240 @@
1
+ // src/eslint/astro.ts
2
+ import eslintPluginAstro from "eslint-plugin-astro";
3
+
4
+ // src/eslint/base.ts
5
+ import js from "@eslint/js";
6
+ import preferArrowFunctions from "eslint-plugin-prefer-arrow-functions";
7
+ import eslintPluginUnicorn from "eslint-plugin-unicorn";
8
+ var config = [
9
+ js.configs.recommended,
10
+ eslintPluginUnicorn.configs.recommended,
11
+ {
12
+ rules: {
13
+ "unicorn/filename-case": [
14
+ `error`,
15
+ {
16
+ cases: {
17
+ kebabCase: true
18
+ }
19
+ }
20
+ ],
21
+ "unicorn/no-array-for-each": [`off`],
22
+ "unicorn/no-array-reduce": [`off`],
23
+ "unicorn/prevent-abbreviations": [`off`]
24
+ }
25
+ },
26
+ {
27
+ plugins: {
28
+ "prefer-arrow-functions": preferArrowFunctions
29
+ },
30
+ rules: {
31
+ "prefer-arrow-functions/prefer-arrow-functions": [
32
+ `error`,
33
+ { returnStyle: `implicit` }
34
+ ]
35
+ }
36
+ },
37
+ {
38
+ files: [
39
+ `**/*.ts`,
40
+ `**/*.js`,
41
+ `**/*.mjs`,
42
+ `**/*.mts`,
43
+ `**/*.tsx`,
44
+ `**/*.jsx`
45
+ ]
46
+ },
47
+ {
48
+ ignores: [`**/dist/`]
49
+ },
50
+ {
51
+ rules: {
52
+ "no-console": `warn`,
53
+ quotes: [`warn`, `backtick`, { avoidEscape: true }]
54
+ }
55
+ }
56
+ ];
57
+ var base_default = config;
58
+
59
+ // src/eslint/relative.ts
60
+ import noRelativeImportPaths from "eslint-plugin-no-relative-import-paths";
61
+ var relativeConfig = [
62
+ {
63
+ plugins: {
64
+ "no-relative-import-paths": noRelativeImportPaths
65
+ },
66
+ rules: {
67
+ "no-relative-import-paths/no-relative-import-paths": [
68
+ `error`,
69
+ { prefix: `@` }
70
+ ]
71
+ }
72
+ }
73
+ ];
74
+ var relative_default = relativeConfig;
75
+
76
+ // src/eslint/typescript.ts
77
+ import parser from "@typescript-eslint/parser";
78
+ import tseslint from "typescript-eslint";
79
+ var typescriptConfig = [
80
+ ...tseslint.configs.recommended,
81
+ {
82
+ languageOptions: {
83
+ parser,
84
+ parserOptions: {
85
+ projectService: true
86
+ }
87
+ }
88
+ },
89
+ {
90
+ rules: {
91
+ "@typescript-eslint/no-unused-vars": [
92
+ `error`,
93
+ {
94
+ args: `all`,
95
+ argsIgnorePattern: `^_`,
96
+ caughtErrors: `all`,
97
+ caughtErrorsIgnorePattern: `^_`,
98
+ destructuredArrayIgnorePattern: `^_`,
99
+ ignoreRestSiblings: true,
100
+ varsIgnorePattern: `^_`
101
+ }
102
+ ]
103
+ }
104
+ }
105
+ ];
106
+ var typescript_default = typescriptConfig;
107
+
108
+ // src/eslint/astro.ts
109
+ var astroConfig = [
110
+ ...base_default,
111
+ ...typescript_default,
112
+ ...relative_default,
113
+ ...eslintPluginAstro.configs.recommended
114
+ ];
115
+ var astro_default = astroConfig;
116
+ // src/eslint/functional.ts
117
+ import functional from "eslint-plugin-functional";
118
+ var functionalConfig = [
119
+ functional.configs.externalTypeScriptRecommended,
120
+ functional.configs.recommended,
121
+ functional.configs.stylistic,
122
+ {
123
+ rules: {
124
+ "functional/no-expression-statements": [`off`],
125
+ "functional/no-return-void": [`off`]
126
+ }
127
+ }
128
+ ];
129
+ var functional_default = functionalConfig;
130
+
131
+ // src/eslint/elysia.ts
132
+ var elysiaConfig = [
133
+ ...base_default,
134
+ ...typescript_default,
135
+ ...functional_default,
136
+ ...relative_default
137
+ ];
138
+ var elysia_default = elysiaConfig;
139
+ // src/eslint/next.ts
140
+ import pluginNext from "@next/eslint-plugin-next";
141
+
142
+ // src/eslint/react.ts
143
+ import pluginReact from "eslint-plugin-react";
144
+ import pluginReactHooks from "eslint-plugin-react-hooks";
145
+ var reactConfig = [
146
+ pluginReact.configs.flat[`recommended`],
147
+ pluginReact.configs.flat[`jsx-runtime`],
148
+ pluginReactHooks.configs[`recommended-latest`]
149
+ ];
150
+ var react_default = reactConfig;
151
+
152
+ // src/eslint/next.ts
153
+ var nextJsConfig = [
154
+ ...base_default,
155
+ ...react_default,
156
+ ...relative_default,
157
+ ...typescript_default,
158
+ {
159
+ plugins: {
160
+ "@next/next": pluginNext
161
+ },
162
+ rules: {
163
+ ...pluginNext.configs.recommended.rules,
164
+ ...pluginNext.configs[`core-web-vitals`].rules
165
+ }
166
+ }
167
+ ];
168
+ var next_default = nextJsConfig;
169
+ // src/eslint/perfectionist.ts
170
+ import perfectionist from "eslint-plugin-perfectionist";
171
+ var perfectionistConfig = [
172
+ perfectionist.configs[`recommended-natural`],
173
+ {
174
+ rules: {
175
+ "perfectionist/sort-object-types": [
176
+ `warn`,
177
+ {
178
+ partitionByNewLine: true
179
+ }
180
+ ],
181
+ "perfectionist/sort-objects": [
182
+ `warn`,
183
+ {
184
+ partitionByNewLine: true
185
+ }
186
+ ]
187
+ }
188
+ }
189
+ ];
190
+ var perfectionist_default = perfectionistConfig;
191
+ // src/eslint/prettier.ts
192
+ import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
193
+ var eslintPrettierConfig = [
194
+ eslintPluginPrettierRecommended,
195
+ {
196
+ rules: {
197
+ "prettier/prettier": `warn`,
198
+ quotes: [`warn`, `backtick`, { avoidEscape: true }]
199
+ }
200
+ }
201
+ ];
202
+ var prettier_default = eslintPrettierConfig;
203
+ // src/eslint/solid.ts
204
+ import eslintPluginSolid from "eslint-plugin-solid/configs/typescript";
205
+ var solidConfig = [eslintPluginSolid];
206
+ var solid_default = solidConfig;
207
+ // src/eslint/stylistic.ts
208
+ import stylistic from "@stylistic/eslint-plugin";
209
+ var stylisticConfig = [
210
+ stylistic.configs.all,
211
+ {
212
+ plugins: {
213
+ "@stylistic": stylistic
214
+ }
215
+ }
216
+ ];
217
+ var stylistic_default = stylisticConfig;
218
+ // src/eslint/turbo.ts
219
+ import turboPlugin from "eslint-plugin-turbo";
220
+ var turborepoConfig = [turboPlugin.configs[`flat/recommended`]];
221
+ var turbo_default = turborepoConfig;
222
+
223
+ // src/eslint/index.ts
224
+ var eslintConfig = (config2) => config2;
225
+ export {
226
+ typescript_default as eslintConfigTypescript,
227
+ turbo_default as eslintConfigTurbo,
228
+ stylistic_default as eslintConfigStylistic,
229
+ solid_default as eslintConfigSolid,
230
+ relative_default as eslintConfigRelative,
231
+ react_default as eslintConfigReact,
232
+ prettier_default as eslintConfigPrettier,
233
+ perfectionist_default as eslintConfigPerfectionist,
234
+ next_default as eslintConfigNext,
235
+ functional_default as eslintConfigFunctional,
236
+ elysia_default as eslintConfigElysia,
237
+ base_default as eslintConfigBase,
238
+ astro_default as eslintConfigAstro,
239
+ eslintConfig
240
+ };
@@ -1,2 +1,3 @@
1
- declare const nextJsConfig: any[];
1
+ import type { ConfigArray } from "typescript-eslint";
2
+ declare const nextJsConfig: ConfigArray;
2
3
  export default nextJsConfig;
@@ -1,2 +1,3 @@
1
- declare const perfectionistConfig: any[];
1
+ import type { ConfigArray } from "typescript-eslint";
2
+ declare const perfectionistConfig: ConfigArray;
2
3
  export default perfectionistConfig;
@@ -1,2 +1,3 @@
1
- declare const eslintPrettierConfig: any[];
1
+ import type { ConfigArray } from "typescript-eslint";
2
+ declare const eslintPrettierConfig: ConfigArray;
2
3
  export default eslintPrettierConfig;
@@ -1,2 +1,3 @@
1
- declare const reactConfig: any[];
1
+ import type { ConfigArray } from "typescript-eslint";
2
+ declare const reactConfig: ConfigArray;
2
3
  export default reactConfig;
@@ -1,11 +1,3 @@
1
- declare const relativeConfig: {
2
- plugins: {
3
- 'no-relative-import-paths': any;
4
- };
5
- rules: {
6
- 'no-relative-import-paths/no-relative-import-paths': (string | {
7
- prefix: string;
8
- })[];
9
- };
10
- }[];
1
+ import type { ConfigArray } from "typescript-eslint";
2
+ declare const relativeConfig: ConfigArray;
11
3
  export default relativeConfig;
@@ -1,2 +1,3 @@
1
- declare const solidConfig: any[];
1
+ import type { ConfigArray } from "typescript-eslint";
2
+ declare const solidConfig: ConfigArray;
2
3
  export default solidConfig;
@@ -1,9 +1,3 @@
1
- declare const stylisticConfig: (import("eslint").Linter.Config<import("eslint").Linter.RulesRecord> | {
2
- plugins: {
3
- '@stylistic': {
4
- rules: import("@stylistic/eslint-plugin").Rules;
5
- configs: import("eslint").ESLint.Plugin["configs"] & import("@stylistic/eslint-plugin").Configs;
6
- };
7
- };
8
- })[];
1
+ import type { ConfigArray } from "typescript-eslint";
2
+ declare const stylisticConfig: ConfigArray;
9
3
  export default stylisticConfig;
@@ -1,15 +1,3 @@
1
- declare const turborepoConfig: {
2
- plugins: {
3
- readonly turbo: import("eslint").ESLint.Plugin;
4
- };
5
- name: string;
6
- rules: {
7
- [x: string]: "error";
8
- };
9
- settings: {
10
- turbo: {
11
- cacheKey: number | import("eslint-plugin-turbo").ProjectKey;
12
- };
13
- };
14
- }[];
1
+ import type { ConfigArray } from "typescript-eslint";
2
+ declare const turborepoConfig: ConfigArray;
15
3
  export default turborepoConfig;
@@ -1,2 +1,3 @@
1
- declare const typescriptConfig: object[];
1
+ import { type ConfigArray } from "typescript-eslint";
2
+ declare const typescriptConfig: ConfigArray;
2
3
  export default typescriptConfig;
@@ -1,3 +1,3 @@
1
- import { type Config } from 'prettier';
1
+ import { type Config } from "prettier";
2
2
  declare const astroConfig: Config;
3
3
  export default astroConfig;
@@ -1,3 +1,3 @@
1
- import { type Config } from 'prettier';
1
+ import { type Config } from "prettier";
2
2
  declare const config: Config;
3
3
  export default config;
@@ -1,5 +1,5 @@
1
- export { default as prettierConfigAstro } from './astro';
2
- export { default as prettierConfigBase } from './base';
3
- export { merge } from './merge';
4
- export { default as prettierConfigSortImports } from './sort-imports';
5
- export { default as prettierConfigTailwind } from './tailwind';
1
+ export { default as prettierConfigAstro } from "./astro";
2
+ export { default as prettierConfigBase } from "./base";
3
+ export { merge as prettierConfig } from "./merge";
4
+ export { default as prettierConfigSortImports } from "./sort-imports";
5
+ export { default as prettierConfigTailwind } from "./tailwind";
@@ -0,0 +1,63 @@
1
+ // src/prettier/astro.ts
2
+ import lodash from "lodash";
3
+
4
+ // src/prettier/base.ts
5
+ var config = {
6
+ arrowParens: `always`,
7
+ bracketSameLine: false,
8
+ bracketSpacing: true,
9
+ experimentalTernaries: true,
10
+ jsxSingleQuote: true,
11
+ semi: true,
12
+ singleQuote: true,
13
+ tabWidth: 2,
14
+ trailingComma: `all`,
15
+ useTabs: false
16
+ };
17
+ var base_default = config;
18
+
19
+ // src/prettier/astro.ts
20
+ var { merge } = lodash;
21
+ var astroConfig = merge({
22
+ overrides: [
23
+ {
24
+ files: `*.astro`,
25
+ options: { parser: `astro` }
26
+ }
27
+ ],
28
+ plugins: [`prettier-plugin-astro`]
29
+ }, base_default);
30
+ var astro_default = astroConfig;
31
+ // src/prettier/merge.ts
32
+ import lodash2 from "lodash";
33
+ var { isArray, mergeWith, union } = lodash2;
34
+ var arrayMerge = (arr1, arr2) => {
35
+ if (!isArray(arr1) || !isArray(arr2))
36
+ return;
37
+ const retArr = union(arr1, arr2);
38
+ if (retArr.includes(`prettier-plugin-tailwindcss`)) {
39
+ retArr.push(retArr.splice(retArr.indexOf(`prettier-plugin-tailwindcss`), 1)[0]);
40
+ }
41
+ return retArr;
42
+ };
43
+ var merge2 = (source, ...sources) => mergeWith({}, source, ...sources, arrayMerge);
44
+ // src/prettier/sort-imports.ts
45
+ var sortConfig = {
46
+ importOrderSeparation: true,
47
+ importOrderSortSpecifiers: true,
48
+ plugins: [`@trivago/prettier-plugin-sort-imports`]
49
+ };
50
+ var sort_imports_default = sortConfig;
51
+ // src/prettier/tailwind.ts
52
+ var tailwindConfig = {
53
+ plugins: [`prettier-plugin-tailwindcss`],
54
+ tailwindFunctions: [`cva`, `clsx`, `cn`]
55
+ };
56
+ var tailwind_default = tailwindConfig;
57
+ export {
58
+ tailwind_default as prettierConfigTailwind,
59
+ sort_imports_default as prettierConfigSortImports,
60
+ base_default as prettierConfigBase,
61
+ astro_default as prettierConfigAstro,
62
+ merge2 as prettierConfig
63
+ };
@@ -1,2 +1,2 @@
1
- import type { Config } from 'prettier';
2
- export declare const merge: (source: Config, ...sources: Config[]) => any;
1
+ import type { Config } from "prettier";
2
+ export declare const merge: (source: Config, ...sources: Config[]) => Config;
@@ -1,3 +1,3 @@
1
- import { type Config } from 'prettier';
1
+ import { type Config } from "prettier";
2
2
  declare const sortConfig: Config;
3
3
  export default sortConfig;
@@ -1,3 +1,3 @@
1
- import { type Config } from 'prettier';
1
+ import { type Config } from "prettier";
2
2
  declare const tailwindConfig: Config;
3
3
  export default tailwindConfig;
package/package.json CHANGED
@@ -1,27 +1,29 @@
1
1
  {
2
2
  "name": "@hiddenability/opinionated-defaults",
3
3
  "description": "Opinionated default configurations for webdev tools.",
4
- "version": "0.0.26",
4
+ "version": "0.1.0",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "git+https://github.com/HiddenAbilitree/reasonable-defaults.git"
8
+ "url": "git+https://github.com/HiddenAbilitree/opinionated-defaults.git"
9
9
  },
10
10
  "type": "module",
11
11
  "scripts": {
12
- "build": "bun run test run && unbuild",
13
- "prepack": "bun run test run && unbuild",
14
- "lint": "eslint .",
15
- "lint:fix": "eslint . --fix",
16
- "test": "vitest"
12
+ "build": "bun test && bun build.ts",
13
+ "prepack": "bun test && bun build.ts",
14
+ "test": "bun test",
15
+ "lint": "eslint",
16
+ "lint:fix": "eslint --fix",
17
+ "format": "prettier . -c",
18
+ "format:fix": "prettier . -w"
17
19
  },
18
20
  "exports": {
19
21
  "./eslint": {
20
- "import": "./dist/eslint/index.mjs",
22
+ "import": "./dist/eslint/index.js",
21
23
  "types": "./dist/eslint/index.d.ts"
22
24
  },
23
25
  "./prettier": {
24
- "import": "./dist/prettier/index.mjs",
26
+ "import": "./dist/prettier/index.js",
25
27
  "types": "./dist/prettier/index.d.ts"
26
28
  }
27
29
  },
@@ -48,7 +50,6 @@
48
50
  "eslint-plugin-solid": "^0.14.5",
49
51
  "eslint-plugin-turbo": "^2.5.5",
50
52
  "eslint-plugin-unicorn": "^59.0.1",
51
- "jiti": "^2.4.2",
52
53
  "lodash": "^4.17.21",
53
54
  "prettier": "3.6.2",
54
55
  "prettier-plugin-astro": "^0.14.1",
@@ -56,10 +57,9 @@
56
57
  "typescript-eslint": "^8.37.0"
57
58
  },
58
59
  "devDependencies": {
59
- "@hiddenability/opinionated-defaults": "^0.0.24",
60
+ "@hiddenability/opinionated-defaults": "link:@hiddenability/opinionated-defaults",
60
61
  "@types/bun": "^1.2.18",
61
- "typescript": "^5.8.3",
62
- "unbuild": "^3.5.0",
63
- "vitest": "^3.2.4"
62
+ "consola": "^3.4.2",
63
+ "oxc-transform": "^0.77.3"
64
64
  }
65
65
  }
@@ -1,11 +0,0 @@
1
- import eslintPluginAstro from "eslint-plugin-astro";
2
- import baseConfig from "./base.mjs";
3
- import relativeConfig from "./relative.mjs";
4
- import tsConfig from "./typescript.mjs";
5
- const astroConfig = [
6
- ...baseConfig,
7
- ...tsConfig,
8
- ...relativeConfig,
9
- eslintPluginAstro.configs.recommended
10
- ];
11
- export default astroConfig;
@@ -1,47 +0,0 @@
1
- import js from "@eslint/js";
2
- import preferArrowFunctions from "eslint-plugin-prefer-arrow-functions";
3
- import eslintPluginUnicorn from "eslint-plugin-unicorn";
4
- const config = [
5
- js.configs.recommended,
6
- eslintPluginUnicorn.configs.recommended,
7
- {
8
- rules: {
9
- "unicorn/filename-case": [
10
- "error",
11
- {
12
- cases: {
13
- kebabCase: true
14
- }
15
- }
16
- ],
17
- "unicorn/no-array-for-each": ["off"],
18
- "unicorn/no-array-reduce": ["off"],
19
- "unicorn/prevent-abbreviations": ["off"]
20
- }
21
- },
22
- {
23
- plugins: {
24
- "prefer-arrow-functions": preferArrowFunctions
25
- },
26
- rules: {
27
- "prefer-arrow-functions/prefer-arrow-functions": [
28
- "error",
29
- { returnStyle: "implicit" }
30
- ]
31
- }
32
- },
33
- {
34
- files: [
35
- "**/*.ts",
36
- "**/*.js",
37
- "**/*.mjs",
38
- "**/*.mts",
39
- "**/*.tsx",
40
- "**/*.jsx"
41
- ]
42
- },
43
- {
44
- ignores: ["**/dist/"]
45
- }
46
- ];
47
- export default config;
@@ -1,11 +0,0 @@
1
- import baseConfig from "./base.mjs";
2
- import functionalConfig from "./functional.mjs";
3
- import relativeConfig from "./relative.mjs";
4
- import tsConfig from "./typescript.mjs";
5
- const elysiaConfig = [
6
- ...baseConfig,
7
- ...tsConfig,
8
- ...functionalConfig,
9
- ...relativeConfig
10
- ];
11
- export default elysiaConfig;
@@ -1,13 +0,0 @@
1
- import functional from "eslint-plugin-functional";
2
- const functionalConfig = [
3
- functional.configs.externalTypeScriptRecommended,
4
- functional.configs.recommended,
5
- functional.configs.stylistic,
6
- {
7
- rules: {
8
- "functional/no-expression-statements": ["off"],
9
- "functional/no-return-void": ["off"]
10
- }
11
- }
12
- ];
13
- export default functionalConfig;
@@ -1,13 +0,0 @@
1
- export { default as eslintConfigAstro } from "./astro.mjs";
2
- export { default as eslintConfigBase } from "./base.mjs";
3
- export { default as eslintConfigElysia } from "./elysia.mjs";
4
- export { default as eslintConfigFunctional } from "./functional.mjs";
5
- export { default as eslintConfigNext } from "./next.mjs";
6
- export { default as eslintConfigPerfectionist } from "./perfectionist.mjs";
7
- export { default as eslintConfigPrettier } from "./prettier.mjs";
8
- export { default as eslintConfigReact } from "./react.mjs";
9
- export { default as eslintConfigRelative } from "./relative.mjs";
10
- export { default as eslintConfigSolid } from "./solid.mjs";
11
- export { default as eslintConfigStylistic } from "./stylistic.mjs";
12
- export { default as eslintConfigTurbo } from "./turbo.mjs";
13
- export { default as eslintConfigTypescript } from "./typescript.mjs";
@@ -1,21 +0,0 @@
1
- import pluginNext from "@next/eslint-plugin-next";
2
- import baseConfig from "./base.mjs";
3
- import reactConfig from "./react.mjs";
4
- import relativeConfig from "./relative.mjs";
5
- import tsConfig from "./typescript.mjs";
6
- const nextJsConfig = [
7
- ...baseConfig,
8
- ...reactConfig,
9
- ...relativeConfig,
10
- ...tsConfig,
11
- {
12
- plugins: {
13
- "@next/next": pluginNext
14
- },
15
- rules: {
16
- ...pluginNext.configs.recommended.rules,
17
- ...pluginNext.configs["core-web-vitals"].rules
18
- }
19
- }
20
- ];
21
- export default nextJsConfig;
@@ -1,3 +0,0 @@
1
- import perfectionist from "eslint-plugin-perfectionist";
2
- const perfectionistConfig = [perfectionist.configs["recommended-natural"]];
3
- export default perfectionistConfig;
@@ -1,3 +0,0 @@
1
- import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
2
- const eslintPrettierConfig = [eslintPluginPrettierRecommended];
3
- export default eslintPrettierConfig;
@@ -1,8 +0,0 @@
1
- import pluginReact from "eslint-plugin-react";
2
- import pluginReactHooks from "eslint-plugin-react-hooks";
3
- const reactConfig = [
4
- pluginReact.configs.flat["recommended"],
5
- pluginReact.configs.flat["jsx-runtime"],
6
- pluginReactHooks.configs["recommended-latest"]
7
- ];
8
- export default reactConfig;
@@ -1,15 +0,0 @@
1
- import noRelativeImportPaths from "eslint-plugin-no-relative-import-paths";
2
- const relativeConfig = [
3
- {
4
- plugins: {
5
- "no-relative-import-paths": noRelativeImportPaths
6
- },
7
- rules: {
8
- "no-relative-import-paths/no-relative-import-paths": [
9
- "error",
10
- { prefix: "@" }
11
- ]
12
- }
13
- }
14
- ];
15
- export default relativeConfig;
@@ -1,3 +0,0 @@
1
- import eslintPluginSolid from "eslint-plugin-solid/configs/typescript";
2
- const solidConfig = [eslintPluginSolid];
3
- export default solidConfig;
@@ -1,10 +0,0 @@
1
- import stylistic from "@stylistic/eslint-plugin";
2
- const stylisticConfig = [
3
- stylistic.configs.all,
4
- {
5
- plugins: {
6
- "@stylistic": stylistic
7
- }
8
- }
9
- ];
10
- export default stylisticConfig;
@@ -1,3 +0,0 @@
1
- import turboPlugin from "eslint-plugin-turbo";
2
- const turborepoConfig = [turboPlugin.configs["flat/recommended"]];
3
- export default turborepoConfig;
@@ -1,30 +0,0 @@
1
- import parser from "@typescript-eslint/parser";
2
- import tseslint from "typescript-eslint";
3
- const typescriptConfig = [
4
- ...tseslint.configs.recommended,
5
- {
6
- languageOptions: {
7
- parser,
8
- parserOptions: {
9
- projectService: true
10
- }
11
- }
12
- },
13
- {
14
- rules: {
15
- "@typescript-eslint/no-unused-vars": [
16
- `error`,
17
- {
18
- args: `all`,
19
- argsIgnorePattern: `^_`,
20
- caughtErrors: `all`,
21
- caughtErrorsIgnorePattern: `^_`,
22
- destructuredArrayIgnorePattern: `^_`,
23
- ignoreRestSiblings: true,
24
- varsIgnorePattern: `^_`
25
- }
26
- ]
27
- }
28
- }
29
- ];
30
- export default typescriptConfig;
@@ -1,16 +0,0 @@
1
- import lodash from "lodash";
2
- import baseConfig from "./base.mjs";
3
- const { merge } = lodash;
4
- const astroConfig = merge(
5
- {
6
- overrides: [
7
- {
8
- files: "*.astro",
9
- options: { parser: "astro" }
10
- }
11
- ],
12
- plugins: ["prettier-plugin-astro"]
13
- },
14
- baseConfig
15
- );
16
- export default astroConfig;
@@ -1,13 +0,0 @@
1
- const config = {
2
- arrowParens: "always",
3
- bracketSameLine: false,
4
- bracketSpacing: true,
5
- experimentalTernaries: true,
6
- jsxSingleQuote: true,
7
- semi: true,
8
- singleQuote: true,
9
- tabWidth: 2,
10
- trailingComma: "all",
11
- useTabs: false
12
- };
13
- export default config;
@@ -1,5 +0,0 @@
1
- export { default as prettierConfigAstro } from "./astro.mjs";
2
- export { default as prettierConfigBase } from "./base.mjs";
3
- export { merge } from "./merge.mjs";
4
- export { default as prettierConfigSortImports } from "./sort-imports.mjs";
5
- export { default as prettierConfigTailwind } from "./tailwind.mjs";
@@ -1,13 +0,0 @@
1
- import lodash from "lodash";
2
- const { isArray, mergeWith, union } = lodash;
3
- const arrayMerge = (arr1, arr2) => {
4
- if (!isArray(arr1) || !isArray(arr2)) return;
5
- const retArr = union(arr1, arr2);
6
- if (retArr.includes("prettier-plugin-tailwindcss")) {
7
- retArr.push(
8
- retArr.splice(retArr.indexOf("prettier-plugin-tailwindcss"), 1)[0]
9
- );
10
- }
11
- return retArr;
12
- };
13
- export const merge = (source, ...sources) => mergeWith({}, source, ...sources, arrayMerge);
@@ -1,6 +0,0 @@
1
- const sortConfig = {
2
- importOrderSeparation: true,
3
- importOrderSortSpecifiers: true,
4
- plugins: ["@trivago/prettier-plugin-sort-imports"]
5
- };
6
- export default sortConfig;
@@ -1,5 +0,0 @@
1
- const tailwindConfig = {
2
- plugins: ["prettier-plugin-tailwindcss"],
3
- tailwindFunctions: ["cva", "clsx", "cn"]
4
- };
5
- export default tailwindConfig;