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

sam-resource-name-linter

v1.0.0

Published

Tool to enforce naming conventions for AWS SAM resources

Readme

SAM Resource Name Linter

This package helps enforce naming conventions for AWS SAM resources. It reads a SAM template and validates resource names against a set of configurable rules.

Why This Tool?

Maintaining consistent naming conventions across multiple AWS SAM projects is crucial for readability, maintainability, and team collaboration. This tool helps enforce a single standard, preventing inconsistencies and improving overall code quality. The benefit is amplified by its minimal external dependencies, ensuring ease of integration and reducing potential conflicts.

Installation

npm install sam-resource-name-linter

Usage

  1. Create the configuration file: After installing the package in your repository with the previous command, you should create a new file called named .sam-resource-name-rules.json in the root directory of your SAM project.

  2. Configure the linter: Before running the linter, personalize your configuration file (.sam-resource-name-rules.json) by defining the resource naming rules that suit your project's needs.

  3. Run the linter: Execute the linter using the following command:

    sam-resource-name-linter

    Integrate the linter into your workflow by adding it to your project's npm scripts. This will automatically enforce your defined resource naming standards. The linter defaults to .sam-resource-name-rules.json

  4. Review the results: The linter will output a message indicating whether the validation passed or failed. If it failed, it will list the specific errors encountered.

Configuration File Format

The configuration file (.sam-resource-name-rules.json) is a JSON file with the following structure:

{
  "$schema": "node_modules/sam-resource-name-linter/.sam-resource-name-rules.schema.json",
  "rules": {
    "AWS::Serverless::Function": {
      "maxLength": 63,
      "pattern": "^[a-z][a-z0-9-]*$",
      "excludedWords": ["test", "dev"],
      "propertyName": "FunctionName"
    },
    "AWS::Serverless::Api": {
      "maxLength": 63,
      "pattern": "^[a-z][a-z0-9-]*$",
      "propertyName": "Name"
    }
    // Add rules for other resource types as needed
  }
}
  • "rules": An object containing rules for different resource types.
  • <resource-type>: The AWS resource type (e.g., "AWS::Serverless::Function").
  • "maxLength": The maximum allowed length of the resource name (optional).
  • "pattern": A regular expression pattern that the resource name must match (required).
  • "excludedWords": An array of words that are not allowed in the resource name (optional).
  • "propertyName": Name of the resource property to be validated (required).

Importance of "$schema"

Including the "$schema" property in your .sam-resource-name-rules.json file is highly recommended. This property points to a JSON Schema definition that describes the structure and data types expected in your configuration file. Using a JSON Schema offers several key benefits:

  • Validation: It allows for automated validation of your configuration file, ensuring it conforms to the expected format. This helps prevent errors and inconsistencies in your rules.
  • IDE Support: Many IDEs and code editors leverage JSON Schema to provide features like autocompletion, linting, and error highlighting, making it easier to write and maintain your configuration files.
  • Maintainability: The schema acts as a central source of truth for your configuration file's structure, improving maintainability and reducing the risk of errors as your rules evolve.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

MIT