Skip to content

An common eslint-config to be shared between the different js/ts rotki repositories

License

Notifications You must be signed in to change notification settings

rotki/eslint-config

Repository files navigation

@rotki/eslint-config

npm (scoped)

A comprehensive ESLint configuration preset for rotki TypeScript and JavaScript repositories. Based on @antfu/eslint-config and inspired by @sxzz/eslint-config.

Table of Contents

Features

  • 📝 TypeScript and JavaScript support
  • 🔧 Auto-fixable rules
  • 🌐 Vue I18n integration
  • ⚡ Editor-aware configurations
  • 🛠️ Preconfigured best practices

Requirements

  • Node.js >=20 < 21
  • ESLint >=9.10.0
  • TypeScript >=5.0.0 (for TypeScript support)

Installation

Using pnpm (recommended):

pnpm add -D eslint @rotki/eslint-config

Using npm:

npm install --save-dev eslint @rotki/eslint-config

Using yarn:

yarn add -D eslint @rotki/eslint-config

Usage

Basic Configuration

Create an eslint.config.ts file in your project root:

import rotki from '@rotki/eslint-config';

// eslint-disable-next-line import/no-default-export
export default rotki();

Add scripts to your package.json:

{
  "scripts": {
    "lint": "eslint .",
    "lint:fix": "eslint . --fix"
  }
}

Vue I18n Support

For projects using Vue I18n, configure the plugin in your eslint.config.ts:

import path from 'node:path';
import rotki from '@rotki/eslint-config';

// eslint-disable-next-line import/no-default-export
export default rotki({
  vueI18n: {
    src: path.join('app', 'src'), // Source directory
    localeDir: 'locales', // Locales directory
    ignores: [], // Ignored paths
  },
});

TypeScript Configuration

For TypeScript projects, specify your tsconfig.json location:

import rotki from '@rotki/eslint-config';

// eslint-disable-next-line import/no-default-export
export default rotki({
  typescript: {
    tsconfigPath: 'tsconfig.json',
  },
});

Editor Integration

This configuration includes special handling for editor environments. The following rules are disabled during editing but enabled during CI/CD:

This improves the development experience while maintaining code quality in production.

Troubleshooting

Common issues and their solutions:

  • If you encounter parsing errors, ensure your TypeScript version matches the requirements
  • For Vue I18n issues, verify your directory structure matches the configuration

Contributing

Contributions are welcome! Please read our Contributing Guide for details.

License

AGPL-3.0 License © 2023- Rotki Solutions GmbH

About

An common eslint-config to be shared between the different js/ts rotki repositories

Resources

License

Stars

Watchers

Forks

Packages

No packages published