---
url: /reference/@cssdoc/cssdoc/functions/applyDirectives.md
---
# Function: applyDirectives()

```ts
function applyDirectives(diagnostics, source): Diagnostic[];
```

Defined in: [packages/providers/src/directives.ts:81](https://github.com/thedannywahl/cssdoc/blob/main/packages/providers/src/directives.ts#L81)

Drop diagnostics suppressed by directive comments in `source`, and add a `cssdoc-directive`
diagnostic for any `cssdoc-expect-error` that matched nothing.

## Parameters

### diagnostics

[`Diagnostic`](../interfaces/Diagnostic.md)\[]

The diagnostics to filter (author-side, with CSS spans).

### source

`string`

The CSS the diagnostics came from (the same text passed to the linter).

## Returns

[`Diagnostic`](../interfaces/Diagnostic.md)\[]

The surviving diagnostics.
