Canonical ESLint Shareable Config providing comprehensive code style guide with 1,000+ rules for JavaScript/TypeScript projects
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
ESLint configurations optimized for various testing frameworks. These configurations provide framework-specific rules, patterns, and best practices for writing maintainable tests.
Comprehensive Jest testing configuration with rules for describe blocks, test organization, and Jest-specific patterns.
/**
* Jest testing framework ESLint configuration
* Includes plugin: jest
* Applies to: Jest test files and Jest-specific patterns
*/
interface JestConfiguration {
recommended: ESLintConfig;
}
declare const jest: JestConfiguration;Usage Examples:
import * as jest from 'eslint-config-canonical/jest';
import tseslint from 'typescript-eslint';
export default tseslint.config({
files: ['**/*.test.{js,ts}', '**/*.spec.{js,ts}', '**/__tests__/**/*.{js,ts}'],
...jest.recommended,
});Key Features:
describe, it, expect, etc.)Configuration for Vitest testing framework with modern testing patterns and Vite integration.
/**
* Vitest testing framework ESLint configuration
* Includes plugin: @vitest/eslint-plugin
* Provides Vitest-specific rules and patterns
*/
interface VitestConfiguration {
recommended: ESLintConfig;
}
declare const vitest: VitestConfiguration;Usage Examples:
import * as vitest from 'eslint-config-canonical/vitest';
import tseslint from 'typescript-eslint';
export default tseslint.config({
files: ['**/*.test.{js,ts}', '**/*.spec.{js,ts}'],
...vitest.recommended,
});Key Features:
Configuration for AVA testing framework with its unique execution model and assertion patterns.
/**
* AVA testing framework ESLint configuration
* Includes plugin: ava
* Provides AVA-specific rules and test patterns
*/
interface AVAConfiguration {
recommended: ESLintConfig;
}
declare const ava: AVAConfiguration;Usage Examples:
import * as ava from 'eslint-config-canonical/ava';
import tseslint from 'typescript-eslint';
export default tseslint.config({
files: ['test/**/*.js', '**/*.test.js'],
...ava.recommended,
});Key Features:
Configuration for Mocha testing framework with traditional BDD/TDD patterns and lifecycle hooks.
/**
* Mocha testing framework ESLint configuration
* Includes plugin: mocha
* Provides Mocha-specific rules and patterns
*/
interface MochaConfiguration {
recommended: ESLintConfig;
}
declare const mocha: MochaConfiguration;Usage Examples:
import * as mocha from 'eslint-config-canonical/mocha';
import tseslint from 'typescript-eslint';
export default tseslint.config({
files: ['test/**/*.{js,ts}', '**/*.test.{js,ts}'],
...mocha.recommended,
});Key Features:
describe, it, before, after, etc.)import * as jest from 'eslint-config-canonical/jest';
import * as vitest from 'eslint-config-canonical/vitest';
import tseslint from 'typescript-eslint';
export default tseslint.config(
// Jest for unit tests
{
files: ['src/**/*.test.{js,ts}'],
...jest.recommended,
},
// Vitest for integration tests
{
files: ['tests/integration/**/*.{js,ts}'],
...vitest.recommended,
}
);import * as canonical from 'eslint-config-canonical';
import * as typescript from 'eslint-config-canonical/typescript';
import * as jest from 'eslint-config-canonical/jest';
import tseslint from 'typescript-eslint';
export default tseslint.config(
// Base configuration
canonical.recommended,
// TypeScript support
{
files: ['**/*.{ts,tsx}'],
...typescript.recommended,
},
// Jest tests
{
files: ['**/*.test.ts', '**/*.spec.ts'],
...jest.recommended,
}
);import * as canonical from 'eslint-config-canonical';
import * as typescript from 'eslint-config-canonical/typescript';
import * as react from 'eslint-config-canonical/react';
import * as jest from 'eslint-config-canonical/jest';
import tseslint from 'typescript-eslint';
export default tseslint.config(
canonical.recommended,
// TypeScript files
{
files: ['**/*.{ts,tsx}'],
...typescript.recommended,
},
// React components
{
files: ['**/*.{jsx,tsx}'],
...react.recommended,
},
// Component tests
{
files: ['**/*.test.{jsx,tsx}', '**/*.spec.{jsx,tsx}'],
...jest.recommended,
}
);All testing configurations enforce proper test structure:
// ✅ Correct - descriptive test names
describe('UserService', () => {
it('should return user data when valid ID is provided', () => {
// test implementation
});
});
// ❌ Incorrect - vague test names
describe('UserService', () => {
it('works', () => {
// test implementation
});
});// ✅ Correct - specific assertions
expect(result).toBe(expected);
expect(array).toHaveLength(3);
// ❌ Incorrect - truthy/falsy assertions for specific values
expect(result).toBeTruthy(); // when you expect a specific value
expect(array.length).toBeTruthy(); // when you expect a specific length// ✅ Correct - proper async/await usage
it('should fetch user data', async () => {
const user = await fetchUser(1);
expect(user.name).toBe('John');
});
// ❌ Incorrect - missing await
it('should fetch user data', () => {
const user = fetchUser(1); // Promise not awaited
expect(user.name).toBe('John');
});Install with Tessl CLI
npx tessl i tessl/npm-eslint-config-canonical