To set a formatter on a component or a group of components, configure it in the components' envs.
For example, the following configuration defines Prettier as the code formatter to use during development.
Install the formatter in your workspace:
$bit install @teambit/defender.prettier-formatter 
Set the formatter in the relevant env:
/* @filename: my-env.bit-env.ts */
import { EnvHandler } from '@teambit/envs';
import { Tester } from '@teambit/tester';
import { Pipeline } from '@teambit/builder';
/* import the formatter to use by this env */
import { PrettierFormatter } from '@teambit/defender.prettier-formatter';
export class MyEnv {
/**
* the path to the prettier config file.
*/
protected prettierConfigPath = require.resolve('./config/prettier.config.js');
/**
* the formatter to use to format code.
* 'bit format'
*/
formatter() {
return PrettierFormatter.from({
/* use this config file */
configPath: this.prettierConfigPath
});
}
}
export default new MyEnv();