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> = NamedCreateRuleMeta<T, Docs>;
|
22 |
|
23 |
|
24 |
|
25 | export type Rule<MessageIds extends string, Options extends ReadonlyArray<unknown>> = RuleModule<MessageIds, Options, Docs> & {
|
26 | meta: NamedCreateRuleCustomMeta<MessageIds>;
|
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 |
|
122 |
|
123 |
|
124 | export type Options = [
|
125 | IgnoreIdentifierPatternOption & IgnoreCodePatternOption
|
126 | ];
|
127 | declare const errorMessages$2: {
|
128 | readonly abstract: "Unexpected abstract class.";
|
129 | readonly extends: "Unexpected inheritance, use composition instead.";
|
130 | };
|
131 | declare const rule$2: Rule<keyof typeof errorMessages$2, Options>;
|
132 | declare const name$3 = "no-classes";
|
133 | declare const fullName$3: `${typeof ruleNameScope}/${typeof name$3}`;
|
134 | type Options$1 = [
|
135 | IgnoreIdentifierPatternOption & IgnoreCodePatternOption
|
136 | ];
|
137 | declare const errorMessages$3: {
|
138 | readonly generic: "Unexpected class, use functions not classes.";
|
139 | };
|
140 | declare const rule$3: Rule<keyof typeof errorMessages$3, Options$1>;
|
141 | declare const name$4 = "no-conditional-statements";
|
142 | declare const fullName$4: `${typeof ruleNameScope}/${typeof name$4}`;
|
143 | type Options$2 = [
|
144 | {
|
145 | allowReturningBranches: boolean | "ifExhaustive";
|
146 | }
|
147 | ];
|
148 | declare 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 | };
|
155 | declare const rule$4: Rule<keyof typeof errorMessages$4, Options$2>;
|
156 | declare const name$5 = "no-expression-statements";
|
157 | declare const fullName$5: `${typeof ruleNameScope}/${typeof name$5}`;
|
158 | type Options$3 = [
|
159 | IgnoreCodePatternOption & {
|
160 | ignoreVoid: boolean;
|
161 | ignoreSelfReturning: boolean;
|
162 | }
|
163 | ];
|
164 | declare const errorMessages$5: {
|
165 | readonly generic: "Using expressions to cause side-effects not allowed.";
|
166 | };
|
167 | declare const rule$5: Rule<keyof typeof errorMessages$5, Options$3>;
|
168 | declare const name$6 = "no-let";
|
169 | declare const fullName$6: `${typeof ruleNameScope}/${typeof name$6}`;
|
170 | type Options$4 = [
|
171 | IgnoreIdentifierPatternOption & {
|
172 | allowInForLoopInit: boolean;
|
173 | allowInFunctions: boolean;
|
174 | }
|
175 | ];
|
176 | declare const errorMessages$6: {
|
177 | readonly generic: "Unexpected let, use const instead.";
|
178 | };
|
179 | declare const rule$6: Rule<keyof typeof errorMessages$6, Options$4>;
|
180 | declare const name$7 = "no-loop-statements";
|
181 | declare const fullName$7: `${typeof ruleNameScope}/${typeof name$7}`;
|
182 | type Options$5 = [
|
183 | {}
|
184 | ];
|
185 | declare const errorMessages$7: {
|
186 | readonly generic: "Unexpected loop, use map or reduce instead.";
|
187 | };
|
188 | declare const rule$7: Rule<keyof typeof errorMessages$7, Options$5>;
|
189 | declare const name$8 = "no-mixed-types";
|
190 | declare const fullName$8: `${typeof ruleNameScope}/${typeof name$8}`;
|
191 | type Options$6 = [
|
192 | {
|
193 | checkInterfaces: boolean;
|
194 | checkTypeLiterals: boolean;
|
195 | }
|
196 | ];
|
197 | declare const errorMessages$8: {
|
198 | readonly generic: "Only the same kind of members allowed in types.";
|
199 | };
|
200 | declare const rule$8: Rule<keyof typeof errorMessages$8, Options$6>;
|
201 | declare const name$9 = "no-promise-reject";
|
202 | declare const fullName$9: `${typeof ruleNameScope}/${typeof name$9}`;
|
203 | type Options$7 = [
|
204 | {}
|
205 | ];
|
206 | declare const errorMessages$9: {
|
207 | readonly generic: "Unexpected rejection, resolve an error instead.";
|
208 | };
|
209 | declare const rule$9: Rule<keyof typeof errorMessages$9, Options$7>;
|
210 | declare const name$10 = "no-return-void";
|
211 | declare const fullName$10: `${typeof ruleNameScope}/${typeof name$10}`;
|
212 | type Options$8 = [
|
213 | {
|
214 | allowNull: boolean;
|
215 | allowUndefined: boolean;
|
216 | ignoreInferredTypes: boolean;
|
217 | }
|
218 | ];
|
219 | declare const errorMessages$10: {
|
220 | readonly generic: "Function must return a value.";
|
221 | };
|
222 | declare const rule$10: Rule<keyof typeof errorMessages$10, Options$8>;
|
223 | declare const name$11 = "no-this-expressions";
|
224 | declare const fullName$11: `${typeof ruleNameScope}/${typeof name$11}`;
|
225 | type Options$9 = [
|
226 | {}
|
227 | ];
|
228 | declare const errorMessages$11: {
|
229 | readonly generic: "Unexpected this, use functions not classes.";
|
230 | };
|
231 | declare const rule$11: Rule<keyof typeof errorMessages$11, Options$9>;
|
232 | declare const name$12 = "no-throw-statements";
|
233 | declare const fullName$12: `${typeof ruleNameScope}/${typeof name$12}`;
|
234 | type Options$10 = [
|
235 | {
|
236 | allowToRejectPromises: boolean;
|
237 | }
|
238 | ];
|
239 | declare const errorMessages$12: {
|
240 | readonly generic: "Unexpected throw, throwing exceptions is not functional.";
|
241 | };
|
242 | declare const rule$12: Rule<keyof typeof errorMessages$12, Options$10>;
|
243 | declare const name$13 = "no-try-statements";
|
244 | declare const fullName$13: `${typeof ruleNameScope}/${typeof name$13}`;
|
245 | type Options$11 = [
|
246 | {
|
247 | allowCatch: boolean;
|
248 | allowFinally: boolean;
|
249 | }
|
250 | ];
|
251 | declare 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 | };
|
255 | declare const rule$13: Rule<keyof typeof errorMessages$13, Options$11>;
|
256 | declare const name$14 = "prefer-immutable-types";
|
257 | declare const fullName$14: `${typeof ruleNameScope}/${typeof name$14}`;
|
258 | export type RawEnforcement = Exclude<Immutability | keyof typeof Immutability, "Unknown" | "Mutable"> | "None" | false | undefined;
|
259 | export type Option = IgnoreClassesOption & {
|
260 | enforcement: RawEnforcement;
|
261 | ignoreInferredTypes: boolean;
|
262 | ignoreNamePattern?: string[] | string;
|
263 | ignoreTypePattern?: string[] | string;
|
264 | };
|
265 | type 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 | };
|
274 | export type FixerConfigRaw = {
|
275 | pattern: string;
|
276 | replace: string;
|
277 | };
|
278 | export type SuggestionsConfigRaw = Array<FixerConfigRaw & {
|
279 | message?: string;
|
280 | }>;
|
281 | export type FixerConfigRawMap = Partial<Record<"ReadonlyShallow" | "ReadonlyDeep" | "Immutable", FixerConfigRaw | FixerConfigRaw[] | undefined>>;
|
282 | export type SuggestionConfigRawMap = Partial<Record<"ReadonlyShallow" | "ReadonlyDeep" | "Immutable", SuggestionsConfigRaw[] | undefined>>;
|
283 | type RawOptions$2 = [
|
284 | RawOverridableOptions<CoreOptions$2>
|
285 | ];
|
286 | declare 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 | };
|
295 | declare const rule$14: Rule<keyof typeof errorMessages$14, RawOptions$2>;
|
296 | declare const name$15 = "prefer-property-signatures";
|
297 | declare const fullName$15: `${typeof ruleNameScope}/${typeof name$15}`;
|
298 | type Options$12 = [
|
299 | {
|
300 | ignoreIfReadonlyWrapped: boolean;
|
301 | }
|
302 | ];
|
303 | declare const errorMessages$15: {
|
304 | readonly generic: "Use a property signature instead of a method signature";
|
305 | };
|
306 | declare const rule$15: Rule<keyof typeof errorMessages$15, Options$12>;
|
307 | declare const name$16 = "prefer-readonly-type";
|
308 | declare const fullName$16: `${typeof ruleNameScope}/${typeof name$16}`;
|
309 | type 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 | ];
|
320 | declare 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 | };
|
327 | declare const rule$16: Rule<keyof typeof errorMessages$16, Options$13>;
|
328 | declare const name$17 = "prefer-tacit";
|
329 | declare const fullName$17: `${typeof ruleNameScope}/${typeof name$17}`;
|
330 | type Options$14 = [
|
331 | {
|
332 | checkMemberExpressions: boolean;
|
333 | }
|
334 | ];
|
335 | declare const errorMessages$17: {
|
336 | readonly generic: "Potentially unnecessary function wrapper.";
|
337 | };
|
338 | declare const rule$17: Rule<keyof typeof errorMessages$17, Options$14>;
|
339 | declare const name$18 = "readonly-type";
|
340 | declare const fullName$18: `${typeof ruleNameScope}/${typeof name$18}`;
|
341 | type Options$15 = [
|
342 | "generic" | "keyword"
|
343 | ];
|
344 | declare 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 | };
|
348 | declare const rule$18: Rule<keyof typeof errorMessages$18, Options$15>;
|
349 | declare const name$19 = "type-declaration-immutability";
|
350 | declare const fullName$19: `${typeof ruleNameScope}/${typeof name$19}`;
|
351 | declare enum RuleEnforcementComparator {
|
352 | Less = -2,
|
353 | AtMost = -1,
|
354 | Exactly = 0,
|
355 | AtLeast = 1,
|
356 | More = 2
|
357 | }
|
358 | type FixerConfigRaw$1 = {
|
359 | pattern: string;
|
360 | replace: string;
|
361 | };
|
362 | export type FixerConfig = {
|
363 | pattern: RegExp;
|
364 | replace: string;
|
365 | };
|
366 | export type SuggestionsConfig = FixerConfig[];
|
367 | type 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 | ];
|
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 | };
|
386 |
|
387 |
|
388 |
|
389 | export type ImmutabilityRule = {
|
390 | identifiers: RegExp[];
|
391 | immutability: Immutability;
|
392 | comparator: RuleEnforcementComparator;
|
393 | fixers: FixerConfig[] | false;
|
394 | suggestions: SuggestionsConfig | false;
|
395 | };
|
396 | declare const rule$19: Rule<keyof typeof errorMessages$19, Options$16>;
|
397 | declare 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 | }>;
|
419 | declare const meta: {
|
420 | readonly name: "eslint-plugin-functional";
|
421 | readonly version: string;
|
422 | };
|
423 | declare 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 | }>;
|
439 | export type EslintPluginFunctional = FlatConfig.Plugin & {
|
440 | meta: typeof meta;
|
441 | rules: typeof rules;
|
442 | configs: typeof configs;
|
443 | };
|
444 | declare const _default: EslintPluginFunctional;
|
445 |
|
446 | declare namespace typeDeclarationImmutability {
|
447 | export { ImmutabilityRule, RuleEnforcementComparator, fullName$19 as fullName, name$19 as name, rule$19 as rule };
|
448 | }
|
449 |
|
450 | export {
|
451 | _default as default,
|
452 | };
|
453 |
|
454 | export {};
|