diff --git a/README.md b/README.md index ae77df4651..5a6e923a03 100644 --- a/README.md +++ b/README.md @@ -249,7 +249,6 @@ rules in templates can be disabled with eslint directives with mustache or html | [template-no-model-argument-in-route-templates](docs/rules/template-no-model-argument-in-route-templates.md) | disallow @model argument in route templates | | 🔧 | | | [template-no-multiple-empty-lines](docs/rules/template-no-multiple-empty-lines.md) | disallow multiple consecutive empty lines in templates | | 🔧 | | | [template-no-mut-helper](docs/rules/template-no-mut-helper.md) | disallow usage of (mut) helper | | | | -| [template-no-negated-comparison](docs/rules/template-no-negated-comparison.md) | disallow negated comparisons in templates | | | | | [template-no-negated-condition](docs/rules/template-no-negated-condition.md) | disallow negated conditions in if/unless | | 🔧 | | | [template-no-nested-splattributes](docs/rules/template-no-nested-splattributes.md) | disallow nested ...attributes usage | | | | | [template-no-obscure-array-access](docs/rules/template-no-obscure-array-access.md) | disallow obscure array access patterns like `objectPath.@each.property` | | 🔧 | | diff --git a/docs/rules/template-no-negated-comparison.md b/docs/rules/template-no-negated-comparison.md deleted file mode 100644 index 2b46e145b5..0000000000 --- a/docs/rules/template-no-negated-comparison.md +++ /dev/null @@ -1,39 +0,0 @@ -# ember/template-no-negated-comparison - - - -Disallows negated comparison operators in templates. - -## Rule Details - -Use positive comparison operators with `{{unless}}` instead of negated comparison operators like `not-eq`. - -## Examples - -Examples of **incorrect** code for this rule: - -```gjs - -``` - -Examples of **correct** code for this rule: - -```gjs - -``` - -```gjs - -``` diff --git a/lib/rules/template-no-negated-comparison.js b/lib/rules/template-no-negated-comparison.js deleted file mode 100644 index 6ae92584e8..0000000000 --- a/lib/rules/template-no-negated-comparison.js +++ /dev/null @@ -1,34 +0,0 @@ -/** @type {import('eslint').Rule.RuleModule} */ -module.exports = { - meta: { - type: 'suggestion', - docs: { - description: 'disallow negated comparisons in templates', - category: 'Best Practices', - url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/template-no-negated-comparison.md', - templateMode: 'both', - }, - fixable: null, - schema: [], - messages: { - noNegatedComparison: 'Use positive comparison operators instead of negated ones.', - }, - }, - - create(context) { - return { - GlimmerSubExpression(node) { - if ( - node.path && - node.path.type === 'GlimmerPathExpression' && - node.path.original === 'not-eq' - ) { - context.report({ - node, - messageId: 'noNegatedComparison', - }); - } - }, - }; - }, -}; diff --git a/tests/lib/rules/template-no-negated-comparison.js b/tests/lib/rules/template-no-negated-comparison.js deleted file mode 100644 index c6a99f8045..0000000000 --- a/tests/lib/rules/template-no-negated-comparison.js +++ /dev/null @@ -1,68 +0,0 @@ -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const rule = require('../../../lib/rules/template-no-negated-comparison'); -const RuleTester = require('eslint').RuleTester; - -//------------------------------------------------------------------------------ -// Tests -//------------------------------------------------------------------------------ - -const ruleTester = new RuleTester({ - parser: require.resolve('ember-eslint-parser'), - parserOptions: { ecmaVersion: 2022, sourceType: 'module' }, -}); - -ruleTester.run('template-no-negated-comparison', rule, { - valid: [ - ``, - ``, - ``, - // `ne` is not a standard Ember/ember-truth-helpers helper; the rule must not flag it. - ``, - ], - - invalid: [ - { - code: ``, - output: null, - errors: [ - { - message: 'Use positive comparison operators instead of negated ones.', - type: 'GlimmerSubExpression', - }, - ], - }, - { - code: ``, - output: null, - errors: [ - { - message: 'Use positive comparison operators instead of negated ones.', - type: 'GlimmerSubExpression', - }, - ], - }, - ], -});