Documentation for Simbo's Packages
    Preparing search index...

    Module @simbo/eslint-config - v2.0.2

    Simbo's ESLint Configurations

    📦 @simbo/eslint-config

    Shared ESLint configurations for different environments and technology stacks with utilities for configuration customization.

    9️⃣ Requires ESLint v9+ ("flat config" format).

    This package includes a curated set of ESLint-related dependencies:

    Installing @simbo/eslint-config automatically includes these dependencies — you do not need to add them separately.

    Install ESLint and @simbo/eslint-config from the npm registry:

    npm i -D eslint @simbo/eslint-config
    

    Add one or more configurations to your eslint configuration file (e.g. eslint.config.ts).

    See examples below, or consult the API reference.

    Tip


    Inspect and debug your configuration with the ESLint Config Inspector:

    npx @eslint/config-inspector@latest --config=./eslint.config.ts
    

    All configuration exports are ConfigsRecord objects.

    A ConfigsRecord provides the following environments and variations:

    import type { Linter } from 'eslint';

    interface ConfigsRecord {
    node: {
    recommended: Linter.Config[]; // Recommended for Node.js projects
    };
    browser: {
    recommended: Linter.Config[]; // Recommended for browser projects
    };
    }

    ⭐️ Use the all-in-one configs export, which combines all configuration supersets:

    import { configs } from '@simbo/eslint-config';
    

    Each of the following supersets extends curated third-party configurations:

    • Overrides tailored for spec files and mocks.
      Exported as testingConfigs

      import { testingConfigs } from '@simbo/eslint-config/testing';
      

    Utilities can be imported from either @simbo/eslint-config or @simbo/eslint-config/utils.

    Using the recommended configuration for Node.js projects:

    import { configs, globals } from '@simbo/eslint-config';
    import { defineConfig, globalIgnores } from 'eslint/config';

    export default defineConfig([
    globalIgnores(['**/dist/', '**/coverage/']),
    {
    // Set up language options for TypeScript with globals for Node.js.
    languageOptions: {
    globals: { ...globals.node },
    parserOptions: {
    project: ['./tsconfig.json'],
    tsconfigRootDir: import.meta.dirname,
    allowDefaultProject: ['*.config.js', '.*.js'],
    },
    },
    // Extend the recommended Node.js configuration.
    extends: [configs.node.recommended],
    rules: {
    // Your rule overrides can be added here.
    },
    },
    // Additional configurations can be added here.
    ]);

    Using the recommended configuration for browser projects:

    import { configs, globals } from '@simbo/eslint-config';
    import { defineConfig, globalIgnores } from 'eslint/config';

    export default defineConfig([
    globalIgnores(['**/dist/', '**/coverage/']),
    {
    // Set up language options for TypeScript with globals for browser.
    languageOptions: {
    globals: { ...globals.browser },
    parserOptions: {
    project: ['./tsconfig.json'],
    tsconfigRootDir: import.meta.dirname,
    allowDefaultProject: ['*.config.js', '.*.js'],
    },
    },
    // Extend the recommended browser configuration.
    extends: [configs.browser.recommended],
    rules: {
    // Your rule overrides can be added here.
    },
    },
    // Additional configurations can be added here.
    ]);

    In this example, we create a combined configuration for a browser environment with support for JavaScript, TypeScript, and Prettier.

    import { eslintJsConfigs } from '@simbo/eslint-confi^g/eslint-js';
    import { typescriptEslintConfigs } from '@simbo/eslint-config/typescript-eslint';
    import { prettierConfigs } from '@simbo/eslint-config/prettier';
    import { globals } from '@simbo/eslint-config';
    import { defineConfig, globalIgnores } from 'eslint/config';

    export default defineConfig([
    globalIgnores(['**/dist/', '**/coverage/']),
    {
    // Set up language options for TypeScript with globals for browser.
    languageOptions: {
    globals: { ...globals.browser },
    parserOptions: {
    project: ['./tsconfig.json'],
    tsconfigRootDir: import.meta.dirname,
    allowDefaultProject: ['*.config.js', '.*.js'],
    },
    },
    // Extend combinable configuration supersets for browser.
    extends: [
    eslintJsConfigs.browser.recommended,
    typescriptEslintConfigs.browser.recommended,
    prettierConfigs.recommended,
    ],
    rules: {
    // Your rule overrides can be added here.
    },
    },
    // Additional configurations can be added here.
    ]);

    MIT © Simon Lepel

    Modules

    eslint-js
    jsdoc
    n
    prettier
    testing
    typescript-eslint
    unicorn
    utils