How to Lint Code in OpenWork: ESLint Configuration and Commands

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 (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. The lint script is defined in this same file and executes ESLint with the appropriate extensions.

To lint the entire repository:

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:

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:

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:

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 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, 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 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.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →