Configuration

The restyling process can be configured through a YAML file committed in your repository. Restyled will use the first file found at any of the following locations:

The contents of that file are documented here. The current default configuration is available here . Any differences or additional notes in that source file take precedence over what’s described in this wiki page. When referring to the file, we use .restyled.yaml – but of course this documentation applies regardless of location.

The .restyled.yaml in the branch being Restyled is what is used. If you make a configuration change on another branch (e.g. main), you will need to bring that change into any open Pull Requests (e.g. rebase) before Restyled will see it there.

General notes #

Core Configuration #

Enabled #

enabled: true

Do anything at all?

Exclude #

exclude:
  - "**/*.patch"
  - "**/node_modules/**/*"
  - "**/vendor/**/*"
  - ".github/workflows/**/*"

Patterns to exclude from all Restylers.

By default, we ignore directories that are often checked-in but rarely represent project code. Some globs are slightly complicated to match paths within directories of names appearing at any depth.

This behavior can be disabled in your project with:

exclude: []

Also Exclude #

If you wish to exclude patterns while retaining our default exclude, add them to also_exclude instead.

also_exclude: []

Remote files #

remote_files: []

Files to download before restyling.

Example:

remote_files:
  - url: https://raw.github.com/.../hlint.yaml
    path: .hlint.yaml

If omitted, path is the basename of url.

Restyling Outcomes #

Commit Template #

commit_template: |
  Restyled by ${restyler.name}  

Control the commit messages used when Restyler makes fixes. Supports limited interpolation, currently just ${restyler.name}.

Ignore Authors #

ignore_authors:
  - "*[bot]"

Authors to ignore, supports globs.

PRs opened by authors whose login matches any patterns will be ignored by Restyled.

Ignore Branches #

ignore_branches:
  - "renovate/*"

Branches to ignore, supports globs.

PRs whose head branches match any patterns will be ignored by Restyled.

Ignore labels #

ignore_labels:
  - restyled-ignore

Labels to ignore, supports globs.

PRs labels match any patterns will be ignored by Restyled.

Restylers #

Restylers version #

restylers_version: stable

Version of the set of Restylers to run.

This name corresponds to a manifest at (e.g.) https://docs.restyled.io/data-files/restylers/manifests/stable/restylers.yaml . Feel free to specify dev to get new versions more quickly, but stable does not lag far behind.

Restylers #

restylers:
  - "*"

Restylers to run, and how

Elements in this list can be specified in one of three forms:

  1. A string, which means to run that Restyler with all defaults

    restylers:
      - prettier
    
  2. A single key, that is a name, and override object as the value:

    restylers:
      - prettier:
          include:
            - "**/*.js"
    
  3. An object with a name key

    restylers:
      - name: prettier
        include:
          - "**/*.js"
    

All three of the above are equivalent. The latter two are useful if you want to run the same Restyler multiple ways:

restylers:
  - name: prettier
    arguments: ["--one-thing"]
    include: ["needs-one-thing/**/*.js"]

  - name: prettier
    arguments: ["--another"]
    include: ["needs-another/**/*.js"]

Omitted keys inherit defaults for the Restyler of that name, which can be seen in Available Restylers .

Note that the enabled key is not inherited. Adding an item to this list, without specifying enabled: false, automatically enables that Restyler.

In string form, prefixing the name with ! is short-hand for disabling. The following two configurations are equivalent:

restylers:
  - "!astyle" # quoting is required for this
  - astyle:
      enabled: false

Wildcard #

The special value * (wildcard) means all Restylers not configured. One wildcard may be placed anywhere in the restylers list and remaining Restylers will be run, with their default values, at that point.

Note that the Restylers added by the * entry will not run if they’re default configuration includes enabled: false. You must explicitly add such Restylers for them to run.

Examples:

Restyler Override #

Valid keys in the override object are: