@molecule/eslint-config

Utility · eslint-config · Dev tooling · v1.3.0 · Apache-2.0

The ESLint flat config every Molecule workspace runs: TypeScript, import order, accessibility and the molecule-local rules, switched on by the workspace's own package.json.

npm install -D @molecule/eslint-config

npm · Source on GitHub

How it works

@molecule/eslint-config is project dev tooling: the api/ and app/ workspaces each install it as a devDependency, and no app or API source imports it.

// eslint.config.js
import { moleculeEslintConfig } from '@molecule/eslint-config'

export default await moleculeEslintConfig(import.meta.url)

Reference

The ESLint flat config every Molecule workspace runs, as one package.

A workspace's eslint.config.js passes its own URL, so the config reads that workspace's package.json (and migrations/) and switches its rules on from what it declares: React's hook rules where React is a dependency, the query-cache rules where @molecule/app-query-react is, the Vue and Svelte component rules where their ESLint plugins are devDependencies, and the resource-table rule from the resource packages and migrations it has. Every rule's plugin is this package's own dependency, so the workspace declares one lint package and eslint.

Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit src/index.ts JSDoc, not this file.

Quick Start

// eslint.config.js
import { moleculeEslintConfig } from '@molecule/eslint-config'

export default await moleculeEslintConfig(import.meta.url)
// A project's own rules go after the shared ones.
import { moleculeEslintConfig } from '@molecule/eslint-config'

export default [
  ...(await moleculeEslintConfig(import.meta.url)),
  { rules: { 'no-console': 'error' } },
]
// Another config that wants only the rules: register the plugin under its usual name.
import { moleculeLocalPlugin } from '@molecule/eslint-config'

export default [
  {
    plugins: { 'molecule-local': moleculeLocalPlugin },
    rules: { 'molecule-local/require-catch-binding': 'error' },
  },
]

Type

utility

Installation

npm install -D @molecule/eslint-config eslint typescript

Injection Notes

Requirements

Peer dependencies:

  • eslint ^10.0.0
  • eslint-plugin-svelte ^3.0.0 (optional)
  • eslint-plugin-vue ^10.0.0 (optional)
  • eslint-plugin-vuejs-accessibility ^2.0.0 (optional)
  • typescript >=4.8.4 <6.1.0

Runtime Dependencies

  • @eslint/js
  • eslint
  • eslint-config-prettier
  • eslint-plugin-jsx-a11y
  • eslint-plugin-react-hooks
  • eslint-plugin-simple-import-sort
  • eslint-plugin-svelte (optional)
  • eslint-plugin-vue (optional)
  • eslint-plugin-vuejs-accessibility (optional)
  • typescript
  • typescript-eslint