Skip to content

Commit

Permalink
ESLint Plugin: Rename avoid-unguarded-get-range-at to no-unguarded-ge…
Browse files Browse the repository at this point in the history
…t-range-at
  • Loading branch information
aduth committed Jun 26, 2019
1 parent afc18a4 commit 2bf8129
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/eslint-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### New Features

- New Rule: [`@wordpress/avoid-unguarded-get-range-at`](https://github.com/WordPress/gutenberg/blob/master/packages/eslint-plugin/docs/rules/avoid-unguarded-get-range-at.md)
- New Rule: [`@wordpress/no-unguarded-get-range-at`](https://github.com/WordPress/gutenberg/blob/master/packages/eslint-plugin/docs/rules/no-unguarded-get-range-at.md)

## 2.3.0 (2019-06-12)

Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Rule|Description|Recommended
[react-no-unsafe-timeout](/packages/eslint-plugin/docs/rules/react-no-unsafe-timeout.md)|Disallow unsafe `setTimeout` in component|
[valid-sprintf](/packages/eslint-plugin/docs/rules/valid-sprintf.md)|Enforce valid sprintf usage|✓
[no-base-control-with-label-without-id](/packages/eslint-plugin/docs/rules/no-base-control-with-label-without-id.md)| Disallow the usage of BaseControl component with a label prop set but omitting the id property|✓
[avoid-unguarded-get-range-at](/packages/eslint-plugin/docs/rules/avoid-unguarded-get-range-at.md)| Disallow the usage of unguarded `getRangeAt` calls|✓
[no-unguarded-get-range-at](/packages/eslint-plugin/docs/rules/no-unguarded-get-range-at.md)| Disallow the usage of unguarded `getRangeAt` calls|✓

### Legacy

Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin/configs/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
'@wordpress/no-unused-vars-before-return': 'error',
'@wordpress/valid-sprintf': 'error',
'@wordpress/no-base-control-with-label-without-id': 'error',
'@wordpress/avoid-unguarded-get-range-at': 'error',
'@wordpress/no-unguarded-get-range-at': 'error',
'no-restricted-syntax': [
'error',
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Avoid unguarded getRangeAt (avoid-unguarded-get-range-at)
# Avoid unguarded getRangeAt (no-unguarded-get-range-at)

Some browsers (e.g. Safari) will throw an error when `getRangeAt` is called and there are no ranges in the selection.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import { RuleTester } from 'eslint';
/**
* Internal dependencies
*/
import rule from '../avoid-unguarded-get-range-at';
import rule from '../no-unguarded-get-range-at';

const ruleTester = new RuleTester( {
parserOptions: {
ecmaVersion: 6,
},
} );

ruleTester.run( 'avoid-unguarded-get-range-at', rule, {
ruleTester.run( 'no-unguarded-get-range-at', rule, {
valid: [
{
code: `const selection = window.getSelection(); const range = selection.rangeCount ? selection.getRangeAt( 0 ) : null;`,
Expand Down

0 comments on commit 2bf8129

Please sign in to comment.