From c595c37e892fcc6c50024f326961ff393ed68f9a Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Mon, 3 Jun 2024 16:12:51 -0400 Subject: [PATCH] Add 'recommended' status to each rule as a starter Fixes #249. --- src/rules/no-ajax-events.js | 3 ++- src/rules/no-animate-toggle.js | 3 ++- src/rules/no-animate.js | 3 ++- src/rules/no-append-html.js | 3 ++- src/rules/no-class-state.js | 3 ++- src/rules/no-constructor-attributes.js | 3 ++- src/rules/no-deferred.js | 3 ++- src/rules/no-extend.js | 3 ++- src/rules/no-fx-interval.js | 3 ++- src/rules/no-global-selector.js | 3 ++- src/rules/no-jquery-constructor.js | 3 ++- src/rules/no-load-shorthand.js | 3 ++- src/rules/no-on-ready.js | 3 ++- src/rules/no-other-methods.js | 3 ++- src/rules/no-other-utils.js | 3 ++- src/rules/no-parse-html-literal.js | 3 ++- src/rules/no-ready.js | 3 ++- src/rules/no-sizzle.js | 3 ++- src/rules/variable-pattern.js | 3 ++- 19 files changed, 38 insertions(+), 19 deletions(-) diff --git a/src/rules/no-ajax-events.js b/src/rules/no-ajax-events.js index 40ab289..88db16e 100644 --- a/src/rules/no-ajax-events.js +++ b/src/rules/no-ajax-events.js @@ -15,7 +15,8 @@ module.exports = { meta: { type: 'suggestion', docs: { - description: 'Disallows global ajax events handlers: ' + disallowedEvents.map( utils.jQueryCollectionLink ).join( '/' ) + '. Prefer local events.' + description: 'Disallows global ajax events handlers: ' + disallowedEvents.map( utils.jQueryCollectionLink ).join( '/' ) + '. Prefer local events.', + recommended: false }, schema: [] }, diff --git a/src/rules/no-animate-toggle.js b/src/rules/no-animate-toggle.js index f88a362..b33c566 100644 --- a/src/rules/no-animate-toggle.js +++ b/src/rules/no-animate-toggle.js @@ -9,7 +9,8 @@ module.exports = { description: 'Disallows the duration argument when using the ' + utils.jQueryCollectionLink( 'show' ) + ', ' + utils.jQueryCollectionLink( 'hide' ) + ' & ' + utils.jQueryCollectionLink( 'toggle' ) + - ' methods. Prefer CSS transitions.' + ' methods. Prefer CSS transitions.', + recommended: true }, schema: [] }, diff --git a/src/rules/no-animate.js b/src/rules/no-animate.js index a8bd1fd..e0f62ce 100644 --- a/src/rules/no-animate.js +++ b/src/rules/no-animate.js @@ -8,7 +8,8 @@ module.exports = { docs: { description: 'Disallows the ' + utils.jQueryCollectionLink( 'animate' ) + - ' method. Use the `allowScroll` option to allow animations which are just used for scrolling. Prefer CSS transitions.' + ' method. Use the `allowScroll` option to allow animations which are just used for scrolling. Prefer CSS transitions.', + recommended: true }, schema: [ { diff --git a/src/rules/no-append-html.js b/src/rules/no-append-html.js index 7740608..b9c46e1 100644 --- a/src/rules/no-append-html.js +++ b/src/rules/no-append-html.js @@ -23,7 +23,8 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallows using ' + methods.map( utils.jQueryCollectionLink ).join( '/' ) + - ' to inject HTML, in order to prevent possible XSS bugs.' + ' to inject HTML, in order to prevent possible XSS bugs.', + recommended: false }, schema: [] }, diff --git a/src/rules/no-class-state.js b/src/rules/no-class-state.js index 64365ba..deb3240 100644 --- a/src/rules/no-class-state.js +++ b/src/rules/no-class-state.js @@ -10,7 +10,8 @@ module.exports = { ' and ' + utils.jQueryCollectionLink( 'toggleClass' ) + ' to discourage querying the DOM for state information. ' + utils.jQueryCollectionLink( 'toggleClass' ) + ' may be used with a boolean argument as then it behaves like ' + - utils.jQueryCollectionLink( 'addClass' ) + '/' + utils.jQueryCollectionLink( 'removeClass' ) + '.' + utils.jQueryCollectionLink( 'addClass' ) + '/' + utils.jQueryCollectionLink( 'removeClass' ) + '.', + recommended: true }, schema: [] }, diff --git a/src/rules/no-constructor-attributes.js b/src/rules/no-constructor-attributes.js index 5d78067..768c5f5 100644 --- a/src/rules/no-constructor-attributes.js +++ b/src/rules/no-constructor-attributes.js @@ -6,7 +6,8 @@ module.exports = { meta: { type: 'suggestion', docs: { - description: 'Disallows passing attributes to the jQuery constructor. Prefer `.attr`.' + description: 'Disallows passing attributes to the jQuery constructor. Prefer `.attr`.', + recommended: true }, schema: [] }, diff --git a/src/rules/no-deferred.js b/src/rules/no-deferred.js index 496bcc5..4a73c7a 100644 --- a/src/rules/no-deferred.js +++ b/src/rules/no-deferred.js @@ -6,7 +6,8 @@ module.exports = { meta: { type: 'suggestion', docs: { - description: 'Disallows ' + utils.jQueryGlobalLink( 'Deferred' ) + ' constructor. Prefer `Promise`.' + description: 'Disallows ' + utils.jQueryGlobalLink( 'Deferred' ) + ' constructor. Prefer `Promise`.', + recommended: true }, schema: [] }, diff --git a/src/rules/no-extend.js b/src/rules/no-extend.js index 4b483ca..ddaac47 100644 --- a/src/rules/no-extend.js +++ b/src/rules/no-extend.js @@ -6,7 +6,8 @@ module.exports = { meta: { type: 'suggestion', docs: { - description: 'Disallows the ' + utils.jQueryGlobalLink( 'extend' ) + ' utility. Prefer `Object.assign` or the spread operator.' + description: 'Disallows the ' + utils.jQueryGlobalLink( 'extend' ) + ' utility. Prefer `Object.assign` or the spread operator.', + recommended: true }, fixable: 'code', schema: [ diff --git a/src/rules/no-fx-interval.js b/src/rules/no-fx-interval.js index 9dbfcf1..f739b68 100644 --- a/src/rules/no-fx-interval.js +++ b/src/rules/no-fx-interval.js @@ -6,7 +6,8 @@ module.exports = { meta: { type: 'suggestion', docs: { - description: 'Disallows ' + utils.jQueryGlobalLink( 'fx.interval' ) + '.' + description: 'Disallows ' + utils.jQueryGlobalLink( 'fx.interval' ) + '.', + recommended: true }, schema: [] }, diff --git a/src/rules/no-global-selector.js b/src/rules/no-global-selector.js index f096545..e3263d0 100644 --- a/src/rules/no-global-selector.js +++ b/src/rules/no-global-selector.js @@ -13,7 +13,8 @@ module.exports = { docs: { description: 'Disallows global selectors which search the whole document. ' + 'Encourages users to keep references to DOM nodes in memory, instead of selecting them from the DOM each time. ' + - 'Use the `allowIds` option to allow single ID selectors.' + 'Use the `allowIds` option to allow single ID selectors.', + recommended: true }, schema: [ { diff --git a/src/rules/no-jquery-constructor.js b/src/rules/no-jquery-constructor.js index 384f86b..14d8b50 100644 --- a/src/rules/no-jquery-constructor.js +++ b/src/rules/no-jquery-constructor.js @@ -6,7 +6,8 @@ module.exports = { meta: { type: 'suggestion', docs: { - description: 'Disallows the jQuery constructor `$()`.' + description: 'Disallows the jQuery constructor `$()`.', + recommended: true }, schema: [] }, diff --git a/src/rules/no-load-shorthand.js b/src/rules/no-load-shorthand.js index b1c7b27..bb2a539 100644 --- a/src/rules/no-load-shorthand.js +++ b/src/rules/no-load-shorthand.js @@ -6,7 +6,8 @@ module.exports = { meta: { type: 'suggestion', docs: { - description: 'Disallows the [`.load`](https://api.jquery.com/load-event/) method when used as a shorthand for `.on( \'load\', function )` or `.trigger( \'load\' )`. Prefer `.on` or `.trigger`.' + description: 'Disallows the [`.load`](https://api.jquery.com/load-event/) method when used as a shorthand for `.on( \'load\', function )` or `.trigger( \'load\' )`. Prefer `.on` or `.trigger`.', + recommended: true }, fixable: 'code', schema: [] diff --git a/src/rules/no-on-ready.js b/src/rules/no-on-ready.js index 48dc6f3..627dd39 100644 --- a/src/rules/no-on-ready.js +++ b/src/rules/no-on-ready.js @@ -6,7 +6,8 @@ module.exports = { meta: { type: 'suggestion', docs: { - description: 'Disallows using the ready event on the document.' + description: 'Disallows using the ready event on the document.', + recommended: true }, fixable: 'code', schema: [] diff --git a/src/rules/no-other-methods.js b/src/rules/no-other-methods.js index eee2e6d..00e95a0 100644 --- a/src/rules/no-other-methods.js +++ b/src/rules/no-other-methods.js @@ -89,7 +89,8 @@ module.exports = { meta: { type: 'suggestion', docs: { - description: 'Disallows all methods not covered by more specific rules.' + description: 'Disallows all methods not covered by more specific rules.', + recommended: false }, schema: [] }, diff --git a/src/rules/no-other-utils.js b/src/rules/no-other-utils.js index faaa758..6f14224 100644 --- a/src/rules/no-other-utils.js +++ b/src/rules/no-other-utils.js @@ -57,7 +57,8 @@ module.exports = { meta: { type: 'suggestion', docs: { - description: 'Disallows all utilities not covered by more specific rules.' + description: 'Disallows all utilities not covered by more specific rules.', + recommended: false }, schema: [] }, diff --git a/src/rules/no-parse-html-literal.js b/src/rules/no-parse-html-literal.js index 6057025..6629303 100644 --- a/src/rules/no-parse-html-literal.js +++ b/src/rules/no-parse-html-literal.js @@ -40,7 +40,8 @@ module.exports = { 'The format of single tags can be specified using the `singleTagStyle` option:\n' + '* `"minimal"` (default) no whitespace or self-closing i.e. `
`\n' + '* `"self-closing"` no whitespace and self-closing i.e. `
`\n' + - '* `"any"` no style enforced' + '* `"any"` no style enforced', + recommended: true }, fixable: 'code', schema: [ diff --git a/src/rules/no-ready.js b/src/rules/no-ready.js index 8d49924..35ba93a 100644 --- a/src/rules/no-ready.js +++ b/src/rules/no-ready.js @@ -25,7 +25,8 @@ module.exports = { meta: { type: 'suggestion', docs: { - description: 'Disallows the document ready event, either `$( function() {} )` or `$( document ).ready()`.' + description: 'Disallows the document ready event, either `$( function() {} )` or `$( document ).ready()`.', + recommended: true }, schema: [] }, diff --git a/src/rules/no-sizzle.js b/src/rules/no-sizzle.js index 8e4bf7a..de77b2d 100644 --- a/src/rules/no-sizzle.js +++ b/src/rules/no-sizzle.js @@ -21,7 +21,8 @@ module.exports = { docs: { description: 'Disallows selector extensions provided by Sizzle. Use the `allowPositional` option to allow positional selectors. ' + 'Use the `allowOther` option to allow all other selectors. These options are used in the `deprecated-3.4` ruleset as only positional ' + - 'selectors were deprecated in that version.' + 'selectors were deprecated in that version.', + recommended: true }, schema: [ { diff --git a/src/rules/variable-pattern.js b/src/rules/variable-pattern.js index 924b8ef..951e764 100644 --- a/src/rules/variable-pattern.js +++ b/src/rules/variable-pattern.js @@ -6,7 +6,8 @@ module.exports = { meta: { type: 'suggestion', docs: { - description: 'Disallows variable names which don\'t match `variablePattern` in settings (by default a `$`-prefix).' + description: 'Disallows variable names which don\'t match `variablePattern` in settings (by default a `$`-prefix).', + recommended: true }, schema: [] },