0.1.12 • Published 14 days ago

@jsse/eslint-config v0.1.12

Weekly downloads
-
License
MIT
Repository
-
Last release
14 days ago

@jsse/eslint-config

Version Badge

Eslint config

  • eslint flat config
  • double quotes + semi
  • react, react-hooks & react-refresh, OH MY!
  • no vue (I don't use vue (as of 2023-10-12) don't want/need the vue plugins/parsers/etc)
  • assumes you're using prettier
  • Based on:
    • My old, very long, and very messy (non-flat) eslint config (.eslintrc.js)
    • antfu eslint-config eslint-config
    • sxzz eslint-config eslint-config

Usage

Install

pnpm i -D eslint @jsse/eslint-config

Create config file

With "type": "module" in package.json (recommended):

// eslint.config.js
import jsse from "@jsse/eslint-config";

export default jsse({
    // options
    // typescript: {
    //     tsconfigPath: "tsconfig.json", // or ["tsconfig.json", "tsconfig.eslint.json", ...]
    // },
    // react: true
});

With CJS:

// eslint.config.js
module.exports = require("@jsse/eslint-config").jsse({
    // options
    // typescript: {
    //     tsconfigPath: "tsconfig.json", // or ["tsconfig.json", "tsconfig.eslint.json", ...]
    // },
    // react: true
});

Note that .eslintignore no longer works in Flat config, see customization for more details.

Add script for package.json

For example:

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

Type Aware Rules

You can optionally enable the type aware rules by passing the options object to the typescript config:

// eslint.config.js
import jsse from "@jsse/eslint-config";

export default jsse({
    typescript: {
        tsconfigPath: "tsconfig.json", // or ["tsconfig.json", "tsconfig.eslint.json", ...]
    },
});

Thanks

  • antfu and sxzz for their eslint-configs which this is based on
  • Younger me for being more willing to spend time configuring eslint
  • My fans for being my fans

FAQ

Why use prettier?

I DO NOT CARE ANYMORE... My current stance on formatters is pick one that is stable, and use it, preferably with the default config.

A younger me (jessekrubin) would take the time to configure a formatter/linter/code style to my liking, but I really don't care anymore...

License

MIT License © 2023-PRESENT jesse rubin