@conorroberts/utils 0.0.37 → 0.0.39
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/dist/env.mjs.map +1 -1
- package/dist/oxlint/config.json +68 -0
- package/dist/oxlint/jsx-component-pascal-case.d.mts +8 -8
- package/dist/oxlint/no-component-date-instantiation.d.mts +8 -8
- package/dist/oxlint/no-emoji.d.mts +4 -4
- package/dist/oxlint/no-finally.d.mts +4 -4
- package/dist/oxlint/no-react-namespace.d.mts +4 -4
- package/dist/oxlint/no-switch-plugin.d.mts +3 -3
- package/dist/oxlint/no-top-level-let.d.mts +4 -4
- package/dist/oxlint/no-type-cast.d.mts +4 -4
- package/package.json +4 -1
package/dist/env.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.mjs","names":["invalidKeys: string[]","pairs"],"sources":["../src/env.ts"],"sourcesContent":["import { pipe } from \"remeda\";\nimport * as v from \"valibot\";\n\nconst PUBLIC_ENV_PREFIX = \"PUBLIC_\" as const;\n\n/**\n * Validates your environment variables against the given Valibot schema;\n * @param args\n * @returns An object containing client environment variables and another containing server environment variables\n */\nexport const createEnv = <\n Schema extends Record<string, v.GenericSchema>,\n Env = {\n [K in keyof Schema]: v.InferOutput<Schema[K]>;\n },\n>(args: {\n schema: Schema;\n env: any;\n}) => {\n const pairs = Object.entries(args.schema);\n const serverEnv = new Map();\n const invalidKeys: string[] = [];\n\n for (const [key, value] of pairs) {\n const result = v.safeParse(value, args.env[key] ?? null);\n\n if (!result.success) {\n invalidKeys.push(key);\n }\n\n serverEnv.set(key, result.output);\n }\n\n if (invalidKeys.length > 0) {\n console.error(`Invalid environment variable(s): ${invalidKeys.map((e) => `\"${e}\"`).join(\", \")}`);\n process.exit(1);\n }\n\n type ClientEnvKeys = Exclude<\n {\n [K in keyof Env]: K extends `${typeof PUBLIC_ENV_PREFIX}${string}` ? K : never;\n }[keyof Env],\n undefined\n >;\n\n type ClientEnv = {\n [B in ClientEnvKeys]: Env[B];\n };\n\n const clientEnv = pipe(\n serverEnv,\n (obj) => Array.from(obj.entries()),\n (pairs) => pairs.filter(([k]) => k.startsWith(PUBLIC_ENV_PREFIX)),\n (pairs) => Object.fromEntries(pairs),\n ) as ClientEnv;\n\n return {\n client: clientEnv,\n server: Object.fromEntries(serverEnv.entries()) as Env,\n };\n};\n"],"mappings":";;;;AAGA,MAAM,oBAAoB;;;;;;AAO1B,MAAa,aAKX,
|
|
1
|
+
{"version":3,"file":"env.mjs","names":["invalidKeys: string[]","pairs"],"sources":["../src/env.ts"],"sourcesContent":["import { pipe } from \"remeda\";\nimport * as v from \"valibot\";\n\nconst PUBLIC_ENV_PREFIX = \"PUBLIC_\" as const;\n\n/**\n * Validates your environment variables against the given Valibot schema;\n * @param args\n * @returns An object containing client environment variables and another containing server environment variables\n */\nexport const createEnv = <\n Schema extends Record<string, v.GenericSchema>,\n Env = {\n [K in keyof Schema]: v.InferOutput<Schema[K]>;\n },\n>(args: {\n schema: Schema;\n // oxlint-disable-next-line no-explicit-any\n env: any;\n}) => {\n const pairs = Object.entries(args.schema);\n const serverEnv = new Map();\n const invalidKeys: string[] = [];\n\n for (const [key, value] of pairs) {\n const result = v.safeParse(value, args.env[key] ?? null);\n\n if (!result.success) {\n invalidKeys.push(key);\n }\n\n serverEnv.set(key, result.output);\n }\n\n if (invalidKeys.length > 0) {\n console.error(`Invalid environment variable(s): ${invalidKeys.map((e) => `\"${e}\"`).join(\", \")}`);\n process.exit(1);\n }\n\n type ClientEnvKeys = Exclude<\n {\n [K in keyof Env]: K extends `${typeof PUBLIC_ENV_PREFIX}${string}` ? K : never;\n }[keyof Env],\n undefined\n >;\n\n type ClientEnv = {\n [B in ClientEnvKeys]: Env[B];\n };\n\n const clientEnv = pipe(\n serverEnv,\n (obj) => Array.from(obj.entries()),\n (pairs) => pairs.filter(([k]) => k.startsWith(PUBLIC_ENV_PREFIX)),\n (pairs) => Object.fromEntries(pairs),\n ) as ClientEnv;\n\n return {\n client: clientEnv,\n server: Object.fromEntries(serverEnv.entries()) as Env,\n };\n};\n"],"mappings":";;;;AAGA,MAAM,oBAAoB;;;;;;AAO1B,MAAa,aAKX,SAII;CACJ,MAAM,QAAQ,OAAO,QAAQ,KAAK,OAAO;CACzC,MAAM,4BAAY,IAAI,KAAK;CAC3B,MAAMA,cAAwB,EAAE;AAEhC,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO;EAChC,MAAM,SAAS,EAAE,UAAU,OAAO,KAAK,IAAI,QAAQ,KAAK;AAExD,MAAI,CAAC,OAAO,QACV,aAAY,KAAK,IAAI;AAGvB,YAAU,IAAI,KAAK,OAAO,OAAO;;AAGnC,KAAI,YAAY,SAAS,GAAG;AAC1B,UAAQ,MAAM,oCAAoC,YAAY,KAAK,MAAM,IAAI,EAAE,GAAG,CAAC,KAAK,KAAK,GAAG;AAChG,UAAQ,KAAK,EAAE;;AAqBjB,QAAO;EACL,QARgB,KAChB,YACC,QAAQ,MAAM,KAAK,IAAI,SAAS,CAAC,GACjC,YAAUC,QAAM,QAAQ,CAAC,OAAO,EAAE,WAAW,kBAAkB,CAAC,GAChE,YAAU,OAAO,YAAYA,QAAM,CACrC;EAIC,QAAQ,OAAO,YAAY,UAAU,SAAS,CAAC;EAChD"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../node_modules/oxlint/configuration_schema.json",
|
|
3
|
+
"plugins": [
|
|
4
|
+
"import",
|
|
5
|
+
"typescript",
|
|
6
|
+
"unicorn",
|
|
7
|
+
"react",
|
|
8
|
+
"react-perf",
|
|
9
|
+
"oxc",
|
|
10
|
+
"node",
|
|
11
|
+
"promise"
|
|
12
|
+
],
|
|
13
|
+
"env": {
|
|
14
|
+
"browser": true
|
|
15
|
+
},
|
|
16
|
+
"ignorePatterns": [
|
|
17
|
+
"packages/*/src/routeTree.gen.ts",
|
|
18
|
+
"packages/*/.output",
|
|
19
|
+
"packages/*/vite-plugins",
|
|
20
|
+
"packages/*/dist",
|
|
21
|
+
"packages/common/src/oxlint-plugins",
|
|
22
|
+
"**/node_modules"
|
|
23
|
+
],
|
|
24
|
+
"settings": {},
|
|
25
|
+
"rules": {
|
|
26
|
+
"@typescript-eslint/no-explicit-any": "error",
|
|
27
|
+
"@typescript-eslint/no-non-null-assertion": "error",
|
|
28
|
+
"react/button-has-type": "deny",
|
|
29
|
+
"react/rules-of-hooks": "deny",
|
|
30
|
+
"no-nested-ternary": "deny",
|
|
31
|
+
"react/exhaustive-deps": "deny",
|
|
32
|
+
"react/no-unstable-nested-components": "error",
|
|
33
|
+
"typescript/no-floating-promises": "off",
|
|
34
|
+
"no-unused-vars": "warn",
|
|
35
|
+
"typescript/no-import-type-side-effects": "deny",
|
|
36
|
+
"no-inline-components/no-inline-components": "error",
|
|
37
|
+
"@typescript-eslint/consistent-type-imports": "deny",
|
|
38
|
+
"no-switch-plugin/no-switch": "error",
|
|
39
|
+
"no-top-level-let/no-top-level-let": "error",
|
|
40
|
+
"no-finally/no-finally": "error",
|
|
41
|
+
"no-react-namespace/no-react-namespace": "error",
|
|
42
|
+
"no-type-cast/no-type-cast": "warn",
|
|
43
|
+
"no-emoji/no-emoji": "error",
|
|
44
|
+
"no-component-date-instantiation/no-component-date-instantiation": "warn",
|
|
45
|
+
"jsx-component-pascal-case/jsx-component-pascal-case": "error",
|
|
46
|
+
"react/self-closing-comp": [
|
|
47
|
+
"deny",
|
|
48
|
+
{
|
|
49
|
+
"html": false
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
"overrides": [
|
|
54
|
+
{
|
|
55
|
+
"files": [
|
|
56
|
+
"packages/**/*.test.ts",
|
|
57
|
+
"packages/**/*.test.tsx",
|
|
58
|
+
"packages/**/*.spec.ts",
|
|
59
|
+
"packages/**/*.spec.tsx",
|
|
60
|
+
"packages/**/__tests__/**"
|
|
61
|
+
],
|
|
62
|
+
"rules": {
|
|
63
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
64
|
+
"no-type-cast/no-type-cast": "off"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as oxlint29 from "oxlint";
|
|
2
2
|
|
|
3
3
|
//#region src/oxlint-plugins/jsx-component-pascal-case.d.ts
|
|
4
|
-
declare const jsxComponentPascalCaseRule:
|
|
4
|
+
declare const jsxComponentPascalCaseRule: oxlint29.Rule;
|
|
5
5
|
declare namespace _default {
|
|
6
6
|
namespace meta {
|
|
7
7
|
let name: string;
|
|
8
8
|
}
|
|
9
9
|
let rules: {
|
|
10
|
-
"jsx-component-pascal-case":
|
|
10
|
+
"jsx-component-pascal-case": oxlint29.Rule;
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
type RuleContext =
|
|
14
|
-
type ESTNode =
|
|
15
|
-
type ESTExpression =
|
|
16
|
-
type ReturnStatementNode =
|
|
17
|
-
type FunctionLikeNode =
|
|
13
|
+
type RuleContext = oxlint29.Context;
|
|
14
|
+
type ESTNode = oxlint29.ESTree.Node;
|
|
15
|
+
type ESTExpression = oxlint29.ESTree.Expression;
|
|
16
|
+
type ReturnStatementNode = oxlint29.ESTree.ReturnStatement;
|
|
17
|
+
type FunctionLikeNode = oxlint29.ESTree.Function | oxlint29.ESTree.ArrowFunctionExpression;
|
|
18
18
|
type FunctionContext = {
|
|
19
19
|
node: FunctionLikeNode;
|
|
20
20
|
name: string;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as oxlint5 from "oxlint";
|
|
2
2
|
|
|
3
3
|
//#region src/oxlint-plugins/no-component-date-instantiation.d.ts
|
|
4
|
-
declare const noComponentDateInstantiationRule:
|
|
4
|
+
declare const noComponentDateInstantiationRule: oxlint5.Rule;
|
|
5
5
|
declare namespace _default {
|
|
6
6
|
namespace meta {
|
|
7
7
|
let name: string;
|
|
8
8
|
}
|
|
9
9
|
let rules: {
|
|
10
|
-
"no-component-date-instantiation":
|
|
10
|
+
"no-component-date-instantiation": oxlint5.Rule;
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
type RuleContext =
|
|
14
|
-
type ESTNode =
|
|
15
|
-
type NewExpressionNode =
|
|
16
|
-
type ReturnStatementNode =
|
|
17
|
-
type FunctionLikeNode =
|
|
13
|
+
type RuleContext = oxlint5.Context;
|
|
14
|
+
type ESTNode = oxlint5.ESTree.Node;
|
|
15
|
+
type NewExpressionNode = oxlint5.ESTree.NewExpression;
|
|
16
|
+
type ReturnStatementNode = oxlint5.ESTree.ReturnStatement;
|
|
17
|
+
type FunctionLikeNode = oxlint5.ESTree.Function | oxlint5.ESTree.ArrowFunctionExpression;
|
|
18
18
|
type FunctionContext = {
|
|
19
19
|
node: FunctionLikeNode;
|
|
20
20
|
parent: FunctionContext | null;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as oxlint37 from "oxlint";
|
|
2
2
|
|
|
3
3
|
//#region src/oxlint-plugins/no-emoji.d.ts
|
|
4
|
-
declare const noEmojiRule:
|
|
4
|
+
declare const noEmojiRule: oxlint37.Rule;
|
|
5
5
|
declare namespace _default {
|
|
6
6
|
namespace meta {
|
|
7
7
|
let name: string;
|
|
8
8
|
}
|
|
9
9
|
let rules: {
|
|
10
|
-
"no-emoji":
|
|
10
|
+
"no-emoji": oxlint37.Rule;
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
type ESTNode =
|
|
13
|
+
type ESTNode = oxlint37.ESTree.Node;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { ESTNode, _default as default, noEmojiRule };
|
|
16
16
|
//# sourceMappingURL=no-emoji.d.mts.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as oxlint0 from "oxlint";
|
|
2
2
|
|
|
3
3
|
//#region src/oxlint-plugins/no-finally.d.ts
|
|
4
|
-
declare const noFinallyRule:
|
|
4
|
+
declare const noFinallyRule: oxlint0.Rule;
|
|
5
5
|
declare namespace _default {
|
|
6
6
|
namespace meta {
|
|
7
7
|
let name: string;
|
|
8
8
|
}
|
|
9
9
|
let rules: {
|
|
10
|
-
"no-finally":
|
|
10
|
+
"no-finally": oxlint0.Rule;
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
type ESTNode =
|
|
13
|
+
type ESTNode = oxlint0.ESTree.Node;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { ESTNode, _default as default, noFinallyRule };
|
|
16
16
|
//# sourceMappingURL=no-finally.d.mts.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as oxlint40 from "oxlint";
|
|
2
2
|
|
|
3
3
|
//#region src/oxlint-plugins/no-react-namespace.d.ts
|
|
4
|
-
declare const noReactNamespaceRule:
|
|
4
|
+
declare const noReactNamespaceRule: oxlint40.Rule;
|
|
5
5
|
declare namespace _default {
|
|
6
6
|
namespace meta {
|
|
7
7
|
let name: string;
|
|
8
8
|
}
|
|
9
9
|
let rules: {
|
|
10
|
-
"no-react-namespace":
|
|
10
|
+
"no-react-namespace": oxlint40.Rule;
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
type ESTNode =
|
|
13
|
+
type ESTNode = oxlint40.ESTree.Node;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { ESTNode, _default as default, noReactNamespaceRule };
|
|
16
16
|
//# sourceMappingURL=no-react-namespace.d.mts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as oxlint27 from "oxlint";
|
|
2
2
|
|
|
3
3
|
//#region src/oxlint-plugins/no-switch-plugin.d.ts
|
|
4
4
|
declare namespace _default {
|
|
@@ -6,10 +6,10 @@ declare namespace _default {
|
|
|
6
6
|
let name: string;
|
|
7
7
|
}
|
|
8
8
|
let rules: {
|
|
9
|
-
"no-switch":
|
|
9
|
+
"no-switch": oxlint27.Rule;
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
-
type ESTNode =
|
|
12
|
+
type ESTNode = oxlint27.ESTree.Node;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { ESTNode, _default as default };
|
|
15
15
|
//# sourceMappingURL=no-switch-plugin.d.mts.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as oxlint13 from "oxlint";
|
|
2
2
|
|
|
3
3
|
//#region src/oxlint-plugins/no-top-level-let.d.ts
|
|
4
|
-
declare const noTopLevelLetRule:
|
|
4
|
+
declare const noTopLevelLetRule: oxlint13.Rule;
|
|
5
5
|
declare namespace _default {
|
|
6
6
|
namespace meta {
|
|
7
7
|
let name: string;
|
|
8
8
|
}
|
|
9
9
|
let rules: {
|
|
10
|
-
"no-top-level-let":
|
|
10
|
+
"no-top-level-let": oxlint13.Rule;
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
type ESTNode =
|
|
13
|
+
type ESTNode = oxlint13.ESTree.Node;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { ESTNode, _default as default, noTopLevelLetRule };
|
|
16
16
|
//# sourceMappingURL=no-top-level-let.d.mts.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as oxlint2 from "oxlint";
|
|
2
2
|
|
|
3
3
|
//#region src/oxlint-plugins/no-type-cast.d.ts
|
|
4
|
-
declare const noTypeCastRule:
|
|
4
|
+
declare const noTypeCastRule: oxlint2.Rule;
|
|
5
5
|
declare namespace _default {
|
|
6
6
|
namespace meta {
|
|
7
7
|
let name: string;
|
|
8
8
|
}
|
|
9
9
|
let rules: {
|
|
10
|
-
"no-type-cast":
|
|
10
|
+
"no-type-cast": oxlint2.Rule;
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
type ESTNode =
|
|
13
|
+
type ESTNode = oxlint2.ESTree.Node;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { ESTNode, _default as default, noTypeCastRule };
|
|
16
16
|
//# sourceMappingURL=no-type-cast.d.mts.map
|
package/package.json
CHANGED
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
"types": "./dist/images.d.ts",
|
|
16
16
|
"default": "./dist/images.js"
|
|
17
17
|
},
|
|
18
|
+
"./oxlint/config": {
|
|
19
|
+
"default": "./dist/oxlint/config.json"
|
|
20
|
+
},
|
|
18
21
|
"./oxlint/jsx-component-pascal-case": {
|
|
19
22
|
"types": "./dist/oxlint/jsx-component-pascal-case.d.ts",
|
|
20
23
|
"default": "./dist/oxlint/jsx-component-pascal-case.js"
|
|
@@ -70,7 +73,7 @@
|
|
|
70
73
|
"typescript": "5.9.3",
|
|
71
74
|
"vitest": "4.0.15"
|
|
72
75
|
},
|
|
73
|
-
"version": "0.0.
|
|
76
|
+
"version": "0.0.39",
|
|
74
77
|
"scripts": {
|
|
75
78
|
"dev": "tsdown --watch",
|
|
76
79
|
"build": "tsc --noEmit && tsdown",
|