Skip to content

JanSzewczyk/eslint-config

Repository files navigation

@szum-tech/eslint-config

GitHub release (latest by date) GitHub pull requests GitHub issues GitHub Repo stars

πŸš€ publish CodeQL πŸ“ˆ

npm npm

Conventional Commits MIT License


A shared configuration is an NPM package that exports a configuration as an array. It's super convenient for anyone to use, because the configuration dynamically adapts to the needs of the project.

✨ Ready for ESLint v10! This configuration uses the modern flat config format and is compatible with ESLint v9.x. Full ESLint v10 support will be added once the ecosystem plugins (especially typescript-eslint) release compatible versions.

πŸ“š Features

πŸ“– Table of Contents

🎯 Getting Started

βš™οΈ Installation

@szum-tech/eslint-config is available as npm package.

Requirements:

  • ESLint v9.0.0 or higher
  • Node.js v20.x+ / v22.x+ / v24.x+
# NPM
npm install --save-dev eslint@latest @szum-tech/eslint-config

# YARN
yarn add -D eslint@latest @szum-tech/eslint-config

# PNPM
pnpm add --save-dev eslint@latest @szum-tech/eslint-config

# BUN
bun add --dev eslint@latest @szum-tech/eslint-config

Configuration

This package uses the ESLint Flat Config format introduced in ESLint v9 and required in ESLint v10. The legacy .eslintrc format is not supported.

A @szum-tech/eslint-config is an npm package that exports a configuration array that automatically adapts to your project's dependencies.

Configuration file: eslint.config.(js|cjs|mjs)

Simple Usage

Export the entire configuration as-is:

// eslint.config.mjs
export { default } from "@szum-tech/eslint-config";

Extended Configuration

@szum-tech/eslint-config is flexible enough to allow for configuration extensions. Use the spread operator to insert the configuration into your array:

// eslint.config.mjs
import szumTechEslintConfig from "@szum-tech/eslint-config";

export default [
  ...szumTechEslintConfig,

  // Your custom modifications
  {
    rules: {
      "no-unused-vars": "warn"
    }
  }
];

CommonJS Format

For projects using CommonJS:

// eslint.config.cjs
const szumTechEslintConfig = require("@szum-tech/eslint-config");

module.exports = [
  ...szumTechEslintConfig,

  // Your custom modifications
  {
    rules: {
      "no-unused-vars": "warn"
    }
  }
];

Note: The configuration automatically detects which libraries are installed in your project (React, TypeScript, Next.js, Vitest, etc.) and enables the appropriate ESLint plugins and rules.

πŸ’» Scripts

Suggested scripts you can add to package.json file:

{
  "scripts": {
    "lint": "eslint .",
    "lint:ci": "eslint . -o eslint-results.sarif -f @microsoft/eslint-formatter-sarif",
    "lint:fix": "eslint . --fix",
    "lint:inspect": "npx @eslint/config-inspector@latest"
  }
}

Scripts description:

  • lint: Lints the code using ESLint
  • lint:ci: Lints the code using ESLint for CI - uses a @microsoft/eslint-formatter-sarif output format for report generation
  • lint:fix: Automatically fixes linting errors
  • lint:inspect: Launches a visual representation of the ESLint configuration file (check http://localhost:7777 in your browser). Allows you to navigate through the rules, plugins, and language configurations that are enabled or disabled

πŸš€ Minimal GitHub ESLint check workflow

Here are the minimal steps required to run an ESLint check. Creating or adding any content to a PR will trigger this event. Not only will this action validate the code and return its results, but it will also add highlighted parts of the code that have an error to the comments under the PR thanks to the Upload ESLint results to GitHub step, which uses github/codeql-action/upload-sarif.

name: PR Checks βœ…

on:
  pull_request:

jobs:
  lint:
    name: ESLint ⬣
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        node-version: [24.x] # Use Node.js 20+, 22+, or 24+
        os: [ubuntu-latest]
    steps:
      - name: Checkout code πŸ“š
        uses: actions/checkout@v4
      - name: Set up Node 🟒
        uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node-version }}
          cache: "npm"
      - name: Install dependencies βš™οΈ
        run: npm ci
      - name: ESLint Check ⬣
        run: npm run lint:ci
        continue-on-error: true
      - name: Upload ESLint results to GitHub
        uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: eslint-results.sarif
          wait-for-processing: true

πŸ› οΈ Developer Info

Dependencies

NPM (prod) Dependency Version NPM (prod) Dependency Version NPM (prod) Dependency Version NPM (prod) Dependency Version NPM (prod) Dependency Version NPM (prod) Dependency Version NPM (prod) Dependency Version NPM (prod) Dependency Version NPM (prod) Dependency Version NPM (prod) Dependency Version NPM (prod) Dependency Version NPM (prod) Dependency Version NPM (prod) Dependency Version

πŸ“’ Changelog

The changelog is regularly updated to reflect what's changed in each new release.

πŸ“œ License

This project is licensed under the terms of the MIT license.

About

ESLint shareable config for the JavaScript/TypeScript/React style guide compliant with the Szum-Tech standards.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors