UNPKG

16.9 kBTypeScriptView Raw
1// Generated by dts-bundle-generator v9.5.1
2
3import { NamedCreateRuleMeta } from '@typescript-eslint/utils/eslint-utils';
4import { FlatConfig, RuleModule } from '@typescript-eslint/utils/ts-eslint';
5import { Immutability } from 'is-immutable-type';
6import { TypeDeclarationSpecifier } from 'ts-declaration-location';
7
8export type Docs = {
9 /**
10 * Used for creating category configs and splitting the README rules list into sub-lists.
11 */
12 category: "Currying" | "No Exceptions" | "No Mutations" | "No Other Paradigms" | "No Statements" | "Stylistic";
13 recommended: "recommended" | "strict" | false;
14 recommendedSeverity: "error" | "warn";
15 requiresTypeChecking: boolean;
16 url?: never;
17};
18/**
19 * Any custom rule meta properties.
20 */
21export type NamedCreateRuleCustomMeta<T extends string, Options extends ReadonlyArray<unknown>> = NamedCreateRuleMeta<T, Docs, Options>;
22/**
23 * The definition of a rule.
24 */
25export type Rule<MessageIds extends string, Options extends ReadonlyArray<unknown>> = RuleModule<MessageIds, Options, Docs> & {
26 meta: NamedCreateRuleCustomMeta<MessageIds, Options>;
27};
28/**
29 * The option to ignore patterns.
30 */
31export type IgnoreIdentifierPatternOption = Readonly<{
32 ignoreIdentifierPattern?: ReadonlyArray<string> | string;
33}>;
34/**
35 * The option to ignore patterns.
36 */
37export type IgnoreCodePatternOption = Readonly<{
38 ignoreCodePattern?: ReadonlyArray<string> | string;
39}>;
40/**
41 * The option to ignore accessor patterns.
42 */
43export type IgnoreAccessorPatternOption = Readonly<{
44 ignoreAccessorPattern?: ReadonlyArray<string> | string;
45}>;
46/**
47 * The option to ignore classes.
48 */
49export type IgnoreClassesOption = Readonly<{
50 ignoreClasses: boolean | "fieldsOnly";
51}>;
52/**
53 * The option to ignore prefix selector.
54 */
55export type IgnorePrefixSelectorOption = Readonly<{
56 ignorePrefixSelector?: ReadonlyArray<string> | string;
57}>;
58export type RawTypeSpecifier = {
59 name?: string | string[];
60 pattern?: string | string[];
61 ignoreName?: string | string[];
62 ignorePattern?: string | string[];
63} & TypeDeclarationSpecifier;
64export type RawOverridableOptions<CoreOptions> = CoreOptions & {
65 overrides?: Array<{
66 specifiers?: RawTypeSpecifier | RawTypeSpecifier[];
67 options?: CoreOptions;
68 inherit?: boolean;
69 disable?: boolean;
70 }>;
71};
72declare const ruleNameScope = "functional";
73declare const name = "functional-parameters";
74declare const fullName: `${typeof ruleNameScope}/${typeof name}`;
75/**
76 * The parameter count options this rule can take.
77 */
78export type ParameterCountOptions = "atLeastOne" | "exactlyOne";
79export type CoreOptions = IgnoreIdentifierPatternOption & IgnorePrefixSelectorOption & {
80 allowRestParameter: boolean;
81 allowArgumentsKeyword: boolean;
82 enforceParameterCount: ParameterCountOptions | false | {
83 count: ParameterCountOptions;
84 ignoreLambdaExpression: boolean;
85 ignoreIIFE: boolean;
86 ignoreGettersAndSetters: boolean;
87 };
88};
89/**
90 * The options this rule can take.
91 */
92export type RawOptions = [
93 RawOverridableOptions<CoreOptions>
94];
95declare const errorMessages: {
96 readonly restParam: "Unexpected rest parameter. Use a regular parameter of type array instead.";
97 readonly arguments: "Unexpected use of `arguments`. Use regular function arguments instead.";
98 readonly paramCountAtLeastOne: "Functions must have at least one parameter.";
99 readonly paramCountExactlyOne: "Functions must have exactly one parameter.";
100};
101declare const rule: Rule<keyof typeof errorMessages, RawOptions>;
102declare const name$1 = "immutable-data";
103declare const fullName$1: `${typeof ruleNameScope}/${typeof name$1}`;
104type CoreOptions$1 = IgnoreAccessorPatternOption & IgnoreClassesOption & IgnoreIdentifierPatternOption & {
105 ignoreImmediateMutation: boolean;
106 ignoreNonConstDeclarations: boolean | {
107 treatParametersAsConst: boolean;
108 };
109};
110type RawOptions$1 = [
111 RawOverridableOptions<CoreOptions$1>
112];
113declare const errorMessages$1: {
114 readonly generic: "Modifying an existing object/array is not allowed.";
115 readonly object: "Modifying properties of existing object not allowed.";
116 readonly array: "Modifying an array is not allowed.";
117};
118declare const rule$1: Rule<keyof typeof errorMessages$1, RawOptions$1>;
119declare const name$2 = "no-class-inheritance";
120declare const fullName$2: `${typeof ruleNameScope}/${typeof name$2}`;
121type RawOptions$2 = [
122 IgnoreIdentifierPatternOption & IgnoreCodePatternOption
123];
124declare const errorMessages$2: {
125 readonly abstract: "Unexpected abstract class.";
126 readonly extends: "Unexpected inheritance, use composition instead.";
127};
128declare const rule$2: Rule<keyof typeof errorMessages$2, RawOptions$2>;
129declare const name$3 = "no-classes";
130declare const fullName$3: `${typeof ruleNameScope}/${typeof name$3}`;
131type RawOptions$3 = [
132 IgnoreIdentifierPatternOption & IgnoreCodePatternOption
133];
134declare const errorMessages$3: {
135 readonly generic: "Unexpected class, use functions not classes.";
136};
137declare const rule$3: Rule<keyof typeof errorMessages$3, RawOptions$3>;
138declare const name$4 = "no-conditional-statements";
139declare const fullName$4: `${typeof ruleNameScope}/${typeof name$4}`;
140type RawOptions$4 = [
141 IgnoreCodePatternOption & {
142 allowReturningBranches: boolean | "ifExhaustive";
143 }
144];
145declare const errorMessages$4: {
146 readonly incompleteBranch: "Incomplete branch, every branch in a conditional statement must contain a return statement.";
147 readonly incompleteIf: "Incomplete if, it must have an else statement and every branch must contain a return statement.";
148 readonly incompleteSwitch: "Incomplete switch, it must be exhaustive or have an default case and every case must contain a return statement.";
149 readonly unexpectedIf: "Unexpected if, use a conditional expression (ternary operator) instead.";
150 readonly unexpectedSwitch: "Unexpected switch, use a conditional expression (ternary operator) instead.";
151};
152declare const rule$4: Rule<keyof typeof errorMessages$4, RawOptions$4>;
153declare const name$5 = "no-expression-statements";
154declare const fullName$5: `${typeof ruleNameScope}/${typeof name$5}`;
155type RawOptions$5 = [
156 IgnoreCodePatternOption & {
157 ignoreVoid: boolean;
158 ignoreSelfReturning: boolean;
159 }
160];
161declare const errorMessages$5: {
162 readonly generic: "Using expressions to cause side-effects not allowed.";
163};
164declare const rule$5: Rule<keyof typeof errorMessages$5, RawOptions$5>;
165declare const name$6 = "no-let";
166declare const fullName$6: `${typeof ruleNameScope}/${typeof name$6}`;
167type RawOptions$6 = [
168 IgnoreIdentifierPatternOption & {
169 allowInForLoopInit: boolean;
170 allowInFunctions: boolean;
171 }
172];
173declare const errorMessages$6: {
174 readonly generic: "Unexpected let, use const instead.";
175};
176declare const rule$6: Rule<keyof typeof errorMessages$6, RawOptions$6>;
177declare const name$7 = "no-loop-statements";
178declare const fullName$7: `${typeof ruleNameScope}/${typeof name$7}`;
179type RawOptions$7 = [
180 {}
181];
182declare const errorMessages$7: {
183 readonly generic: "Unexpected loop, use map or reduce instead.";
184};
185declare const rule$7: Rule<keyof typeof errorMessages$7, RawOptions$7>;
186declare const name$8 = "no-mixed-types";
187declare const fullName$8: `${typeof ruleNameScope}/${typeof name$8}`;
188type RawOptions$8 = [
189 {
190 checkInterfaces: boolean;
191 checkTypeLiterals: boolean;
192 }
193];
194declare const errorMessages$8: {
195 readonly generic: "Only the same kind of members allowed in types.";
196};
197declare const rule$8: Rule<keyof typeof errorMessages$8, RawOptions$8>;
198declare const name$9 = "no-promise-reject";
199declare const fullName$9: `${typeof ruleNameScope}/${typeof name$9}`;
200type RawOptions$9 = [
201 {}
202];
203declare const errorMessages$9: {
204 readonly generic: "Unexpected rejection, resolve an error instead.";
205};
206declare const rule$9: Rule<keyof typeof errorMessages$9, RawOptions$9>;
207declare const name$10 = "no-return-void";
208declare const fullName$10: `${typeof ruleNameScope}/${typeof name$10}`;
209type RawOptions$10 = [
210 {
211 allowNull: boolean;
212 allowUndefined: boolean;
213 ignoreInferredTypes: boolean;
214 }
215];
216declare const errorMessages$10: {
217 readonly generic: "Function must return a value.";
218};
219declare const rule$10: Rule<keyof typeof errorMessages$10, RawOptions$10>;
220declare const name$11 = "no-this-expressions";
221declare const fullName$11: `${typeof ruleNameScope}/${typeof name$11}`;
222type RawOptions$11 = [
223 {}
224];
225declare const errorMessages$11: {
226 readonly generic: "Unexpected this, use functions not classes.";
227};
228declare const rule$11: Rule<keyof typeof errorMessages$11, RawOptions$11>;
229declare const name$12 = "no-throw-statements";
230declare const fullName$12: `${typeof ruleNameScope}/${typeof name$12}`;
231type RawOptions$12 = [
232 {
233 allowToRejectPromises: boolean;
234 }
235];
236declare const errorMessages$12: {
237 readonly generic: "Unexpected throw, throwing exceptions is not functional.";
238};
239declare const rule$12: Rule<keyof typeof errorMessages$12, RawOptions$12>;
240declare const name$13 = "no-try-statements";
241declare const fullName$13: `${typeof ruleNameScope}/${typeof name$13}`;
242type RawOptions$13 = [
243 {
244 allowCatch: boolean;
245 allowFinally: boolean;
246 }
247];
248declare const errorMessages$13: {
249 readonly catch: "Unexpected try-catch, this pattern is not functional.";
250 readonly finally: "Unexpected try-finally, this pattern is not functional.";
251};
252declare const rule$13: Rule<keyof typeof errorMessages$13, RawOptions$13>;
253declare const name$14 = "prefer-immutable-types";
254declare const fullName$14: `${typeof ruleNameScope}/${typeof name$14}`;
255export type RawEnforcement = Exclude<Immutability | keyof typeof Immutability, "Unknown" | "Mutable"> | "None" | false | undefined;
256export type Option = IgnoreClassesOption & {
257 enforcement: RawEnforcement;
258 ignoreInferredTypes: boolean;
259 ignoreNamePattern?: string[] | string;
260 ignoreTypePattern?: string[] | string;
261};
262type CoreOptions$2 = Option & {
263 parameters?: Partial<Option> | RawEnforcement;
264 returnTypes?: Partial<Option> | RawEnforcement;
265 variables?: Partial<Option & {
266 ignoreInFunctions?: boolean;
267 }> | RawEnforcement;
268 fixer?: FixerConfigRawMap;
269 suggestions?: SuggestionConfigRawMap;
270};
271export type FixerConfigRaw = {
272 pattern: string;
273 replace: string;
274};
275export type SuggestionsConfigRaw = Array<FixerConfigRaw & {
276 message?: string;
277}>;
278export type FixerConfigRawMap = Partial<Record<"ReadonlyShallow" | "ReadonlyDeep" | "Immutable", FixerConfigRaw | FixerConfigRaw[] | undefined>>;
279export type SuggestionConfigRawMap = Partial<Record<"ReadonlyShallow" | "ReadonlyDeep" | "Immutable", SuggestionsConfigRaw[] | undefined>>;
280type RawOptions$14 = [
281 RawOverridableOptions<CoreOptions$2>
282];
283declare const errorMessages$14: {
284 readonly parameter: "Parameter should have an immutability of at least \"{{ expected }}\" (actual: \"{{ actual }}\").";
285 readonly returnType: "Return type should have an immutability of at least \"{{ expected }}\" (actual: \"{{ actual }}\").";
286 readonly variable: "Variable should have an immutability of at least \"{{ expected }}\" (actual: \"{{ actual }}\").";
287 readonly propertyImmutability: "Property should have an immutability of at least \"{{ expected }}\" (actual: \"{{ actual }}\").";
288 readonly propertyModifier: "Property should have a readonly modifier.";
289 readonly propertyModifierSuggestion: "Add readonly modifier.";
290 readonly userDefined: "{{ message }}";
291};
292declare const rule$14: Rule<keyof typeof errorMessages$14, RawOptions$14>;
293declare const name$15 = "prefer-property-signatures";
294declare const fullName$15: `${typeof ruleNameScope}/${typeof name$15}`;
295type RawOptions$15 = [
296 {
297 ignoreIfReadonlyWrapped: boolean;
298 }
299];
300declare const errorMessages$15: {
301 readonly generic: "Use a property signature instead of a method signature";
302};
303declare const rule$15: Rule<keyof typeof errorMessages$15, RawOptions$15>;
304declare const name$16 = "prefer-readonly-type";
305declare const fullName$16: `${typeof ruleNameScope}/${typeof name$16}`;
306type RawOptions$16 = [
307 {
308 allowLocalMutation: boolean;
309 allowMutableReturnType: boolean;
310 checkImplicit: boolean;
311 ignoreCollections: boolean;
312 ignoreClass: boolean | "fieldsOnly";
313 ignoreInterface: boolean;
314 ignorePattern?: string[] | string;
315 }
316];
317declare const errorMessages$16: {
318 readonly array: "Only readonly arrays allowed.";
319 readonly implicit: "Implicitly a mutable array. Only readonly arrays allowed.";
320 readonly property: "A readonly modifier is required.";
321 readonly tuple: "Only readonly tuples allowed.";
322 readonly type: "Only readonly types allowed.";
323};
324declare const rule$16: Rule<keyof typeof errorMessages$16, RawOptions$16>;
325declare const name$17 = "prefer-tacit";
326declare const fullName$17: `${typeof ruleNameScope}/${typeof name$17}`;
327type RawOptions$17 = [
328 {
329 checkMemberExpressions: boolean;
330 }
331];
332declare const errorMessages$17: {
333 readonly generic: "Potentially unnecessary function wrapper.";
334 readonly genericSuggestion: "Remove unnecessary function wrapper.";
335};
336declare const rule$17: Rule<keyof typeof errorMessages$17, RawOptions$17>;
337declare const name$18 = "readonly-type";
338declare const fullName$18: `${typeof ruleNameScope}/${typeof name$18}`;
339type RawOptions$18 = [
340 "generic" | "keyword"
341];
342declare const errorMessages$18: {
343 readonly generic: "Readonly type using 'readonly' keyword is forbidden. Use 'Readonly<T>' instead.";
344 readonly keyword: "Readonly type using 'Readonly<T>' is forbidden. Use 'readonly' keyword instead.";
345};
346declare const rule$18: Rule<keyof typeof errorMessages$18, RawOptions$18>;
347declare const name$19 = "type-declaration-immutability";
348declare const fullName$19: `${typeof ruleNameScope}/${typeof name$19}`;
349declare enum RuleEnforcementComparator {
350 Less = -2,
351 AtMost = -1,
352 Exactly = 0,
353 AtLeast = 1,
354 More = 2
355}
356type FixerConfigRaw$1 = {
357 pattern: string;
358 replace: string;
359 message?: string;
360};
361export type FixerConfig = {
362 pattern: RegExp;
363 replace: string;
364 message?: string;
365};
366export type SuggestionsConfig = FixerConfig[];
367type RawOptions$19 = [
368 IgnoreIdentifierPatternOption & {
369 rules: Array<{
370 identifiers: string | string[];
371 immutability: Exclude<Immutability | keyof typeof Immutability, "Unknown">;
372 comparator?: RuleEnforcementComparator | keyof typeof RuleEnforcementComparator;
373 fixer?: FixerConfigRaw$1 | FixerConfigRaw$1[] | false;
374 suggestions?: FixerConfigRaw$1[] | false;
375 }>;
376 ignoreInterfaces: boolean;
377 }
378];
379declare const errorMessages$19: {
380 readonly Less: "This type is declare to have an immutability less than \"{{ expected }}\" (actual: \"{{ actual }}\").";
381 readonly AtLeast: "This type is declare to have an immutability of at least \"{{ expected }}\" (actual: \"{{ actual }}\").";
382 readonly Exactly: "This type is declare to have an immutability of exactly \"{{ expected }}\" (actual: \"{{ actual }}\").";
383 readonly AtMost: "This type is declare to have an immutability of at most \"{{ expected }}\" (actual: \"{{ actual }}\").";
384 readonly More: "This type is declare to have an immutability more than \"{{ expected }}\" (actual: \"{{ actual }}\").";
385 readonly userDefined: "{{ message }}";
386};
387/**
388 * A rule given by the user after being upgraded.
389 */
390export type ImmutabilityRule = {
391 identifiers: RegExp[];
392 immutability: Immutability;
393 comparator: RuleEnforcementComparator;
394 fixers: FixerConfig[] | false;
395 suggestions: SuggestionsConfig | false;
396};
397declare const rule$19: Rule<keyof typeof errorMessages$19, RawOptions$19>;
398declare const rules: Readonly<{
399 [name]: typeof rule;
400 [name$1]: typeof rule$1;
401 [name$3]: typeof rule$3;
402 [name$2]: typeof rule$2;
403 [name$4]: typeof rule$4;
404 [name$5]: typeof rule$5;
405 [name$6]: typeof rule$6;
406 [name$7]: typeof rule$7;
407 [name$8]: typeof rule$8;
408 [name$9]: typeof rule$9;
409 [name$10]: typeof rule$10;
410 [name$11]: typeof rule$11;
411 [name$12]: typeof rule$12;
412 [name$13]: typeof rule$13;
413 [name$14]: typeof rule$14;
414 [name$15]: typeof rule$15;
415 [name$16]: typeof rule$16;
416 [name$17]: typeof rule$17;
417 [name$18]: typeof rule$18;
418 [typeDeclarationImmutability.name]: typeof typeDeclarationImmutability.rule;
419}>;
420declare const meta: {
421 readonly name: "eslint-plugin-functional";
422 readonly version: string;
423};
424declare const configs: Readonly<{
425 all: FlatConfig.Config;
426 lite: FlatConfig.Config;
427 recommended: FlatConfig.Config;
428 strict: FlatConfig.Config;
429 off: FlatConfig.Config;
430 disableTypeChecked: FlatConfig.Config;
431 externalVanillaRecommended: FlatConfig.Config;
432 externalTypeScriptRecommended: FlatConfig.Config;
433 currying: FlatConfig.Config;
434 noExceptions: FlatConfig.Config;
435 noMutations: FlatConfig.Config;
436 noOtherParadigms: FlatConfig.Config;
437 noStatements: FlatConfig.Config;
438 stylistic: FlatConfig.Config;
439}>;
440export type EslintPluginFunctional = FlatConfig.Plugin & {
441 meta: typeof meta;
442 rules: typeof rules;
443 configs: typeof configs;
444};
445declare const _default: EslintPluginFunctional;
446
447declare namespace typeDeclarationImmutability {
448 export { ImmutabilityRule, RuleEnforcementComparator, fullName$19 as fullName, name$19 as name, rule$19 as rule };
449}
450
451export {
452 _default as default,
453};
454
455export {};