npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@accordproject/concerto-linter-default-ruleset

v3.26.0

Published

Default ruleset for the Accord Project Concerto Linter

Readme

Concerto Linter Default Ruleset

A comprehensive set of linting rules designed to validate concerto models against industry best practices and consistent naming conventions. This default ruleset helps maintain high-quality, readable, and maintainable concerto models across your projects. It is fully configurable - you can extend it, add new rules, disable existing ones, or create an entirely new ruleset without extending this one.

This sub-package is part of the @accordproject/concerto-linter package. Read the concerto-linter README if you want to know how to use this ruleset with concerto models.

Table of Contents

Key Benefits

  • Consistent Code Style: Enforce uniform naming conventions across your concerto models
  • Error Prevention: Catch common modeling mistakes before they cause issues
  • Best Practices: Apply industry-standard modeling practices automatically
  • Customizable: Easily extend or modify rules to match your project's specific needs
  • Integration Ready: Works seamlessly with the concerto Linter and your development workflow

Available Rules

The following table provides an overview of the available linting rules in the default ruleset:

Installation

First, install the package as a development dependency:

npm install --save-dev @accordproject/concerto-linter-default-ruleset

Usage

Once installed, the default ruleset is automatically used by the concerto Linter when no custom ruleset is specified:

import { lintModel } from '@accordproject/concerto-linter';

// The default ruleset will be used automatically
const results = await lintModel(modelText);
console.log(results);

To explicitly specify the default ruleset:

const results = await lintModel(modelText, { ruleset: 'default' });

Customization

To create your own ruleset that fits your project needs, you can either extend the default ruleset, or create an entirely new ruleset from scratch.

Your ruleset should be defined in one of these file formats: .spectral.yaml, .spectral.yml, .spectral.json, or .spectral.js. The concerto Linter will automatically detect and use these files, or you can specify a custom path using the ruleset property: ruleset: "./path/to/my-ruleset.yaml".

Extending the Default Ruleset

You can extend the default ruleset in multiple formats:

YAML (.spectral.yaml)

extends: '@accordproject/concerto-linter-default-ruleset'

JSON (.spectral.json)

{
  "extends": "@accordproject/concerto-linter-default-ruleset"
}

JavaScript (.spectral.js)

const rules = require('@accordproject/concerto-linter-default-ruleset');
module.exports = {
  extends: rules
};

Disabling Specific Rules

You can disable specific rules that don't match your project's requirements by setting them to 'off'. The rule identifiers are defined in the ruleset-main.ts file located at concerto/packages/concerto-linter/default-ruleset/src.

Available Rule IDs

Here are all the rule IDs that can be disabled:

| Rule ID | Description | |---------|-------------| | namespace-version | Ensures namespaces include version numbers | | no-reserved-keywords | Prevents use of reserved keywords | | pascal-case-declarations | Enforces PascalCase for declarations | | camel-case-properties | Enforces camelCase for properties | | upper-snake-case-enum-constants | Enforces UPPER_SNAKE_CASE for enum constants | | pascal-case-decorators | Enforces PascalCase for decorators | | string-length-validator | Requires string length validators | | no-empty-declarations | Prevents empty declarations | | abstract-must-subclassed | Ensures abstract classes have concrete subclasses |

YAML (.spectral.yaml)

extends: '@accordproject/concerto-linter-default-ruleset'
rules:
  pascal-case-declarations: 'off'
  camel-case-properties: 'off'

JSON (.spectral.json)

{
  "extends": "@accordproject/concerto-linter-default-ruleset",
  "rules": {
    "pascal-case-declarations": "off",
    "camel-case-properties": "off"
  }
}

JavaScript (.spectral.js)

const rules = require('@accordproject/concerto-linter-default-ruleset');
module.exports = {
  extends: rules,
  rules: {
    'pascal-case-declarations': off,
    'namespace-version': off
  }
};

Enabling Specific Rules

You can selectively start with everything off and enable only specific rules:

YAML (.spectral.yaml)

extends: [['@accordproject/concerto-linter-default-ruleset', 'off']]
rules:
  pascal-case-declarations: true
  namespace-version: true

JSON (.spectral.json)

{
  "extends": [["@accordproject/concerto-linter-default-ruleset", "off"]],
  "rules": {
    "pascal-case-declarations": true,
    "namespace-version": true
  }
}

JavaScript (.spectral.js)

const rules = require('@accordproject/concerto-linter-default-ruleset');
module.exports = {
  extends: [[rules, 'off']],
  rules: {
    'pascal-case-declarations': true,
    'namespace-version': true
  }
};

Adjusting Rule Severity

You can customize the severity level of each rule to control how violations are reported.

  • 0 = error (must be fixed)
  • 1 = warn (should be addressed)
  • 2 = info (useful information)
  • 3 = hint (optional suggestion)

YAML (.spectral.yaml)

extends: '@accordproject/concerto-linter-default-ruleset'
rules:
  pascal-case-declarations: 'warn'  # Change from error to warning
  camel-case-properties: 'info'     # Change to informational

JSON (.spectral.json)

{
  "extends": "@accordproject/concerto-linter-default-ruleset",
  "rules": {
    "pascal-case-declarations": "warn",
    "camel-case-properties": "info"
  }
}

JavaScript (.spectral.js)

const rules = require('@accordproject/concerto-linter-default-ruleset');
module.exports = {
  extends: rules,
  rules: {
    'pascal-case-declarations': 'warn',
    'camel-case-properties': 'info'
  }
};

Creating Custom Rules

Whether you want to add new rules to the default ruleset or create an entirely new ruleset, you can follow the Spectral ruleset format. For comprehensive documentation, see the Spectral ruleset documentation.

Here's a simple example of what a custom rule looks like:

# description (optional): Explains what the ruleset is about.
description: "Declaration names (scalar, enum, concept, asset, participant, transaction, event) should be PascalCase."

# given (required): JSONPath expression that specifies where the rule applies.
given: "$.models[*].declarations[*].name"

# message (required): The error/warning message shown when the rule is violated.
message: "Declaration '{{value}}' should be PascalCase (e.g. 'MyDeclaration')"

# severity (optional): The level of violation.
# 0 = error, 1 = warning, 2 = info, 3 = hint
severity: 0

# then (required): Defines what function to apply and how.
then:
  # function (required): The function that validates the rule.
  function: casing

  # functionOptions (optional): Extra options for the function.
  functionOptions:
    type: pascal

For more complex rules, you can create custom JavaScript functions following Spectral ruleset documentation and import it into your rule, similar to how the built-in rules work.

License

Accord Project source code files are made available under the Apache License, Version 2.0 (Apache-2.0), located in the LICENSE file. Accord Project documentation files are made available under the Creative Commons Attribution 4.0 International License (CC-BY-4.0).