Linting Your Awesome Lists

airscript

Francesco Sardone

Posted on August 8, 2023

Linting Your Awesome Lists

Contents

Introduction

Hey there! I'm Francesco known as Airscript on the web.
Today I want to share with you how to use awesome-lint, a linter for your Awesome Lists.

Purpose

Awesome Lint was born for helping in standardize and check statically all the Awesome Lists that just try to drop into awesome.

It does a really good job in this for the fact that it is simple to use and usable in so many different ways.
Let's check them all out!

CLI

The first usage that we will see, it is via CLI.
Awesome Lint can be installed via npm or executed using npx:

# Installing through npm
npm install awesome-lint

# Installing temporarily and executing through npx
npx awesome-lint
Enter fullscreen mode Exit fullscreen mode

Then you just need to run it toward one of your repositories, both local or remote:

# If you are into a local repository with a README.md
npx awesome-lint

# If you have installed it globally through npm
awesome-list

# If you don't have the repository locally
awesome-lint https://github.com/airscripts/awesome-steam-deck
Enter fullscreen mode Exit fullscreen mode

At last the command will output something like this:

āœ– Linting

  README.md:1:1
  āœ–   1:1  Git repository must be at least 30 days old  remark-lint:awesome-git-repo-age
  āœ–   1:1  Forbidden license section found              remark-lint:awesome-license
  āœ–  24:1  Table of Contents must be the first section  remark-lint:awesome-toc

  3 errors
Enter fullscreen mode Exit fullscreen mode

Continuous Integration

You can also run everything inside your CI pipelines by making sure that your list adheres to the standards after every change.

Just make sure to create the workflow in .github/workflows/main.yml, starting from the root of your project, with the following contents:

name: ci

on:
  pull_request:
    branches: [main]

jobs:
  lint:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

        with:
          fetch-depth: 0

      - run: npx awesome-lint
Enter fullscreen mode Exit fullscreen mode

API

Awesome Lint also exposes an API that you can use inside of your projects.
Just make sure to first install into your project awesome-lint:

npm install awesome-lint
Enter fullscreen mode Exit fullscreen mode

And after that, you can use it with these two small lines of code:

const awesomeLint = require('awesome-lint');
awesomeLint.report();
Enter fullscreen mode Exit fullscreen mode

The report function just returns the lint output as we have seen previously in CLI section.

Conclusion

So, wrapping up we have seen what Awesome Lint is, how we can use it and how we can integrate it in our automation workflows.
I hope that everything was clear and informative to you.
Thank you kindly for reading this post and I will see you onto the next one!

Share Support

If you have liked this post, just come and tell me!
Are you too shy for doing this? No problem. Just visit airscript.it and share your support following me on your preferred social platform.
If you want to make me even happier, just follow, share or star me and my projects on GitHub.

šŸ’– šŸ’Ŗ šŸ™… šŸš©
airscript
Francesco Sardone

Posted on August 8, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Linting Your Awesome Lists
awesome Linting Your Awesome Lists

August 8, 2023