# Excluding certain components & files

Omlet CLI ignores certain files while scanning, such as node modules, Storybook stories, and test files. Here are the patterns ignored in scans by default:

* `**/node_modules/**`
* `**/*.d.ts`
* `**/stories/**/*`
* `**/.storybook/**/*`
* `**/*.stories.{jsx,tsx,js,ts}`
* `**/*.{spec,test}.{jsx,tsx,js,ts}`
* `**/{__test__,tests}/**/*.{jsx,tsx,js,ts}`

You can define custom file names and glob patterns to ignore from scans or limit the CLI to scan certain directories and glob patterns. There are two different options you can choose to exclude components and files from scans.

## Option 1: Config file

One way of ignoring certain components is to define them in the configuration file. To do this, you can create a **`.omletrc`** file in the root directory of your repository. The CLI will automatically detect this file and apply your configuration.

{% hint style="info" %}
Your config file can have alternative names and locations. Check the [Config file](broken://pages/ZSbROtEQCE5YmQUO9Prh) page to learn more.
{% endhint %}

Once the config file is created, you can define the **`ignore`** property with an array of filenames or glob patterns that should be excluded from the scan.

{% code title=".omletrc" lineNumbers="true" %}

```json
{
  "ignore": ["**/test_folder/**", "**/another_test_folder/**"]
}
```

{% endcode %}

If you need to narrow and specify where the CLI will look for components, you can define the **`include`** property with an array of filenames or glob patterns.

{% code title=".omletrc" lineNumbers="true" %}

```json
{
  "include": ["glob/one", "glob/two"]
}
```

{% endcode %}

{% hint style="info" %}
The paths and patterns are resolved relative to the root project path, where the **`-r`** parameter points to—or to the current working directory if **`-r`** is not provided to the CLI.
{% endhint %}

## Option 2: Command line arguments

Alternatively, you can add the **`--ignore`** option to the **`analyze`** command while scanning your repositories.

{% tabs %}
{% tab title="npm" %}

```sh
npx omlet analyze --ignore 'glob/one'
```

{% endtab %}

{% tab title="yarn" %}

```sh
yarn omlet analyze --ignore 'glob/one'
```

{% endtab %}

{% tab title="pnpm" %}

```sh
pnpm exec omlet analyze --ignore 'glob/one'
```

{% endtab %}
{% endtabs %}

If you need to ignore multiple directories, you can pass multiple glob patterns to the CLI.

{% tabs %}
{% tab title="npm" %}

```sh
npx omlet analyze --ignore 'glob/one' --ignore 'glob/two'
```

{% endtab %}

{% tab title="yarn" %}

```sh
yarn omlet analyze --ignore 'glob/one' --ignore 'glob/two'
```

{% endtab %}

{% tab title="pnpm" %}

```sh
pnpm exec omlet analyze --ignore 'glob/one' --ignore 'glob/two'
```

{% endtab %}
{% endtabs %}

Similar to the config file, you can use **`-i`** / **`--include`** option in the **`analyze`** command to include only specific components, files, or directories.

{% tabs %}
{% tab title="npm" %}

```sh
npx omlet analyze -i 'glob/one' -i 'glob/two'
```

{% endtab %}

{% tab title="yarn" %}

```sh
yarn omlet analyze -i 'glob/one' -i 'glob/two'
```

{% endtab %}

{% tab title="pnpm" %}

```sh
pnpm exec omlet analyze -i 'glob/one' -i 'glob/two'
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
If the **`ignore`** or **`include`** properties are provided both as a command-line argument and defined in the config file, the corresponding values in the config file will be ignored.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.omlet.dev/cli-and-dashboard/learn-omlet-cli/config-file/excluding-certain-components-and-files.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
