formatFiles() from nx-devkit - can't ignore YAML files from processing

21 views Asked by At
import {
  formatFiles,
} from '@nx/devkit';

export async function filesGenerator(tree: Tree, options: OptionsSchema): Promise<void> {

//do stuff

  await formatFiles(tree);
}

In //do stuff I'm generating necessary application files, but it also prepares required deployment YAML files. As prettier formatting breaks the files (i.e it changes {{ to { {) I wanted to exclude this from the formatting. However, adding .prettierignore to a generator library root or to the monorepo's root doesn't stop the YAML files from being formatted.

I've checked that the monorepo's ignore rules (from the root folder) apply when I try to format the files manually after the generation process is complete (it's not being formatted then). However I can't get it to working with the generator - formatFiles() method does not have any additional parameters/overloads and the .prettierignore files I've mentioned seem to be ignored by the NX engine and I can't find anything related to that in the NX's documentation.

How can I stop those files from being processed by the Prettier?

0

There are 0 answers