From b22bd8b21c2652c8e087ca112c196428519b8d90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=AF=E7=84=B6?= Date: Mon, 25 Mar 2024 08:33:03 +0800 Subject: [PATCH] feat: support flat configs (#2407) Co-authored-by: Flo Edelmann --- lib/configs/flat/base.js | 17 +++ lib/configs/flat/vue2-essential.js | 76 +++++++++++++ lib/configs/flat/vue2-recommended.js | 20 ++++ lib/configs/flat/vue2-strongly-recommended.js | 36 +++++++ lib/configs/flat/vue3-essential.js | 93 ++++++++++++++++ lib/configs/flat/vue3-recommended.js | 20 ++++ lib/configs/flat/vue3-strongly-recommended.js | 44 ++++++++ .../{essential.js => vue2-essential.js} | 0 .../{recommended.js => vue2-recommended.js} | 2 +- ...mended.js => vue2-strongly-recommended.js} | 2 +- lib/index.js | 63 +++++++++-- lib/rules/attribute-hyphenation.js | 2 +- lib/rules/attributes-order.js | 2 +- lib/rules/component-definition-name-casing.js | 2 +- lib/rules/component-tags-order.js | 2 +- lib/rules/first-attribute-linebreak.js | 2 +- lib/rules/html-closing-bracket-newline.js | 2 +- lib/rules/html-closing-bracket-spacing.js | 2 +- lib/rules/html-end-tags.js | 2 +- lib/rules/html-indent.js | 2 +- lib/rules/html-quotes.js | 2 +- lib/rules/html-self-closing.js | 2 +- lib/rules/max-attributes-per-line.js | 2 +- lib/rules/multi-word-component-names.js | 2 +- .../multiline-html-element-content-newline.js | 2 +- lib/rules/mustache-interpolation-spacing.js | 2 +- lib/rules/no-arrow-functions-in-watch.js | 2 +- lib/rules/no-async-in-computed-properties.js | 2 +- lib/rules/no-child-content.js | 2 +- lib/rules/no-computed-properties-in-data.js | 2 +- lib/rules/no-custom-modifiers-on-v-model.js | 2 +- lib/rules/no-dupe-keys.js | 2 +- lib/rules/no-dupe-v-else-if.js | 2 +- lib/rules/no-duplicate-attributes.js | 2 +- lib/rules/no-export-in-script-setup.js | 2 +- lib/rules/no-lone-template.js | 2 +- lib/rules/no-multi-spaces.js | 2 +- lib/rules/no-multiple-slot-args.js | 2 +- lib/rules/no-multiple-template-root.js | 2 +- lib/rules/no-mutating-props.js | 2 +- lib/rules/no-parsing-error.js | 2 +- lib/rules/no-ref-as-operand.js | 2 +- lib/rules/no-reserved-component-names.js | 2 +- lib/rules/no-reserved-keys.js | 2 +- lib/rules/no-reserved-props.js | 2 +- lib/rules/no-shared-component-data.js | 2 +- .../no-side-effects-in-computed-properties.js | 2 +- ...-spaces-around-equal-signs-in-attribute.js | 2 +- lib/rules/no-template-key.js | 2 +- lib/rules/no-template-shadow.js | 2 +- lib/rules/no-textarea-mustache.js | 2 +- lib/rules/no-unused-components.js | 2 +- lib/rules/no-unused-vars.js | 2 +- .../no-use-computed-property-like-method.js | 2 +- lib/rules/no-use-v-if-with-v-for.js | 2 +- lib/rules/no-useless-template-attributes.js | 2 +- lib/rules/no-v-for-template-key.js | 2 +- lib/rules/no-v-html.js | 2 +- lib/rules/no-v-model-argument.js | 2 +- lib/rules/no-v-text-v-html-on-component.js | 2 +- lib/rules/one-component-per-file.js | 2 +- lib/rules/order-in-components.js | 2 +- lib/rules/prop-name-casing.js | 2 +- lib/rules/require-component-is.js | 2 +- lib/rules/require-default-prop.js | 2 +- lib/rules/require-prop-type-constructor.js | 2 +- lib/rules/require-prop-types.js | 2 +- lib/rules/require-render-return.js | 2 +- lib/rules/require-v-for-key.js | 2 +- lib/rules/require-valid-default-prop.js | 2 +- lib/rules/return-in-computed-property.js | 2 +- lib/rules/return-in-emits-validator.js | 2 +- ...singleline-html-element-content-newline.js | 2 +- lib/rules/this-in-template.js | 2 +- lib/rules/use-v-on-exact.js | 2 +- lib/rules/v-bind-style.js | 2 +- lib/rules/v-on-style.js | 2 +- lib/rules/v-slot-style.js | 2 +- lib/rules/valid-attribute-name.js | 2 +- lib/rules/valid-define-emits.js | 2 +- lib/rules/valid-define-options.js | 2 +- lib/rules/valid-define-props.js | 2 +- lib/rules/valid-model-definition.js | 2 +- lib/rules/valid-next-tick.js | 2 +- lib/rules/valid-template-root.js | 2 +- lib/rules/valid-v-bind-sync.js | 2 +- lib/rules/valid-v-bind.js | 2 +- lib/rules/valid-v-cloak.js | 2 +- lib/rules/valid-v-else-if.js | 2 +- lib/rules/valid-v-else.js | 2 +- lib/rules/valid-v-for.js | 2 +- lib/rules/valid-v-html.js | 2 +- lib/rules/valid-v-if.js | 2 +- lib/rules/valid-v-model.js | 2 +- lib/rules/valid-v-on.js | 2 +- lib/rules/valid-v-once.js | 2 +- lib/rules/valid-v-pre.js | 2 +- lib/rules/valid-v-show.js | 2 +- lib/rules/valid-v-slot.js | 2 +- lib/rules/valid-v-text.js | 2 +- lib/utils/config-helpers.js | 19 ++++ package.json | 1 + tests/lib/configs/{configs.js => eslintrc.js} | 6 +- tests/lib/configs/flat.js | 99 +++++++++++++++++ tools/lib/categories.js | 8 +- tools/lib/configs.js | 15 --- tools/lib/utils.js | 6 +- tools/update-docs-rules-index.js | 8 +- tools/update-docs.js | 4 +- tools/update-lib-configs.js | 10 +- tools/update-lib-flat-configs.js | 101 ++++++++++++++++++ tools/update-lib-index.js | 35 ++++-- tools/update.js | 1 + 113 files changed, 722 insertions(+), 142 deletions(-) create mode 100644 lib/configs/flat/base.js create mode 100644 lib/configs/flat/vue2-essential.js create mode 100644 lib/configs/flat/vue2-recommended.js create mode 100644 lib/configs/flat/vue2-strongly-recommended.js create mode 100644 lib/configs/flat/vue3-essential.js create mode 100644 lib/configs/flat/vue3-recommended.js create mode 100644 lib/configs/flat/vue3-strongly-recommended.js rename lib/configs/{essential.js => vue2-essential.js} (100%) rename lib/configs/{recommended.js => vue2-recommended.js} (87%) rename lib/configs/{strongly-recommended.js => vue2-strongly-recommended.js} (95%) create mode 100644 lib/utils/config-helpers.js rename tests/lib/configs/{configs.js => eslintrc.js} (85%) create mode 100644 tests/lib/configs/flat.js delete mode 100644 tools/lib/configs.js create mode 100644 tools/update-lib-flat-configs.js diff --git a/lib/configs/flat/base.js b/lib/configs/flat/base.js new file mode 100644 index 000000000..e36ab4b77 --- /dev/null +++ b/lib/configs/flat/base.js @@ -0,0 +1,17 @@ +/* + * IMPORTANT! + * This file has been automatically generated, + * in order to update its content execute "npm run update" + */ +const globals = require('globals') +module.exports = { + languageOptions: { + parser: require('vue-eslint-parser'), + sourceType: 'module', + globals: globals.browser + }, + rules: { + 'vue/comment-directive': 'error', + 'vue/jsx-uses-vars': 'error' + } +} diff --git a/lib/configs/flat/vue2-essential.js b/lib/configs/flat/vue2-essential.js new file mode 100644 index 000000000..ce253352b --- /dev/null +++ b/lib/configs/flat/vue2-essential.js @@ -0,0 +1,76 @@ +/* + * IMPORTANT! + * This file has been automatically generated, + * in order to update its content execute "npm run update" + */ +'use strict' +const config = require('./base.js') +const { extendRules } = require('../../utils/config-helpers.js') + +const rules = { + 'vue/multi-word-component-names': 'error', + 'vue/no-arrow-functions-in-watch': 'error', + 'vue/no-async-in-computed-properties': 'error', + 'vue/no-child-content': 'error', + 'vue/no-computed-properties-in-data': 'error', + 'vue/no-custom-modifiers-on-v-model': 'error', + 'vue/no-dupe-keys': 'error', + 'vue/no-dupe-v-else-if': 'error', + 'vue/no-duplicate-attributes': 'error', + 'vue/no-export-in-script-setup': 'error', + 'vue/no-multiple-template-root': 'error', + 'vue/no-mutating-props': 'error', + 'vue/no-parsing-error': 'error', + 'vue/no-ref-as-operand': 'error', + 'vue/no-reserved-component-names': 'error', + 'vue/no-reserved-keys': 'error', + 'vue/no-reserved-props': [ + 'error', + { + vueVersion: 2 + } + ], + 'vue/no-shared-component-data': 'error', + 'vue/no-side-effects-in-computed-properties': 'error', + 'vue/no-template-key': 'error', + 'vue/no-textarea-mustache': 'error', + 'vue/no-unused-components': 'error', + 'vue/no-unused-vars': 'error', + 'vue/no-use-computed-property-like-method': 'error', + 'vue/no-use-v-if-with-v-for': 'error', + 'vue/no-useless-template-attributes': 'error', + 'vue/no-v-for-template-key': 'error', + 'vue/no-v-model-argument': 'error', + 'vue/no-v-text-v-html-on-component': 'error', + 'vue/require-component-is': 'error', + 'vue/require-prop-type-constructor': 'error', + 'vue/require-render-return': 'error', + 'vue/require-v-for-key': 'error', + 'vue/require-valid-default-prop': 'error', + 'vue/return-in-computed-property': 'error', + 'vue/return-in-emits-validator': 'error', + 'vue/use-v-on-exact': 'error', + 'vue/valid-attribute-name': 'error', + 'vue/valid-define-emits': 'error', + 'vue/valid-define-props': 'error', + 'vue/valid-model-definition': 'error', + 'vue/valid-next-tick': 'error', + 'vue/valid-template-root': 'error', + 'vue/valid-v-bind-sync': 'error', + 'vue/valid-v-bind': 'error', + 'vue/valid-v-cloak': 'error', + 'vue/valid-v-else-if': 'error', + 'vue/valid-v-else': 'error', + 'vue/valid-v-for': 'error', + 'vue/valid-v-html': 'error', + 'vue/valid-v-if': 'error', + 'vue/valid-v-model': 'error', + 'vue/valid-v-on': 'error', + 'vue/valid-v-once': 'error', + 'vue/valid-v-pre': 'error', + 'vue/valid-v-show': 'error', + 'vue/valid-v-slot': 'error', + 'vue/valid-v-text': 'error' +} + +module.exports = extendRules(config, rules) diff --git a/lib/configs/flat/vue2-recommended.js b/lib/configs/flat/vue2-recommended.js new file mode 100644 index 000000000..e15b02075 --- /dev/null +++ b/lib/configs/flat/vue2-recommended.js @@ -0,0 +1,20 @@ +/* + * IMPORTANT! + * This file has been automatically generated, + * in order to update its content execute "npm run update" + */ +'use strict' +const config = require('./vue2-strongly-recommended.js') +const { extendRules } = require('../../utils/config-helpers.js') + +const rules = { + 'vue/attributes-order': 'warn', + 'vue/component-tags-order': 'warn', + 'vue/no-lone-template': 'warn', + 'vue/no-multiple-slot-args': 'warn', + 'vue/no-v-html': 'warn', + 'vue/order-in-components': 'warn', + 'vue/this-in-template': 'warn' +} + +module.exports = extendRules(config, rules) diff --git a/lib/configs/flat/vue2-strongly-recommended.js b/lib/configs/flat/vue2-strongly-recommended.js new file mode 100644 index 000000000..a1c870b92 --- /dev/null +++ b/lib/configs/flat/vue2-strongly-recommended.js @@ -0,0 +1,36 @@ +/* + * IMPORTANT! + * This file has been automatically generated, + * in order to update its content execute "npm run update" + */ +'use strict' +const config = require('./vue2-essential.js') +const { extendRules } = require('../../utils/config-helpers.js') + +const rules = { + 'vue/attribute-hyphenation': 'warn', + 'vue/component-definition-name-casing': 'warn', + 'vue/first-attribute-linebreak': 'warn', + 'vue/html-closing-bracket-newline': 'warn', + 'vue/html-closing-bracket-spacing': 'warn', + 'vue/html-end-tags': 'warn', + 'vue/html-indent': 'warn', + 'vue/html-quotes': 'warn', + 'vue/html-self-closing': 'warn', + 'vue/max-attributes-per-line': 'warn', + 'vue/multiline-html-element-content-newline': 'warn', + 'vue/mustache-interpolation-spacing': 'warn', + 'vue/no-multi-spaces': 'warn', + 'vue/no-spaces-around-equal-signs-in-attribute': 'warn', + 'vue/no-template-shadow': 'warn', + 'vue/one-component-per-file': 'warn', + 'vue/prop-name-casing': 'warn', + 'vue/require-default-prop': 'warn', + 'vue/require-prop-types': 'warn', + 'vue/singleline-html-element-content-newline': 'warn', + 'vue/v-bind-style': 'warn', + 'vue/v-on-style': 'warn', + 'vue/v-slot-style': 'warn' +} + +module.exports = extendRules(config, rules) diff --git a/lib/configs/flat/vue3-essential.js b/lib/configs/flat/vue3-essential.js new file mode 100644 index 000000000..e8450635d --- /dev/null +++ b/lib/configs/flat/vue3-essential.js @@ -0,0 +1,93 @@ +/* + * IMPORTANT! + * This file has been automatically generated, + * in order to update its content execute "npm run update" + */ +'use strict' +const config = require('./base.js') +const { extendRules } = require('../../utils/config-helpers.js') + +const rules = { + 'vue/multi-word-component-names': 'error', + 'vue/no-arrow-functions-in-watch': 'error', + 'vue/no-async-in-computed-properties': 'error', + 'vue/no-child-content': 'error', + 'vue/no-computed-properties-in-data': 'error', + 'vue/no-deprecated-data-object-declaration': 'error', + 'vue/no-deprecated-destroyed-lifecycle': 'error', + 'vue/no-deprecated-dollar-listeners-api': 'error', + 'vue/no-deprecated-dollar-scopedslots-api': 'error', + 'vue/no-deprecated-events-api': 'error', + 'vue/no-deprecated-filter': 'error', + 'vue/no-deprecated-functional-template': 'error', + 'vue/no-deprecated-html-element-is': 'error', + 'vue/no-deprecated-inline-template': 'error', + 'vue/no-deprecated-props-default-this': 'error', + 'vue/no-deprecated-router-link-tag-prop': 'error', + 'vue/no-deprecated-scope-attribute': 'error', + 'vue/no-deprecated-slot-attribute': 'error', + 'vue/no-deprecated-slot-scope-attribute': 'error', + 'vue/no-deprecated-v-bind-sync': 'error', + 'vue/no-deprecated-v-is': 'error', + 'vue/no-deprecated-v-on-native-modifier': 'error', + 'vue/no-deprecated-v-on-number-modifiers': 'error', + 'vue/no-deprecated-vue-config-keycodes': 'error', + 'vue/no-dupe-keys': 'error', + 'vue/no-dupe-v-else-if': 'error', + 'vue/no-duplicate-attributes': 'error', + 'vue/no-export-in-script-setup': 'error', + 'vue/no-expose-after-await': 'error', + 'vue/no-lifecycle-after-await': 'error', + 'vue/no-mutating-props': 'error', + 'vue/no-parsing-error': 'error', + 'vue/no-ref-as-operand': 'error', + 'vue/no-reserved-component-names': 'error', + 'vue/no-reserved-keys': 'error', + 'vue/no-reserved-props': 'error', + 'vue/no-shared-component-data': 'error', + 'vue/no-side-effects-in-computed-properties': 'error', + 'vue/no-template-key': 'error', + 'vue/no-textarea-mustache': 'error', + 'vue/no-unused-components': 'error', + 'vue/no-unused-vars': 'error', + 'vue/no-use-computed-property-like-method': 'error', + 'vue/no-use-v-if-with-v-for': 'error', + 'vue/no-useless-template-attributes': 'error', + 'vue/no-v-for-template-key-on-child': 'error', + 'vue/no-v-text-v-html-on-component': 'error', + 'vue/no-watch-after-await': 'error', + 'vue/prefer-import-from-vue': 'error', + 'vue/require-component-is': 'error', + 'vue/require-prop-type-constructor': 'error', + 'vue/require-render-return': 'error', + 'vue/require-slots-as-functions': 'error', + 'vue/require-toggle-inside-transition': 'error', + 'vue/require-v-for-key': 'error', + 'vue/require-valid-default-prop': 'error', + 'vue/return-in-computed-property': 'error', + 'vue/return-in-emits-validator': 'error', + 'vue/use-v-on-exact': 'error', + 'vue/valid-attribute-name': 'error', + 'vue/valid-define-emits': 'error', + 'vue/valid-define-props': 'error', + 'vue/valid-next-tick': 'error', + 'vue/valid-template-root': 'error', + 'vue/valid-v-bind': 'error', + 'vue/valid-v-cloak': 'error', + 'vue/valid-v-else-if': 'error', + 'vue/valid-v-else': 'error', + 'vue/valid-v-for': 'error', + 'vue/valid-v-html': 'error', + 'vue/valid-v-if': 'error', + 'vue/valid-v-is': 'error', + 'vue/valid-v-memo': 'error', + 'vue/valid-v-model': 'error', + 'vue/valid-v-on': 'error', + 'vue/valid-v-once': 'error', + 'vue/valid-v-pre': 'error', + 'vue/valid-v-show': 'error', + 'vue/valid-v-slot': 'error', + 'vue/valid-v-text': 'error' +} + +module.exports = extendRules(config, rules) diff --git a/lib/configs/flat/vue3-recommended.js b/lib/configs/flat/vue3-recommended.js new file mode 100644 index 000000000..e39b86bc8 --- /dev/null +++ b/lib/configs/flat/vue3-recommended.js @@ -0,0 +1,20 @@ +/* + * IMPORTANT! + * This file has been automatically generated, + * in order to update its content execute "npm run update" + */ +'use strict' +const config = require('./vue3-strongly-recommended.js') +const { extendRules } = require('../../utils/config-helpers.js') + +const rules = { + 'vue/attributes-order': 'warn', + 'vue/component-tags-order': 'warn', + 'vue/no-lone-template': 'warn', + 'vue/no-multiple-slot-args': 'warn', + 'vue/no-v-html': 'warn', + 'vue/order-in-components': 'warn', + 'vue/this-in-template': 'warn' +} + +module.exports = extendRules(config, rules) diff --git a/lib/configs/flat/vue3-strongly-recommended.js b/lib/configs/flat/vue3-strongly-recommended.js new file mode 100644 index 000000000..ec71ac468 --- /dev/null +++ b/lib/configs/flat/vue3-strongly-recommended.js @@ -0,0 +1,44 @@ +/* + * IMPORTANT! + * This file has been automatically generated, + * in order to update its content execute "npm run update" + */ +'use strict' +const config = require('./vue3-essential.js') +const { extendRules } = require('../../utils/config-helpers.js') + +const rules = { + 'vue/attribute-hyphenation': 'warn', + 'vue/component-definition-name-casing': 'warn', + 'vue/first-attribute-linebreak': 'warn', + 'vue/html-closing-bracket-newline': 'warn', + 'vue/html-closing-bracket-spacing': 'warn', + 'vue/html-end-tags': 'warn', + 'vue/html-indent': 'warn', + 'vue/html-quotes': 'warn', + 'vue/html-self-closing': 'warn', + 'vue/max-attributes-per-line': 'warn', + 'vue/multiline-html-element-content-newline': 'warn', + 'vue/mustache-interpolation-spacing': 'warn', + 'vue/no-multi-spaces': 'warn', + 'vue/no-spaces-around-equal-signs-in-attribute': 'warn', + 'vue/no-template-shadow': 'warn', + 'vue/one-component-per-file': 'warn', + 'vue/prop-name-casing': 'warn', + 'vue/require-default-prop': 'warn', + 'vue/require-explicit-emits': 'warn', + 'vue/require-prop-types': 'warn', + 'vue/singleline-html-element-content-newline': 'warn', + 'vue/v-bind-style': 'warn', + 'vue/v-on-event-hyphenation': [ + 'warn', + 'always', + { + autofix: true + } + ], + 'vue/v-on-style': 'warn', + 'vue/v-slot-style': 'warn' +} + +module.exports = extendRules(config, rules) diff --git a/lib/configs/essential.js b/lib/configs/vue2-essential.js similarity index 100% rename from lib/configs/essential.js rename to lib/configs/vue2-essential.js diff --git a/lib/configs/recommended.js b/lib/configs/vue2-recommended.js similarity index 87% rename from lib/configs/recommended.js rename to lib/configs/vue2-recommended.js index 3db36d8c0..b04180998 100644 --- a/lib/configs/recommended.js +++ b/lib/configs/vue2-recommended.js @@ -4,7 +4,7 @@ * in order to update its content execute "npm run update" */ module.exports = { - extends: require.resolve('./strongly-recommended'), + extends: require.resolve('./vue2-strongly-recommended'), rules: { 'vue/attributes-order': 'warn', 'vue/component-tags-order': 'warn', diff --git a/lib/configs/strongly-recommended.js b/lib/configs/vue2-strongly-recommended.js similarity index 95% rename from lib/configs/strongly-recommended.js rename to lib/configs/vue2-strongly-recommended.js index 02daf9a3c..e7b0f3dc7 100644 --- a/lib/configs/strongly-recommended.js +++ b/lib/configs/vue2-strongly-recommended.js @@ -4,7 +4,7 @@ * in order to update its content execute "npm run update" */ module.exports = { - extends: require.resolve('./essential'), + extends: require.resolve('./vue2-essential'), rules: { 'vue/attribute-hyphenation': 'warn', 'vue/component-definition-name-casing': 'warn', diff --git a/lib/index.js b/lib/index.js index 99421f248..bc6c9a463 100644 --- a/lib/index.js +++ b/lib/index.js @@ -5,7 +5,7 @@ */ 'use strict' -module.exports = { +const plugin = { meta: require('./meta'), rules: { 'array-bracket-newline': require('./rules/array-bracket-newline'), @@ -250,16 +250,6 @@ module.exports = { 'valid-v-slot': require('./rules/valid-v-slot'), 'valid-v-text': require('./rules/valid-v-text') }, - configs: { - base: require('./configs/base'), - essential: require('./configs/essential'), - 'no-layout-rules': require('./configs/no-layout-rules'), - recommended: require('./configs/recommended'), - 'strongly-recommended': require('./configs/strongly-recommended'), - 'vue3-essential': require('./configs/vue3-essential'), - 'vue3-recommended': require('./configs/vue3-recommended'), - 'vue3-strongly-recommended': require('./configs/vue3-strongly-recommended') - }, processors: { '.vue': require('./processor') }, @@ -276,3 +266,54 @@ module.exports = { } } } + +const baseConfig = { plugins: { vue: plugin } } + +plugin.configs = { + // eslintrc configs + base: require('./configs/base'), + essential: require('./configs/vue2-essential'), + 'no-layout-rules': require('./configs/no-layout-rules'), + recommended: require('./configs/vue2-recommended'), + 'strongly-recommended': require('./configs/vue2-strongly-recommended'), + 'vue3-essential': require('./configs/vue3-essential'), + 'vue3-recommended': require('./configs/vue3-recommended'), + 'vue3-strongly-recommended': require('./configs/vue3-strongly-recommended'), + + // flat configs + 'flat/base': Object.assign({}, baseConfig, require('./configs/flat/base.js')), + 'flat/vue2-essential': Object.assign( + {}, + baseConfig, + require('./configs/flat/vue2-essential.js') + ), + 'flat/vue2-recommended': Object.assign( + {}, + baseConfig, + require('./configs/flat/vue2-recommended.js') + ), + 'flat/vue2-strongly-recommended': Object.assign( + {}, + baseConfig, + require('./configs/flat/vue2-strongly-recommended.js') + ), + + // in flat configs, non-prefixed config is for Vue 3 (unlike eslintrc configs) + 'flat/essential': Object.assign( + {}, + baseConfig, + require('./configs/flat/vue3-essential.js') + ), + 'flat/recommended': Object.assign( + {}, + baseConfig, + require('./configs/flat/vue3-recommended.js') + ), + 'flat/strongly-recommended': Object.assign( + {}, + baseConfig, + require('./configs/flat/vue3-strongly-recommended.js') + ) +} + +module.exports = plugin diff --git a/lib/rules/attribute-hyphenation.js b/lib/rules/attribute-hyphenation.js index 11f681ef7..3de0af1b5 100644 --- a/lib/rules/attribute-hyphenation.js +++ b/lib/rules/attribute-hyphenation.js @@ -34,7 +34,7 @@ module.exports = { docs: { description: 'enforce attribute naming style on custom components in template', - categories: ['vue3-strongly-recommended', 'strongly-recommended'], + categories: ['vue3-strongly-recommended', 'vue2-strongly-recommended'], url: 'https://eslint.vuejs.org/rules/attribute-hyphenation.html' }, fixable: 'code', diff --git a/lib/rules/attributes-order.js b/lib/rules/attributes-order.js index 44404f05c..30dc75c27 100644 --- a/lib/rules/attributes-order.js +++ b/lib/rules/attributes-order.js @@ -424,7 +424,7 @@ module.exports = { type: 'suggestion', docs: { description: 'enforce order of attributes', - categories: ['vue3-recommended', 'recommended'], + categories: ['vue3-recommended', 'vue2-recommended'], url: 'https://eslint.vuejs.org/rules/attributes-order.html' }, fixable: 'code', diff --git a/lib/rules/component-definition-name-casing.js b/lib/rules/component-definition-name-casing.js index 99ba619c1..840a89e52 100644 --- a/lib/rules/component-definition-name-casing.js +++ b/lib/rules/component-definition-name-casing.js @@ -26,7 +26,7 @@ module.exports = { type: 'suggestion', docs: { description: 'enforce specific casing for component definition name', - categories: ['vue3-strongly-recommended', 'strongly-recommended'], + categories: ['vue3-strongly-recommended', 'vue2-strongly-recommended'], url: 'https://eslint.vuejs.org/rules/component-definition-name-casing.html' }, fixable: 'code', diff --git a/lib/rules/component-tags-order.js b/lib/rules/component-tags-order.js index a2a5cd656..132aab898 100644 --- a/lib/rules/component-tags-order.js +++ b/lib/rules/component-tags-order.js @@ -10,7 +10,7 @@ module.exports = { type: baseRule.meta.type, docs: { description: baseRule.meta.docs.description, - categories: ['vue3-recommended', 'recommended'], + categories: ['vue3-recommended', 'vue2-recommended'], url: 'https://eslint.vuejs.org/rules/component-tags-order.html' }, deprecated: true, diff --git a/lib/rules/first-attribute-linebreak.js b/lib/rules/first-attribute-linebreak.js index c023762d4..b2e6aefc3 100644 --- a/lib/rules/first-attribute-linebreak.js +++ b/lib/rules/first-attribute-linebreak.js @@ -11,7 +11,7 @@ module.exports = { type: 'layout', docs: { description: 'enforce the location of first attribute', - categories: ['vue3-strongly-recommended', 'strongly-recommended'], + categories: ['vue3-strongly-recommended', 'vue2-strongly-recommended'], url: 'https://eslint.vuejs.org/rules/first-attribute-linebreak.html' }, fixable: 'whitespace', diff --git a/lib/rules/html-closing-bracket-newline.js b/lib/rules/html-closing-bracket-newline.js index 58f7fc8e8..5787bf97a 100644 --- a/lib/rules/html-closing-bracket-newline.js +++ b/lib/rules/html-closing-bracket-newline.js @@ -69,7 +69,7 @@ module.exports = { docs: { description: "require or disallow a line break before tag's closing brackets", - categories: ['vue3-strongly-recommended', 'strongly-recommended'], + categories: ['vue3-strongly-recommended', 'vue2-strongly-recommended'], url: 'https://eslint.vuejs.org/rules/html-closing-bracket-newline.html' }, fixable: 'whitespace', diff --git a/lib/rules/html-closing-bracket-spacing.js b/lib/rules/html-closing-bracket-spacing.js index daf42d540..6c0da838f 100644 --- a/lib/rules/html-closing-bracket-spacing.js +++ b/lib/rules/html-closing-bracket-spacing.js @@ -56,7 +56,7 @@ module.exports = { type: 'layout', docs: { description: "require or disallow a space before tag's closing brackets", - categories: ['vue3-strongly-recommended', 'strongly-recommended'], + categories: ['vue3-strongly-recommended', 'vue2-strongly-recommended'], url: 'https://eslint.vuejs.org/rules/html-closing-bracket-spacing.html' }, fixable: 'whitespace', diff --git a/lib/rules/html-end-tags.js b/lib/rules/html-end-tags.js index 58c1142ea..a0d313cf2 100644 --- a/lib/rules/html-end-tags.js +++ b/lib/rules/html-end-tags.js @@ -12,7 +12,7 @@ module.exports = { type: 'suggestion', docs: { description: 'enforce end tag style', - categories: ['vue3-strongly-recommended', 'strongly-recommended'], + categories: ['vue3-strongly-recommended', 'vue2-strongly-recommended'], url: 'https://eslint.vuejs.org/rules/html-end-tags.html' }, fixable: 'code', diff --git a/lib/rules/html-indent.js b/lib/rules/html-indent.js index 397cdc52b..96a8a4456 100644 --- a/lib/rules/html-indent.js +++ b/lib/rules/html-indent.js @@ -26,7 +26,7 @@ module.exports = { type: 'layout', docs: { description: 'enforce consistent indentation in `