Skip to content

Possible to specify a newer version of prettier? #362

@billkoch

Description

@billkoch

First off, thanks for all the hard work that has gone into this project!

I was looking to use the support for Prettier to format YAML files in my project.

With the following configuration:

spotless {
  format 'yaml', {
    target '**/*.yml', '**/*.yaml'
    prettier().config(['parser': 'yaml'])
  }
}

I was getting:

Error: Couldn't resolve parser "yaml"
    at _construct (/Users/kochwm/dev/istio-demo/java/build/spotless-node-modules-prettier-format/node_modules/prettier/index.js:1922:22)
    at _construct (/Users/kochwm/dev/istio-demo/java/build/spotless-node-modules-prettier-format/node_modules/prettier/index.js:1928:21)
    at ConfigError.Wrapper (/Users/kochwm/dev/istio-demo/java/build/spotless-node-modules-prettier-format/node_modules/prettier/index.js:1948:14)
    at new ConfigError (/Users/kochwm/dev/istio-demo/java/build/spotless-node-modules-prettier-format/node_modules/prettier/index.js:2027:74)
    at resolveParser$1 (/Users/kochwm/dev/istio-demo/java/build/spotless-node-modules-prettier-format/node_modules/prettier/index.js:6972:13)
    at normalize (/Users/kochwm/dev/istio-demo/java/build/spotless-node-modules-prettier-format/node_modules/prettier/index.js:7063:19)
    at formatWithCursor (/Users/kochwm/dev/istio-demo/java/build/spotless-node-modules-prettier-format/node_modules/prettier/index.js:10372:12)
    at /Users/kochwm/dev/istio-demo/java/build/spotless-node-modules-prettier-format/node_modules/prettier/index.js:31126:15
    at Object.format (/Users/kochwm/dev/istio-demo/java/build/spotless-node-modules-prettier-format/node_modules/prettier/index.js:31145:12)

After doing some digging, I noticed Prettier doesn't support YAML until version 1.14.0 and (if I understand how things work correctly) prettier-package.json is pulling in 1.13.4

Is it possible to specify a newer version of prettier in my spotless configuration?

It's also possible (read: likely) I'm barking up the wrong tree entirely, so any tips/suggestions would be greatly appreciated.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions