Linter
The linter enforces rules on your notes to ensure their syntax is consistent and makes easy to find them later. It’s particularly interesting as your collection of notes grows over time.
Configuration
The linter reads its configuration from the YAML file .nt/lint
. No file exists by default. Ex:
Rules are declared under the attribute rules
. Some rules accept arguments using the attribute args
(array of primitive values) and all rules can be restricted to apply on a subset of your notes using the attribute includes
(array of glob path expressions).
Rules
Rule | Description | Arguments |
---|---|---|
no-duplicate-note-title | Enforce no duplicate between note titles inside the same file | - |
no-duplicate-slug | Enforce no duplicate slugs between notes across files | - |
min-lines-between-notes | Enforce a minimum number of lines between notes |
|
max-lines-between-notes | Enforce a maximum number of lines between notes |
|
note-title-match | Enforce a consistent naming for notes |
|
no-free-note | Forbid untyped notes | - |
no-dangling-media | Path to media files must exist | - |
no-dead-wikilink | Links between notes must exist | - |
no-extension-wikilink | No extension in wikilinks | - |
no-ambiguous-wikilink | No ambiguity in wikilinks | - |
require-quote-tag | At least one tag on quotes (must match the optional pattern) |
|
check-attribute | Attributes must satisfy their schema if defined (see below) | - |
no-duplicate-note-title
Configuration:
Example (with violations highlighted):
no-duplicate-slug
Configuration:
Example (with violations highlighted):
min-lines-between-notes
Configuration:
Example (with violations highlighted):
max-lines-between-notes
Configuration:
Example (with violations highlighted):
note-title-match
Configuration:
Example (with violations highlighted):
no-free-note
Configuration:
Example (with violations highlighted):
no-dangling-media
Configuration:
Example (with violations highlighted):
no-dead-wikilink
Configuration:
Example (with violations highlighted):
no-extension-wikilink
Configuration:
Example (with violations highlighted):
no-ambiguous-wikilink
Configuration:
Example (with violations highlighted):
require-quote-tag
Configuration:
Example (with violations highlighted):
check-attribute
Configuration:
Example (with violations highlighted):
Schemas
Schemas are used to defined attributes and must follow this structure:
Default schemas (important for the inner working of the application) are predefined:
Declaring attributes as array
is convenient as value will automatically be appended to existing values: