Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions docs/repositories-configure/local-analysis/running-eslint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
description: Instructions on how to run ESLint as a client-side tool on Codacy.
tool_name: ESLint
---

# Running ESLint

To run ESLint as a [client-side tool](client-side-tools.md):


<!-- NOTE
include-markdown breaks the final list in two, use include instead. -->
{%
include "../../assets/includes/client-side-tool-instructions.md"
start="<!--instructions-start-->"
end="<!--instructions-end-->"
%}

## Important Concepts

- **`.codacy/codacy.yaml`**: Configuration file to specify `node` and `eslint` versions for the CLI.

```yaml
runtimes:
- node@22.2.0
tools:
- eslint@9.3.0
```
## Manual configuration

```bash
codacy-cli install
codacy-cli analyze -t eslint -o eslint.sarif
codacy-cli upload -s eslint.sarif -c $COMMIT_SHA -t CODACY_PROJECT_TOKEN
```

**If you're using an account API token**, you must also provide the flags `-p`, `-o`, and `-r`. You can obtain the values for these flags from the URL of your repository dashboard on Codacy:

```bash
codacy-cli install
codacy-cli analyze -t eslint -o eslint.sarif
codacy-cli analyze -t eslint -o eslint.sarif -c $COMMIT_SHA -a CODACY_API_TOKEN -p provider (gh|gl|bb) -o ORGANIZATION -r REPOSITORY
```

## GitHub Action


### Using a project token
```yml
- name: Run Codacy CLI
uses: codacy/codacy-cli-v2-action@main
with:
project-token: CODACY_PROJECT_TOKEN
tool: eslint
upload_report: true
```

### Using an account API token

```yml
- name: Run Codacy CLI
uses: codacy/codacy-cli-v2-action@main
with:
api_token: CODACY_API_TOKEN
tool: eslint
upload_report: true
provider: gh
owner: codacy-acme
repository: sample-javascript-project
```

!!! warning "Tokens should be stored in the repository secrets."

1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ nav:
- repositories-configure/local-analysis/running-aligncheck.md
- repositories-configure/local-analysis/running-deadcode.md
- repositories-configure/local-analysis/running-spotbugs.md
- repositories-configure/local-analysis/running-eslint.md
- repositories-configure/using-submodules.md
- repositories-configure/codacy-configuration-file.md
- repositories-configure/removing-your-repository.md
Expand Down
Loading