# javascript

> JavaScript files: the shipped lint rules, type checks through JSDoc, and no unused code.

JavaScript files: the shipped lint rules, type checks through JSDoc, and no unused code. The [JavaScript and TypeScript guide](/languages/javascript-typescript/) explains the setup.

## Checks

| Check                                                       | Stage    | Level         | What it does                                                                                |
| ----------------------------------------------------------- | -------- | ------------- | ------------------------------------------------------------------------------------------- |
| [`javascript/eslint`](/reference/checks/javascript/eslint/) | `commit` | `recommended` | Runs the shipped ESLint rules on JavaScript, TypeScript, component files, and package.json. |
| [`javascript/tsc`](/reference/checks/javascript/tsc/)       | `push`   | `recommended` | Type-checks plain JavaScript through its JSDoc comments.                                    |
| [`javascript/knip`](/reference/checks/javascript/knip/)     | `push`   | `recommended` | Finds files, exports, and dependencies nothing uses.                                        |

## Settings

| Setting                                                                                   | What it sets                                                                                                                                         |
| ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`javascript.script_files`](/reference/gspot-toml/#javascript.script_files)               | Script files, which may print to the console and call process.exit.                                                                                  |
| [`tools.eslint.import_extension`](/reference/gspot-toml/#tools.eslint.import_extension)   | The import suffix in this scope: js for compiled ESM, ts for Deno and Bun, or extensionless for code that a bundler builds.                          |
| [`tools.eslint.restricted_imports`](/reference/gspot-toml/#toolseslintrestricted_imports) | Imports that this repository refuses, each with a name and a message.                                                                                |
| [`tools.eslint.rules`](/reference/gspot-toml/#tools.eslint.rules)                         | Option arrays by ESLint rule ID, without a severity, which apply only where the level turns the rule on; accept findings with gspot ignore `--rule`. |
| [`tools.eslint.override`](/reference/gspot-toml/#toolseslintoverride)                     | Lint rule options for repository-relative paths, in order, with ignores applied last.                                                                |
| [`tools.knip.entry`](/reference/gspot-toml/#tools.knip.entry)                             | Entry points knip starts from beyond the ones the framework configuration declares.                                                                  |
| [`tools.knip.ignore_dependencies`](/reference/gspot-toml/#tools.knip.ignore_dependencies) | Exact package names that knip does not report as unused; new names need a reason, and a scope list applies to that project only.                     |

## Selected when

gspot selects it in a scope with file extensions `.js`, `.jsx`, `.mjs`, `.cjs`, or script interpreters `node`, or project files `package.json`. A configuration that requires it selects it too: [`astro`](/reference/configurations/astro/), [`cloudflare`](/reference/configurations/cloudflare/), [`drizzle`](/reference/configurations/drizzle/), [`express`](/reference/configurations/express/), [`jest`](/reference/configurations/jest/), [`react`](/reference/configurations/react/), [`react-hook-form`](/reference/configurations/react-hook-form/), [`supabase`](/reference/configurations/supabase/), [`svelte`](/reference/configurations/svelte/), [`tanstack-query`](/reference/configurations/tanstack-query/), [`testing-library`](/reference/configurations/testing-library/), [`translations`](/reference/configurations/translations/), [`trpc`](/reference/configurations/trpc/), [`typescript`](/reference/configurations/typescript/), [`vitest`](/reference/configurations/vitest/), [`vue`](/reference/configurations/vue/), [`zod`](/reference/configurations/zod/), [`zustand`](/reference/configurations/zustand/).

## Rules for coding agents

| Rule file                                                       | Installed when                                                                                          |
| --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| `.gspot/configurations/language/javascript/rules/BUN.md`        | The repository has filenames `bun.lock`, `bun.lockb`, `bunfig.toml`.                                    |
| `.gspot/configurations/language/javascript/rules/COMPONENTS.md` | The repository has dependencies `astro`, `svelte`, `vue`, `react`.                                      |
| `.gspot/configurations/language/javascript/rules/DENO.md`       | The repository has javascript runtimes `deno`.                                                          |
| `.gspot/configurations/language/javascript/rules/JAVASCRIPT.md` | Always                                                                                                  |
| `.gspot/configurations/language/javascript/rules/NODE.md`       | The repository has javascript runtimes `node`, unless the repository depends on `react-native`, `expo`. |
| `.gspot/configurations/language/javascript/rules/PLAYWRIGHT.md` | The repository has dependencies `@playwright/test`, `playwright`.                                       |

## Tools and versions

| Tool                              | Version   |
| --------------------------------- | --------- |
| eslint                            | `9.39.5`  |
| @eslint/js                        | `9.39.5`  |
| @gspothq/eslint-plugin            | `0.2.0`   |
| eslint-plugin-sonarjs             | `4.2.0`   |
| eslint-plugin-unicorn             | `65.0.1`  |
| eslint-plugin-security            | `4.0.1`   |
| eslint-plugin-barrel-files        | `3.0.1`   |
| eslint-plugin-perfectionist       | `5.12.1`  |
| eslint-plugin-n                   | `18.3.0`  |
| eslint-plugin-jsdoc               | `64.3.9`  |
| eslint-plugin-regexp              | `3.3.0`   |
| eslint-plugin-import-x            | `4.17.1`  |
| picomatch                         | `4.0.7`   |
| eslint-import-resolver-typescript | `4.4.5`   |
| eslint-plugin-boundaries          | `7.2.0`   |
| eslint-plugin-package-json        | `1.8.0`   |
| eslint-config-prettier            | `10.1.8`  |
| globals                           | `17.12.0` |
| knip                              | `6.35.1`  |
| tsc                               | `5.9.3`   |

## Files gspot writes

gspot writes `.gspot/configurations/language/javascript/eslint.mjs`, `.gspot/configurations/language/javascript/jsconfig.json`, `.gspot/configurations/language/javascript/knip.json`, `.gspot/configurations/language/javascript/semgrep.yml` (with the [`security`](/reference/configurations/security/) configuration), and `.gspot/configurations/language/javascript/eslint-runtime.mjs`.

## Kept out of Git

`node_modules` and `bower_components`.
