Skip to content

Various shared ESLint configurations for Zakodium projects

License

Notifications You must be signed in to change notification settings

zakodium/eslint-config

Repository files navigation

eslint-config-zakodium

Various shared ESLint configurations for Zakodium projects.

Installation

npm install -D eslint-config-zakodium eslint

Configuration

Create a file named eslint.config.mjs at the root of the project and extend the config that you want to use. Example:

import ts from 'eslint-config-zakodium/ts';
import adonisV5 from 'eslint-config-zakodium/adonis-v5';

export default [...ts, ...adonisV5];

Globals

This package re-exports globals for convenience:

import { globals } from 'eslint-config-zakodium';

export default [
  {
    languageOptions: {
      globals: {
        ...globals.node,
      },
    },
  },
];

Monorepo

In a monorepo, you may want to apply different configs for different paths. We re-export the config helper from typescript-eslint for this purpose:

import { config } from 'eslint-config-zakodium';
import ts from 'eslint-config-zakodium/ts';
import adonisV5 from 'eslint-config-zakodium/adonis-v5';
import react from 'eslint-config-zakodium/react';

export default config(
  {
    // Global ignore patterns.
    ignores: ['**/build'],
  },
  // Apply TypeScript config on the whole project.
  ...ts,
  {
    // Apply Adonis v5 config only to the api.
    files: ['api/**'],
    extends: [...adonisV5],
  },
  {
    // Apply React config only to the frontend.
    files: ['front/**'],
    extends: [...react],
  },
);

Available configs