diff --git a/changelog.md b/changelog.md index 69a5a55..a6ecf92 100644 --- a/changelog.md +++ b/changelog.md @@ -1,10 +1,11 @@ # Changelog -- `2.0.0` - new `onSubmit` rule (thank you @@jzatt), upgrade to ESLint 8 and Mocha 9, fix moderate security advisory for `chalk/ansi-regex` -- `1.3.0` - Add auto-fix capability to `onClick` (thank you @bkonuwa and @pixelbandito). ([#8](https://github.com/davidcalhoun/eslint-plugin-test-selectors/pull/8)) -- `1.1.0` - - elements with `disabled` and `readonly` attributes are now ignored by default. See [Custom Rules Options](#custom-rule-options) to customize this behavior. (fixes [#3][i3]) - - `plugin:test-selectors/recommended` now emits warnings by default instead of errors. For the old stricter behavior which emits errors, folks can use `plugin:test-selectors/recommendedWithErrors` (fixes [#4][i4]) - - Refactoring and cleanup. Readme improvements. -- `1.0.1` - fix bug with inline functions (fixes [#1][i1]) -- `1.0.0` - initial release +- `2.1.0` - custom `testAttribute` property now accepts arrays. Also fixes vulnerability in word-wrap. +- `2.0.0` - new `onSubmit` rule (thank you @@jzatt), upgrade to ESLint 8 and Mocha 9, fix moderate security advisory for `chalk/ansi-regex` +- `1.3.0` - Add auto-fix capability to `onClick` (thank you @bkonuwa and @pixelbandito). ([#8](https://github.com/davidcalhoun/eslint-plugin-test-selectors/pull/8)) +- `1.1.0` + - elements with `disabled` and `readonly` attributes are now ignored by default. See [Custom Rules Options](#custom-rule-options) to customize this behavior. (fixes [#3][i3]) + - `plugin:test-selectors/recommended` now emits warnings by default instead of errors. For the old stricter behavior which emits errors, folks can use `plugin:test-selectors/recommendedWithErrors` (fixes [#4][i4]) + - Refactoring and cleanup. Readme improvements. +- `1.0.1` - fix bug with inline functions (fixes [#1][i1]) +- `1.0.0` - initial release diff --git a/readme.md b/readme.md index c65bc99..7817b21 100644 --- a/readme.md +++ b/readme.md @@ -1,27 +1,23 @@ # eslint-plugin-test-selectors -[![Build Status](https://travis-ci.org/davidcalhoun/eslint-plugin-test-selectors.svg?branch=master)](https://travis-ci.org/davidcalhoun/eslint-plugin-test-selectors) [![Downloads][downloads-image]][npm-url] Enforces that a `data-test-id` attribute is present on interactive DOM elements to help with UI testing. -- ❌ `` -- ✅ `` +- ❌ `` +- ✅ `` ### Example of eslint-plugin-test-selectors running in Visual Studio Code: ![Example of eslint-plugin-test-selectors running in Visual Studio Code](https://github.com/davidcalhoun/eslint-plugin-test-selectors/blob/master/vscode-test-selectors-example.png) -## Changelog +## Selected changelog -- `2.0.0` - new `onSubmit` rule (thank you @@jzatt), upgrade to ESLint 8 and Mocha 9, fix moderate security advisory for `chalk/ansi-regex` -- `1.3.0` - Add auto-fix capability to `onClick` (thank you @bkonuwa and @pixelbandito). ([#8](https://github.com/davidcalhoun/eslint-plugin-test-selectors/pull/8)) -- `1.1.0` - - elements with `disabled` and `readonly` attributes are now ignored by default. See [Custom Rules Options](#custom-rule-options) to customize this behavior. (fixes [#3][i3]) - - `plugin:test-selectors/recommended` now emits warnings by default instead of errors. For the old stricter behavior which emits errors, folks can use `plugin:test-selectors/recommendedWithErrors` (fixes [#4][i4]) - - Refactoring and cleanup. Readme improvements. -- `1.0.1` - fix bug with inline functions (fixes [#1][i1]) -- `1.0.0` - initial release +[See full changelog](https://github.com/davidcalhoun/eslint-plugin-test-selectors/blob/main/changelog.md) + +- `2.1.0` - custom `testAttribute` property now accepts arrays. Also fixes vulnerability in word-wrap. +- `2.0.0` - new `onSubmit` rule (thank you @@jzatt), upgrade to ESLint 8 and Mocha 9, fix moderate security advisory for `chalk/ansi-regex` +- `1.3.0` - Add auto-fix capability to `onClick` (thank you @bkonuwa and @pixelbandito). ([#8](https://github.com/davidcalhoun/eslint-plugin-test-selectors/pull/8)) ## Installation @@ -45,7 +41,7 @@ Add `test-selectors` to the plugins section of your `.eslintrc` configuration fi ```json { - "plugins": ["test-selectors"] + "plugins": ["test-selectors"] } ``` @@ -53,7 +49,7 @@ If you want to use all the recommended default rules, you can simply add this li ```json { - "extends": ["plugin:test-selectors/recommended"] + "extends": ["plugin:test-selectors/recommended"] } ``` @@ -63,9 +59,9 @@ Another option: you can also selectively enable and disable individual rules in ```json { - "rules": { - "test-selectors/button": ["warn", "always"] - } + "rules": { + "test-selectors/button": ["warn", "always"] + } } ``` @@ -73,9 +69,9 @@ If you like most of the recommended rules by adding the `extends` option above, ```json { - "rules": { - "test-selectors/anchor": "off" - } + "rules": { + "test-selectors/anchor": "off" + } } ``` @@ -91,40 +87,31 @@ The default test attribute expected is `data-test-id`, but you can override it w ```json { - "rules": { - "test-selectors/onChange": [ - "warn", - "always", - { "testAttribute": "data-some-custom-attribute" } - ] - } + "rules": { + "test-selectors/onChange": ["warn", "always", { "testAttribute": "data-some-custom-attribute" }] + } } ``` -Note: You can also pass multiple attributes +Note: You can also pass multiple attributes ```json { - "rules": { - "test-selectors/onChange": [ - "warn", - "always", - { "testAttribute": ["data-testid", "testId"] } - ] - } + "rules": { + "test-selectors/onChange": ["warn", "always", { "testAttribute": ["data-testid", "testId"] }] + } } ``` - ### ignoreDisabled By default all elements with the `disabled` attribute are ignored, e.g. ``. If you don't want to ignore this attribute, set `ignoreDisabled` to `false`: ```json { - "rules": { - "test-selectors/onChange": ["warn", "always", { "ignoreDisabled": false }] - } + "rules": { + "test-selectors/onChange": ["warn", "always", { "ignoreDisabled": false }] + } } ``` @@ -134,9 +121,9 @@ By default all elements with the `readonly` attribute are ignored, e.g. `