From c987c9505128723fdf63b46c4ccbb71b8a94e984 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Fri, 13 Dec 2024 10:21:33 +0100 Subject: [PATCH 1/6] Remove deprecated `vue/component-tags-order` rule --- docs/rules/component-tags-order.md | 3 +- docs/rules/index.md | 6 +- lib/index.js | 1 - lib/removed-rules.js | 6 + lib/rules/component-tags-order.js | 23 -- tests/lib/rules/component-tags-order.js | 496 ------------------------ 6 files changed, 11 insertions(+), 524 deletions(-) delete mode 100644 lib/rules/component-tags-order.js delete mode 100644 tests/lib/rules/component-tags-order.js diff --git a/docs/rules/component-tags-order.md b/docs/rules/component-tags-order.md index 0826be968..a5037cdee 100644 --- a/docs/rules/component-tags-order.md +++ b/docs/rules/component-tags-order.md @@ -10,8 +10,7 @@ since: v6.1.0 > enforce order of component top-level elements -- :no_entry_sign: This rule was **deprecated** and replaced by [vue/block-order](block-order.md) rule. -- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule. +- :no_entry: This rule was **removed** in eslint-plugin-vue v10.0.0 and replaced by [vue/block-order](block-order.md) rule. ## :book: Rule Details diff --git a/docs/rules/index.md b/docs/rules/index.md index 8bac4aaa9..4f72ffc91 100644 --- a/docs/rules/index.md +++ b/docs/rules/index.md @@ -348,7 +348,6 @@ The following rules extend the rules provided by ESLint itself and apply them to | Rule ID | Replaced by | |:--------|:------------| -| [vue/component-tags-order] | [vue/block-order] | | [vue/no-invalid-model-keys] | [vue/valid-model-definition] | | [vue/no-ref-object-destructure] | [vue/no-ref-object-reactivity-loss] | | [vue/no-setup-props-destructure] | [vue/no-setup-props-reactivity-loss] | @@ -361,6 +360,7 @@ The following rules extend the rules provided by ESLint itself and apply them to | Rule ID | Replaced by | Deprecated in version | Removed in version | |:--------|:------------|:-----------------------|:-------------------| +| [vue/component-tags-order] | [vue/block-order] | [v9.16.0] | [v10.0.0] | | [vue/experimental-script-setup-vars] | (no replacement) | [v7.13.0] | [v9.0.0] | | [vue/name-property-casing] | [vue/component-definition-name-casing] | [v7.0.0] | [v9.0.0] | | [vue/no-confusing-v-for-v-if] | [vue/no-use-v-if-with-v-for] | [v5.0.0] | [v9.0.0] | @@ -388,7 +388,6 @@ The following rules extend the rules provided by ESLint itself and apply them to [vue/component-definition-name-casing]: ./component-definition-name-casing.md [vue/component-name-in-template-casing]: ./component-name-in-template-casing.md [vue/component-options-name-casing]: ./component-options-name-casing.md -[vue/component-tags-order]: ./component-tags-order.md [vue/custom-event-name-casing]: ./custom-event-name-casing.md [vue/define-emits-declaration]: ./define-emits-declaration.md [vue/define-macros-order]: ./define-macros-order.md @@ -619,6 +618,7 @@ The following rules extend the rules provided by ESLint itself and apply them to +[vue/component-tags-order]: ./component-tags-order.md [vue/experimental-script-setup-vars]: ./experimental-script-setup-vars.md [vue/name-property-casing]: ./name-property-casing.md [vue/no-confusing-v-for-v-if]: ./no-confusing-v-for-v-if.md @@ -626,8 +626,10 @@ The following rules extend the rules provided by ESLint itself and apply them to +[v10.0.0]: https://github.com/vuejs/eslint-plugin-vue/releases/tag/v10.0.0 [v5.0.0]: https://github.com/vuejs/eslint-plugin-vue/releases/tag/v5.0.0 [v7.0.0]: https://github.com/vuejs/eslint-plugin-vue/releases/tag/v7.0.0 [v7.13.0]: https://github.com/vuejs/eslint-plugin-vue/releases/tag/v7.13.0 [v8.4.0]: https://github.com/vuejs/eslint-plugin-vue/releases/tag/v8.4.0 [v9.0.0]: https://github.com/vuejs/eslint-plugin-vue/releases/tag/v9.0.0 +[v9.16.0]: https://github.com/vuejs/eslint-plugin-vue/releases/tag/v9.16.0 diff --git a/lib/index.js b/lib/index.js index ce562f458..0429242d2 100644 --- a/lib/index.js +++ b/lib/index.js @@ -50,7 +50,6 @@ const plugin = { 'component-definition-name-casing': require('./rules/component-definition-name-casing'), 'component-name-in-template-casing': require('./rules/component-name-in-template-casing'), 'component-options-name-casing': require('./rules/component-options-name-casing'), - 'component-tags-order': require('./rules/component-tags-order'), 'custom-event-name-casing': require('./rules/custom-event-name-casing'), 'define-emits-declaration': require('./rules/define-emits-declaration'), 'define-macros-order': require('./rules/define-macros-order'), diff --git a/lib/removed-rules.js b/lib/removed-rules.js index cf2b5e8fa..c83452acd 100644 --- a/lib/removed-rules.js +++ b/lib/removed-rules.js @@ -10,6 +10,12 @@ /** @type {RemovedRule[]} */ module.exports = [ + { + ruleName: 'component-tags-order', + replacedBy: ['block-order'], + deprecatedInVersion: 'v9.16.0', + removedInVersion: 'v10.0.0' + }, { ruleName: 'experimental-script-setup-vars', replacedBy: [], diff --git a/lib/rules/component-tags-order.js b/lib/rules/component-tags-order.js deleted file mode 100644 index 5ae0bccff..000000000 --- a/lib/rules/component-tags-order.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict' - -const baseRule = require('./block-order') - -module.exports = { - // eslint-disable-next-line eslint-plugin/require-meta-schema, eslint-plugin/prefer-message-ids -- inherit schema from base rule - meta: { - ...baseRule.meta, - // eslint-disable-next-line eslint-plugin/meta-property-ordering - type: baseRule.meta.type, - docs: { - description: baseRule.meta.docs.description, - categories: undefined, - url: 'https://eslint.vuejs.org/rules/component-tags-order.html' - }, - deprecated: true, - replacedBy: ['block-order'] - }, - /** @param {RuleContext} context */ - create(context) { - return baseRule.create(context) - } -} diff --git a/tests/lib/rules/component-tags-order.js b/tests/lib/rules/component-tags-order.js deleted file mode 100644 index 8ba50eb74..000000000 --- a/tests/lib/rules/component-tags-order.js +++ /dev/null @@ -1,496 +0,0 @@ -/** - * @author Yosuke Ota - */ -'use strict' - -const rule = require('../../../lib/rules/component-tags-order') -const RuleTester = require('../../eslint-compat').RuleTester -const assert = require('assert') -const { ESLint } = require('../../eslint-compat') - -// Initialize linter. -const eslint = new ESLint({ - overrideConfigFile: true, - overrideConfig: { - files: ['**/*.vue'], - languageOptions: { - parser: require('vue-eslint-parser'), - ecmaVersion: 2015 - }, - plugins: { vue: require('../../../lib/index') }, - rules: { - 'vue/comment-directive': 'error', - 'vue/component-tags-order': 'error' - }, - processor: require('../../../lib/processor') - }, - fix: true -}) - -const tester = new RuleTester({ - languageOptions: { parser: require('vue-eslint-parser') } -}) - -tester.run('component-tags-order', rule, { - valid: [ - // default - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - ` - - - - - - `, - ` - - - - - - `, - - // order - { - code: '', - output: null, - options: [{ order: ['script', 'template', 'style'] }] - }, - { - code: '', - output: null, - options: [{ order: ['template', 'script', 'style'] }] - }, - { - code: '', - output: null, - options: [{ order: ['style', 'template', 'script'] }] - }, - { - code: '', - output: null, - options: [{ order: ['template', 'docs', 'script', 'style'] }] - }, - { - code: '', - output: null, - options: [{ order: ['template', 'script', 'style'] }] - }, - { - code: '
text

', - output: null, - options: [{ order: ['docs', 'script', 'template', 'style'] }] - }, - { - code: '', - output: null, - options: [ - { order: ['script[setup]', 'script:not([setup])', 'template', 'style'] } - ] - }, - { - code: '', - output: null, - options: [ - { - order: [['script[setup]', 'script:not([setup])', 'template'], 'style'] - } - ] - }, - { - code: '', - output: null, - options: [{ order: ['script', 'template', 'style'] }] - }, - { - code: '', - output: null, - options: [{ order: [['script', 'template'], 'style'] }] - }, - { - code: '', - output: null, - options: [ - { order: ['script:not([setup])', 'script[setup]', 'template', 'style'] } - ] - }, - { - code: '', - output: null, - options: [ - { - order: [['script:not([setup])', 'script[setup]', 'template'], 'style'] - } - ] - }, - { - code: '', - output: null, - options: [ - { - order: [ - ['script:not([setup])', 'script[setup]', 'template'], - 'style[scoped]', - 'style:not([scoped])', - 'i18n:not([locale=en])', - 'i18n:not([locale=ja])' - ] - } - ] - }, - { - code: '', - output: null, - options: [ - { - order: [ - 'template', - 'script:not([setup])', - 'script[setup]', - 'style[scoped]', - 'style:not([scoped])', - 'i18n[locale=en]', - 'i18n[locale=ja]' - ] - } - ] - }, - { - code: '', - output: null, - options: [{ order: [['docs', 'script', 'template'], 'style'] }] - }, - { - code: '', - output: null, - options: [{ order: ['i18n[locale=en]', 'i18n[locale=ja]'] }] - }, - { - code: '', - output: null, - options: [{ order: ['style:not([scoped])', 'style[scoped]'] }] - }, - - ``, - - // Invalid EOF - '