# CLI Usage

> [!NOTE]  
> When using Docker with `[p]npm` Make recipes add `make` before every command, and surround instruction with quotes.

## NPM Scripts

To use ESLint in the command-line, add the following scripts to your projects `package.json`:

### Basic JavaScript

```json
{
  "scripts": {
    "eslint": "eslint 'path/to/your/assets/**/*.{cjs,js,mjs}'",
    "eslint:fix": "pnpm run eslint --fix"
  }
}
```

```json
{
  "scripts": {
    "eslint": "eslint 'path/to/your/assets/**/*.{cjs,js,mjs}'",
    "eslint:fix": "npm run eslint -- --fix"
  }
}
```

### Vue.js files

```json
{
  "scripts": {
    "eslint": "eslint 'path/to/your/assets/**/*.vue'",
    "eslint:fix": "pnpm run eslint --fix"
  }
}
```

```json
{
  "scripts": {
    "eslint": "eslint 'path/to/your/assets/**/*.vue'",
    "eslint:fix": "npm run eslint -- --fix"
  }
}
```

### TypeScript files

```json
{
  "scripts": {
    "eslint": "eslint 'path/to/your/assets/**/*.{ts,tsx}'",
    "eslint:fix": "pnpm run eslint --fix"
  }
}
```

```json
{
  "scripts": {
    "eslint": "eslint 'path/to/your/assets/**/*.{ts,tsx}'",
    "eslint:fix": "npm run eslint -- --fix"
  }
}
```

### All files (let config decide)

```json
{
  "scripts": {
    "eslint": "eslint .",
    "eslint:fix": "pnpm run eslint --fix"
  }
}
```

```json
{
  "scripts": {
    "eslint": "eslint .",
    "eslint:fix": "npm run eslint -- --fix"
  }
}
```

## Running Commands

You can run the commands with:

```bash
pnpm run eslint
pnpm run eslint:fix
```

```bash
npm run eslint
npm run eslint:fix
```

> With PNPM you can also run scripts without 'run' like `pnpm eslint`.
