Skip to content

atabel/eslint-plugin-tape

Repository files navigation

eslint-plugin-tape Build Status Coverage Status

ESLint rules for tape

This ESLint plugin is a copy of the great eslint-plugin-ava adapting the rules to work for tape tests and removing AVA specific rules.

Install

$ npm install --save-dev eslint eslint-plugin-tape

Usage

Configure it in your package.json or eslintrc.* file as described in ESLint user guide.

{
	"env": {
		"es6": true
	},
	"parserOptions": {
		"ecmaVersion": 7,
		"sourceType": "module"
	},
	"plugins": [
		"tape"
	],
	"rules": {
		"tape/assertion-message": ["off", "always"],
		"tape/max-asserts": ["off", 5],
		"tape/no-identical-title": "error",
		"tape/no-ignored-test-files": "error",
		"tape/no-only-test": "error",
		"tape/no-skip-assert": "error",
		"tape/no-skip-test": "error",
		"tape/no-statement-after-end": "error",
		"tape/no-unknown-modifiers": "error",
		"tape/test-ended": "error",
		"tape/test-title": ["error", "if-multiple"],
		"tape/use-t-well": "error",
		"tape/use-t": "error",
		"tape/use-test": "error",
	}
}

Rules

The rules will only activate in test files.

Recommended config

This plugin exports a recommended config that enforces good practices.

Enable it in your package.json with the extends option:

{
	"name": "my-awesome-project",
	"eslintConfig": {
		"plugins": [
			"tape"
		],
		"extends": "plugin:tape/recommended"
	}
}

See the ESLint docs for more information about extending config files.

Note: This config will also enable the correct parser options and environment.

Credit