import { NamedStyles, Style } from "../style"; import { Tree } from "../tree"; export declare const JavaScriptStyles: { IntelliJ: string; }; export declare const StyleKind: { readonly SpacesStyle: "org.openrewrite.javascript.style.SpacesStyle"; readonly WrappingAndBracesStyle: "org.openrewrite.javascript.style.WrappingAndBracesStyle"; readonly BlankLinesStyle: "org.openrewrite.javascript.style.BlankLinesStyle"; readonly TabsAndIndentsStyle: "org.openrewrite.javascript.style.TabsAndIndentsStyle"; readonly PrettierStyle: "org.openrewrite.javascript.style.PrettierStyle"; readonly Autodetect: "org.openrewrite.javascript.style.Autodetect"; }; /** * Style for Prettier-based formatting. * * This implements NamedStyles so it can be both: * - A marker attached to source files (detected from project's .prettierrc) * - A style that can be passed via the styles parameter or found via getStyle * * When this style is present, AutoformatVisitor will use Prettier for formatting * instead of the built-in formatting visitors. */ export interface PrettierStyle extends NamedStyles { readonly kind: typeof StyleKind.PrettierStyle; readonly name: "org.openrewrite.javascript.Prettier"; readonly displayName: "Prettier"; readonly description: "Prettier code formatter configuration."; /** * The resolved Prettier options for this file (with overrides applied). */ readonly config: Record; /** * The Prettier version from the project's package.json. * At formatting time, this version of Prettier will be loaded dynamically * to ensure consistent formatting. */ readonly prettierVersion?: string; /** * Whether this file is ignored by .prettierignore. * When true, Prettier formatting should be skipped for this file. */ readonly ignored: boolean; } export declare function prettierStyle(id: string, config: Record, prettierVersion?: string, ignored?: boolean): PrettierStyle; export declare const SpacesStyleDetailKind: { readonly SpacesStyleBeforeParentheses: "org.openrewrite.javascript.style.SpacesStyle$BeforeParentheses"; readonly SpacesStyleAroundOperators: "org.openrewrite.javascript.style.SpacesStyle$AroundOperators"; readonly SpacesStyleBeforeLeftBrace: "org.openrewrite.javascript.style.SpacesStyle$BeforeLeftBrace"; readonly SpacesStyleBeforeKeywords: "org.openrewrite.javascript.style.SpacesStyle$BeforeKeywords"; readonly SpacesStyleWithin: "org.openrewrite.javascript.style.SpacesStyle$Within"; readonly SpacesStyleTernaryOperator: "org.openrewrite.javascript.style.SpacesStyle$TernaryOperator"; readonly SpacesStyleOther: "org.openrewrite.javascript.style.SpacesStyle$Other"; }; export interface SpacesStyle extends Style { readonly kind: typeof StyleKind.SpacesStyle; readonly beforeParentheses: SpacesStyle.BeforeParentheses; readonly aroundOperators: SpacesStyle.AroundOperators; readonly beforeLeftBrace: SpacesStyle.BeforeLeftBrace; readonly beforeKeywords: SpacesStyle.BeforeKeywords; readonly within: SpacesStyle.Within; readonly ternaryOperator: SpacesStyle.TernaryOperator; readonly other: SpacesStyle.Other; } export declare namespace SpacesStyle { interface BeforeParentheses { readonly kind: typeof SpacesStyleDetailKind.SpacesStyleBeforeParentheses; readonly functionDeclarationParentheses: boolean; readonly functionCallParentheses: boolean; readonly ifParentheses: boolean; readonly forParentheses: boolean; readonly whileParentheses: boolean; readonly switchParentheses: boolean; readonly catchParentheses: boolean; readonly inFunctionCallExpression: boolean; readonly inAsyncArrowFunction: boolean; } interface AroundOperators { readonly kind: typeof SpacesStyleDetailKind.SpacesStyleAroundOperators; readonly assignment: boolean; readonly logical: boolean; readonly equality: boolean; readonly relational: boolean; readonly bitwise: boolean; readonly additive: boolean; readonly multiplicative: boolean; readonly shift: boolean; readonly unary: boolean; readonly arrowFunction: boolean; readonly beforeUnaryNotAndNotNull: boolean; readonly afterUnaryNotAndNotNull: boolean; } interface BeforeLeftBrace { readonly kind: typeof SpacesStyleDetailKind.SpacesStyleBeforeLeftBrace; readonly functionLeftBrace: boolean; readonly ifLeftBrace: boolean; readonly elseLeftBrace: boolean; readonly forLeftBrace: boolean; readonly whileLeftBrace: boolean; readonly doLeftBrace: boolean; readonly switchLeftBrace: boolean; readonly tryLeftBrace: boolean; readonly catchLeftBrace: boolean; readonly finallyLeftBrace: boolean; readonly classInterfaceModuleLeftBrace: boolean; } interface BeforeKeywords { readonly kind: typeof SpacesStyleDetailKind.SpacesStyleBeforeKeywords; readonly elseKeyword: boolean; readonly whileKeyword: boolean; readonly catchKeyword: boolean; readonly finallyKeyword: boolean; } interface Within { readonly kind: typeof SpacesStyleDetailKind.SpacesStyleWithin; readonly indexAccessBrackets: boolean; readonly groupingParentheses: boolean; readonly functionDeclarationParentheses: boolean; readonly functionCallParentheses: boolean; readonly ifParentheses: boolean; readonly forParentheses: boolean; readonly whileParentheses: boolean; readonly switchParentheses: boolean; readonly catchParentheses: boolean; readonly objectLiteralBraces: boolean; readonly es6ImportExportBraces: boolean; readonly arrayBrackets: boolean; readonly interpolationExpressions: boolean; readonly objectLiteralTypeBraces: boolean; readonly unionAndIntersectionTypes: boolean; readonly typeAssertions: boolean; } interface TernaryOperator { readonly kind: typeof SpacesStyleDetailKind.SpacesStyleTernaryOperator; readonly beforeQuestionMark: boolean; readonly afterQuestionMark: boolean; readonly beforeColon: boolean; readonly afterColon: boolean; } interface Other { readonly kind: typeof SpacesStyleDetailKind.SpacesStyleOther; readonly beforeComma: boolean; readonly afterComma: boolean; readonly beforeForSemicolon: boolean; readonly beforePropertyNameValueSeparator: boolean; readonly afterPropertyNameValueSeparator: boolean; readonly afterVarArgInRestOrSpread: boolean; readonly beforeAsteriskInGenerator: boolean; readonly afterAsteriskInGenerator: boolean; readonly beforeTypeReferenceColon: boolean; readonly afterTypeReferenceColon: boolean; } } export declare const WrappingAndBracesStyleDetailKind: { readonly WrappingAndBracesStyleIfStatement: "org.openrewrite.javascript.style.WrappingAndBracesStyle$IfStatement"; readonly WrappingAndBracesStyleKeepWhenReformatting: "org.openrewrite.javascript.style.WrappingAndBracesStyle$KeepWhenReformatting"; }; export interface WrappingAndBracesStyle extends Style { readonly kind: typeof StyleKind.WrappingAndBracesStyle; readonly ifStatement: WrappingAndBracesStyle.IfStatement; readonly keepWhenReformatting: WrappingAndBracesStyle.KeepWhenReformatting; } export declare namespace WrappingAndBracesStyle { interface IfStatement { readonly kind: typeof WrappingAndBracesStyleDetailKind.WrappingAndBracesStyleIfStatement; readonly elseOnNewLine: boolean; } interface KeepWhenReformatting { readonly kind: typeof WrappingAndBracesStyleDetailKind.WrappingAndBracesStyleKeepWhenReformatting; readonly simpleBlocksInOneLine: boolean; readonly simpleMethodsInOneLine: boolean; } } export interface BlankLinesStyle extends Style { readonly kind: "org.openrewrite.javascript.style.BlankLinesStyle"; readonly keepMaximum: BlankLinesStyle.KeepMaximum; readonly minimum: BlankLinesStyle.Minimum; } export declare namespace BlankLinesStyle { interface KeepMaximum { readonly inCode: number; } interface Minimum { readonly afterImports: number; readonly aroundClass: number; readonly aroundFieldInInterface?: number; readonly aroundField: number; readonly aroundMethodInInterface?: number; readonly aroundMethod: number; readonly aroundFunction: number; } } export interface TabsAndIndentsStyle extends Style { readonly kind: typeof StyleKind.TabsAndIndentsStyle; readonly useTabCharacter: boolean; readonly tabSize: number; readonly indentSize: number; readonly continuationIndent: number; readonly keepIndentsOnEmptyLines: boolean; readonly indentChainedMethods: boolean; readonly indentAllChainedCallsInAGroup: boolean; } export declare namespace IntelliJ { namespace JavaScript { const defaults: NamedStyles; function spaces(): SpacesStyle; function wrappingAndBraces(): WrappingAndBracesStyle; function blankLines(): BlankLinesStyle; function tabsAndIndents(): TabsAndIndentsStyle; } namespace TypeScript { const defaults: NamedStyles; function spaces(): SpacesStyle; function wrappingAndBraces(): WrappingAndBracesStyle; function blankLines(): BlankLinesStyle; function tabsAndIndents(): TabsAndIndentsStyle; } } export declare function styleFromSourceFile(styleKind: string, sourceFile: Tree): Style | undefined; /** * Get a style by kind, with passed-in styles taking precedence over source file styles. * Falls back to IntelliJ defaults if no style is found. * * @param styleKind The kind of style to retrieve * @param sourceFile The source file to check for styles * @param styles Optional array of NamedStyles that take precedence over source file styles */ export declare function getStyle(styleKind: string, sourceFile: Tree, styles?: NamedStyles[]): Style | undefined; //# sourceMappingURL=style.d.ts.map