---
# Don't modify this file manually. This file is auto generated from source, and you will lose your changes next time the website is built.
# Head to the `biomejs/biome` repository, and modify the source code in there.

title: useRequiredScripts
description: Learn more about useRequiredScripts
---
import { Tabs, TabItem } from '@astrojs/starlight/components';

<Tabs>
<TabItem label="JSON (and super languages)" icon="seti:json">
:::caution
This rule is part of the [nursery](/linter/#nursery) group. This means that it is experimental and the behavior can change at any time.
:::
## Summary
- Rule available since: `v2.3.9`
- Diagnostic Category: [`lint/nursery/useRequiredScripts`](/reference/diagnostics#diagnostic-category)
- This rule doesn't have a fix.
- The default severity of this rule is [**information**](/reference/diagnostics#information).
## How to configure
```json title="biome.json"
{
	"linter": {
		"rules": {
			"nursery": {
				"useRequiredScripts": "error"
			}
		}
	}
}

```
## Description
Enforce the presence of required scripts in package.json.

This rule ensures that specified scripts are defined in the `scripts` section of a `package.json` file.
It's particularly useful in monorepo environments where consistency across workspaces is important.

Without required scripts configured, this rule doesn't do anything.

## Examples

### Invalid

```json title='biome.json'
{
	"linter": {
		"rules": {
			"nursery": {
				"useRequiredScripts": {
					"options": {
						"requiredScripts": [
							"test",
							"build"
						]
					}
				}
			}
		}
	}
}

```

```json
{
    "scripts": {
        "test": "vitest"
    }
}
```

### Valid

```json
{
    "scripts": {
        "test": "vitest",
        "build": "tsc"
    }
}
```

## Options

### `requiredScripts`

An array of script names that must be present in the `scripts` section of `package.json`.
Default: `[]` (no scripts required)

## Related links

- [Disable a rule](/linter/#disable-a-rule)
- [Configure the code fix](/linter#configure-the-code-fix)
- [Rule options](/linter/#rule-options)
- [Source Code](https://github.com/biomejs/biome/blob/main/crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs)
- [Test Cases](https://github.com/biomejs/biome/blob/main/crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts)

</TabItem>
</Tabs>