Skip to content

Commit

Permalink
chore: improve Ecosystem.md linter to lint all sections (#4258)
Browse files Browse the repository at this point in the history
* chore: improve `Ecosystem.md` linter to validate all sections

* Cache module name detection boolean to a variable

* Extend ecosystem linter ordering functionality to all sections

* Fix out of order modules in `Core` section in `Ecosystem.md`

* refactor: refactor `ecosystem.md` linter
  • Loading branch information
nooreldeensalah committed Sep 9, 2022
1 parent 91564f7 commit 16e4b5b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
11 changes: 4 additions & 7 deletions .github/scripts/lint-ecosystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,17 @@ module.exports = async function ({ core }) {
const moduleNameRegex = /^\- \[\`(.+)\`\]/
let hasOutOfOrderItem = false
let lineNumber = 0
let inCommunitySection = false
let modules = []
let hasImproperFormat = false

for await (const line of rl) {
lineNumber += 1
if (line.startsWith('#### [Community]')) {
inCommunitySection = true
modules = []
}

if (line.startsWith('#### [Community Tools]')) {
inCommunitySection = false
}
if (inCommunitySection === false) {
continue
modules = []
}

if (line.startsWith('- [') !== true) {
Expand Down Expand Up @@ -58,7 +55,7 @@ module.exports = async function ({ core }) {
if (hasOutOfOrderItem === true) {
core.setFailed('Some ecosystem modules are not in alphabetical order.')
}

if (hasImproperFormat === true) {
core.setFailed('Some ecosystem modules are improperly formatted.')
}
Expand Down
16 changes: 8 additions & 8 deletions docs/Guides/Ecosystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,28 +75,28 @@ section.
connection pool across every part of your server.
- [`@fastify/multipart`](https://github.com/fastify/fastify-multipart) Multipart
support for Fastify.
- [`@fastify/nextjs`](https://github.com/fastify/fastify-nextjs) React
server-side rendering support for Fastify with
[Next](https://github.com/zeit/next.js/).
- [`@fastify/oauth2`](https://github.com/fastify/fastify-oauth2) Wrap around
[`simple-oauth2`](https://github.com/lelylan/simple-oauth2).
- [`@fastify/postgres`](https://github.com/fastify/fastify-postgres) Fastify
PostgreSQL connection plugin, with this you can share the same PostgreSQL
connection pool in every part of your server.
- [`@fastify/rate-limit`](https://github.com/fastify/fastify-rate-limit) A low
overhead rate limiter for your routes.
- [`@fastify/redis`](https://github.com/fastify/fastify-redis) Fastify Redis
connection plugin, with which you can share the same Redis connection across
every part of your server.
- [`@fastify/reply-from`](https://github.com/fastify/fastify-reply-from) Plugin
to forward the current HTTP request to another server.
- [`@fastify/request-context`](https://github.com/fastify/fastify-request-context)
Request-scoped storage, based on
[AsyncLocalStorage](https://nodejs.org/api/async_hooks.html#async_hooks_class_asynclocalstorage)
(with fallback to [cls-hooked](https://github.com/Jeff-Lewis/cls-hooked)),
providing functionality similar to thread-local storages.
- [`@fastify/response-validation`](https://github.com/fastify/fastify-response-validation)
A simple plugin that enables response validation for Fastify.
- [`@fastify/nextjs`](https://github.com/fastify/fastify-nextjs) React
server-side rendering support for Fastify with
[Next](https://github.com/zeit/next.js/).
- [`@fastify/redis`](https://github.com/fastify/fastify-redis) Fastify Redis
connection plugin, with which you can share the same Redis connection across
every part of your server.
- [`@fastify/reply-from`](https://github.com/fastify/fastify-reply-from) Plugin
to forward the current HTTP request to another server.
- [`@fastify/routes`](https://github.com/fastify/fastify-routes) Plugin that
provides a `Map` of routes.
- [`@fastify/schedule`](https://github.com/fastify/fastify-schedule) Plugin for
Expand Down

0 comments on commit 16e4b5b

Please sign in to comment.