New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@lobehub/eslint-config

Package Overview
Dependencies
Maintainers
6
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lobehub/eslint-config

ESLint Flat Config configuration for LobeHub projects

latest
Source
npmnpm
Version
2.1.5
Version published
Maintainers
6
Created
Source

@lobehub/eslint-config

ESLint Flat Config configuration for LobeHub projects

Features

  • ESLint 9+ Flat Config
  • TypeScript support with type-aware rules
  • React / React Native / Next.js / Remix support
  • Next.js ESLint rules (@next/eslint-plugin-next)
  • Import sorting with simple-import-sort
  • Interface and enum key sorting with perfectionist
  • Unicorn best practices
  • Accessibility rules (jsx-a11y)
  • React Compiler support

Installation

pnpm add -D @lobehub/eslint-config eslint typescript

Usage

Create eslint.config.js (or eslint.config.mjs) in your project root:

import { defineConfig } from '@lobehub/eslint-config';

export default defineConfig();

With React (Next.js)

import { defineConfig } from '@lobehub/eslint-config';

export default defineConfig({
  react: 'next',
  next: true,
});

With React Native

import { defineConfig } from '@lobehub/eslint-config';

export default defineConfig({
  react: 'expo',
  reactNative: true,
});

With Type-Checked Rules

import { defineConfig } from '@lobehub/eslint-config';

export default defineConfig({
  typescript: 'strict',
  typeChecked: true,
});

With Experimental Decorators

import { defineConfig } from '@lobehub/eslint-config';

export default defineConfig({
  parserOptions: {
    emitDecoratorMetadata: true,
    experimentalDecorators: true,
  },
});

Full Options

import { defineConfig } from '@lobehub/eslint-config';

export default defineConfig({
  // TypeScript support: true | false | 'strict'
  typescript: true,

  // Enable type-aware rules (requires tsconfig)
  typeChecked: false,

  // Custom tsconfig path
  tsconfigPath: './tsconfig.json',

  // React support: true | false | 'next' | 'remix' | 'vite' | 'expo'
  react: false,

  // React Native support
  reactNative: false,

  // React Compiler rules
  reactCompiler: false,

  // Accessibility rules (requires react)
  a11y: false,

  // Import sorting
  sortImports: true,

  // Interface and enum key sorting
  sortKeys: true,

  // Stylistic rules (jsx-sort-props, etc.)
  stylistic: true,

  // Regexp optimization rules
  regexp: true,

  // Additional ignore patterns
  ignores: ['**/dist/**'],
});

Custom Rule Overrides

Use rest parameters to add custom configurations with higher priority:

import { defineConfig } from '@lobehub/eslint-config';

export default defineConfig(
  { react: 'next' },
  // Global rule overrides
  {
    rules: {
      'no-console': 'warn',
    },
  },
  // File-specific overrides
  {
    files: ['**/test/**', '**/*.test.ts', '**/*.spec.ts'],
    rules: {
      'no-console': 'off',
      '@typescript-eslint/no-explicit-any': 'off',
    },
  },
  {
    files: ['**/scripts/**'],
    rules: {
      'unicorn/no-process-exit': 'off',
    },
  },
);

Complex Configuration Example

import { defineConfig } from '@lobehub/eslint-config';

export default defineConfig(
  {
    react: 'next',
    typescript: 'strict',
  },
  // Relax rules for test files
  {
    files: ['**/*.test.ts', '**/*.test.tsx', '**/test/**'],
    rules: {
      '@typescript-eslint/no-explicit-any': 'off',
      '@typescript-eslint/no-non-null-assertion': 'off',
    },
  },
  // Relax rules for scripts
  {
    files: ['scripts/**'],
    rules: {
      'no-console': 'off',
      'unicorn/no-process-exit': 'off',
    },
  },
  // Relax rules for config files
  {
    files: ['*.config.ts', '*.config.js'],
    rules: {
      'unicorn/no-anonymous-default-export': 'off',
    },
  },
);

Options Reference

OptionTypeDefaultDescription
typescriptboolean | 'strict'trueEnable TypeScript rules
typeCheckedbooleanfalseEnable type-aware rules
tsconfigPathstring | string[]-Custom tsconfig path
parserOptionsParserOptions-TypeScript parser options
reactboolean | 'next' | 'remix' | 'vite' | 'expo'falseEnable React rules
reactNativebooleanfalseEnable React Native rules
reactCompilerbooleanfalseEnable React Compiler rules
nextbooleanfalseEnable Next.js ESLint rules
a11ybooleanfalseEnable accessibility rules
sortImportsbooleantrueEnable import sorting
sortKeysbooleantrueEnable interface/enum/jsx sorting
stylisticbooleantrueEnable stylistic rules
regexpbooleantrueEnable regexp rules
ignoresstring[][]Additional ignore patterns

API

function defineConfig(options?: Options, ...configs: FlatConfig[]): FlatConfigArray;
  • options - Configuration options (see table above)
  • ...configs - Additional flat configs to append (highest priority)

Requirements

  • Node.js >= 18
  • ESLint >= 9.0.0
  • TypeScript >= 5.0.0 (optional)

License

MIT © LobeHub

FAQs

Package last updated on 13 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts