UNPKG

16.6 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> = NamedCreateRuleMeta<T, Docs>;
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>;
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}`;
121/**
122 * The options this rule can take.
123 */
124export type Options = [
125 IgnoreIdentifierPatternOption & IgnoreCodePatternOption
126];
127declare const errorMessages$2: {
128 readonly abstract: "Unexpected abstract class.";
129 readonly extends: "Unexpected inheritance, use composition instead.";
130};
131declare const rule$2: Rule<keyof typeof errorMessages$2, Options>;
132declare const name$3 = "no-classes";
133declare const fullName$3: `${typeof ruleNameScope}/${typeof name$3}`;
134type Options$1 = [
135 IgnoreIdentifierPatternOption & IgnoreCodePatternOption
136];
137declare const errorMessages$3: {
138 readonly generic: "Unexpected class, use functions not classes.";
139};
140declare const rule$3: Rule<keyof typeof errorMessages$3, Options$1>;
141declare const name$4 = "no-conditional-statements";
142declare const fullName$4: `${typeof ruleNameScope}/${typeof name$4}`;
143type Options$2 = [
144 {
145 allowReturningBranches: boolean | "ifExhaustive";
146 }
147];
148declare const errorMessages$4: {
149 readonly incompleteBranch: "Incomplete branch, every branch in a conditional statement must contain a return statement.";
150 readonly incompleteIf: "Incomplete if, it must have an else statement and every branch must contain a return statement.";
151 readonly incompleteSwitch: "Incomplete switch, it must be exhaustive or have an default case and every case must contain a return statement.";
152 readonly unexpectedIf: "Unexpected if, use a conditional expression (ternary operator) instead.";
153 readonly unexpectedSwitch: "Unexpected switch, use a conditional expression (ternary operator) instead.";
154};
155declare const rule$4: Rule<keyof typeof errorMessages$4, Options$2>;
156declare const name$5 = "no-expression-statements";
157declare const fullName$5: `${typeof ruleNameScope}/${typeof name$5}`;
158type Options$3 = [
159 IgnoreCodePatternOption & {
160 ignoreVoid: boolean;
161 ignoreSelfReturning: boolean;
162 }
163];
164declare const errorMessages$5: {
165 readonly generic: "Using expressions to cause side-effects not allowed.";
166};
167declare const rule$5: Rule<keyof typeof errorMessages$5, Options$3>;
168declare const name$6 = "no-let";
169declare const fullName$6: `${typeof ruleNameScope}/${typeof name$6}`;
170type Options$4 = [
171 IgnoreIdentifierPatternOption & {
172 allowInForLoopInit: boolean;
173 allowInFunctions: boolean;
174 }
175];
176declare const errorMessages$6: {
177 readonly generic: "Unexpected let, use const instead.";
178};
179declare const rule$6: Rule<keyof typeof errorMessages$6, Options$4>;
180declare const name$7 = "no-loop-statements";
181declare const fullName$7: `${typeof ruleNameScope}/${typeof name$7}`;
182type Options$5 = [
183 {}
184];
185declare const errorMessages$7: {
186 readonly generic: "Unexpected loop, use map or reduce instead.";
187};
188declare const rule$7: Rule<keyof typeof errorMessages$7, Options$5>;
189declare const name$8 = "no-mixed-types";
190declare const fullName$8: `${typeof ruleNameScope}/${typeof name$8}`;
191type Options$6 = [
192 {
193 checkInterfaces: boolean;
194 checkTypeLiterals: boolean;
195 }
196];
197declare const errorMessages$8: {
198 readonly generic: "Only the same kind of members allowed in types.";
199};
200declare const rule$8: Rule<keyof typeof errorMessages$8, Options$6>;
201declare const name$9 = "no-promise-reject";
202declare const fullName$9: `${typeof ruleNameScope}/${typeof name$9}`;
203type Options$7 = [
204 {}
205];
206declare const errorMessages$9: {
207 readonly generic: "Unexpected rejection, resolve an error instead.";
208};
209declare const rule$9: Rule<keyof typeof errorMessages$9, Options$7>;
210declare const name$10 = "no-return-void";
211declare const fullName$10: `${typeof ruleNameScope}/${typeof name$10}`;
212type Options$8 = [
213 {
214 allowNull: boolean;
215 allowUndefined: boolean;
216 ignoreInferredTypes: boolean;
217 }
218];
219declare const errorMessages$10: {
220 readonly generic: "Function must return a value.";
221};
222declare const rule$10: Rule<keyof typeof errorMessages$10, Options$8>;
223declare const name$11 = "no-this-expressions";
224declare const fullName$11: `${typeof ruleNameScope}/${typeof name$11}`;
225type Options$9 = [
226 {}
227];
228declare const errorMessages$11: {
229 readonly generic: "Unexpected this, use functions not classes.";
230};
231declare const rule$11: Rule<keyof typeof errorMessages$11, Options$9>;
232declare const name$12 = "no-throw-statements";
233declare const fullName$12: `${typeof ruleNameScope}/${typeof name$12}`;
234type Options$10 = [
235 {
236 allowToRejectPromises: boolean;
237 }
238];
239declare const errorMessages$12: {
240 readonly generic: "Unexpected throw, throwing exceptions is not functional.";
241};
242declare const rule$12: Rule<keyof typeof errorMessages$12, Options$10>;
243declare const name$13 = "no-try-statements";
244declare const fullName$13: `${typeof ruleNameScope}/${typeof name$13}`;
245type Options$11 = [
246 {
247 allowCatch: boolean;
248 allowFinally: boolean;
249 }
250];
251declare const errorMessages$13: {
252 readonly catch: "Unexpected try-catch, this pattern is not functional.";
253 readonly finally: "Unexpected try-finally, this pattern is not functional.";
254};
255declare const rule$13: Rule<keyof typeof errorMessages$13, Options$11>;
256declare const name$14 = "prefer-immutable-types";
257declare const fullName$14: `${typeof ruleNameScope}/${typeof name$14}`;
258export type RawEnforcement = Exclude<Immutability | keyof typeof Immutability, "Unknown" | "Mutable"> | "None" | false | undefined;
259export type Option = IgnoreClassesOption & {
260 enforcement: RawEnforcement;
261 ignoreInferredTypes: boolean;
262 ignoreNamePattern?: string[] | string;
263 ignoreTypePattern?: string[] | string;
264};
265type CoreOptions$2 = Option & {
266 parameters?: Partial<Option> | RawEnforcement;
267 returnTypes?: Partial<Option> | RawEnforcement;
268 variables?: Partial<Option & {
269 ignoreInFunctions?: boolean;
270 }> | RawEnforcement;
271 fixer?: FixerConfigRawMap;
272 suggestions?: SuggestionConfigRawMap;
273};
274export type FixerConfigRaw = {
275 pattern: string;
276 replace: string;
277};
278export type SuggestionsConfigRaw = Array<FixerConfigRaw & {
279 message?: string;
280}>;
281export type FixerConfigRawMap = Partial<Record<"ReadonlyShallow" | "ReadonlyDeep" | "Immutable", FixerConfigRaw | FixerConfigRaw[] | undefined>>;
282export type SuggestionConfigRawMap = Partial<Record<"ReadonlyShallow" | "ReadonlyDeep" | "Immutable", SuggestionsConfigRaw[] | undefined>>;
283type RawOptions$2 = [
284 RawOverridableOptions<CoreOptions$2>
285];
286declare const errorMessages$14: {
287 readonly parameter: "Parameter should have an immutability of at least \"{{ expected }}\" (actual: \"{{ actual }}\").";
288 readonly returnType: "Return type should have an immutability of at least \"{{ expected }}\" (actual: \"{{ actual }}\").";
289 readonly variable: "Variable should have an immutability of at least \"{{ expected }}\" (actual: \"{{ actual }}\").";
290 readonly propertyImmutability: "Property should have an immutability of at least \"{{ expected }}\" (actual: \"{{ actual }}\").";
291 readonly propertyModifier: "Property should have a readonly modifier.";
292 readonly propertyModifierSuggestion: "Add readonly modifier.";
293 readonly userDefined: "{{ message }}";
294};
295declare const rule$14: Rule<keyof typeof errorMessages$14, RawOptions$2>;
296declare const name$15 = "prefer-property-signatures";
297declare const fullName$15: `${typeof ruleNameScope}/${typeof name$15}`;
298type Options$12 = [
299 {
300 ignoreIfReadonlyWrapped: boolean;
301 }
302];
303declare const errorMessages$15: {
304 readonly generic: "Use a property signature instead of a method signature";
305};
306declare const rule$15: Rule<keyof typeof errorMessages$15, Options$12>;
307declare const name$16 = "prefer-readonly-type";
308declare const fullName$16: `${typeof ruleNameScope}/${typeof name$16}`;
309type Options$13 = [
310 {
311 allowLocalMutation: boolean;
312 allowMutableReturnType: boolean;
313 checkImplicit: boolean;
314 ignoreCollections: boolean;
315 ignoreClass: boolean | "fieldsOnly";
316 ignoreInterface: boolean;
317 ignorePattern?: string[] | string;
318 }
319];
320declare const errorMessages$16: {
321 readonly array: "Only readonly arrays allowed.";
322 readonly implicit: "Implicitly a mutable array. Only readonly arrays allowed.";
323 readonly property: "A readonly modifier is required.";
324 readonly tuple: "Only readonly tuples allowed.";
325 readonly type: "Only readonly types allowed.";
326};
327declare const rule$16: Rule<keyof typeof errorMessages$16, Options$13>;
328declare const name$17 = "prefer-tacit";
329declare const fullName$17: `${typeof ruleNameScope}/${typeof name$17}`;
330type Options$14 = [
331 {
332 checkMemberExpressions: boolean;
333 }
334];
335declare const errorMessages$17: {
336 readonly generic: "Potentially unnecessary function wrapper.";
337};
338declare const rule$17: Rule<keyof typeof errorMessages$17, Options$14>;
339declare const name$18 = "readonly-type";
340declare const fullName$18: `${typeof ruleNameScope}/${typeof name$18}`;
341type Options$15 = [
342 "generic" | "keyword"
343];
344declare const errorMessages$18: {
345 readonly generic: "Readonly type using 'readonly' keyword is forbidden. Use 'Readonly<T>' instead.";
346 readonly keyword: "Readonly type using 'Readonly<T>' is forbidden. Use 'readonly' keyword instead.";
347};
348declare const rule$18: Rule<keyof typeof errorMessages$18, Options$15>;
349declare const name$19 = "type-declaration-immutability";
350declare const fullName$19: `${typeof ruleNameScope}/${typeof name$19}`;
351declare enum RuleEnforcementComparator {
352 Less = -2,
353 AtMost = -1,
354 Exactly = 0,
355 AtLeast = 1,
356 More = 2
357}
358type FixerConfigRaw$1 = {
359 pattern: string;
360 replace: string;
361};
362export type FixerConfig = {
363 pattern: RegExp;
364 replace: string;
365};
366export type SuggestionsConfig = FixerConfig[];
367type Options$16 = [
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};
386/**
387 * A rule given by the user after being upgraded.
388 */
389export type ImmutabilityRule = {
390 identifiers: RegExp[];
391 immutability: Immutability;
392 comparator: RuleEnforcementComparator;
393 fixers: FixerConfig[] | false;
394 suggestions: SuggestionsConfig | false;
395};
396declare const rule$19: Rule<keyof typeof errorMessages$19, Options$16>;
397declare const rules: Readonly<{
398 [name]: typeof rule;
399 [name$1]: typeof rule$1;
400 [name$3]: typeof rule$3;
401 [name$2]: typeof rule$2;
402 [name$4]: typeof rule$4;
403 [name$5]: typeof rule$5;
404 [name$6]: typeof rule$6;
405 [name$7]: typeof rule$7;
406 [name$8]: typeof rule$8;
407 [name$9]: typeof rule$9;
408 [name$10]: typeof rule$10;
409 [name$11]: typeof rule$11;
410 [name$12]: typeof rule$12;
411 [name$13]: typeof rule$13;
412 [name$14]: typeof rule$14;
413 [name$15]: typeof rule$15;
414 [name$16]: typeof rule$16;
415 [name$17]: typeof rule$17;
416 [name$18]: typeof rule$18;
417 [typeDeclarationImmutability.name]: typeof typeDeclarationImmutability.rule;
418}>;
419declare const meta: {
420 readonly name: "eslint-plugin-functional";
421 readonly version: string;
422};
423declare const configs: Readonly<{
424 all: FlatConfig.Config;
425 lite: FlatConfig.Config;
426 recommended: FlatConfig.Config;
427 strict: FlatConfig.Config;
428 off: FlatConfig.Config;
429 disableTypeChecked: FlatConfig.Config;
430 externalVanillaRecommended: FlatConfig.Config;
431 externalTypeScriptRecommended: FlatConfig.Config;
432 currying: FlatConfig.Config;
433 noExceptions: FlatConfig.Config;
434 noMutations: FlatConfig.Config;
435 noOtherParadigms: FlatConfig.Config;
436 noStatements: FlatConfig.Config;
437 stylistic: FlatConfig.Config;
438}>;
439export type EslintPluginFunctional = FlatConfig.Plugin & {
440 meta: typeof meta;
441 rules: typeof rules;
442 configs: typeof configs;
443};
444declare const _default: EslintPluginFunctional;
445
446declare namespace typeDeclarationImmutability {
447 export { ImmutabilityRule, RuleEnforcementComparator, fullName$19 as fullName, name$19 as name, rule$19 as rule };
448}
449
450export {
451 _default as default,
452};
453
454export {};