For paid-plan users, our new configuration format provides top-level keys to specify separate options for each supported language. This allows you to fine-tune each language independently for a more comprehensive code fixing experience.
The configuration for each language must now fall under the relevant name. For instance, observe the example config file below:
php:
risky: true
version: 8.4
preset: laravel
enabled:
- ternary_to_elvis_operator
disabled:
- single_import_per_statement
monolithic: true
finder:
exclude:
- "modules"
- "node_modules"
- "nova"
- "nova-components"
- "storage"
- "spark"
- "vendor"
name: "*.php"
not-name:
- "*.blade.php"
- "_ide_helper.php"
js:
tab-width: 4
use-tabs: false
print-width: 120
double-quotes: false
trailing-commas: es5
semicolons: true
arrow-parens: always
bracket-same-line: false
bracket-spacing: true
finder:
exclude:
- "modules"
- "node_modules"
- "nova"
- "nova-components"
- "storage"
- "spark"
- "vendor"
name:
- "*.js"
- "*.jsx"
not-name:
- "*.min.js"
ts: false
css: false
py: true
As can be seen, the php
, js
, ts
, css
and py
keys each allow for PHP, Javascript, Typescript, CSS and Python configuration respectively. Writing false
after such a key disables fixing for that language; writing true
enables our default fixes for it. If you want to customize, you can instead write out the configuration manually under the language you want.
In the above example, it can be seen that custom PHP and Javascript configurations are used, along with the default Python one and no other languages.
{info} If you removed the
ts
orcss
keys, the behavior would remain the same; removing any such language's key replaces it with its default behavior, ie.true
for PHP andfalse
for all others.
You may notice that the PHP and Javascript configurations look different. In fact, every language has its own separate configuration options, with PHP retaining the PHP-only ones.
We describe each new language's options below. For all languages, the finder key works the same.
Setting php: true
translates to the following:
php:
risky: false
version: 8.4
preset: recommended
monolithic: true
tab-width: 4
use-tabs: false
finder:
exclude:
- "modules"
- "node_modules"
- "nova"
- "nova-components"
- "storage"
- "spark"
- "vendor"
name: "*.php"
not-name:
- "*.blade.php"
- "_ide_helper.php"
PHP configuration is the same as before, other than that all PHP config options must fall under the php
key as above. Read more about PHP configuration here.
Setting js: true
translates to the following:
js:
tab-width: 4
use-tabs: false
print-width: 120
double-quotes: false
trailing-commas: es5
semicolons: true
arrow-parens: always
bracket-same-line: false
bracket-spacing: true
finder:
exclude:
- "modules"
- "node_modules"
- "nova"
- "nova-components"
- "storage"
- "spark"
- "vendor"
name:
- "*.js"
- "*.jsx"
not-name:
- "*.min.js"
- Valid values for
tab-width
are2
and4
. - Valid values for
use-tabs
arefalse
andtrue
. - Valid values for
print-width
are integers between20
and200
. We'd recommend80
,100
, or120
. - Valid values for
double-quotes
arefalse
andtrue
. - Valid values for
trailing-commas
arenone
,es5
, orall
. - Valid values for
semicolons
arefalse
andtrue
. - Valid values for
arrow-parens
areavoid
andalways
. - Valid values for
bracket-same-line
arefalse
andtrue
. - Valid values for
bracket-spacing
arefalse
andtrue
.
Setting ts: true
translates to the following:
ts:
tab-width: 4
use-tabs: false
print-width: 120
double-quotes: false
trailing-commas: es5
semicolons: true
arrow-parens: always
bracket-same-line: false
bracket-spacing: true
finder:
exclude:
- "modules"
- "node_modules"
- "nova"
- "nova-components"
- "storage"
- "spark"
- "vendor"
name: "*.ts"
- Valid values for
tab-width
are2
and4
. - Valid values for
use-tabs
arefalse
andtrue
. - Valid values for
print-width
are integers between20
and200
. We'd recommend80
,100
, or120
. - Valid values for
double-quotes
arefalse
andtrue
. - Valid values for
trailing-commas
arenone
,es5
, orall
. - Valid values for
semicolons
arefalse
andtrue
. - Valid values for
arrow-parens
areavoid
andalways
. - Valid values for
bracket-same-line
arefalse
andtrue
. - Valid values for
bracket-spacing
arefalse
andtrue
.
Setting css: true
translates to the following:
css:
tab-width: 4
use-tabs: false
print-width: 120
double-quotes: false
finder:
exclude:
- "modules"
- "node_modules"
- "nova"
- "nova-components"
- "storage"
- "spark"
- "vendor"
name:
- "*.css"
- "*.scss"
- "*.less"
- Valid values for
tab-width
are2
and4
. - Valid values for
use-tabs
arefalse
andtrue
. - Valid values for
print-width
are integers between20
and200
. We'd recommend80
,100
, or120
. - Valid values for
double-quotes
arefalse
andtrue
.
Setting vue: true
translates to the following:
vue:
tab-width: 4
use-tabs: false
print-width: 120
double-quotes: false
trailing-commas: es5
semicolons: true
arrow-parens: always
bracket-same-line: false
bracket-spacing: true
indent-script-and-style: false
whitespace-sensitivity: css
finder:
exclude:
- "modules"
- "node_modules"
- "nova"
- "nova-components"
- "storage"
- "spark"
- "vendor"
name: "*.vue"
- Valid values for
tab-width
are2
and4
. - Valid values for
use-tabs
arefalse
andtrue
. - Valid values for
print-width
are integers between20
and200
. We'd recommend80
,100
, or120
. - Valid values for
double-quotes
arefalse
andtrue
. - Valid values for
trailing-commas
arenone
,es5
, orall
. - Valid values for
semicolons
arefalse
andtrue
. - Valid values for
arrow-parens
areavoid
andalways
. - Valid values for
bracket-same-line
arefalse
andtrue
. - Valid values for
bracket-spacing
arefalse
andtrue
. - Valid values for
indent-script-and-style
arefalse
andtrue
. - Valid values for
whitespace-sensitivity
arecss
,strict
andignore
.
Setting py: true
translates to the following:
py:
version: 3.11
preset: pep8
options:
tab-width: 4
use-tabs: false
print-width: 120
multiline-split-indent: 4
join-short-lines: false
comment-indent: 4
finder:
exclude:
- "modules"
- "node_modules"
- "nova"
- "nova-components"
- "storage"
- "spark"
- "vendor"
name: "*.py"
- The
version
key specifies the Python grammar version to use.2.7
and3.11
are allowed values,3.11
being the default, and additionally,2
is an alias for2.7
and3
is an alias for3.11
. - Valid values for the
preset
key arepep8
,google
,chromium
orfacebook
. We'd recommend eitherpep8
orgoogle
. - The
options
key contains several suboptions for further, fine-tuned customizations. These options are as follows:- Valid values for
tab-width
are2
and4
. - Valid values for
use-tabs
arefalse
andtrue
. - Valid values for
print-width
are integers between20
and200
. We'd recommend80
,100
, or120
. - The
multiline-split-indent
key specifies the extra indentation used when a line is split across several lines. Valid values are integers between2
and8
. We'd recommend4
. - The
join-short-lines
key specifies whether to join several short lines into one, eg. making a small 'if' statement a one-liner. Valid values arefalse
ortrue
. - The
comment-indent
specifies indentation required after a line for a trailing comment. Valid values are integers between2
and8
.
- Valid values for
Note that for Python, we allow a preset along with a set of extra options for fine-tuning their behavior. The presets will have the side effect of changing the defaults for options
, which are overriden by setting these keys explicitly:
pep8
will setuse-tabs
tofalse
,print-width
to79
,tab-width
to4
,multiline-split-indent
to4
,join-short-lines
totrue
andcomment-indent
to 2.google
,facebook
andchromium
will all do the same, albeit settingcolumn-width
to80
.
{info} It's important to remember the preset does a lot more than just choose defaults for the
options
key - the internal differences in behavior will be noticeable and substantial, albeit not directly configurable. Hence, for example, choosing the