Skip to content

Commit

Permalink
Introduce no-visibility, deprecate no-show, no-hide, no-toggle
Browse files Browse the repository at this point in the history
See #163
  • Loading branch information
edg2s committed Oct 16, 2019
1 parent c128d08 commit aa7bd9a
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 6 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ The following global settings can be used under the "no-jquery" property to conf
* [no-jquery/no-global-eval](docs/no-global-eval.md)
* [no-jquery/no-grep](docs/no-grep.md)
* [no-jquery/no-has](docs/no-has.md)
* [no-jquery/no-hide](docs/no-hide.md)
* [no-jquery/no-hold-ready](docs/no-hold-ready.md)
* [no-jquery/no-html](docs/no-html.md)
* [no-jquery/no-in-array](docs/no-in-array.md)
Expand Down Expand Up @@ -132,15 +131,13 @@ The following global settings can be used under the "no-jquery" property to conf
* [no-jquery/no-global-selector](docs/no-global-selector.md)
* [no-jquery/no-selector-prop](docs/no-selector-prop.md)
* [no-jquery/no-serialize](docs/no-serialize.md)
* [no-jquery/no-show](docs/no-show.md)
* [no-jquery/no-size](docs/no-size.md)
* [no-jquery/no-sizzle](docs/no-sizzle.md)
* [no-jquery/no-slide](docs/no-slide.md)
* [no-jquery/no-sub](docs/no-sub.md)
* [no-jquery/no-submit](docs/no-submit.md)
* [no-jquery/no-support](docs/no-support.md)
* [no-jquery/no-text](docs/no-text.md)
* [no-jquery/no-toggle](docs/no-toggle.md)
* [no-jquery/no-trigger](docs/no-trigger.md)
* [no-jquery/no-trim](docs/no-trim.md)
* [no-jquery/no-type](docs/no-type.md)
Expand All @@ -149,9 +146,15 @@ The following global settings can be used under the "no-jquery" property to conf
* [no-jquery/no-unique](docs/no-unique.md)
* [no-jquery/no-unload-shorthand](docs/no-unload-shorthand.md)
* [no-jquery/no-val](docs/no-val.md)
* [no-jquery/no-visibility](docs/no-visibility.md)
* [no-jquery/no-when](docs/no-when.md)
* [no-jquery/no-wrap](docs/no-wrap.md)

### Deprecated
* [no-jquery/no-hide](docs/no-hide.md)
* [no-jquery/no-show](docs/no-show.md)
* [no-jquery/no-toggle](docs/no-toggle.md)

## Development

```sh
Expand Down
2 changes: 2 additions & 0 deletions docs/no-hide.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Disallows the .hide method.

⚠️ This rule is deprecated. Use [no-visibility](no-visibility.md) instead.

## Rule details

❌ The following patterns are considered errors:
Expand Down
2 changes: 2 additions & 0 deletions docs/no-show.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Disallows the .show method.

⚠️ This rule is deprecated. Use [no-visibility](no-visibility.md) instead.

## Rule details

❌ The following patterns are considered errors:
Expand Down
2 changes: 2 additions & 0 deletions docs/no-toggle.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Disallows the .toggle method.

⚠️ This rule is deprecated. Use [no-visibility](no-visibility.md) instead.

## Rule details

❌ The following patterns are considered errors:
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ module.exports = {
'no-unique': require( './rules/no-unique' ),
'no-unload-shorthand': require( './rules/no-unload-shorthand' ),
'no-val': require( './rules/no-val' ),
'no-visibility': require( './rules/no-visibility' ),
'no-when': require( './rules/no-when' ),
'no-wrap': require( './rules/no-wrap' )
},
Expand Down
10 changes: 10 additions & 0 deletions rule-tester-and-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ class RuleTesterAndDocs extends RuleTester {
console.warn( 'Rule ' + name + ' has no description.' );
}

if ( rule.meta.docs.deprecated ) {
output += '⚠️ This rule is deprecated.';
if ( rule.meta.docs.replacedBy ) {
output += ' Use ' +
rule.meta.docs.replacedBy.map( ( name ) => '[' + name + '](' + name + '.md)' ).join( ', ' ) +
' instead.';
}
output += '\n\n';
}

if ( name in rulesData ) {
const data = rulesData[ name ];
output += 'This rule is enabled in `plugin:no-jquery/' + data.ruleset + '`';
Expand Down
7 changes: 6 additions & 1 deletion rules/no-hide.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@

const utils = require( './utils.js' );

module.exports = utils.createCollectionMethodRule( 'hide' );
const rule = utils.createCollectionMethodRule( 'hide' );

rule.meta.docs.deprecated = true;
rule.meta.docs.replacedBy = [ 'no-visibility' ];

module.exports = rule;
7 changes: 6 additions & 1 deletion rules/no-show.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@

const utils = require( './utils.js' );

module.exports = utils.createCollectionMethodRule( 'show' );
const rule = utils.createCollectionMethodRule( 'show' );

rule.meta.docs.deprecated = true;
rule.meta.docs.replacedBy = [ 'no-visibility' ];

module.exports = rule;
7 changes: 6 additions & 1 deletion rules/no-toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@

const utils = require( './utils.js' );

module.exports = utils.createCollectionMethodRule( 'toggle' );
const rule = utils.createCollectionMethodRule( 'toggle' );

rule.meta.docs.deprecated = true;
rule.meta.docs.replacedBy = [ 'no-visibility' ];

module.exports = rule;

0 comments on commit aa7bd9a

Please sign in to comment.