CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-eslint-config-love

A TypeScript ESLint shareable configuration that prioritizes safety over verbosity and provides comprehensive linting rules for TypeScript projects

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

ESLint Config Love

ESLint Config Love is a comprehensive TypeScript ESLint shareable configuration that prioritizes safety over verbosity. It provides a complete, opinionated linting setup for TypeScript projects, excluding framework-specific rules and formatting rules while covering all areas not handled by strict TypeScript compilation.

Package Information

  • Package Name: eslint-config-love
  • Package Type: npm
  • Language: TypeScript
  • Installation: npm install eslint-config-love

Peer Dependencies

Required peer dependencies that must be installed:

  • eslint (^9.12.0)
  • typescript (*)

Core Imports

ESM (ECMAScript Modules):

import love from 'eslint-config-love';

CommonJS:

module.exports = (async function config() {
  const { default: love } = await import('eslint-config-love');
  return love;
})();

Basic Usage

import love from 'eslint-config-love';

export default [
  {
    ...love,
    files: ['**/*.js', '**/*.ts'],
  },
];

For CommonJS projects:

module.exports = (async function config() {
  const { default: love } = await import('eslint-config-love');
  
  return [
    {
      ...love,
      files: ['**/*.js', '**/*.ts'],
    },
  ];
})();

Architecture

ESLint Config Love combines rules from multiple popular ESLint plugins into a single, cohesive configuration:

  • Core ESLint Rules: Fundamental JavaScript/TypeScript linting rules
  • TypeScript ESLint: TypeScript-specific rules from @typescript-eslint plugin
  • Import Rules: ES6 import/export validation via eslint-plugin-import
  • Node.js Rules: Node.js best practices via eslint-plugin-n
  • Promise Rules: Promise handling via eslint-plugin-promise
  • Comment Rules: ESLint directive management via eslint-plugin-eslint-comments

The configuration automatically sets up TypeScript parsing with project service support and enforces strict reporting of unused disable directives.

Capabilities

Default Configuration

The main export provides a complete ESLint flat config object ready for use.

interface TSESLint.FlatConfig.Config {
  linterOptions: {
    reportUnusedDisableDirectives: 'error';
  };
  languageOptions: {
    parser: TSESLint.FlatConfig.Parser;
    parserOptions: {
      projectService: true;
    };
  };
  plugins: Record<string, TSESLint.FlatConfig.Plugin>;
  rules: Record<string, TSESLint.SharedConfig.RuleEntry>;
}

declare const config: TSESLint.FlatConfig.Config;
export default config;

The configuration includes:

  • Linter Options: Reports unused ESLint disable directives as errors
  • Language Options: Uses TypeScript parser with automatic project detection via projectService: true
  • Plugins: Includes all necessary ESLint plugins for comprehensive TypeScript linting
  • Rules: 274 carefully configured rules covering:
    • Core JavaScript/TypeScript best practices
    • Type safety and null checks
    • Import/export management
    • Node.js compatibility
    • Promise handling
    • ESLint directive usage

Rule Categories

The configuration covers these areas:

TypeScript Rules (142 rules):

  • Type annotations and inference
  • Consistent type definitions
  • Null/undefined safety
  • Generic usage
  • Interface and type definitions
  • Method signatures

Core ESLint Rules (110 rules):

  • Variable declarations and scoping
  • Function definitions and usage
  • Control flow and complexity
  • Object and array handling
  • Error handling patterns

Import/Export Rules (6 rules):

  • Module import/export validation
  • Node.js protocol enforcement
  • Duplicate import detection
  • Path validation

Node.js Rules (7 rules):

  • Callback error handling
  • Deprecated API detection
  • Module resolution
  • Process handling

Promise Rules (2 rules):

  • Promise constructor usage
  • Parameter naming conventions

Comment Rules (7 rules):

  • ESLint directive management
  • Disable/enable pair validation
  • Comment descriptions

Configuration Details

Parser Configuration

The configuration automatically sets up TypeScript parsing:

languageOptions: {
  parser, // imported from 'typescript-eslint'
  parserOptions: {
    projectService: true, // Automatic project detection
  },
}

The projectService: true option enables automatic TypeScript project detection, eliminating the need to manually specify tsconfig.json paths.

Rule Strictness

This configuration prioritizes safety over convenience:

  • Most rules are set to 'error' level rather than 'warn'
  • Strict type checking is enforced where TypeScript compilation doesn't cover
  • Unused disable directives are reported as errors
  • Comprehensive coverage of potential issues and anti-patterns

Extensibility

The exported configuration object can be extended or overridden:

import love from 'eslint-config-love';

export default [
  {
    ...love,
    files: ['**/*.ts'],
    rules: {
      ...love.rules,
      // Override specific rules
      '@typescript-eslint/no-unused-vars': 'warn',
    },
  },
];

Error Handling

The configuration does not throw runtime errors. All validation occurs during ESLint execution. Common issues:

  • Missing TypeScript: Ensure TypeScript is installed as a peer dependency
  • Missing ESLint: Ensure ESLint ^9.12.0 is installed
  • Project Detection: The projectService: true option requires a valid TypeScript project (tsconfig.json)

Types

// Re-exported from @typescript-eslint/utils
interface TSESLint.FlatConfig.Config {
  linterOptions?: {
    reportUnusedDisableDirectives?: 'error' | 'warn' | 'off';
  };
  languageOptions?: {
    parser?: TSESLint.FlatConfig.Parser;
    parserOptions?: {
      projectService?: boolean;
      [key: string]: any;
    };
  };
  plugins?: Record<string, TSESLint.FlatConfig.Plugin>;
  rules?: Record<string, TSESLint.SharedConfig.RuleEntry>;
}

type TSESLint.SharedConfig.RuleEntry = 
  | 'error' 
  | 'warn' 
  | 'off' 
  | ['error' | 'warn' | 'off', ...any[]];

interface TSESLint.FlatConfig.Plugin {
  rules?: Record<string, TSESLint.RuleModule<any, any>>;
  processors?: Record<string, TSESLint.Processor>;
  configs?: Record<string, TSESLint.FlatConfig.Config>;
}

interface TSESLint.FlatConfig.Parser {
  parse(text: string, options?: any): TSESTree.Program;
  parseForESLint?(text: string, options?: any): TSESLint.ESLintParseResult;
}

Install with Tessl CLI

npx tessl i tessl/npm-eslint-config-love
Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/eslint-config-love@122.0.x
Publish Source
CLI
Badge
tessl/npm-eslint-config-love badge