> For the complete documentation index, see [llms.txt](https://tutorial.specian.co.uk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tutorial.specian.co.uk/project-setup/prettier.md).

# Prettier

Remaining consistent isn't easy when the team grows. A lot of code formatting issues brought up by the linter can be fixed automatically. That's Prettier.

```
$ yarn add prettier
```

Change `index.ts` to following code:

{% code title="index.ts" %}

```typescript
const printFizz = number => {
        if (!Boolean(number % 3)) 
        {
return "fizz";
    }
};

```

{% endcode %}

then run

```
$ prettier --write packages/api/index.ts
```

The file has been formatted correctly:

{% code title="index.ts" %}

```typescript
const printFizz = number => {
    if (!Boolean(number % 3)) {
        return "fizz";
    }
};
```

{% endcode %}

### Avoid TSLint conflict

```
yarn add tslint-config-prettier -D
```

Update `tslint.json`

{% code title="tslint.json" %}

```typescript
{
  "defaultSeverity": "error",
  "extends": ["tslint:recommended", "tslint-config-prettier"],
  "jsRules": {},
  "rules": {},
  "rulesDirectory": []
}
```

{% endcode %}
