Skip to content

eglove/eslint-config-ethang

Repository files navigation

Relentless. Unapologetic.

View Config

Caution

Do not use this with Prettier! Styling rules are included.

Add Even More!

Install

pnpm i -D eslint typescript-eslint @ethang/eslint-config

Requires TypesScript and tsconfig.json at root directory.

Config

In eslint.config.js

import config from "@ethang/eslint-config/eslint.config.js";
import tseslint from "typescript-eslint";
import astroConfig from "@ethang/eslint-config/config.astro.js"; // OPTIONAL
import reactConfig from "@ethang/eslint-config/config.react.js"; // OPTIONAL

export default tseslint.config(
  {
    ignores: [], // Ignored files apply to all following configs
  },
  ...config,
  ...astroConfig,
  ...reactConfig,
  {
    languageOptions: {
      parserOptions: {
        project: true,
        tsconfigRootDir: import.meta.dirname,
      },
    },
    rules: {
      // Override rules from above configs
    },
  },
);

Scripts

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

Browserslist

This config will also lint for browserslist features. Make sure to set this in package.json. More info.

"browserslist": [
  "defaults and fully supports es6-module",
  "maintained node versions"
]