Linting Your Awesome Lists
Tags: awesome, linter, terminal, opensource
Published: 2023-08-08 08:00:00

## Contents
- [Introduction](#introduction)
- [Purpose](#purpose)
- [CLI](#cli)
- [Continuous Integration](#continuous-integration)
- [API](#api)
- [Conclusion](#conclusion)
- [Share Support](#share-support)

## Introduction
Hey there! I'm Francesco known as Airscript on the web.
Today I want to share with you how to use [awesome-lint](https://github.com/sindresorhus/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](https://github.com/sindresorhus/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`:
```bash
# Installing through npm
npm install awesome-lint

# Installing temporarily and executing through npx
npx awesome-lint
```

Then you just need to run it toward one of your repositories, both local or remote:
```bash
# 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
```

At last the command will output something like this:
```bash
✖ 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
```

## 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:
```yaml
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
```

## 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:
```bash
npm install awesome-lint
```

And after that, you can use it with these two small lines of code:
```javascript
const awesomeLint = require('awesome-lint');
awesomeLint.report();
```

The report function just returns the lint output as we have seen previously in [CLI](#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](https://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](https://github.com/airscripts).