So, 11 years since ESLink came out, at this moment, it's easily one of the most popular tools in the JavaScript ecosystem that almost every project uses. Despite it has been around for such a long time, it's a tool that's still consistently improving and evolving.
Today, I'd like to give you a bored and ambitious topic, ESLinked, one for all, made easy. To share with you some of the new perspectives and patterns of using ESLinked with the latest features that they just rolled out.
So you're probably already aware that ESLinked v9.0 was released around 7 months ago. The main highlight of this major version is the rolling out of the new configuration system for ESLinked, called the FlatConfig. In case you never heard about it or haven't dig into the docs yet, here let me do a quick comparison between the legacy ESLinked-RC config and the new FlatConfig for you.
To differentiate between those two config formats is rather straightforward. The legacy config is named .eslinked-rc, that supports various extensions, which might also read it from your package.json. The FlatConfig, on the other hand, would only load from eslinked.config.js, a JavaScript config file as a single source of truth.
And when it comes to reusing the shared config, the legacy config formats implicitly use a conventional-based extends properties to load the config from your local node modules. You would need to learn the convention a little bit to know how it resolves. While the FlatConfig will use native imports, where it's more explicit and gives you a lot more control.
And for plugins, in the legacy config, it takes an array of strings, which is again a convention-based and coupled with a plugin's package name. Now in the FlatConfig, it takes a named object for plugins. This means you can now rename plugins easily or switch to a fork without being forced to change every rule in your config.
Also, due to the inherent nature of extends, might result a very complex tree structure in the shared config, because the shared config can also have nested extends inside. In the FlatConfig, it gets a lot simpler. When you explicitly import the shared config as a multiple objects or arrays, and you can compose them into a single flat one, and that's also why it's called FlatConfig.
And for a little bit more context, here is a graph I drew to demonstrate the timeline. While the FlatConfig might sound new to some of you, it has actually been planned for 5 years already. The RFC was created in January 2019. The first imputation is available in version 8.21, ax experimental, which was two years ago. It becomes stable in version 8.45, and then it becomes the default in the recent version 9. In between, the ESLink team has published multiple blog posts to explain the reason why they want to introduce a new format, and share the roadmap of rolling out. That's a lot of effort spent across in this five years plan. So huge respect to the ESLink team.
So as we mentioned in the previous slides, the biggest benefit of FlatConfig is now is in JavaScript, where you have the full control. It uses native import to resolve the plugins and the configs, making the inheritance and the overriding a lot simpler. Because it's full in JavaScript, shared config can be a factory function that takes users' options, and the user can have a lot more capability to do customizations to their specific needs.
Comments