JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q86937F
  • License ISC

Development configuration package for ThalorLabs projects including ESLint, Prettier, Jest, and TypeScript configs

Package Exports

  • @thalorlabs/dev-config
  • @thalorlabs/dev-config/eslint
  • @thalorlabs/dev-config/jest
  • @thalorlabs/dev-config/jest-setup

Readme

@thalorlabs/dev-config

A comprehensive development configuration package for ThalorLabs projects, providing standardized ESLint, Prettier, Jest, and TypeScript configurations.

Installation

npm install --save-dev @thalorlabs/dev-config

Features

  • ESLint Configurations - TypeScript and React-specific linting rules
  • Prettier Integration - Code formatting with ESLint integration
  • Jest Configuration - Testing setup with TypeScript support
  • TypeScript Configs - Strict TypeScript configurations for different project types
  • Consistent Standards - Enforced code quality and style across all ThalorLabs projects
  • Zero Configuration - Works out of the box with sensible defaults

Quick Start

1. Install the Package

npm install --save-dev @thalorlabs/dev-config

2. Configure ESLint

Create an .eslintrc.js file in your project root:

module.exports = {
  extends: ['@thalorlabs/dev-config'],
  // Your project-specific overrides
};

Alternative: You can also use the specific ESLint export:

module.exports = {
  extends: ['@thalorlabs/dev-config/eslint'],
  // Your project-specific overrides
};

Note: Both @thalorlabs/dev-config and @thalorlabs/dev-config/eslint work correctly and are much cleaner than the verbose path ./node_modules/@thalorlabs/dev-config/configs/.eslintrc.json

3. Configure Jest

Create a jest.config.js file:

module.exports = require('@thalorlabs/dev-config/jest');

Or if you need the setup file as well:

module.exports = {
  ...require('@thalorlabs/dev-config/jest'),
  setupFilesAfterEnv: ['<rootDir>/jest.setup.js']
};

Then create a jest.setup.js file:

require('@thalorlabs/dev-config/jest-setup');

Available Configurations

ESLint Configuration

@thalorlabs/dev-config/eslint

ESLint configuration for TypeScript projects with:

  • TypeScript-specific rules
  • Code quality rules
  • Security rules
  • Performance rules
  • Import sorting
  • Unused imports detection
  • Complexity limits

Jest Configuration

@thalorlabs/dev-config/jest

Jest configuration with:

  • TypeScript support via ts-jest
  • Coverage reporting (100% threshold)
  • Test environment setup
  • Module resolution with path mapping
  • Mock utilities

@thalorlabs/dev-config/jest-setup

Jest setup file with:

  • Global test utilities
  • Mock helpers for MongoDB/Mongoose
  • Console mocking
  • Test environment configuration

Usage Examples

Basic TypeScript Project

// .eslintrc.js
module.exports = {
  extends: ['@thalorlabs/dev-config/eslint'],
};

// jest.config.js
module.exports = require('@thalorlabs/dev-config/jest');

// jest.setup.js (optional)
require('@thalorlabs/dev-config/jest-setup');

Custom Overrides

You can extend and override any configuration:

// .eslintrc.js
module.exports = {
  extends: ['@thalorlabs/dev-config/eslint'],
  rules: {
    // Override specific rules
    '@typescript-eslint/no-explicit-any': 'off',
    'no-console': 'off',
  },
  overrides: [
    {
      files: ['**/*.test.ts'],
      rules: {
        // Test-specific overrides
        '@typescript-eslint/no-explicit-any': 'off',
      },
    },
  ],
};

Package Scripts

Add these scripts to your package.json:

{
  "scripts": {
    "lint": "eslint . --ext .ts,.js,.tsx,.jsx",
    "lint:fix": "eslint . --ext .ts,.js,.tsx,.jsx --fix",
    "format": "prettier --write .",
    "format:check": "prettier --check .",
    "test": "jest",
    "test:watch": "jest --watch",
    "test:coverage": "jest --coverage",
    "type-check": "tsc --noEmit"
  }
}

Configuration Details

ESLint Rules

The ESLint configurations include:

  • TypeScript Rules: Strict type checking and best practices
  • Code Quality: Complexity limits, function length limits
  • Import/Export: Consistent import/export patterns
  • Prettier Integration: Automatic formatting on save
  • Accessibility: JSX accessibility rules (React config)

Prettier Settings

  • Semi-colons: Always required
  • Quotes: Single quotes for strings
  • Trailing Commas: ES5 compatible
  • Tab Width: 2 spaces
  • Print Width: 80 characters

Jest Settings

  • TypeScript Support: Via ts-jest transformer
  • Coverage: HTML and text coverage reports
  • Test Environment: Node.js environment
  • Module Resolution: Supports path mapping

TypeScript Settings

  • Strict Mode: All strict checks enabled
  • Target: ES2020
  • Module: CommonJS (configurable)
  • Declaration Files: Generated for library projects
  • Source Maps: Enabled for debugging

IDE Integration

VS Code

Install these extensions for the best experience:

{
  "recommendations": [
    "esbenp.prettier-vscode",
    "dbaeumer.vscode-eslint",
    "ms-vscode.vscode-typescript-next"
  ]
}

Add to your VS Code settings:

{
  "editor.formatOnSave": true,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },
  "eslint.validate": ["javascript", "typescript", "javascriptreact", "typescriptreact"]
}

Migration Guide

From Existing Configurations

  1. Backup your current configuration files
  2. Install the dev-config package
  3. Replace your config files with the new ones
  4. Test your build and lint processes
  5. Adjust any project-specific overrides

From Old Import Syntax

If you're currently using the verbose import path, update to the simpler syntax:

// OLD - Verbose path (still works but not recommended)
module.exports = {
  extends: [
    "./node_modules/@thalorlabs/dev-config/configs/.eslintrc.json"
  ]
};

// NEW - Simple imports (recommended)
module.exports = {
  extends: ['@thalorlabs/dev-config']
};

// OR use the specific ESLint export
module.exports = {
  extends: ['@thalorlabs/dev-config/eslint']
};

Important: Both @thalorlabs/dev-config and @thalorlabs/dev-config/eslint are now fully functional and are the recommended ways to use this package.

Common Migrations

ESLint Migration

// Old .eslintrc.js
module.exports = {
  extends: ['@typescript-eslint/recommended'],
  // ... many custom rules
};

// New .eslintrc.js
module.exports = {
  extends: ['@thalorlabs/dev-config/eslint'],
  // Only project-specific overrides
};

Prettier Migration

// Old .prettierrc.js
module.exports = {
  semi: true,
  singleQuote: true,
  // ... many custom settings
};

// New .prettierrc.js
module.exports = require('@thalorlabs/dev-config/prettier');

Contributing

Adding New Rules

  1. Test the rule in multiple projects
  2. Document the reasoning behind the rule
  3. Update this README with examples
  4. Version the change appropriately

Configuration Updates

  1. Backward Compatibility: Maintain compatibility when possible
  2. Breaking Changes: Use semantic versioning
  3. Documentation: Update all relevant documentation
  4. Testing: Test across different project types

Troubleshooting

Common Issues

ESLint Errors

# Clear ESLint cache
npx eslint --cache-location .eslintcache --clear-cache

TypeScript Errors

# Clear TypeScript cache
npx tsc --build --clean

Prettier Conflicts

# Check for conflicting rules
npx eslint-config-prettier .eslintrc.js

Getting Help

  • Issues: GitHub Issues
  • Documentation: Check this README and inline comments
  • Support: Contact the ThalorLabs development team

License

ISC

Changelog

v1.1.8

  • FIXED: ESLint configuration resolution - now works with both @thalorlabs/dev-config and @thalorlabs/dev-config/eslint
  • Added main export (index.js) for better ESLint compatibility
  • Updated documentation with multiple import options
  • Improved package structure for ESLint module resolution

v1.1.7

  • BREAKING: Simplified import syntax - use @thalorlabs/dev-config/eslint instead of verbose paths
  • Updated documentation with migration guide
  • Improved package exports for cleaner imports

v1.0.0

  • Initial release with ESLint, Prettier, Jest, and TypeScript configurations
  • Support for both TypeScript and React projects
  • Comprehensive documentation and examples