From 2506c808d1cffb3d0d749d1f4680854ac176f48f Mon Sep 17 00:00:00 2001 From: Amorites <751809522@qq.com> Date: Mon, 12 Sep 2022 23:33:06 +0800 Subject: [PATCH 01/19] Add `vue/prefer-type-props-decl` rule --- docs/rules/README.md | 1 + docs/rules/prefer-type-props-decl.md | 53 +++++++++++++ lib/configs/no-layout-rules.js | 1 + lib/index.js | 1 + lib/rules/prefer-type-props-decl.js | 56 +++++++++++++ tests/lib/rules/prefer-type-props-decl.js | 96 +++++++++++++++++++++++ 6 files changed, 208 insertions(+) create mode 100644 docs/rules/prefer-type-props-decl.md create mode 100644 lib/rules/prefer-type-props-decl.js create mode 100644 tests/lib/rules/prefer-type-props-decl.js diff --git a/docs/rules/README.md b/docs/rules/README.md index de00e7e53..cfec04f94 100644 --- a/docs/rules/README.md +++ b/docs/rules/README.md @@ -252,6 +252,7 @@ For example: | [vue/prefer-prop-type-boolean-first](./prefer-prop-type-boolean-first.md) | enforce `Boolean` comes first in component prop types | :bulb: | :warning: | | [vue/prefer-separate-static-class](./prefer-separate-static-class.md) | require static class names in template to be in a separate `class` attribute | :wrench: | :hammer: | | [vue/prefer-true-attribute-shorthand](./prefer-true-attribute-shorthand.md) | require shorthand form attribute when `v-bind` value is `true` | :bulb: | :hammer: | +| [vue/prefer-type-props-decl](./prefer-type-props-decl.md) | enforce type-only `defineProps` | | :lipstick: | | [vue/require-direct-export](./require-direct-export.md) | require the component to be directly exported | | :hammer: | | [vue/require-emit-validator](./require-emit-validator.md) | require type definitions in emits | :bulb: | :hammer: | | [vue/require-expose](./require-expose.md) | require declare public properties using `expose` | :bulb: | :hammer: | diff --git a/docs/rules/prefer-type-props-decl.md b/docs/rules/prefer-type-props-decl.md new file mode 100644 index 000000000..7f9252388 --- /dev/null +++ b/docs/rules/prefer-type-props-decl.md @@ -0,0 +1,53 @@ +--- +pageClass: rule-details +sidebarDepth: 0 +title: vue/prefer-type-props-decl +description: enforce type-based `defineProps` +--- + +# vue/prefer-type-props-decl + +> enforce type-based `defineProps` + +- :exclamation: **_This rule has not been released yet._** + +## :book: Rule Details + +This rule forces developers to use the type-based declaration of `defineProps` instead of runtime declaration. + +This rule only works in setup script and `lang="ts"`. + + + +```vue + +``` + + + + + +```vue + +``` + + + +## :wrench: Options + +Nothing. + +## :mag: Implementation + +- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/prefer-type-props-decl.js) +- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/prefer-type-props-decl.js) diff --git a/lib/configs/no-layout-rules.js b/lib/configs/no-layout-rules.js index ab03684b5..ea8637402 100644 --- a/lib/configs/no-layout-rules.js +++ b/lib/configs/no-layout-rules.js @@ -41,6 +41,7 @@ module.exports = { 'vue/object-property-newline': 'off', 'vue/operator-linebreak': 'off', 'vue/padding-line-between-blocks': 'off', + 'vue/prefer-type-props-decl': 'off', 'vue/script-indent': 'off', 'vue/singleline-html-element-content-newline': 'off', 'vue/space-in-parens': 'off', diff --git a/lib/index.js b/lib/index.js index ca3a93084..92f517643 100644 --- a/lib/index.js +++ b/lib/index.js @@ -162,6 +162,7 @@ module.exports = { 'prefer-separate-static-class': require('./rules/prefer-separate-static-class'), 'prefer-template': require('./rules/prefer-template'), 'prefer-true-attribute-shorthand': require('./rules/prefer-true-attribute-shorthand'), + 'prefer-type-props-decl': require('./rules/prefer-type-props-decl'), 'prop-name-casing': require('./rules/prop-name-casing'), 'quote-props': require('./rules/quote-props'), 'require-component-is': require('./rules/require-component-is'), diff --git a/lib/rules/prefer-type-props-decl.js b/lib/rules/prefer-type-props-decl.js new file mode 100644 index 000000000..e42ad5f93 --- /dev/null +++ b/lib/rules/prefer-type-props-decl.js @@ -0,0 +1,56 @@ +/** + * @author Amorites + * See LICENSE file in root directory for full license. + */ +'use strict' + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +const utils = require('../utils') + +// ------------------------------------------------------------------------------ +// Helpers +// ------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------ +// Rule Definition +// ------------------------------------------------------------------------------ + +module.exports = { + meta: { + type: 'layout', + docs: { + description: 'enforce type-based `defineProps`', + categories: undefined, + url: 'https://eslint.vuejs.org/rules/prefer-type-props-decl.html' + }, + fixable: null, + schema: [], + messages: { + hasArg: 'Use type-based declaration instead of runtime declaration.' + } + }, + /** @param {RuleContext} context */ + create(context) { + const scriptSetup = utils.getScriptSetupElement(context) + if (!scriptSetup) { + return {} + } + if (!utils.hasAttribute(scriptSetup, 'lang', 'ts')) { + return {} + } + + return utils.defineScriptSetupVisitor(context, { + onDefinePropsEnter(node) { + if (node.arguments.length > 0) { + context.report({ + node, + messageId: 'hasArg' + }) + } + } + }) + } +} diff --git a/tests/lib/rules/prefer-type-props-decl.js b/tests/lib/rules/prefer-type-props-decl.js new file mode 100644 index 000000000..dc4a21092 --- /dev/null +++ b/tests/lib/rules/prefer-type-props-decl.js @@ -0,0 +1,96 @@ +/** + * @author Amorites + * See LICENSE file in root directory for full license. + */ +'use strict' + +const RuleTester = require('eslint').RuleTester +const rule = require('../../../lib/rules/prefer-type-props-decl') + +const tester = new RuleTester({ + parser: require.resolve('vue-eslint-parser'), + parserOptions: { + ecmaVersion: 2020, + sourceType: 'module' + } +}) + +tester.run('prefer-type-props-decl', rule, { + valid: [ + { + filename: 'test.vue', + code: ` + + ` + }, + { + filename: 'test.vue', + code: ` + + `, + parserOptions: { + parser: require.resolve('@typescript-eslint/parser') + } + }, + { + filename: 'test.vue', + code: ` + + `, + parserOptions: { + parser: require.resolve('@typescript-eslint/parser') + } + }, + { + filename: 'test.vue', + code: ` + + + `, + parserOptions: { + parser: require.resolve('@typescript-eslint/parser') + } + } + ], + invalid: [ + { + filename: 'test.vue', + code: ` + + `, + errors: [ + { + message: 'Use type-based declaration instead of runtime declaration.', + line: 3 + } + ] + } + ] +}) From 5fa4d5c1ec624e0a5606f21aa04841ded3a21506 Mon Sep 17 00:00:00 2001 From: Amorites <751809522@qq.com> Date: Tue, 13 Sep 2022 01:46:08 +0800 Subject: [PATCH 02/19] Add rule --- docs/rules/README.md | 3 +- docs/rules/prefer-type-emits-decl.md | 51 +++++++++++++ docs/rules/prefer-type-props-decl.md | 3 +- lib/configs/no-layout-rules.js | 1 + lib/index.js | 1 + lib/rules/prefer-type-emits-decl.js | 56 ++++++++++++++ tests/lib/rules/prefer-type-emits-decl.js | 93 +++++++++++++++++++++++ 7 files changed, 205 insertions(+), 3 deletions(-) create mode 100644 docs/rules/prefer-type-emits-decl.md create mode 100644 lib/rules/prefer-type-emits-decl.js create mode 100644 tests/lib/rules/prefer-type-emits-decl.js diff --git a/docs/rules/README.md b/docs/rules/README.md index cfec04f94..e2c017a04 100644 --- a/docs/rules/README.md +++ b/docs/rules/README.md @@ -252,7 +252,8 @@ For example: | [vue/prefer-prop-type-boolean-first](./prefer-prop-type-boolean-first.md) | enforce `Boolean` comes first in component prop types | :bulb: | :warning: | | [vue/prefer-separate-static-class](./prefer-separate-static-class.md) | require static class names in template to be in a separate `class` attribute | :wrench: | :hammer: | | [vue/prefer-true-attribute-shorthand](./prefer-true-attribute-shorthand.md) | require shorthand form attribute when `v-bind` value is `true` | :bulb: | :hammer: | -| [vue/prefer-type-props-decl](./prefer-type-props-decl.md) | enforce type-only `defineProps` | | :lipstick: | +| [vue/prefer-type-emits-decl](./prefer-type-emits-decl.md) | enforce type-based `defineEmits` | | :lipstick: | +| [vue/prefer-type-props-decl](./prefer-type-props-decl.md) | enforce type-based `defineProps` | | :lipstick: | | [vue/require-direct-export](./require-direct-export.md) | require the component to be directly exported | | :hammer: | | [vue/require-emit-validator](./require-emit-validator.md) | require type definitions in emits | :bulb: | :hammer: | | [vue/require-expose](./require-expose.md) | require declare public properties using `expose` | :bulb: | :hammer: | diff --git a/docs/rules/prefer-type-emits-decl.md b/docs/rules/prefer-type-emits-decl.md new file mode 100644 index 000000000..564fa4e41 --- /dev/null +++ b/docs/rules/prefer-type-emits-decl.md @@ -0,0 +1,51 @@ +--- +pageClass: rule-details +sidebarDepth: 0 +title: vue/prefer-type-emits-decl +description: enforce type-based `defineEmits` +--- +# vue/prefer-type-emits-decl + +> enforce type-based `defineEmits` + +- :exclamation: ***This rule has not been released yet.*** + +## :book: Rule Details + +This rule forces developers to use the type-based declaration of `defineEmits` instead of runtime declaration. + +This rule only works in setup script and `lang="ts"`. + + + +```vue + +``` + + + + + +```vue + +``` + + + +## :wrench: Options + +Nothing. + +## :mag: Implementation + +- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/prefer-type-emits-decl.js) +- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/prefer-type-emits-decl.js) diff --git a/docs/rules/prefer-type-props-decl.md b/docs/rules/prefer-type-props-decl.md index 7f9252388..c6f42d347 100644 --- a/docs/rules/prefer-type-props-decl.md +++ b/docs/rules/prefer-type-props-decl.md @@ -4,12 +4,11 @@ sidebarDepth: 0 title: vue/prefer-type-props-decl description: enforce type-based `defineProps` --- - # vue/prefer-type-props-decl > enforce type-based `defineProps` -- :exclamation: **_This rule has not been released yet._** +- :exclamation: ***This rule has not been released yet.*** ## :book: Rule Details diff --git a/lib/configs/no-layout-rules.js b/lib/configs/no-layout-rules.js index ea8637402..11fea318f 100644 --- a/lib/configs/no-layout-rules.js +++ b/lib/configs/no-layout-rules.js @@ -41,6 +41,7 @@ module.exports = { 'vue/object-property-newline': 'off', 'vue/operator-linebreak': 'off', 'vue/padding-line-between-blocks': 'off', + 'vue/prefer-type-emits-decl': 'off', 'vue/prefer-type-props-decl': 'off', 'vue/script-indent': 'off', 'vue/singleline-html-element-content-newline': 'off', diff --git a/lib/index.js b/lib/index.js index 92f517643..deeb90589 100644 --- a/lib/index.js +++ b/lib/index.js @@ -162,6 +162,7 @@ module.exports = { 'prefer-separate-static-class': require('./rules/prefer-separate-static-class'), 'prefer-template': require('./rules/prefer-template'), 'prefer-true-attribute-shorthand': require('./rules/prefer-true-attribute-shorthand'), + 'prefer-type-emits-decl': require('./rules/prefer-type-emits-decl'), 'prefer-type-props-decl': require('./rules/prefer-type-props-decl'), 'prop-name-casing': require('./rules/prop-name-casing'), 'quote-props': require('./rules/quote-props'), diff --git a/lib/rules/prefer-type-emits-decl.js b/lib/rules/prefer-type-emits-decl.js new file mode 100644 index 000000000..b95540ef9 --- /dev/null +++ b/lib/rules/prefer-type-emits-decl.js @@ -0,0 +1,56 @@ +/** + * @author Amorites + * See LICENSE file in root directory for full license. + */ +'use strict' + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +const utils = require('../utils') + +// ------------------------------------------------------------------------------ +// Helpers +// ------------------------------------------------------------------------------ + +// ------------------------------------------------------------------------------ +// Rule Definition +// ------------------------------------------------------------------------------ + +module.exports = { + meta: { + type: 'layout', + docs: { + description: 'enforce type-based `defineEmits`', + categories: undefined, + url: 'https://eslint.vuejs.org/rules/prefer-type-emits-decl.html' + }, + fixable: null, + schema: [], + messages: { + hasArg: 'Use type-based declaration instead of runtime declaration.' + } + }, + /** @param {RuleContext} context */ + create(context) { + const scriptSetup = utils.getScriptSetupElement(context) + if (!scriptSetup) { + return {} + } + if (!utils.hasAttribute(scriptSetup, 'lang', 'ts')) { + return {} + } + + return utils.defineScriptSetupVisitor(context, { + onDefineEmitsEnter(node) { + if (node.arguments.length > 0) { + context.report({ + node, + messageId: 'hasArg' + }) + } + } + }) + } +} diff --git a/tests/lib/rules/prefer-type-emits-decl.js b/tests/lib/rules/prefer-type-emits-decl.js new file mode 100644 index 000000000..82e5c93aa --- /dev/null +++ b/tests/lib/rules/prefer-type-emits-decl.js @@ -0,0 +1,93 @@ +/** + * @author Amorites + * See LICENSE file in root directory for full license. + */ +'use strict' + +const RuleTester = require('eslint').RuleTester +const rule = require('../../../lib/rules/prefer-type-emits-decl') + +const tester = new RuleTester({ + parser: require.resolve('vue-eslint-parser'), + parserOptions: { + ecmaVersion: 2020, + sourceType: 'module' + } +}) + +tester.run('prefer-type-props-decl', rule, { + valid: [ + { + filename: 'test.vue', + code: ` + + ` + }, + { + filename: 'test.vue', + code: ` + + `, + parserOptions: { + parser: require.resolve('@typescript-eslint/parser') + } + }, + { + filename: 'test.vue', + code: ` + + `, + parserOptions: { + parser: require.resolve('@typescript-eslint/parser') + } + }, + { + filename: 'test.vue', + code: ` + + + `, + parserOptions: { + parser: require.resolve('@typescript-eslint/parser') + } + } + ], + invalid: [ + { + filename: 'test.vue', + code: ` + + `, + errors: [ + { + message: 'Use type-based declaration instead of runtime declaration.', + line: 3 + } + ] + } + ] +}) From dd6f19db4ea3927ee18e244831674e0897cbaddc Mon Sep 17 00:00:00 2001 From: Amorites <751809522@qq.com> Date: Tue, 13 Sep 2022 02:01:58 +0800 Subject: [PATCH 03/19] chore: Related Rules --- docs/rules/prefer-type-emits-decl.md | 9 +++- docs/rules/prefer-type-props-decl.md | 5 +++ docs/rules/valid-define-props.md | 53 +++++++++++++---------- lib/rules/prefer-type-emits-decl.js | 5 +-- lib/rules/prefer-type-props-decl.js | 5 +-- tests/lib/rules/prefer-type-emits-decl.js | 3 -- tests/lib/rules/prefer-type-props-decl.js | 3 -- 7 files changed, 43 insertions(+), 40 deletions(-) diff --git a/docs/rules/prefer-type-emits-decl.md b/docs/rules/prefer-type-emits-decl.md index 564fa4e41..cfa37f7d5 100644 --- a/docs/rules/prefer-type-emits-decl.md +++ b/docs/rules/prefer-type-emits-decl.md @@ -16,7 +16,7 @@ This rule forces developers to use the type-based declaration of `defineEmits` i This rule only works in setup script and `lang="ts"`. - + ```vue ``` @@ -38,8 +38,8 @@ This rule reports `defineProps` compiler macros in the following cases: ```vue ``` @@ -47,8 +47,8 @@ This rule reports `defineProps` compiler macros in the following cases: ```vue ``` @@ -56,11 +56,11 @@ This rule reports `defineProps` compiler macros in the following cases: ```vue ``` @@ -70,9 +70,9 @@ This rule reports `defineProps` compiler macros in the following cases: ```vue ``` @@ -80,8 +80,8 @@ This rule reports `defineProps` compiler macros in the following cases: ```vue ``` @@ -89,9 +89,9 @@ This rule reports `defineProps` compiler macros in the following cases: ```vue ``` @@ -101,13 +101,13 @@ This rule reports `defineProps` compiler macros in the following cases: ```vue ``` @@ -117,8 +117,8 @@ This rule reports `defineProps` compiler macros in the following cases: ```vue ``` @@ -128,6 +128,11 @@ This rule reports `defineProps` compiler macros in the following cases: Nothing. +## :couple: Related Rules + +- [vue/prefer-type-props-decl](./prefer-type-props-decl.md) +- [vue/prefer-type-emits-decl](./prefer-type-emits-decl.md) + ## :rocket: Version This rule was introduced in eslint-plugin-vue v7.13.0 diff --git a/lib/rules/prefer-type-emits-decl.js b/lib/rules/prefer-type-emits-decl.js index b95540ef9..0d4182571 100644 --- a/lib/rules/prefer-type-emits-decl.js +++ b/lib/rules/prefer-type-emits-decl.js @@ -35,10 +35,7 @@ module.exports = { /** @param {RuleContext} context */ create(context) { const scriptSetup = utils.getScriptSetupElement(context) - if (!scriptSetup) { - return {} - } - if (!utils.hasAttribute(scriptSetup, 'lang', 'ts')) { + if (!scriptSetup || !utils.hasAttribute(scriptSetup, 'lang', 'ts')) { return {} } diff --git a/lib/rules/prefer-type-props-decl.js b/lib/rules/prefer-type-props-decl.js index e42ad5f93..24e2c0572 100644 --- a/lib/rules/prefer-type-props-decl.js +++ b/lib/rules/prefer-type-props-decl.js @@ -35,10 +35,7 @@ module.exports = { /** @param {RuleContext} context */ create(context) { const scriptSetup = utils.getScriptSetupElement(context) - if (!scriptSetup) { - return {} - } - if (!utils.hasAttribute(scriptSetup, 'lang', 'ts')) { + if (!scriptSetup || !utils.hasAttribute(scriptSetup, 'lang', 'ts')) { return {} } diff --git a/tests/lib/rules/prefer-type-emits-decl.js b/tests/lib/rules/prefer-type-emits-decl.js index 82e5c93aa..b4b430980 100644 --- a/tests/lib/rules/prefer-type-emits-decl.js +++ b/tests/lib/rules/prefer-type-emits-decl.js @@ -55,9 +55,6 @@ tester.run('prefer-type-props-decl', rule, { { filename: 'test.vue', code: ` - ``` - - ```vue @@ -48,7 +44,7 @@ Nothing. ## :couple: Related Rules - [vue/prefer-type-props-decl](./prefer-type-props-decl.md) -- [vue/valid-define-props](./valid-define-props.md) +- [vue/valid-define-emits](./valid-define-emits.md) ## :mag: Implementation diff --git a/docs/rules/prefer-type-props-decl.md b/docs/rules/prefer-type-props-decl.md index d92a40ff6..820bdfb1e 100644 --- a/docs/rules/prefer-type-props-decl.md +++ b/docs/rules/prefer-type-props-decl.md @@ -16,8 +16,6 @@ This rule forces developers to use the type-based declaration of `defineProps` i This rule only works in setup script and `lang="ts"`. - - ```vue ``` - - ```vue diff --git a/docs/rules/valid-define-emits.md b/docs/rules/valid-define-emits.md index 5718794ca..1162e70d8 100644 --- a/docs/rules/valid-define-emits.md +++ b/docs/rules/valid-define-emits.md @@ -27,8 +27,8 @@ This rule reports `defineEmits` compiler macros in the following cases: ```vue ``` @@ -38,8 +38,8 @@ This rule reports `defineEmits` compiler macros in the following cases: ```vue ``` @@ -47,8 +47,8 @@ This rule reports `defineEmits` compiler macros in the following cases: ```vue ``` @@ -56,11 +56,11 @@ This rule reports `defineEmits` compiler macros in the following cases: ```vue ``` @@ -70,9 +70,9 @@ This rule reports `defineEmits` compiler macros in the following cases: ```vue ``` @@ -80,8 +80,8 @@ This rule reports `defineEmits` compiler macros in the following cases: ```vue ``` @@ -89,9 +89,9 @@ This rule reports `defineEmits` compiler macros in the following cases: ```vue ``` @@ -101,13 +101,13 @@ This rule reports `defineEmits` compiler macros in the following cases: ```vue ``` @@ -117,8 +117,8 @@ This rule reports `defineEmits` compiler macros in the following cases: ```vue ``` @@ -128,6 +128,11 @@ This rule reports `defineEmits` compiler macros in the following cases: Nothing. +## :couple: Related Rules + +- [vue/prefer-type-emits-decl](./prefer-type-emits-decl.md) +- [vue/valid-define-props](./valid-define-props.md) + ## :rocket: Version This rule was introduced in eslint-plugin-vue v7.13.0 diff --git a/docs/rules/valid-define-props.md b/docs/rules/valid-define-props.md index 623472ed2..c36f7832a 100644 --- a/docs/rules/valid-define-props.md +++ b/docs/rules/valid-define-props.md @@ -131,7 +131,7 @@ Nothing. ## :couple: Related Rules - [vue/prefer-type-props-decl](./prefer-type-props-decl.md) -- [vue/prefer-type-emits-decl](./prefer-type-emits-decl.md) +- [vue/valid-define-emits](./valid-define-emits.md) ## :rocket: Version From 6545e85b2940b931d8ad7f96712ae7ac0b824848 Mon Sep 17 00:00:00 2001 From: Amorites <751809522@qq.com> Date: Wed, 14 Sep 2022 20:04:30 +0800 Subject: [PATCH 07/19] Update lib/rules/prefer-type-emits-decl.js Co-authored-by: Flo Edelmann --- lib/rules/prefer-type-emits-decl.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/rules/prefer-type-emits-decl.js b/lib/rules/prefer-type-emits-decl.js index b76842011..c57ee9aca 100644 --- a/lib/rules/prefer-type-emits-decl.js +++ b/lib/rules/prefer-type-emits-decl.js @@ -10,10 +10,6 @@ const utils = require('../utils') -// ------------------------------------------------------------------------------ -// Helpers -// ------------------------------------------------------------------------------ - // ------------------------------------------------------------------------------ // Rule Definition // ------------------------------------------------------------------------------ From 9dd43d8a5a4f4019868e947906dc578f0cacb99f Mon Sep 17 00:00:00 2001 From: Amorites <751809522@qq.com> Date: Wed, 14 Sep 2022 20:07:08 +0800 Subject: [PATCH 08/19] Update tests/lib/rules/prefer-type-emits-decl.js Co-authored-by: Flo Edelmann --- tests/lib/rules/prefer-type-emits-decl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/rules/prefer-type-emits-decl.js b/tests/lib/rules/prefer-type-emits-decl.js index b4b430980..229691cf1 100644 --- a/tests/lib/rules/prefer-type-emits-decl.js +++ b/tests/lib/rules/prefer-type-emits-decl.js @@ -15,7 +15,7 @@ const tester = new RuleTester({ } }) -tester.run('prefer-type-props-decl', rule, { +tester.run('prefer-type-emits-decl', rule, { valid: [ { filename: 'test.vue', From 624396e387b2eedaea7d7eedcc1bf09e91bea0ab Mon Sep 17 00:00:00 2001 From: Amorites <751809522@qq.com> Date: Wed, 14 Sep 2022 20:55:34 +0800 Subject: [PATCH 09/19] chore: rename rule name --- docs/rules/README.md | 474 +++++++++--------- ...ts-decl.md => define-emits-declaration.md} | 15 +- ...ps-decl.md => define-props-declaration.md} | 15 +- docs/rules/valid-define-emits.md | 3 +- docs/rules/valid-define-props.md | 3 +- lib/configs/no-layout-rules.js | 4 +- lib/index.js | 4 +- ...ts-decl.js => define-emits-declaration.js} | 2 +- ...ps-decl.js => define-props-declaration.js} | 2 +- ...ts-decl.js => define-emits-declaration.js} | 4 +- ...ps-decl.js => define-props-declaration.js} | 4 +- 11 files changed, 267 insertions(+), 263 deletions(-) rename docs/rules/{prefer-type-emits-decl.md => define-emits-declaration.md} (70%) rename docs/rules/{prefer-type-props-decl.md => define-props-declaration.md} (69%) rename lib/rules/{prefer-type-emits-decl.js => define-emits-declaration.js} (94%) rename lib/rules/{prefer-type-props-decl.js => define-props-declaration.js} (95%) rename tests/lib/rules/{prefer-type-emits-decl.js => define-emits-declaration.js} (94%) rename tests/lib/rules/{prefer-type-props-decl.js => define-props-declaration.js} (94%) diff --git a/docs/rules/README.md b/docs/rules/README.md index e2c017a04..d7e017537 100644 --- a/docs/rules/README.md +++ b/docs/rules/README.md @@ -8,9 +8,9 @@ pageClass: rule-list ::: tip Legend - :wrench: Indicates that the rule is fixable, and using `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the reported problems. +:wrench: Indicates that the rule is fixable, and using `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the reported problems. - :bulb: Indicates that some problems reported by the rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions). +:bulb: Indicates that some problems reported by the rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions). ::: Mark indicating rule type: @@ -25,10 +25,10 @@ Rules in this category are enabled for all presets provided by eslint-plugin-vue -| Rule ID | Description | | | -|:--------|:------------|:--:|:--:| -| [vue/comment-directive](./comment-directive.md) | support comment-directives in `