If you've ever worked on multiple projects, you know the pain of copying ESLint configurations between repositories. Every time you set up a new project, you're either starting from scratch or copy-pasting that eslint.config.js file from your last project. There's a better way: create your own shareable ESLint config package. Here's mine!
For me, discovering @antfu/eslint-config was a game-changer. The update to "Flat Config" seemed unnecessary to me, until Anthony Fu created something that makes configuring ESLint incredibly simple and extensible.
Instead of juggling dozens of plugins, configurations, and dependencies, you install one package and you're done.
What makes it special:
For my usual stack (Vue + TypeScript), it's undoubtedly the best starting point for configuring ESLint.
Extending antfu's config with my own preferences and plugins is very simple, since it's designed for composing your own configuration. Personally, I'm used to ending lines with semicolons, indenting code with 2 spaces, and displaying the <template> at the top of my .vue files.
But the real power isn't just about subjective preferences. It's about consistency and reusability. Once you publish your own ESLint config as an npm package, you can:
antfu.My configuration @angelblanco/eslint-config is now available to be installed from npm, and on Github so you can check out the source code!
Creating your own ESLint config is relatively straightforward. You can fork my library on Github instead of starting from scratch:
@yourname/eslint-config and the rest of the details.pnpm install.index.ts to match your preferences.pnpm build.npm publish --access public.@yourname/eslint-config, and import it in your projects.For updated documentation, check out the README in my repository. It includes installation instructions, usage examples, and all the specific rules I modified. You can open an issue if you want me to help!
You don't need to reinvent the wheel to create your own ESLint config. Start with something solid like @antfu/eslint-config, customize it to your liking, and share it as a package. It's a great way to start sharing code with the community. The whole process will take you maybe an hour, and then you'll have a centralized, versioned, reusable linting configuration for all your projects.
If you work with Vue and TypeScript, I'd recommend trying antfu or my configuration. If it's not exactly what you're looking for, fork it and make it yours!