Skip to content

gdlol/eslint-flat-config-gitignore

Repository files navigation

eslint-flat-config-gitignore

NPM Badge AppVeyor Badge Codecov Badge License Badge

ESLint flat config for ignoring files listed in .gitignore.

Usage

import eslint from "@eslint/js";
import prettier from "eslint-config-prettier";
import { gitignore } from "eslint-flat-config-gitignore";
import tsESLint from "typescript-eslint";

export default tsESLint.config(
  await gitignore(import.meta.dirname),
  eslint.configs.recommended,
  {
    files: ["**/*.{ts,tsx,cts,mts}"],
    extends: [...tsESLint.configs.recommendedTypeChecked, ...tsESLint.configs.stylisticTypeChecked],
    languageOptions: { parserOptions: { project: true, tsConfigRootDir: import.meta.dirname } },
    rules: {
      "@typescript-eslint/consistent-type-exports": "error",
      "@typescript-eslint/consistent-type-imports": "error",
    },
  },
  prettier,
);

Example in this repo