1 |
|
2 |
|
3 | import { NamedCreateRuleMeta } from '@typescript-eslint/utils/eslint-utils';
|
4 | import { FlatConfig, RuleModule } from '@typescript-eslint/utils/ts-eslint';
|
5 | import { Immutability } from 'is-immutable-type';
|
6 | import { TypeDeclarationSpecifier } from 'ts-declaration-location';
|
7 |
|
8 | export type Docs = {
|
9 | |
10 |
|
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 |
|
20 |
|
21 | export type NamedCreateRuleCustomMeta<T extends string, Options extends ReadonlyArray<unknown>> = NamedCreateRuleMeta<T, Docs, Options>;
|
22 |
|
23 |
|
24 |
|
25 | export type Rule<MessageIds extends string, Options extends ReadonlyArray<unknown>> = RuleModule<MessageIds, Options, Docs> & {
|
26 | meta: NamedCreateRuleCustomMeta<MessageIds, Options>;
|
27 | };
|
28 |
|
29 |
|
30 |
|
31 | export type IgnoreIdentifierPatternOption = Readonly<{
|
32 | ignoreIdentifierPattern?: ReadonlyArray<string> | string;
|
33 | }>;
|
34 |
|
35 |
|
36 |
|
37 | export type IgnoreCodePatternOption = Readonly<{
|
38 | ignoreCodePattern?: ReadonlyArray<string> | string;
|
39 | }>;
|
40 |
|
41 |
|
42 |
|
43 | export type IgnoreAccessorPatternOption = Readonly<{
|
44 | ignoreAccessorPattern?: ReadonlyArray<string> | string;
|
45 | }>;
|
46 |
|
47 |
|
48 |
|
49 | export type IgnoreClassesOption = Readonly<{
|
50 | ignoreClasses: boolean | "fieldsOnly";
|
51 | }>;
|
52 |
|
53 |
|
54 |
|
55 | export type IgnorePrefixSelectorOption = Readonly<{
|
56 | ignorePrefixSelector?: ReadonlyArray<string> | string;
|
57 | }>;
|
58 | export type RawTypeSpecifier = {
|
59 | name?: string | string[];
|
60 | pattern?: string | string[];
|
61 | ignoreName?: string | string[];
|
62 | ignorePattern?: string | string[];
|
63 | } & TypeDeclarationSpecifier;
|
64 | export type RawOverridableOptions<CoreOptions> = CoreOptions & {
|
65 | overrides?: Array<{
|
66 | specifiers?: RawTypeSpecifier | RawTypeSpecifier[];
|
67 | options?: CoreOptions;
|
68 | inherit?: boolean;
|
69 | disable?: boolean;
|
70 | }>;
|
71 | };
|
72 | declare const ruleNameScope = "functional";
|
73 | declare const name = "functional-parameters";
|
74 | declare const fullName: `${typeof ruleNameScope}/${typeof name}`;
|
75 |
|
76 |
|
77 |
|
78 | export type ParameterCountOptions = "atLeastOne" | "exactlyOne";
|
79 | export 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 |
|
91 |
|
92 | export type RawOptions = [
|
93 | RawOverridableOptions<CoreOptions>
|
94 | ];
|
95 | declare 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 | };
|
101 | declare const rule: Rule<keyof typeof errorMessages, RawOptions>;
|
102 | declare const name$1 = "immutable-data";
|
103 | declare const fullName$1: `${typeof ruleNameScope}/${typeof name$1}`;
|
104 | type CoreOptions$1 = IgnoreAccessorPatternOption & IgnoreClassesOption & IgnoreIdentifierPatternOption & {
|
105 | ignoreImmediateMutation: boolean;
|
106 | ignoreNonConstDeclarations: boolean | {
|
107 | treatParametersAsConst: boolean;
|
108 | };
|
109 | };
|
110 | type RawOptions$1 = [
|
111 | RawOverridableOptions<CoreOptions$1>
|
112 | ];
|
113 | declare 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 | };
|
118 | declare const rule$1: Rule<keyof typeof errorMessages$1, RawOptions$1>;
|
119 | declare const name$2 = "no-class-inheritance";
|
120 | declare const fullName$2: `${typeof ruleNameScope}/${typeof name$2}`;
|
121 | type RawOptions$2 = [
|
122 | IgnoreIdentifierPatternOption & IgnoreCodePatternOption
|
123 | ];
|
124 | declare const errorMessages$2: {
|
125 | readonly abstract: "Unexpected abstract class.";
|
126 | readonly extends: "Unexpected inheritance, use composition instead.";
|
127 | };
|
128 | declare const rule$2: Rule<keyof typeof errorMessages$2, RawOptions$2>;
|
129 | declare const name$3 = "no-classes";
|
130 | declare const fullName$3: `${typeof ruleNameScope}/${typeof name$3}`;
|
131 | type RawOptions$3 = [
|
132 | IgnoreIdentifierPatternOption & IgnoreCodePatternOption
|
133 | ];
|
134 | declare const errorMessages$3: {
|
135 | readonly generic: "Unexpected class, use functions not classes.";
|
136 | };
|
137 | declare const rule$3: Rule<keyof typeof errorMessages$3, RawOptions$3>;
|
138 | declare const name$4 = "no-conditional-statements";
|
139 | declare const fullName$4: `${typeof ruleNameScope}/${typeof name$4}`;
|
140 | type RawOptions$4 = [
|
141 | IgnoreCodePatternOption & {
|
142 | allowReturningBranches: boolean | "ifExhaustive";
|
143 | }
|
144 | ];
|
145 | declare 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 | };
|
152 | declare const rule$4: Rule<keyof typeof errorMessages$4, RawOptions$4>;
|
153 | declare const name$5 = "no-expression-statements";
|
154 | declare const fullName$5: `${typeof ruleNameScope}/${typeof name$5}`;
|
155 | type RawOptions$5 = [
|
156 | IgnoreCodePatternOption & {
|
157 | ignoreVoid: boolean;
|
158 | ignoreSelfReturning: boolean;
|
159 | }
|
160 | ];
|
161 | declare const errorMessages$5: {
|
162 | readonly generic: "Using expressions to cause side-effects not allowed.";
|
163 | };
|
164 | declare const rule$5: Rule<keyof typeof errorMessages$5, RawOptions$5>;
|
165 | declare const name$6 = "no-let";
|
166 | declare const fullName$6: `${typeof ruleNameScope}/${typeof name$6}`;
|
167 | type RawOptions$6 = [
|
168 | IgnoreIdentifierPatternOption & {
|
169 | allowInForLoopInit: boolean;
|
170 | allowInFunctions: boolean;
|
171 | }
|
172 | ];
|
173 | declare const errorMessages$6: {
|
174 | readonly generic: "Unexpected let, use const instead.";
|
175 | };
|
176 | declare const rule$6: Rule<keyof typeof errorMessages$6, RawOptions$6>;
|
177 | declare const name$7 = "no-loop-statements";
|
178 | declare const fullName$7: `${typeof ruleNameScope}/${typeof name$7}`;
|
179 | type RawOptions$7 = [
|
180 | {}
|
181 | ];
|
182 | declare const errorMessages$7: {
|
183 | readonly generic: "Unexpected loop, use map or reduce instead.";
|
184 | };
|
185 | declare const rule$7: Rule<keyof typeof errorMessages$7, RawOptions$7>;
|
186 | declare const name$8 = "no-mixed-types";
|
187 | declare const fullName$8: `${typeof ruleNameScope}/${typeof name$8}`;
|
188 | type RawOptions$8 = [
|
189 | {
|
190 | checkInterfaces: boolean;
|
191 | checkTypeLiterals: boolean;
|
192 | }
|
193 | ];
|
194 | declare const errorMessages$8: {
|
195 | readonly generic: "Only the same kind of members allowed in types.";
|
196 | };
|
197 | declare const rule$8: Rule<keyof typeof errorMessages$8, RawOptions$8>;
|
198 | declare const name$9 = "no-promise-reject";
|
199 | declare const fullName$9: `${typeof ruleNameScope}/${typeof name$9}`;
|
200 | type RawOptions$9 = [
|
201 | {}
|
202 | ];
|
203 | declare const errorMessages$9: {
|
204 | readonly generic: "Unexpected rejection, resolve an error instead.";
|
205 | };
|
206 | declare const rule$9: Rule<keyof typeof errorMessages$9, RawOptions$9>;
|
207 | declare const name$10 = "no-return-void";
|
208 | declare const fullName$10: `${typeof ruleNameScope}/${typeof name$10}`;
|
209 | type RawOptions$10 = [
|
210 | {
|
211 | allowNull: boolean;
|
212 | allowUndefined: boolean;
|
213 | ignoreInferredTypes: boolean;
|
214 | }
|
215 | ];
|
216 | declare const errorMessages$10: {
|
217 | readonly generic: "Function must return a value.";
|
218 | };
|
219 | declare const rule$10: Rule<keyof typeof errorMessages$10, RawOptions$10>;
|
220 | declare const name$11 = "no-this-expressions";
|
221 | declare const fullName$11: `${typeof ruleNameScope}/${typeof name$11}`;
|
222 | type RawOptions$11 = [
|
223 | {}
|
224 | ];
|
225 | declare const errorMessages$11: {
|
226 | readonly generic: "Unexpected this, use functions not classes.";
|
227 | };
|
228 | declare const rule$11: Rule<keyof typeof errorMessages$11, RawOptions$11>;
|
229 | declare const name$12 = "no-throw-statements";
|
230 | declare const fullName$12: `${typeof ruleNameScope}/${typeof name$12}`;
|
231 | type RawOptions$12 = [
|
232 | {
|
233 | allowToRejectPromises: boolean;
|
234 | }
|
235 | ];
|
236 | declare const errorMessages$12: {
|
237 | readonly generic: "Unexpected throw, throwing exceptions is not functional.";
|
238 | };
|
239 | declare const rule$12: Rule<keyof typeof errorMessages$12, RawOptions$12>;
|
240 | declare const name$13 = "no-try-statements";
|
241 | declare const fullName$13: `${typeof ruleNameScope}/${typeof name$13}`;
|
242 | type RawOptions$13 = [
|
243 | {
|
244 | allowCatch: boolean;
|
245 | allowFinally: boolean;
|
246 | }
|
247 | ];
|
248 | declare 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 | };
|
252 | declare const rule$13: Rule<keyof typeof errorMessages$13, RawOptions$13>;
|
253 | declare const name$14 = "prefer-immutable-types";
|
254 | declare const fullName$14: `${typeof ruleNameScope}/${typeof name$14}`;
|
255 | export type RawEnforcement = Exclude<Immutability | keyof typeof Immutability, "Unknown" | "Mutable"> | "None" | false | undefined;
|
256 | export type Option = IgnoreClassesOption & {
|
257 | enforcement: RawEnforcement;
|
258 | ignoreInferredTypes: boolean;
|
259 | ignoreNamePattern?: string[] | string;
|
260 | ignoreTypePattern?: string[] | string;
|
261 | };
|
262 | type 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 | };
|
271 | export type FixerConfigRaw = {
|
272 | pattern: string;
|
273 | replace: string;
|
274 | };
|
275 | export type SuggestionsConfigRaw = Array<FixerConfigRaw & {
|
276 | message?: string;
|
277 | }>;
|
278 | export type FixerConfigRawMap = Partial<Record<"ReadonlyShallow" | "ReadonlyDeep" | "Immutable", FixerConfigRaw | FixerConfigRaw[] | undefined>>;
|
279 | export type SuggestionConfigRawMap = Partial<Record<"ReadonlyShallow" | "ReadonlyDeep" | "Immutable", SuggestionsConfigRaw[] | undefined>>;
|
280 | type RawOptions$14 = [
|
281 | RawOverridableOptions<CoreOptions$2>
|
282 | ];
|
283 | declare 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 | };
|
292 | declare const rule$14: Rule<keyof typeof errorMessages$14, RawOptions$14>;
|
293 | declare const name$15 = "prefer-property-signatures";
|
294 | declare const fullName$15: `${typeof ruleNameScope}/${typeof name$15}`;
|
295 | type RawOptions$15 = [
|
296 | {
|
297 | ignoreIfReadonlyWrapped: boolean;
|
298 | }
|
299 | ];
|
300 | declare const errorMessages$15: {
|
301 | readonly generic: "Use a property signature instead of a method signature";
|
302 | };
|
303 | declare const rule$15: Rule<keyof typeof errorMessages$15, RawOptions$15>;
|
304 | declare const name$16 = "prefer-readonly-type";
|
305 | declare const fullName$16: `${typeof ruleNameScope}/${typeof name$16}`;
|
306 | type 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 | ];
|
317 | declare 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 | };
|
324 | declare const rule$16: Rule<keyof typeof errorMessages$16, RawOptions$16>;
|
325 | declare const name$17 = "prefer-tacit";
|
326 | declare const fullName$17: `${typeof ruleNameScope}/${typeof name$17}`;
|
327 | type RawOptions$17 = [
|
328 | {
|
329 | checkMemberExpressions: boolean;
|
330 | }
|
331 | ];
|
332 | declare const errorMessages$17: {
|
333 | readonly generic: "Potentially unnecessary function wrapper.";
|
334 | readonly genericSuggestion: "Remove unnecessary function wrapper.";
|
335 | };
|
336 | declare const rule$17: Rule<keyof typeof errorMessages$17, RawOptions$17>;
|
337 | declare const name$18 = "readonly-type";
|
338 | declare const fullName$18: `${typeof ruleNameScope}/${typeof name$18}`;
|
339 | type RawOptions$18 = [
|
340 | "generic" | "keyword"
|
341 | ];
|
342 | declare 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 | };
|
346 | declare const rule$18: Rule<keyof typeof errorMessages$18, RawOptions$18>;
|
347 | declare const name$19 = "type-declaration-immutability";
|
348 | declare const fullName$19: `${typeof ruleNameScope}/${typeof name$19}`;
|
349 | declare enum RuleEnforcementComparator {
|
350 | Less = -2,
|
351 | AtMost = -1,
|
352 | Exactly = 0,
|
353 | AtLeast = 1,
|
354 | More = 2
|
355 | }
|
356 | type FixerConfigRaw$1 = {
|
357 | pattern: string;
|
358 | replace: string;
|
359 | message?: string;
|
360 | };
|
361 | export type FixerConfig = {
|
362 | pattern: RegExp;
|
363 | replace: string;
|
364 | message?: string;
|
365 | };
|
366 | export type SuggestionsConfig = FixerConfig[];
|
367 | type 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 | ];
|
379 | declare 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 |
|
389 |
|
390 | export type ImmutabilityRule = {
|
391 | identifiers: RegExp[];
|
392 | immutability: Immutability;
|
393 | comparator: RuleEnforcementComparator;
|
394 | fixers: FixerConfig[] | false;
|
395 | suggestions: SuggestionsConfig | false;
|
396 | };
|
397 | declare const rule$19: Rule<keyof typeof errorMessages$19, RawOptions$19>;
|
398 | declare 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 | }>;
|
420 | declare const meta: {
|
421 | readonly name: "eslint-plugin-functional";
|
422 | readonly version: string;
|
423 | };
|
424 | declare 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 | }>;
|
440 | export type EslintPluginFunctional = FlatConfig.Plugin & {
|
441 | meta: typeof meta;
|
442 | rules: typeof rules;
|
443 | configs: typeof configs;
|
444 | };
|
445 | declare const _default: EslintPluginFunctional;
|
446 |
|
447 | declare namespace typeDeclarationImmutability {
|
448 | export { ImmutabilityRule, RuleEnforcementComparator, fullName$19 as fullName, name$19 as name, rule$19 as rule };
|
449 | }
|
450 |
|
451 | export {
|
452 | _default as default,
|
453 | };
|
454 |
|
455 | export {};
|