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

@testgorilla/tgo-linting

v1.0.1

Published

Linting rules and code quality standards for TestGorilla projects

Downloads

197

Readme

@testgorilla/tgo-linting

Linting rules and code quality standards for TestGorilla projects.

Installation

npm install @testgorilla/tgo-linting @angular-eslint/template-parser --save-dev

Usage

This package supports both modern flat config (ESLint 9+) and legacy config formats (ESLint 8.x and below).

Flat Config (ESLint 9+)

Recommended approach:

// eslint.config.js
import tgoPlugin from '@testgorilla/tgo-linting';

export default [
  tgoPlugin.configs.recommended,
  // Your other configurations
];

Manual configuration:

// eslint.config.js
import tgoPlugin from '@testgorilla/tgo-linting';

export default [
  {
    plugins: {
      tgo: tgoPlugin,
    },
    rules: {
      'tgo/require-data-testid': 'warn',
    },
  },
];

Legacy Config (ESLint 8.x and below)

Using the legacy preset:

// .eslintrc.js
const { legacy } = require('@testgorilla/tgo-linting');

module.exports = {
  // Your base config
  extends: [
    // Your other extends
  ],
  plugins: ['tgo'],
  overrides: [
    {
      files: ['*.html'],
      parser: '@angular-eslint/template-parser',
      ...legacy,
    },
  ],
};

Manual configuration:

// .eslintrc.js
module.exports = {
  plugins: ['tgo'],
  extends: [
    // Your other extends
  ],
  overrides: [
    {
      files: ['*.html'],
      parser: '@angular-eslint/template-parser',
      rules: {
        'tgo/require-data-testid': 'warn',
      },
    },
  ],
};

Important Notes

  • Template Parser Required: The tgo/require-data-testid rule only works with HTML/Angular templates. You must configure @angular-eslint/template-parser for .html files.
  • Angular Projects: If you're using @angular-eslint, the template parser is usually already configured for HTML files in your overrides.

Rules

tgo/require-data-testid

Ensures that specific HTML elements have a data-testid attribute for testing purposes. This makes it easier to write stable E2E tests by providing consistent selectors.

Severity: warn (in recommended config)

Category: Testing Best Practices

Default Elements

By default, this rule checks the following elements:

  • button
  • mat-checkbox
  • input
  • mat-radio-button
  • mat-radio-group
  • h1
  • table, header-table, mat-table
  • img
  • textarea
  • ng-select
  • video
  • app-tgo-choice
  • testgorilla-confirm-dialog
  • mat-form-field
  • tgo-checkout-message
  • mat-dialog-actions
  • ui-button

Configuration

You can customize which elements to check:

{
  rules: {
    'tgo/require-data-testid': ['warn', {
      tags: ['button', 'input', 'custom-element']
    }]
  }
}

Examples

Incorrect

<button>Click me</button>
<input type="text" />

Correct

<button data-testid="submit-button">Click me</button>
<input type="text" data-testid="email-input" />

Development

Building

nx build tgo-linting

Testing

nx test tgo-linting

Linting

nx lint tgo-linting

License

PROPRIETARY - © TestGorilla