
Company News
Free Business Plan Upgrades for Open Source Maintainers
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.
@testgorilla/tgo-linting
Advanced tools
Linting rules and code quality standards for TestGorilla projects.
npm install @testgorilla/tgo-linting @angular-eslint/template-parser --save-dev
| tgo-linting | ESLint | angular-eslint | Angular |
|---|---|---|---|
| 5.x | ^9.0.0 || ^10.0.0 | 21.x | any (angular-eslint 21 bundles its own compiler) |
| 4.x | ^8.57.0 || ^9.0.0 | 20.x | any |
ESLint 9 consumers: the bundled
eslint-plugin-rxjs-x@1.0.2declares aneslint: ^10peer dependency (no release of that plugin supports ESLint 9 and 10 simultaneously). Until your repo moves to ESLint 10, keep this override in yourpackage.jsonsonpm installresolves cleanly:"overrides": { "eslint-plugin-rxjs-x": { "eslint": "$eslint" } }Consumers on ESLint 10 do not need the override.
This package requires ESLint flat config (eslint.config.js/.mjs) and ESLint 9 or 10.
Support for legacy .eslintrc.* configs and ESLint 8 was removed in 5.0.0.
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', // Example rule configuration
},
},
];
tgo/require-data-testid rule only works with HTML/Angular templates. You must configure @angular-eslint/template-parser for .html files.@angular-eslint, the template parser is usually already configured for HTML files in your overrides.| Rule | Description |
|---|---|
tgo/require-data-testid | Ensures specific HTML elements have a data-testid attribute for E2E testing |
Detailed documentation for each rule, including examples and configuration options, can be found alongside the rule implementation:
To add a new ESLint rule to this package:
Create the rule file in src/rules/:
// src/rules/your-rule-name.ts
import { Rule } from 'eslint';
const rule: Rule.RuleModule = {
meta: {
type: 'problem', // or 'suggestion' or 'layout'
docs: {
description: 'Your rule description',
category: 'Best Practices',
recommended: false,
},
schema: [], // JSON schema for rule options
messages: {
// Define error messages here
},
},
create(context) {
// Your rule implementation
return {
// AST node visitors
};
},
};
export default rule;
Add tests in src/rules/your-rule-name.spec.ts:
import { RuleTester } from '@typescript-eslint/rule-tester';
import rule from './your-rule-name';
const ruleTester = new RuleTester({
parser: '@angular-eslint/template-parser',
});
ruleTester.run('your-rule-name', rule, {
valid: [
// Test cases that should pass
],
invalid: [
// Test cases that should fail
],
});
Export the rule in src/rules/index.ts:
import yourRuleName from './your-rule-name';
export const rules = {
'require-data-testid': requireDataTestId,
'your-rule-name': yourRuleName,
};
Add to recommended config (optional) in src/configs/recommended.ts:
rules: {
'tgo/require-data-testid': 'warn',
'tgo/your-rule-name': 'error', // or 'warn'
}
Document the rule in src/rules/your-rule-name.md:
Update this README by adding the new rule to the rules table above
Test your changes:
nx test tgo-linting
nx build tgo-linting
nx build tgo-linting
nx test tgo-linting
nx lint tgo-linting
PROPRIETARY - © TestGorilla
FAQs
Linting rules and code quality standards for TestGorilla projects
We found that @testgorilla/tgo-linting demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.