Class PrettierSettings.Builder
- java.lang.Object
-
- io.github.cdklabs.projen.javascript.PrettierSettings.Builder
-
- All Implemented Interfaces:
software.amazon.jsii.Builder<PrettierSettings>
- Enclosing interface:
- PrettierSettings
@Stability(Experimental) public static final class PrettierSettings.Builder extends Object implements software.amazon.jsii.Builder<PrettierSettings>
A builder forPrettierSettings
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
-
-
-
Method Detail
-
arrowParens
@Stability(Experimental) public PrettierSettings.Builder arrowParens(ArrowParens arrowParens)
Sets the value ofPrettierSettings.getArrowParens()- Parameters:
arrowParens- Include parentheses around a sole arrow function parameter.- Returns:
this
-
bracketSameLine
@Stability(Experimental) public PrettierSettings.Builder bracketSameLine(Boolean bracketSameLine)
Sets the value ofPrettierSettings.getBracketSameLine()- Parameters:
bracketSameLine- Put > of opening tags on the last line instead of on a new line.- Returns:
this
-
bracketSpacing
@Stability(Experimental) public PrettierSettings.Builder bracketSpacing(Boolean bracketSpacing)
Sets the value ofPrettierSettings.getBracketSpacing()- Parameters:
bracketSpacing- Print spaces between brackets.- Returns:
this
-
cursorOffset
@Stability(Experimental) public PrettierSettings.Builder cursorOffset(Number cursorOffset)
Sets the value ofPrettierSettings.getCursorOffset()- Parameters:
cursorOffset- Print (to stderr) where a cursor at the given position would move to after formatting. This option cannot be used with --range-start and --range-end.- Returns:
this
-
embeddedLanguageFormatting
@Stability(Experimental) public PrettierSettings.Builder embeddedLanguageFormatting(EmbeddedLanguageFormatting embeddedLanguageFormatting)
Sets the value ofPrettierSettings.getEmbeddedLanguageFormatting()- Parameters:
embeddedLanguageFormatting- Control how Prettier formats quoted code embedded in the file.- Returns:
this
-
endOfLine
@Stability(Experimental) public PrettierSettings.Builder endOfLine(EndOfLine endOfLine)
Sets the value ofPrettierSettings.getEndOfLine()- Parameters:
endOfLine- Which end of line characters to apply.- Returns:
this
-
filepath
@Stability(Experimental) public PrettierSettings.Builder filepath(String filepath)
Sets the value ofPrettierSettings.getFilepath()- Parameters:
filepath- Specify the input filepath. This will be used to do parser inference.- Returns:
this
-
htmlWhitespaceSensitivity
@Stability(Experimental) public PrettierSettings.Builder htmlWhitespaceSensitivity(HTMLWhitespaceSensitivity htmlWhitespaceSensitivity)
Sets the value ofPrettierSettings.getHtmlWhitespaceSensitivity()- Parameters:
htmlWhitespaceSensitivity- How to handle whitespaces in HTML.- Returns:
this
-
insertPragma
@Stability(Experimental) public PrettierSettings.Builder insertPragma(Boolean insertPragma)
Sets the value ofPrettierSettings.getInsertPragma()- Parameters:
insertPragma- Insert.- Returns:
this
-
jsxSingleQuote
@Stability(Experimental) public PrettierSettings.Builder jsxSingleQuote(Boolean jsxSingleQuote)
Sets the value ofPrettierSettings.getJsxSingleQuote()- Parameters:
jsxSingleQuote- Use single quotes in JSX.- Returns:
this
-
parser
@Stability(Experimental) public PrettierSettings.Builder parser(String parser)
Sets the value ofPrettierSettings.getParser()- Parameters:
parser- Which parser to use.- Returns:
this
-
plugins
@Stability(Experimental) public PrettierSettings.Builder plugins(List<String> plugins)
Sets the value ofPrettierSettings.getPlugins()- Parameters:
plugins- Add a plugin. Multiple plugins can be passed as separate--plugins.- Returns:
this
-
pluginSearchDirs
@Stability(Experimental) public PrettierSettings.Builder pluginSearchDirs(List<String> pluginSearchDirs)
Sets the value ofPrettierSettings.getPluginSearchDirs()- Parameters:
pluginSearchDirs- Custom directory that contains prettier plugins in node_modules subdirectory. Overrides default behavior when plugins are searched relatively to the location of Prettier. Multiple values are accepted.- Returns:
this
-
printWidth
@Stability(Experimental) public PrettierSettings.Builder printWidth(Number printWidth)
Sets the value ofPrettierSettings.getPrintWidth()- Parameters:
printWidth- The line length where Prettier will try wrap.- Returns:
this
-
proseWrap
@Stability(Experimental) public PrettierSettings.Builder proseWrap(ProseWrap proseWrap)
Sets the value ofPrettierSettings.getProseWrap()- Parameters:
proseWrap- How to wrap prose.- Returns:
this
-
quoteProps
@Stability(Experimental) public PrettierSettings.Builder quoteProps(QuoteProps quoteProps)
Sets the value ofPrettierSettings.getQuoteProps()- Parameters:
quoteProps- Change when properties in objects are quoted.- Returns:
this
-
rangeEnd
@Stability(Experimental) public PrettierSettings.Builder rangeEnd(Number rangeEnd)
Sets the value ofPrettierSettings.getRangeEnd()- Parameters:
rangeEnd- Format code ending at a given character offset (exclusive). The range will extend forwards to the end of the selected statement. This option cannot be used with --cursor-offset.- Returns:
this
-
rangeStart
@Stability(Experimental) public PrettierSettings.Builder rangeStart(Number rangeStart)
Sets the value ofPrettierSettings.getRangeStart()- Parameters:
rangeStart- Format code starting at a given character offset. The range will extend backwards to the start of the first line containing the selected statement. This option cannot be used with --cursor-offset.- Returns:
this
-
requirePragma
@Stability(Experimental) public PrettierSettings.Builder requirePragma(Boolean requirePragma)
Sets the value ofPrettierSettings.getRequirePragma()- Parameters:
requirePragma- Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted.- Returns:
this
-
semi
@Stability(Experimental) public PrettierSettings.Builder semi(Boolean semi)
Sets the value ofPrettierSettings.getSemi()- Parameters:
semi- Print semicolons.- Returns:
this
-
singleQuote
@Stability(Experimental) public PrettierSettings.Builder singleQuote(Boolean singleQuote)
Sets the value ofPrettierSettings.getSingleQuote()- Parameters:
singleQuote- Use single quotes instead of double quotes.- Returns:
this
-
tabWidth
@Stability(Experimental) public PrettierSettings.Builder tabWidth(Number tabWidth)
Sets the value ofPrettierSettings.getTabWidth()- Parameters:
tabWidth- Number of spaces per indentation level.- Returns:
this
-
trailingComma
@Stability(Experimental) public PrettierSettings.Builder trailingComma(TrailingComma trailingComma)
Sets the value ofPrettierSettings.getTrailingComma()- Parameters:
trailingComma- Print trailing commas wherever possible when multi-line.- Returns:
this
-
useTabs
@Stability(Experimental) public PrettierSettings.Builder useTabs(Boolean useTabs)
Sets the value ofPrettierSettings.getUseTabs()- Parameters:
useTabs- Indent with tabs instead of spaces.- Returns:
this
-
vueIndentScriptAndStyle
@Stability(Experimental) public PrettierSettings.Builder vueIndentScriptAndStyle(Boolean vueIndentScriptAndStyle)
Sets the value ofPrettierSettings.getVueIndentScriptAndStyle()- Parameters:
vueIndentScriptAndStyle- Indent script and style tags in Vue files.- Returns:
this
-
build
@Stability(Experimental) public PrettierSettings build()
Builds the configured instance.- Specified by:
buildin interfacesoftware.amazon.jsii.Builder<PrettierSettings>- Returns:
- a new instance of
PrettierSettings - Throws:
NullPointerException- if any required attribute was not provided
-
-