@@ -120,6 +120,18 @@ let constructTypePrefixingRuleWithConfig rule (ruleConfig: RuleConfig<TypePrefix
120120 else
121121 None
122122
123+
124+ // Deprecated grouped configs. TODO: remove in next major release
125+
126+ [<Literal>]
127+ let private ObsoleteMsg = " Please provide formatting rules at root level. This type will be removed in the near future."
128+ [<Literal>]
129+ let private ObsoleteWarnTreatAsError = false
130+
131+ // to be able to use our own types that we mark as Obsolete
132+ #nowarn " 44"
133+
134+ [<Obsolete( ObsoleteMsg, ObsoleteWarnTreatAsError) >]
123135type TupleFormattingConfig =
124136 { tupleCommaSpacing: EnabledConfig option
125137 tupleIndentation: EnabledConfig option
133145 Option.bind ( constructRuleIfEnabled TupleParentheses.rule) this.tupleParentheses
134146 |]
135147
148+ [<Obsolete( ObsoleteMsg, ObsoleteWarnTreatAsError) >]
136149type PatternMatchFormattingConfig =
137150 { patternMatchClausesOnNewLine: EnabledConfig option
138151 patternMatchOrClausesOnNewLine: EnabledConfig option
148161 Option.bind ( constructRuleIfEnabled PatternMatchExpressionIndentation.rule) this.patternMatchExpressionIndentation
149162 |]
150163
164+ [<Obsolete( ObsoleteMsg, ObsoleteWarnTreatAsError) >]
151165type FormattingConfig =
152166 { typedItemSpacing: RuleConfig < TypedItemSpacing .Config > option
153167 typePrefixing: RuleConfig < TypePrefixing .Config > option
169183 this.patternMatchFormatting |> Option.map ( fun config -> config.Flatten()) |> Option.toArray |> Array.concat
170184 |]
171185
186+ [<Obsolete( ObsoleteMsg, ObsoleteWarnTreatAsError) >]
172187type RaiseWithTooManyArgsConfig =
173188 { failwithBadUsage: EnabledConfig option
174189 raiseWithSingleArgument: EnabledConfig option
188203 this.failwithfWithArgumentsMatchingFormatString |> Option.bind ( constructRuleIfEnabled FailwithfWithArgumentsMatchingFormatString.rule) |> Option.toArray
189204 |]
190205
206+ [<Obsolete( ObsoleteMsg, ObsoleteWarnTreatAsError) >]
191207type SourceLengthConfig =
192208 { maxLinesInLambdaFunction: RuleConfig < Helper .SourceLength .Config > option
193209 maxLinesInMatchLambdaFunction: RuleConfig < Helper .SourceLength .Config > option
219235 this.maxLinesInClass |> Option.bind ( constructRuleWithConfig MaxLinesInClass.rule) |> Option.toArray
220236 |]
221237
238+ [<Obsolete( ObsoleteMsg, ObsoleteWarnTreatAsError) >]
222239type NamesConfig =
223240 { interfaceNames: RuleConfig < NamingConfig > option
224241 genericTypesNames: RuleConfig < NamingConfig > option
263280 this.internalValuesNames|> Option.bind ( constructRuleWithConfig InternalValuesNames.rule) |> Option.toArray
264281 |]
265282
283+ [<Obsolete( ObsoleteMsg, ObsoleteWarnTreatAsError) >]
266284type NumberOfItemsConfig =
267285 { maxNumberOfItemsInTuple: RuleConfig < Helper .NumberOfItems .Config > option
268286 maxNumberOfFunctionParameters: RuleConfig < Helper .NumberOfItems .Config > option
278296 this.maxNumberOfBooleanOperatorsInCondition |> Option.bind ( constructRuleWithConfig MaxNumberOfBooleanOperatorsInCondition.rule) |> Option.toArray
279297 |]
280298
299+ [<Obsolete( ObsoleteMsg, ObsoleteWarnTreatAsError) >]
281300type BindingConfig =
282301 { favourIgnoreOverLetWild: EnabledConfig option
283302 wildcardNamedWithAsPattern: EnabledConfig option
297316 this.favourAsKeyword |> Option.bind ( constructRuleIfEnabled FavourAsKeyword.rule) |> Option.toArray
298317 |]
299318
319+ [<Obsolete( ObsoleteMsg, ObsoleteWarnTreatAsError) >]
300320type ConventionsConfig =
301321 { recursiveAsyncFunction: EnabledConfig option
302322 avoidTooShortNames: EnabledConfig option
348368 this.ensureTailCallDiagnosticsInRecursiveFunctions |> Option.bind ( constructRuleIfEnabled EnsureTailCallDiagnosticsInRecursiveFunctions.rule) |> Option.toArray
349369 |]
350370
371+ [<Obsolete( ObsoleteMsg, ObsoleteWarnTreatAsError) >]
351372type TypographyConfig =
352373 { indentation: EnabledConfig option
353374 maxCharactersOnLine: RuleConfig < MaxCharactersOnLine .Config > option
367388 this.noTabCharacters |> Option.bind ( constructRuleIfEnabled NoTabCharacters.rule) |> Option.toArray
368389 |]
369390
391+ // </Deprecated>
392+
370393let private getOrEmptyList hints = Option.defaultValue Array.empty hints
371394
372395type HintConfig = {
@@ -380,13 +403,21 @@ type GlobalConfig = {
380403
381404type Configuration =
382405 { Global: GlobalConfig option
406+
383407 // Deprecated grouped configs. TODO: remove in next major release
408+
409+ [<Obsolete( ObsoleteMsg, ObsoleteWarnTreatAsError) >]
384410 /// DEPRECATED, provide formatting rules at root level.
385411 formatting: FormattingConfig option
412+ [<Obsolete( ObsoleteMsg, ObsoleteWarnTreatAsError) >]
386413 /// DEPRECATED, provide conventions rules at root level.
387414 conventions: ConventionsConfig option
388415 /// DEPRECATED, provide typography rules at root level.
416+ [<Obsolete( ObsoleteMsg, ObsoleteWarnTreatAsError) >]
389417 typography: TypographyConfig option
418+
419+ // </Deprecated>
420+
390421 ignoreFiles: string [] option
391422 Hints: HintConfig option
392423 TypedItemSpacing: RuleConfig < TypedItemSpacing .Config > option
@@ -480,9 +511,13 @@ with
480511 Global = None
481512 ignoreFiles = None
482513 Hints = None
514+
515+ // Deprecated grouped configs. TODO: remove in next major release
483516 formatting = None
484517 conventions = None
485518 typography = None
519+ // </Deprecated>
520+
486521 // Configs for rules.
487522 TypedItemSpacing = None
488523 TypePrefixing = None
@@ -669,9 +704,12 @@ let flattenConfig (config:Configuration) =
669704 let deprecatedAllRules =
670705 Array.concat
671706 [|
707+ // Deprecated grouped configs. TODO: remove in next major release
672708 config.formatting |> Option.map ( fun config -> config.Flatten()) |> Option.toArray |> Array.concat
673709 config.conventions |> Option.map ( fun config -> config.Flatten()) |> Option.toArray |> Array.concat
674710 config.typography |> Option.map ( fun config -> config.Flatten()) |> Option.toArray |> Array.concat
711+ // </Deprecated>
712+
675713 config.Hints |> Option.map ( fun config -> HintMatcher.rule { HintMatcher.Config.HintTrie = parseHints ( getOrEmptyList config.add) }) |> Option.toArray
676714 |]
677715
0 commit comments