@noctcore/eslint-plugin-contracts 0.2.0 → 0.3.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.
- package/README.md +2 -0
- package/dist/index.cjs +722 -77
- package/dist/index.d.cts +32 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +722 -77
- package/docs/rules/fetch-must-check-ok.md +83 -0
- package/docs/rules/schema-enum-field-consistency.md +75 -0
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
|
|
2
2
|
|
|
3
|
+
interface FetchMustCheckOkOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Callees whose result is a `Response`: a bare name (`fetch`) or a dotted path
|
|
6
|
+
* (`globalThis.fetch`, `http.fetchWithRetry`). Default `['fetch']`.
|
|
7
|
+
*/
|
|
8
|
+
readonly fetchFunctions?: readonly string[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface SchemaEnumFieldConsistencyOptions {
|
|
12
|
+
/** Names the zod namespace is imported under. */
|
|
13
|
+
readonly zodIdentifiers?: readonly string[];
|
|
14
|
+
/** Field names allowed to be an enum in one schema and a string in another. */
|
|
15
|
+
readonly ignoreFields?: readonly string[];
|
|
16
|
+
/**
|
|
17
|
+
* Regex source. An IMPORTED identifier counts as an enum only when its name
|
|
18
|
+
* matches. Unset, no imported identifier does.
|
|
19
|
+
*/
|
|
20
|
+
readonly enumIdentifierPattern?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
3
23
|
interface EnvVarSchemaParityOptions {
|
|
4
24
|
/** Path to the env declaration source — a `.env.example` or a zod-env module. Empty = rule is inert. */
|
|
5
25
|
readonly schema?: string;
|
|
@@ -83,6 +103,12 @@ declare const rules: {
|
|
|
83
103
|
'require-schema-parse-at-boundary': _typescript_eslint_utils_ts_eslint.RuleModule<"castedBoundaryData", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
84
104
|
name: string;
|
|
85
105
|
};
|
|
106
|
+
'schema-enum-field-consistency': _typescript_eslint_utils_ts_eslint.RuleModule<"widenedEnumField", [SchemaEnumFieldConsistencyOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
107
|
+
name: string;
|
|
108
|
+
};
|
|
109
|
+
'fetch-must-check-ok': _typescript_eslint_utils_ts_eslint.RuleModule<"missingOkCheck", [FetchMustCheckOkOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
110
|
+
name: string;
|
|
111
|
+
};
|
|
86
112
|
};
|
|
87
113
|
|
|
88
114
|
declare const plugin: {
|
|
@@ -121,6 +147,12 @@ declare const plugin: {
|
|
|
121
147
|
'require-schema-parse-at-boundary': _typescript_eslint_utils_ts_eslint.RuleModule<"castedBoundaryData", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
122
148
|
name: string;
|
|
123
149
|
};
|
|
150
|
+
'schema-enum-field-consistency': _typescript_eslint_utils_ts_eslint.RuleModule<"widenedEnumField", [SchemaEnumFieldConsistencyOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
151
|
+
name: string;
|
|
152
|
+
};
|
|
153
|
+
'fetch-must-check-ok': _typescript_eslint_utils_ts_eslint.RuleModule<"missingOkCheck", [FetchMustCheckOkOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
154
|
+
name: string;
|
|
155
|
+
};
|
|
124
156
|
};
|
|
125
157
|
configs: Record<string, unknown>;
|
|
126
158
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
|
|
2
2
|
|
|
3
|
+
interface FetchMustCheckOkOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Callees whose result is a `Response`: a bare name (`fetch`) or a dotted path
|
|
6
|
+
* (`globalThis.fetch`, `http.fetchWithRetry`). Default `['fetch']`.
|
|
7
|
+
*/
|
|
8
|
+
readonly fetchFunctions?: readonly string[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface SchemaEnumFieldConsistencyOptions {
|
|
12
|
+
/** Names the zod namespace is imported under. */
|
|
13
|
+
readonly zodIdentifiers?: readonly string[];
|
|
14
|
+
/** Field names allowed to be an enum in one schema and a string in another. */
|
|
15
|
+
readonly ignoreFields?: readonly string[];
|
|
16
|
+
/**
|
|
17
|
+
* Regex source. An IMPORTED identifier counts as an enum only when its name
|
|
18
|
+
* matches. Unset, no imported identifier does.
|
|
19
|
+
*/
|
|
20
|
+
readonly enumIdentifierPattern?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
3
23
|
interface EnvVarSchemaParityOptions {
|
|
4
24
|
/** Path to the env declaration source — a `.env.example` or a zod-env module. Empty = rule is inert. */
|
|
5
25
|
readonly schema?: string;
|
|
@@ -83,6 +103,12 @@ declare const rules: {
|
|
|
83
103
|
'require-schema-parse-at-boundary': _typescript_eslint_utils_ts_eslint.RuleModule<"castedBoundaryData", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
84
104
|
name: string;
|
|
85
105
|
};
|
|
106
|
+
'schema-enum-field-consistency': _typescript_eslint_utils_ts_eslint.RuleModule<"widenedEnumField", [SchemaEnumFieldConsistencyOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
107
|
+
name: string;
|
|
108
|
+
};
|
|
109
|
+
'fetch-must-check-ok': _typescript_eslint_utils_ts_eslint.RuleModule<"missingOkCheck", [FetchMustCheckOkOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
110
|
+
name: string;
|
|
111
|
+
};
|
|
86
112
|
};
|
|
87
113
|
|
|
88
114
|
declare const plugin: {
|
|
@@ -121,6 +147,12 @@ declare const plugin: {
|
|
|
121
147
|
'require-schema-parse-at-boundary': _typescript_eslint_utils_ts_eslint.RuleModule<"castedBoundaryData", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
122
148
|
name: string;
|
|
123
149
|
};
|
|
150
|
+
'schema-enum-field-consistency': _typescript_eslint_utils_ts_eslint.RuleModule<"widenedEnumField", [SchemaEnumFieldConsistencyOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
151
|
+
name: string;
|
|
152
|
+
};
|
|
153
|
+
'fetch-must-check-ok': _typescript_eslint_utils_ts_eslint.RuleModule<"missingOkCheck", [FetchMustCheckOkOptions], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
154
|
+
name: string;
|
|
155
|
+
};
|
|
124
156
|
};
|
|
125
157
|
configs: Record<string, unknown>;
|
|
126
158
|
};
|