#validation #telcoin #tnip #tnipv #tnips

tnipv-preamble

Preamble parser for tnipv, the Telcoin Network Improvement Proposal validator

1 unstable release

0.1.0 Aug 12, 2024

#2151 in Parser implementations

21 downloads per month
Used in tnipv-lint

MPL-2.0 license

20KB
248 lines

tnipv

The TNIP validator for markdown submissions.

This is a Telcoin Network specific implementation of EIPW. We sincerely appreciate their effort, their quality of code, and their spirit of open-sourceness.

USAGE:
    tnipv [OPTIONS] [SOURCES]...

ARGS:
    <SOURCES>...    Files and/or directories to check

OPTIONS:
        --format <FORMAT>     Output format [default: text] [possible values: text, json]
    -h, --help                Print help information
        --lints <LINTS>       Additional lints to enable
        --list-lints          List all available lints
        --no-default-lints    Do not enable the default lints

Demo

Example TNIP

---
tnip: 2
description: A really short example of an TNIP.
title: Sample of an TNIP
author: Grant Kee (@grantkee)
discussions-to: https://forum.telcoin.org/t/great-feature/100
status: Living
type: Meta
created: 2022-06-30
---

## Specification

Implementers of this TNIP must...

## Abstract

This is an abstract!

Output

error[markdown-order-section]: section `Specification` must come after `Motivation`
  --> /tmp/demo.md
   |
12 | ## Specification
   |
error[preamble-order]: preamble header `description` must come after `title`
 --> /tmp/demo.md
  |
3 | description: A really short example of an TNIP.
  |

Lints

id Description
markdown-html-comments There are no HTML comments in review-ready TNIPs
markdown-json-cite All csl-json code blocks adhere to the correct schema.
markdown-link-first First mention of an TNIP must be a link.
markdown-link-status TNIPs linked in the body have statuses further along than the current proposal.
markdown-order-section There are no extra sections and the sections are in the correct order.
markdown-re-tnip-dash Other TNIPs are referenced using TNIP-X, not TNIPX or TNIP X.
markdown-rel-links All URLs in the page are relative.
markdown-req-section Required sections are present in the body of the proposal.
markdown-headings-space Headers have a space after the leading '#' characters
preamble-author The author header is correctly formatted, and there is at least one GitHub user listed.
preamble-date-created The created header is a date.
preamble-date-last-call-deadline The last-call-deadline header is a date.
preamble-discussions-to The discussions-to header is a valid URL.
preamble-tnip The tnip header is a non-negative integer.
preamble-enum-category The category header is a recognized value.
preamble-enum-status The status header is a recognized value.
preamble-enum-type The type header is a recognized value.
preamble-file-name The file name reflects the TNIP number.
preamble-len-description The description header isn't too long.
preamble-len-title The title header isn't too long.
preamble-len-requires The requires header has at least one item.
preamble-list-author The author header is a correctly formatted comma-separated list.
preamble-list-requires The requires header is a correctly formatted comma-separated list.
preamble-no-dup There are no duplicate headers.
preamble-order The preamble headers are in the correct order.
preamble-re-description The description doesn't contain "standard" or similar words.
preamble-re-description-colon The description doesn't contain any ":" characters.
preamble-re-description-tnip-dash TNIPs referenced in the description header use a dash.
preamble-re-discussions-to The discussions-to header points to Telcoin Forum
preamble-re-title The title doesn't contain "standard" or similar words.
preamble-re-title-colon The title doesn't contain any ":" characters.
preamble-re-title-tnip-dash TNIPs referenced in the title header use a dash.
preamble-req All required preamble headers are present.
preamble-req-category The category header is present only when required.
preamble-req-last-call-deadline The last-call-deadline header is present only when required.
preamble-req-withdrawal-reason The withdrawal-reason header is present only when required.
preamble-requires-ref-description Proposals mentioned in the description header appear in the requires header.
preamble-requires-ref-title Proposals mentioned in the title header appear in the requires header.
preamble-requires-status TNIPs listed in requires have statuses further along than the current proposal.
preamble-trim There is no extra whitespace around preamble fields.
preamble-uint-requires The requires header is a sorted list of non-negative integers.

JavaScript / WebAssembly

tnipv-lint-js packages tnipv as an npm package, for use in JavaScript / TypeScript.

You can find the package on npm.

Building & Publishing

cd tnipv-lint-js
wasm-pack test --node
wasm-pack build -t nodejs
wasm-pack publish -t nodejs

Dependencies

~4.5–6MB
~112K SLoC