# How to Lint Code in OpenWork: ESLint Configuration and Commands

> Learn how to lint code in OpenWork using ESLint. Discover essential configuration details and commands for effective TypeScript and JavaScript code checks. Run `pnpm run lint` from the repo root.

- Repository: [Different AI/openwork](https://github.com/different-ai/openwork)
- Tags: how-to-guide
- Published: 2026-08-01

---

**OpenWork uses ESLint as its primary linting tool, executing type-aware checks across TypeScript and JavaScript files via `pnpm run lint` from the repository root.**

The `different-ai/openwork` repository enforces code quality through a centralized ESLint configuration that governs the entire monorepo. When you lint code in OpenWork, you leverage a shared ruleset defined in the root `.eslintrc.cjs` that extends TypeScript recommendations while enforcing project-specific constraints like import ordering and console statement guards.

## ESLint Configuration Architecture

The linting infrastructure relies on a hierarchical configuration system. The root `.eslintrc.cjs` serves as the central authority, defining the parser, plugin list, and rule overrides that all packages inherit.

Key configuration files include:

- **`.eslintrc.cjs`** (root) – Declares the parser as `@typescript-eslint/parser`, extends recommended TypeScript rules, and configures environment settings for Node.js and browser contexts.
- **[`tsconfig.json`](https://github.com/different-ai/openwork/blob/main/tsconfig.json)** (root) – Supplies TypeScript compiler options that the ESLint parser consumes for type-aware linting rules.
- **`packages/*/.eslintrc.cjs`** (optional) – Individual packages can extend or override root rules for sub-project-specific requirements.

The configuration explicitly targets files with extensions `.ts`, `.tsx`, and `.js`, ensuring consistent style enforcement across the entire codebase.

## Running the Linter

OpenWork uses **pnpm** as its package manager, as specified in the `packageManager` field of the root [`package.json`](https://github.com/different-ai/openwork/blob/main/package.json). The `lint` script is defined in this same file and executes ESLint with the appropriate extensions.

To lint the entire repository:

```bash
pnpm run lint

```

This command scans all configured files from the repository root, applying the rules defined in `.eslintrc.cjs`.

To automatically fix fixable problems:

```bash
pnpm run lint -- --fix

```

The `--` separator passes the `--fix` flag directly to the underlying ESLint binary, modifying files in place according to auto-fixable rule violations.

## Package-Level Linting

For targeted development workflows, you can lint specific packages within the monorepo rather than the entire workspace.

Navigate to a specific package and run the lint command:

```bash
cd packages/ui
pnpm run lint

```

This executes the package's local lint script, which inherits the root ESLint configuration while applying any package-specific overrides found in `packages/ui/.eslintrc.cjs`.

## Development Workflow and Watch Mode

During active development, you can run the linter in watch mode to receive immediate feedback as you save files:

```bash
pnpm run lint -- --watch

```

This leverages ESLint's native file watching capabilities to re-lint changed files automatically, reducing context switching during code iterations.

## Summary

- **Centralized config**: The root `.eslintrc.cjs` governs all packages in the `different-ai/openwork` monorepo, extending TypeScript recommended rules.
- **Execution**: Use `pnpm run lint` from the repository root to check all `.ts`, `.tsx`, and `.js` files.
- **Auto-fix**: Append `-- --fix` to automatically resolve fixable style violations.
- **Package isolation**: Run `pnpm run lint` within individual `packages/*` directories for scoped checks.
- **Type-aware**: The configuration references [`tsconfig.json`](https://github.com/different-ai/openwork/blob/main/tsconfig.json) for TypeScript parser settings, enabling rules that require type information.

## Frequently Asked Questions

### Where is the ESLint configuration located in OpenWork?

The primary configuration lives in the repository root at `.eslintrc.cjs`, as implemented in `different-ai/openwork`. This file defines the parser, plugins, and rule overrides that apply to the entire monorepo. Individual packages may contain their own `.eslintrc.cjs` files to extend or override these settings for sub-project-specific needs.

### How do I automatically fix linting errors?

Run `pnpm run lint -- --fix` from the repository root. The double hyphen separates pnpm arguments from ESLint arguments, passing `--fix` directly to the linter. This modifies files in place to resolve auto-fixable violations like indentation, semicolon insertion, and import ordering.

### Can I lint only a specific package instead of the entire repository?

Yes. Change into the target package directory (for example, `cd packages/ui`) and execute `pnpm run lint`. This runs the lint script defined in that package's [`package.json`](https://github.com/different-ai/openwork/blob/main/package.json), which inherits the root ESLint configuration while respecting any local overrides.

### What file extensions does the OpenWork linter check?

According to the root `.eslintrc.cjs` and [`package.json`](https://github.com/different-ai/openwork/blob/main/package.json) scripts, the linter processes files with `.ts`, `.tsx`, and `.js` extensions. The configuration is optimized for TypeScript-heavy development while maintaining compatibility with legacy JavaScript files.