From 2479d2fc2c88963e5627902f5d09656aa77c18cb Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Wed, 12 Oct 2022 04:11:08 +0200 Subject: [PATCH] Improve `new-rule` tool and templates (#2008) * Ask for author in `new-rule` tool * Remove section comments * Update extension rule descriptions by running `npm i && npm run update` --- docs/developer-guide/README.md | 2 +- docs/rules/README.md | 68 +++++++++---------- docs/rules/array-bracket-newline.md | 4 +- docs/rules/array-bracket-spacing.md | 4 +- docs/rules/arrow-spacing.md | 4 +- docs/rules/block-spacing.md | 4 +- docs/rules/brace-style.md | 4 +- docs/rules/camelcase.md | 4 +- docs/rules/comma-dangle.md | 4 +- docs/rules/comma-spacing.md | 4 +- docs/rules/comma-style.md | 4 +- docs/rules/dot-location.md | 4 +- docs/rules/dot-notation.md | 4 +- docs/rules/eqeqeq.md | 4 +- docs/rules/func-call-spacing.md | 4 +- docs/rules/key-spacing.md | 4 +- docs/rules/keyword-spacing.md | 4 +- docs/rules/multiline-ternary.md | 4 +- docs/rules/no-constant-condition.md | 4 +- docs/rules/no-empty-pattern.md | 4 +- docs/rules/no-extra-parens.md | 4 +- docs/rules/no-loss-of-precision.md | 4 +- docs/rules/no-restricted-syntax.md | 4 +- docs/rules/no-sparse-arrays.md | 4 +- docs/rules/no-useless-concat.md | 4 +- docs/rules/object-curly-newline.md | 4 +- docs/rules/object-curly-spacing.md | 4 +- docs/rules/object-property-newline.md | 4 +- docs/rules/object-shorthand.md | 4 +- docs/rules/operator-linebreak.md | 4 +- docs/rules/prefer-template.md | 4 +- docs/rules/quote-props.md | 4 +- docs/rules/space-in-parens.md | 4 +- docs/rules/space-infix-ops.md | 4 +- docs/rules/space-unary-ops.md | 4 +- docs/rules/template-curly-spacing.md | 4 +- .../no-invalid-meta-docs-categories.js | 8 --- eslint-internal-rules/no-invalid-meta.js | 8 --- lib/rules/attribute-hyphenation.js | 8 --- lib/rules/attributes-order.js | 4 -- lib/rules/block-lang.js | 4 -- lib/rules/block-tag-newline.js | 4 -- lib/rules/comment-directive.js | 11 --- lib/rules/component-definition-name-casing.js | 8 --- .../component-name-in-template-casing.js | 12 ---- lib/rules/component-options-name-casing.js | 12 ---- lib/rules/component-tags-order.js | 12 ---- lib/rules/custom-event-name-casing.js | 12 ---- lib/rules/define-emits-declaration.js | 8 --- lib/rules/define-macros-order.js | 12 ---- lib/rules/define-props-declaration.js | 8 --- lib/rules/first-attribute-linebreak.js | 3 - lib/rules/html-button-has-type.js | 8 --- lib/rules/html-closing-bracket-newline.js | 12 ---- lib/rules/html-closing-bracket-spacing.js | 12 ---- lib/rules/html-comment-content-newline.js | 12 ---- lib/rules/html-comment-content-spacing.js | 8 --- lib/rules/html-comment-indent.js | 12 ---- lib/rules/html-end-tags.js | 8 --- lib/rules/html-indent.js | 8 --- lib/rules/html-quotes.js | 8 --- lib/rules/html-self-closing.js | 12 ---- lib/rules/jsx-uses-vars.js | 4 -- lib/rules/match-component-file-name.js | 12 ---- lib/rules/max-attributes-per-line.js | 7 -- lib/rules/max-len.js | 24 ------- lib/rules/multi-word-component-names.js | 8 --- .../multiline-html-element-content-newline.js | 12 ---- lib/rules/multiline-ternary.js | 4 -- lib/rules/mustache-interpolation-spacing.js | 12 ---- .../new-line-between-multi-line-property.js | 3 - lib/rules/next-tick-style.js | 12 ---- lib/rules/no-async-in-computed-properties.js | 4 -- lib/rules/no-bare-strings-in-template.js | 16 ----- lib/rules/no-boolean-default.js | 4 -- lib/rules/no-child-content.js | 4 -- lib/rules/no-computed-properties-in-data.js | 8 --- lib/rules/no-custom-modifiers-on-v-model.js | 12 ---- .../no-deprecated-data-object-declaration.js | 8 --- .../no-deprecated-destroyed-lifecycle.js | 8 --- .../no-deprecated-dollar-listeners-api.js | 8 --- .../no-deprecated-dollar-scopedslots-api.js | 8 --- lib/rules/no-deprecated-events-api.js | 8 --- lib/rules/no-deprecated-filter.js | 8 --- .../no-deprecated-functional-template.js | 8 --- lib/rules/no-deprecated-html-element-is.js | 8 --- lib/rules/no-deprecated-inline-template.js | 8 --- lib/rules/no-deprecated-props-default-this.js | 8 --- .../no-deprecated-router-link-tag-prop.js | 12 ---- lib/rules/no-deprecated-v-bind-sync.js | 8 --- .../no-deprecated-v-on-native-modifier.js | 8 --- .../no-deprecated-v-on-number-modifiers.js | 8 --- .../no-deprecated-vue-config-keycodes.js | 4 -- lib/rules/no-dupe-keys.js | 7 -- lib/rules/no-dupe-v-else-if.js | 12 ---- lib/rules/no-duplicate-attr-inheritance.js | 4 -- lib/rules/no-duplicate-attributes.js | 12 ---- lib/rules/no-empty-component-block.js | 8 --- lib/rules/no-expose-after-await.js | 12 ---- lib/rules/no-irregular-whitespace.js | 12 ---- lib/rules/no-lone-template.js | 12 ---- lib/rules/no-loss-of-precision.js | 4 -- lib/rules/no-multi-spaces.js | 4 -- lib/rules/no-multiple-objects-in-class.js | 8 --- lib/rules/no-multiple-slot-args.js | 8 --- lib/rules/no-multiple-template-root.js | 8 --- lib/rules/no-mutating-props.js | 4 -- lib/rules/no-parsing-error.js | 8 --- .../no-potential-component-option-typo.js | 4 -- lib/rules/no-ref-object-destructure.js | 12 ---- lib/rules/no-required-prop-with-default.js | 8 --- lib/rules/no-reserved-component-names.js | 4 -- lib/rules/no-reserved-keys.js | 8 --- lib/rules/no-reserved-props.js | 12 ---- lib/rules/no-restricted-class.js | 9 --- lib/rules/no-restricted-custom-event.js | 8 --- lib/rules/no-shared-component-data.js | 4 -- .../no-side-effects-in-computed-properties.js | 4 -- ...-spaces-around-equal-signs-in-attribute.js | 8 --- lib/rules/no-template-key.js | 8 --- lib/rules/no-template-shadow.js | 12 ---- lib/rules/no-template-target-blank.js | 11 --- lib/rules/no-textarea-mustache.js | 8 --- lib/rules/no-this-in-before-route-enter.js | 8 --- lib/rules/no-undef-components.js | 12 ---- lib/rules/no-undef-properties.js | 12 ---- lib/rules/no-unused-components.js | 8 --- lib/rules/no-unused-properties.js | 16 ----- lib/rules/no-unused-refs.js | 12 ---- lib/rules/no-unused-vars.js | 8 --- .../no-use-computed-property-like-method.js | 7 -- lib/rules/no-use-v-if-with-v-for.js | 12 ---- lib/rules/no-useless-template-attributes.js | 11 --- lib/rules/no-v-for-template-key-on-child.js | 12 ---- lib/rules/no-v-for-template-key.js | 4 -- lib/rules/no-v-html.js | 4 -- lib/rules/no-v-model-argument.js | 8 --- lib/rules/no-v-text-v-html-on-component.js | 8 --- lib/rules/no-v-text.js | 4 -- lib/rules/one-component-per-file.js | 4 -- lib/rules/order-in-components.js | 4 -- lib/rules/padding-line-between-blocks.js | 4 -- lib/rules/padding-line-between-tags.js | 8 --- lib/rules/prefer-import-from-vue.js | 12 ---- lib/rules/prefer-prop-type-boolean-first.js | 12 ---- lib/rules/prefer-separate-static-class.js | 8 --- lib/rules/prefer-true-attribute-shorthand.js | 8 --- lib/rules/prop-name-casing.js | 11 --- lib/rules/require-component-is.js | 8 --- lib/rules/require-default-prop.js | 12 ---- lib/rules/require-direct-export.js | 4 -- lib/rules/require-emit-validator.js | 12 ---- lib/rules/require-explicit-emits.js | 11 --- lib/rules/require-expose.js | 4 -- lib/rules/require-prop-type-constructor.js | 4 -- lib/rules/require-prop-types.js | 12 ---- lib/rules/require-render-return.js | 8 --- lib/rules/require-slots-as-functions.js | 8 --- lib/rules/require-toggle-inside-transition.js | 8 --- lib/rules/require-v-for-key.js | 8 --- lib/rules/require-valid-default-prop.js | 12 ---- lib/rules/return-in-computed-property.js | 8 --- lib/rules/return-in-emits-validator.js | 8 --- lib/rules/script-indent.js | 8 --- lib/rules/script-setup-uses-vars.js | 8 --- ...singleline-html-element-content-newline.js | 12 ---- lib/rules/sort-keys.js | 12 ---- lib/rules/static-class-names-order.js | 7 -- .../syntaxes/v-model-custom-modifiers.js | 4 -- lib/rules/this-in-template.js | 8 --- lib/rules/use-v-on-exact.js | 12 ---- lib/rules/v-bind-style.js | 8 --- lib/rules/v-for-delimiter-style.js | 8 --- lib/rules/v-on-function-call.js | 12 ---- lib/rules/v-on-style.js | 8 --- lib/rules/valid-model-definition.js | 7 -- lib/rules/valid-next-tick.js | 12 ---- lib/rules/valid-template-root.js | 8 --- lib/rules/valid-v-bind-sync.js | 12 ---- lib/rules/valid-v-bind.js | 12 ---- lib/rules/valid-v-cloak.js | 8 --- lib/rules/valid-v-else-if.js | 8 --- lib/rules/valid-v-else.js | 8 --- lib/rules/valid-v-for.js | 12 ---- lib/rules/valid-v-html.js | 8 --- lib/rules/valid-v-if.js | 8 --- lib/rules/valid-v-is.js | 12 ---- lib/rules/valid-v-memo.js | 8 --- lib/rules/valid-v-model.js | 12 ---- lib/rules/valid-v-on.js | 12 ---- lib/rules/valid-v-once.js | 8 --- lib/rules/valid-v-pre.js | 8 --- lib/rules/valid-v-show.js | 8 --- lib/rules/valid-v-text.js | 8 --- lib/utils/casing.js | 4 -- lib/utils/html-comments.js | 8 --- lib/utils/indent-common.js | 7 -- lib/utils/property-references.js | 8 --- lib/utils/ref-object-references.js | 7 -- tests/integrations/eslint-plugin-import.js | 8 --- tests/lib/rules/attribute-hyphenation.js | 8 --- tests/lib/rules/attributes-order.js | 8 --- tests/lib/rules/comment-directive.js | 8 --- tests/lib/rules/component-api-style.js | 8 --- .../rules/component-definition-name-casing.js | 8 --- .../component-name-in-template-casing.js | 8 --- tests/lib/rules/component-tags-order.js | 8 --- tests/lib/rules/first-attribute-linebreak.js | 8 --- tests/lib/rules/html-button-has-type.js | 8 --- .../lib/rules/html-closing-bracket-newline.js | 8 --- .../lib/rules/html-closing-bracket-spacing.js | 8 --- tests/lib/rules/html-end-tags.js | 8 --- tests/lib/rules/html-indent.js | 12 ---- tests/lib/rules/html-quotes.js | 8 --- tests/lib/rules/html-self-closing.js | 8 --- tests/lib/rules/jsx-uses-vars.js | 8 --- tests/lib/rules/match-component-file-name.js | 8 --- tests/lib/rules/max-attributes-per-line.js | 8 --- tests/lib/rules/max-len.js | 8 --- .../multiline-html-element-content-newline.js | 8 --- .../rules/mustache-interpolation-spacing.js | 8 --- .../new-line-between-multi-line-property.js | 8 --- tests/lib/rules/next-tick-style.js | 8 --- .../lib/rules/no-arrow-functions-in-watch.js | 8 --- .../rules/no-async-in-computed-properties.js | 8 --- .../lib/rules/no-bare-strings-in-template.js | 8 --- tests/lib/rules/no-boolean-default.js | 8 --- tests/lib/rules/no-child-content.js | 7 -- .../rules/no-custom-modifiers-on-v-model.js | 8 --- .../no-deprecated-data-object-declaration.js | 8 --- .../no-deprecated-destroyed-lifecycle.js | 8 --- .../no-deprecated-dollar-listeners-api.js | 8 --- .../no-deprecated-dollar-scopedslots-api.js | 8 --- tests/lib/rules/no-deprecated-events-api.js | 8 --- tests/lib/rules/no-deprecated-filter.js | 8 --- .../no-deprecated-functional-template.js | 8 --- .../rules/no-deprecated-html-element-is.js | 8 --- .../rules/no-deprecated-inline-template.js | 8 --- .../rules/no-deprecated-props-default-this.js | 8 --- tests/lib/rules/no-deprecated-v-bind-sync.js | 8 --- .../no-deprecated-v-on-native-modifier.js | 8 --- .../no-deprecated-v-on-number-modifiers.js | 8 --- .../no-deprecated-vue-config-keycodes.js | 8 --- tests/lib/rules/no-dupe-keys.js | 8 --- .../rules/no-duplicate-attr-inheritance.js | 8 --- tests/lib/rules/no-duplicate-attributes.js | 8 --- tests/lib/rules/no-export-in-script-setup.js | 8 --- tests/lib/rules/no-invalid-model-keys.js | 8 --- tests/lib/rules/no-multi-spaces.js | 8 --- .../lib/rules/no-multiple-objects-in-class.js | 8 --- tests/lib/rules/no-multiple-slot-args.js | 8 --- tests/lib/rules/no-multiple-template-root.js | 8 --- tests/lib/rules/no-mutating-props.js | 8 --- tests/lib/rules/no-parsing-error.js | 8 --- .../no-potential-component-option-typo.js | 10 +-- .../lib/rules/no-reserved-component-names.js | 8 --- tests/lib/rules/no-reserved-keys.js | 8 --- tests/lib/rules/no-restricted-block.js | 8 --- .../rules/no-restricted-component-options.js | 8 --- tests/lib/rules/no-restricted-custom-event.js | 8 --- tests/lib/rules/no-restricted-props.js | 8 --- .../rules/no-restricted-static-attribute.js | 8 --- tests/lib/rules/no-restricted-v-bind.js | 8 --- tests/lib/rules/no-shared-component-data.js | 8 --- .../no-side-effects-in-computed-properties.js | 8 --- ...-spaces-around-equal-signs-in-attribute.js | 8 --- tests/lib/rules/no-template-key.js | 8 --- tests/lib/rules/no-template-shadow.js | 8 --- tests/lib/rules/no-template-target-blank.js | 8 --- tests/lib/rules/no-textarea-mustache.js | 8 --- tests/lib/rules/no-unused-components.js | 8 --- tests/lib/rules/no-unused-vars.js | 8 --- .../no-use-computed-property-like-method.js | 8 --- tests/lib/rules/no-use-v-if-with-v-for.js | 8 --- tests/lib/rules/no-useless-mustaches.js | 8 --- tests/lib/rules/no-useless-v-bind.js | 8 --- .../rules/no-v-for-template-key-on-child.js | 8 --- tests/lib/rules/no-v-for-template-key.js | 8 --- tests/lib/rules/no-v-html.js | 7 -- tests/lib/rules/no-v-model-argument.js | 8 --- tests/lib/rules/no-v-text.js | 7 -- tests/lib/rules/one-component-per-file.js | 4 -- tests/lib/rules/prop-name-casing.js | 8 --- tests/lib/rules/require-component-is.js | 8 --- tests/lib/rules/require-default-prop.js | 8 --- tests/lib/rules/require-direct-export.js | 8 --- tests/lib/rules/require-emit-validator.js | 8 --- .../rules/require-prop-type-constructor.js | 8 --- tests/lib/rules/require-prop-types.js | 8 --- tests/lib/rules/require-render-return.js | 8 --- tests/lib/rules/require-slots-as-functions.js | 8 --- .../rules/require-toggle-inside-transition.js | 8 --- tests/lib/rules/require-v-for-key.js | 8 --- tests/lib/rules/require-valid-default-prop.js | 8 --- .../lib/rules/return-in-computed-property.js | 8 --- tests/lib/rules/return-in-emits-validator.js | 8 --- tests/lib/rules/script-indent.js | 12 ---- tests/lib/rules/script-setup-uses-vars.js | 8 --- ...singleline-html-element-content-newline.js | 8 --- tests/lib/rules/static-class-names-order.js | 8 --- tests/lib/rules/this-in-template.js | 8 --- tests/lib/rules/use-v-on-exact.js | 8 --- tests/lib/rules/v-bind-style.js | 8 --- tests/lib/rules/v-for-delimiter-style.js | 8 --- tests/lib/rules/v-on-function-call.js | 8 --- tests/lib/rules/v-on-style.js | 8 --- tests/lib/rules/v-slot-style.js | 8 --- tests/lib/rules/valid-define-emits.js | 8 --- tests/lib/rules/valid-define-props.js | 8 --- tests/lib/rules/valid-model-definition.js | 8 --- tests/lib/rules/valid-next-tick.js | 8 --- tests/lib/rules/valid-template-root.js | 8 --- tests/lib/rules/valid-v-bind-sync.js | 8 --- tests/lib/rules/valid-v-bind.js | 8 --- tests/lib/rules/valid-v-cloak.js | 8 --- tests/lib/rules/valid-v-else-if.js | 8 --- tests/lib/rules/valid-v-else.js | 8 --- tests/lib/rules/valid-v-for.js | 8 --- tests/lib/rules/valid-v-html.js | 8 --- tests/lib/rules/valid-v-if.js | 8 --- tests/lib/rules/valid-v-is.js | 8 --- tests/lib/rules/valid-v-memo.js | 8 --- tests/lib/rules/valid-v-model.js | 8 --- tests/lib/rules/valid-v-on.js | 8 --- tests/lib/rules/valid-v-once.js | 8 --- tests/lib/rules/valid-v-pre.js | 8 --- tests/lib/rules/valid-v-show.js | 8 --- tests/lib/rules/valid-v-slot.js | 8 --- tests/lib/rules/valid-v-text.js | 8 --- tests/lib/script-setup-vars.js | 8 --- tests/lib/utils/core-rules/wrap-core-rule.js | 4 -- tests/lib/utils/vue-component.js | 8 --- tools/new-rule.js | 46 +++++-------- 333 files changed, 120 insertions(+), 2602 deletions(-) diff --git a/docs/developer-guide/README.md b/docs/developer-guide/README.md index c5bfcc99e..2e1bb7da9 100644 --- a/docs/developer-guide/README.md +++ b/docs/developer-guide/README.md @@ -13,7 +13,7 @@ Please include as much detail as possible to help us properly address your issue In order to add a new rule or a rule change, you should: - Create issue on GitHub with description of proposed rule -- Generate a new rule using the `npm run new -- [rule-name]` command +- Generate a new rule using the `npm run new ` command - Write test scenarios & implement logic - Describe the rule in the generated `docs` file - Make sure all tests are passing diff --git a/docs/rules/README.md b/docs/rules/README.md index 19c2565e4..4052cae75 100644 --- a/docs/rules/README.md +++ b/docs/rules/README.md @@ -276,42 +276,42 @@ The following rules extend the rules provided by ESLint itself and apply them to | Rule ID | Description | | | |:--------|:------------|:--:|:--:| -| [vue/array-bracket-newline](./array-bracket-newline.md) | Enforce linebreaks after opening and before closing array brackets in `