/eslint-config

Run Z ESLint configuration

Primary LanguageJavaScriptMIT LicenseMIT

Run Z ESLint Configuration

NPM Build Status GitHub Project

Contains highly opinionated linting rules for TypeScript, JavaScript, and Jest.

Used in Hatsy, proc7ts, run-z, and Wesib projects.

Example Configuration

Add dependencies:

pnpm add -D eslint @run-z/eslint-config
pnpm add -D @typescript-eslint/eslint-plugin @typescript-eslint/parser  # TypeScript support
pnpm add -D eslint-plugin-jest --save-dev  # Jest support

Put the following to .eslintrc.cjs:

module.exports = {
  root: true,
  ignorePatterns: ['node_modules/', 'dist/', 'target/', '*.d.ts'],
  extends: ['@run-z'],
  overrides: [
    // JavaScript
    {
      files: ['*.js', '*.cjs', '*.mjs'],
      env: {
        node: true,
      },
    },
    // TypeScript
    {
      files: ['*.ts'],
      extends: ['@run-z/eslint-config/typescript'],
      parser: '@typescript-eslint/parser',
      parserOptions: {
        project: './tsconfig.json',
      },
      env: {
        browser: true,
      },
    },
    // Tests (Jest-driven)
    {
      files: ['*.spec.ts'],
      extends: ['@run-z/eslint-config/jest'],
      parserOptions: {
        // Dedicated TypeScript configuration for tests
        project: './tsconfig.spec.json',
      },
    },
  ],
};