How to create your first ESLint Plugin [Week in Review]
Tags: eslint, linter, prettier, javascript
Published: 2021-01-17 18:25:31

---
canonical_url: https://blog.natterstefan.me/how-to-create-your-first-eslint-plugin-week-in-review
---

Hello 👋🏻.

The last two weeks have been relatively hectic for me. Starting a company at the beginning of this year has created a lot of administrative and bureaucratic tasks that keep me from Twitter as well as from coding. At the same time, it has become clear that it can go relatively quickly until self-employment picks up. I've always been a big fan of building a carefully cultivated network of contacts. This has moved me forward several times in life and opened some exciting doors. In fact, I probably wouldn't be at the point I am today if it weren't for many lucky coincidences in my network. For that reason, I can only advise you to take the time to build a network of business contacts. You never know what kind of return on social investment you will get back from it one day. The same is true for Twitter. I spent a considerable amount of time on Twitter last year building a community. Well, I didn't manage to keep the attention span up towards the end of the year, but I'm still proud of my success. With my [nearly 7,000 followers](https://twitter.com/intent/follow?screen_name=natterstefan), I have some reach to ask questions, get insightful answers, [promote YouTube videos](https://youtube.com/natterstefan), or stay up to date. Social networking pays off!

But today it's not about Twitter or vitamin B. Today it's about ESLint plugins and creating your own rules. Let's get started then.

Don't forget to share your thoughts with me on [Twitter](https://twitter.com/intent/follow?screen_name=natterstefan) and sign up for my [newsletter](https://newsletter.natterstefan.me/).

## How to create your first ESLint Plugin

I'm a big fan of a consistent code style within a team, department, or company, respectively. In my opinion, it should not be the case that the teams drift apart too much when it comes to code style. Otherwise, it can be difficult to stick to new rules when you have to help out the other team. Sure the task remains the same, but how the code is written - in terms of style, not content - is important, because once you get used to it you don't want to have it any other way. That's how I feel, for example, when I have to deal with tabs (I'm a spaces developer).

So it's not surprising that I'm pushing the use of Prettier and ESLint in all my projects - and the ones I'm involved in - and taking care of their implementation. As time goes on, it becomes even more important to have a common base of rules and configurations. That's the only way it scales over time. For this reason, I've created both my own [Prettier and ESLint configurations](https://github.com/natterstefan/eslint-config-ns). In a now older [article on Medium](https://natterstefan.medium.com/how-to-create-your-own-shared-eslint-prettier-and-stylelint-configuration-3930dd764de3), I explain step by step how to create and reuse your own ESLint configuration.

Another fan of ESLint, Prettier - and git hooks - is my friend [Barnabas Jovanovic](https://twitter.com/barnabasMJ). We talked weeks ago about whether it would be easier to map certain company rules or learnings into ESLint] rules and make sure they are implemented and followed. And so in our live stream yesterday we started to design our own ESLint plugin with our own rules, test it and publish it on npm.

It was surprisingly easy to create a custom ESLint rule. Basically, much of the work is due to analyzing components of the [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) and declaring them valid or invalid based on one's own set of rules. Take a look at the live streaming recording from my session, the open-source code on GitHub, and the published project on npm.

- [Video: How to create a custom ESLint Plugin enforcing specified import patterns](https://nttr.st/3ilFHuJ)
- [npm: eslint-plugin-lodash-tree-shakeable-import](https://nttr.st/38WVCNb)
- [GitHub: eslint-plugin-lodash-tree-shakeable-import](https://nttr.st/3nOlVsN)

## ⛓ Links of the Week

- You are looking for a hand-drawn annotation for your text, for instance, a text marker? Go and check out: [github.com/rough-stuff/rough-notation](https://github.com/rough-stuff/rough-notation) (thanks [Adithya Sreyaj](https://twitter.com/AdiSreyaj/status/1348705532874379264))
- Tailwind provides some animations out of the box, but it is also not difficult to create your own animations with it. In this 2-minutes-to-read tutorial, Tony Lea explains how to create [Custom Animations in TailwindCSS](https://devdojo.com/tnylea/custom-animations-in-tailwindcss)
- Last week I needed to find and use an [SVG to URL Encoder](https://yoksel.github.io/url-encoder/?ref=natterstefan.me) for a task. This one worked well for me.
- [5 Git Commands That You Probably Aren’t Using Much](https://medium.com/better-programming/5-git-commands-that-you-probably-arent-using-much-5da9a0b95399?ref=natterstefan.me)
- Quickly see your next and upcoming meetings with the macOS app [Next Meeting](https://apps.apple.com/us/app/next-meeting/id1017470484?ref=natterstefan.me).
- CSS Scroll Effects can still be found in and on very many websites. Ahmad Shadeed has written a comprehensive and detailed tutorial on [how you can build a CSS Scroll effect for your website without JavaScript](https://ishadeed.com/article/css-scroll-snap?ref=natterstefan.me). Bookmarked!
I am a fan of CSS artwork. So it's not surprising that I really liked the [iPhone created by Emma Bostian](https://codesandbox.io/s/iphone-ucc0z?file=/src/App.js). And the best part? She did it with [styled-components](https://styled-components.com/?ref=natterstefan.me)!
- Just before the end of 2020, I saw some tweets with the topic "digital reset". Some talked about reducing their following number to 0 and rebuilding in 2021. That sounds exciting in itself, but I don't know if I would be ready for that. I have too many valuable connections in my following list. Speaking of lists, some things could probably be replicated in Twitter lists. However, I was most intrigued by [this tweet](https://twitter.com/anildash/status/1341431610013609985). Anil Dash even goes so far as to update his email address every year. Now that's what I call a digital reset. That would actually be an experiment. Would you do it?
- Are you looking for some inspiration for your personal site? Take a look at [humans.fyi](https://humans.fyi) and get inspired.

## 📺 My latest YouTube Video

{% youtube eJWNYFCrYfI %}

## 🐦 Tweets of the Week

{% twitter 1349055300997824514 %}
{% twitter 1349037729355587587 %}
{% twitter 1348288349656678401 %}
{% twitter 1348023150391431169 %}
{% twitter 1347511568284721155 %}

See you next week - thank you. 👋🏻

Stefan

---

*If you like my [articles](https://blog.natterstefan.me/), you probably like my [tweets](https://twitter.com/intent/follow?screen_name=natterstefan) and [newsletter](https://newsletter.natterstefan.me/) too. Let's stay connected on [Twitter](https://twitter.com/intent/follow?screen_name=natterstefan), [LinkedIn](http://www.linkedin.com/in/natterstefan), and [GitHub](https://github.com/natterstefan).*

---

*This post includes affiliate links; I may receive compensation if you purchase products or services from the different links provided in this article.*