From b3a69d6809bb42ca2f48e2fb280bc3d0d356ad1e Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Tue, 18 Jul 2023 11:53:17 +0200 Subject: [PATCH 01/18] Bump eslint-plugin-eslint-plugin to v5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 75e3ebb78..cb0081284 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "esbuild": "^0.15.15", "eslint": "^8.15.0", "eslint-config-prettier": "^8.5.0", - "eslint-plugin-eslint-plugin": "^3.5.3", + "eslint-plugin-eslint-plugin": "^5.1.1", "eslint-plugin-import": "^2.26.0", "eslint-plugin-jsonc": "^2.2.1", "eslint-plugin-node-dependencies": ">=0.5.0 <1.0.0", From 5107d7d8940565cb36a2ef8d8a4395c47108d8bd Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Tue, 18 Jul 2023 13:02:08 +0200 Subject: [PATCH 02/18] Remove rules that are now part of recommended config --- eslint.config.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index dddc54647..862554bd0 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -144,7 +144,6 @@ module.exports = [ 'prettier/prettier': 'error', 'eslint-plugin/report-message-format': ['error', "^[A-Z`'{].*\\.$"], 'eslint-plugin/prefer-placeholders': 'error', - 'eslint-plugin/consistent-output': 'error', 'no-debugger': 'error', 'no-console': 'error', @@ -199,9 +198,6 @@ module.exports = [ { files: ['lib/rules/*.js'], rules: { - 'eslint-plugin/no-deprecated-context-methods': 'error', - 'eslint-plugin/no-only-tests': 'error', - 'eslint-plugin/prefer-object-rule': 'error', 'eslint-plugin/require-meta-docs-description': 'error', 'eslint-plugin/require-meta-docs-url': [ 'error', @@ -209,9 +205,6 @@ module.exports = [ pattern: `https://eslint.vuejs.org/rules/{{name}}.html` } ], - 'eslint-plugin/require-meta-has-suggestions': 'error', - 'eslint-plugin/require-meta-schema': 'error', - 'eslint-plugin/require-meta-type': 'error', 'internal/no-invalid-meta': 'error', 'internal/no-invalid-meta-docs-categories': 'error' } From d35c60f4686e1630e6e29cc709e6270aa5a8ed2b Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Tue, 18 Jul 2023 16:05:27 +0200 Subject: [PATCH 03/18] Remove unused disable directives --- lib/rules/match-component-file-name.js | 1 - lib/rules/prefer-prop-type-boolean-first.js | 1 - lib/rules/require-typed-object-prop.js | 1 - 3 files changed, 3 deletions(-) diff --git a/lib/rules/match-component-file-name.js b/lib/rules/match-component-file-name.js index f30a6b50a..684d11dc6 100644 --- a/lib/rules/match-component-file-name.js +++ b/lib/rules/match-component-file-name.js @@ -23,7 +23,6 @@ function canVerify(node) { module.exports = { meta: { - // eslint-disable-next-line eslint-plugin/require-meta-has-suggestions hasSuggestions: true, type: 'suggestion', docs: { diff --git a/lib/rules/prefer-prop-type-boolean-first.js b/lib/rules/prefer-prop-type-boolean-first.js index aa16707c4..a1001b13b 100644 --- a/lib/rules/prefer-prop-type-boolean-first.js +++ b/lib/rules/prefer-prop-type-boolean-first.js @@ -53,7 +53,6 @@ module.exports = { url: 'https://eslint.vuejs.org/rules/prefer-prop-type-boolean-first.html' }, fixable: null, - // eslint-disable-next-line eslint-plugin/require-meta-has-suggestions -- `context.report` with suggestion is not recognized in `checkArrayExpression` hasSuggestions: true, schema: [], messages: { diff --git a/lib/rules/require-typed-object-prop.js b/lib/rules/require-typed-object-prop.js index dda7b8346..7e80e7fb4 100644 --- a/lib/rules/require-typed-object-prop.js +++ b/lib/rules/require-typed-object-prop.js @@ -121,7 +121,6 @@ module.exports = { }, fixable: null, schema: [], - // eslint-disable-next-line eslint-plugin/require-meta-has-suggestions -- `context.report` with suggestion is not recognized in `checkPropIdentifierType` hasSuggestions: true, messages: { expectedTypeAnnotation: 'Expected type annotation on object prop.', From fcf58b98d054315092a6808d7f8d4486ebc7e101 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Tue, 18 Jul 2023 16:22:03 +0200 Subject: [PATCH 04/18] Specify rule type for internal rules fixes `eslint-plugin/require-meta-type` lint issues --- eslint-internal-rules/no-invalid-meta-docs-categories.js | 1 + eslint-internal-rules/no-invalid-meta.js | 2 +- eslint-internal-rules/require-eslint-community.js | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/eslint-internal-rules/no-invalid-meta-docs-categories.js b/eslint-internal-rules/no-invalid-meta-docs-categories.js index 24350c8f6..f81dcd886 100644 --- a/eslint-internal-rules/no-invalid-meta-docs-categories.js +++ b/eslint-internal-rules/no-invalid-meta-docs-categories.js @@ -104,6 +104,7 @@ function checkMetaValidity(context, exportsNode) { module.exports = { meta: { + type: 'problem', docs: { description: 'enforce correct use of `meta` property in core rules', categories: ['Internal'] diff --git a/eslint-internal-rules/no-invalid-meta.js b/eslint-internal-rules/no-invalid-meta.js index 24bf01faf..747f07af2 100644 --- a/eslint-internal-rules/no-invalid-meta.js +++ b/eslint-internal-rules/no-invalid-meta.js @@ -87,11 +87,11 @@ function checkMetaValidity(context, exportsNode) { module.exports = { meta: { + type: 'problem', docs: { description: 'enforce correct use of `meta` property in core rules', categories: ['Internal'] }, - schema: [] }, diff --git a/eslint-internal-rules/require-eslint-community.js b/eslint-internal-rules/require-eslint-community.js index f99afd8f9..8bb3438e1 100644 --- a/eslint-internal-rules/require-eslint-community.js +++ b/eslint-internal-rules/require-eslint-community.js @@ -2,6 +2,7 @@ module.exports = { meta: { + type: 'problem', docs: { description: 'enforce use of the `@eslint-community/*` package', categories: ['Internal'] From a1c94b7508ef641ab4ef10bfb6805bcba5b2ec64 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Tue, 18 Jul 2023 13:03:24 +0200 Subject: [PATCH 05/18] Fix `eslint-plugin/prefer-output-null` lint issues --- tests/lib/rules/no-deprecated-slot-attribute.js | 12 +----------- tests/lib/rules/no-deprecated-v-bind-sync.js | 7 +++---- tests/lib/rules/no-required-prop-with-default.js | 14 +------------- 3 files changed, 5 insertions(+), 28 deletions(-) diff --git a/tests/lib/rules/no-deprecated-slot-attribute.js b/tests/lib/rules/no-deprecated-slot-attribute.js index 0db5e5898..8f61e9225 100644 --- a/tests/lib/rules/no-deprecated-slot-attribute.js +++ b/tests/lib/rules/no-deprecated-slot-attribute.js @@ -487,17 +487,7 @@ tester.run('no-deprecated-slot-attribute', rule, { `, - output: ` - `, + output: null, errors: [ '`slot` attributes are deprecated.', '`slot` attributes are deprecated.' diff --git a/tests/lib/rules/no-deprecated-v-bind-sync.js b/tests/lib/rules/no-deprecated-v-bind-sync.js index 626993731..c02342a86 100644 --- a/tests/lib/rules/no-deprecated-v-bind-sync.js +++ b/tests/lib/rules/no-deprecated-v-bind-sync.js @@ -68,7 +68,7 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, { { filename: 'test.vue', code: "", - output: "", + output: null, errors: [ "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." ] @@ -76,7 +76,7 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, { { filename: 'test.vue', code: '', - output: '', + output: null, errors: [ "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." ] @@ -84,8 +84,7 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, { { filename: 'test.vue', code: '', - output: - '', + output: null, errors: [ "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." ] diff --git a/tests/lib/rules/no-required-prop-with-default.js b/tests/lib/rules/no-required-prop-with-default.js index 236de8cd4..261c4a898 100644 --- a/tests/lib/rules/no-required-prop-with-default.js +++ b/tests/lib/rules/no-required-prop-with-default.js @@ -868,19 +868,7 @@ tester.run('no-required-prop-with-default', rule, { }) `, - output: ` - - `, + output: null, errors: [ { message: 'Prop "name" should be optional.', From 7b2208c51efdb8dade789db68f2fd546b7102497 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Tue, 18 Jul 2023 13:08:39 +0200 Subject: [PATCH 06/18] Enable `eslint-plugin/test-case-property-ordering` rule --- eslint.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint.config.js b/eslint.config.js index 862554bd0..e1b80dcb6 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -144,6 +144,7 @@ module.exports = [ 'prettier/prettier': 'error', 'eslint-plugin/report-message-format': ['error', "^[A-Z`'{].*\\.$"], 'eslint-plugin/prefer-placeholders': 'error', + 'eslint-plugin/test-case-property-ordering': 'error', 'no-debugger': 'error', 'no-console': 'error', From b307445155bc1555689c0f5d9c37deff1f02d755 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Tue, 18 Jul 2023 13:08:51 +0200 Subject: [PATCH 07/18] Fix `eslint-plugin/test-case-property-ordering` lint issues --- tests/lib/rules/array-bracket-newline.js | 14 +- tests/lib/rules/array-bracket-spacing.js | 14 +- tests/lib/rules/arrow-spacing.js | 2 +- tests/lib/rules/attributes-order.js | 146 +++++++++--------- tests/lib/rules/block-spacing.js | 2 +- tests/lib/rules/comma-dangle.js | 10 +- tests/lib/rules/comma-spacing.js | 2 +- tests/lib/rules/comma-style.js | 8 +- tests/lib/rules/component-api-style.js | 42 ++--- .../rules/component-definition-name-casing.js | 2 +- .../component-name-in-template-casing.js | 90 +++++------ .../rules/component-options-name-casing.js | 112 +++++++------- tests/lib/rules/component-tags-order.js | 138 ++++++++--------- tests/lib/rules/define-emits-declaration.js | 12 +- tests/lib/rules/define-macros-order.js | 4 +- tests/lib/rules/define-props-declaration.js | 10 +- tests/lib/rules/dot-location.js | 2 +- tests/lib/rules/func-call-spacing.js | 2 +- tests/lib/rules/html-button-has-type.js | 10 +- .../lib/rules/html-comment-content-newline.js | 16 +- .../lib/rules/html-comment-content-spacing.js | 16 +- tests/lib/rules/html-comment-indent.js | 6 +- tests/lib/rules/html-end-tags.js | 4 +- tests/lib/rules/html-self-closing.js | 4 +- tests/lib/rules/key-spacing.js | 2 +- tests/lib/rules/keyword-spacing.js | 2 +- tests/lib/rules/max-attributes-per-line.js | 6 +- tests/lib/rules/max-len.js | 40 ++--- tests/lib/rules/multi-word-component-names.js | 6 +- .../multiline-html-element-content-newline.js | 4 +- tests/lib/rules/multiline-ternary.js | 8 +- .../new-line-between-multi-line-property.js | 6 +- tests/lib/rules/next-tick-style.js | 20 +-- .../rules/no-async-in-computed-properties.js | 12 +- tests/lib/rules/no-boolean-default.js | 10 +- tests/lib/rules/no-child-content.js | 8 +- tests/lib/rules/no-duplicate-attributes.js | 16 +- tests/lib/rules/no-multiple-template-root.js | 4 +- tests/lib/rules/no-parsing-error.js | 4 +- .../no-potential-component-option-typo.js | 22 +-- .../rules/no-required-prop-with-default.js | 6 +- .../rules/no-restricted-call-after-await.js | 4 +- tests/lib/rules/no-restricted-class.js | 36 ++--- .../lib/rules/no-restricted-html-elements.js | 12 +- tests/lib/rules/no-restricted-props.js | 2 +- .../no-side-effects-in-computed-properties.js | 4 +- .../rules/no-this-in-before-route-enter.js | 12 +- tests/lib/rules/no-undef-components.js | 6 +- tests/lib/rules/no-undef-properties.js | 4 +- tests/lib/rules/no-unsupported-features.js | 2 +- .../no-unsupported-features/define-options.js | 4 +- .../slot-scope-attribute.js | 6 +- .../v-bind-prop-modifier-shorthand.js | 6 +- .../rules/no-unsupported-features/v-slot.js | 26 ++-- tests/lib/rules/no-unused-properties.js | 12 +- tests/lib/rules/no-unused-vars.js | 12 +- tests/lib/rules/object-curly-spacing.js | 28 ++-- tests/lib/rules/order-in-components.js | 74 ++++----- .../lib/rules/padding-line-between-blocks.js | 6 +- tests/lib/rules/padding-line-between-tags.js | 142 ++++++++--------- .../rules/prefer-true-attribute-shorthand.js | 20 +-- tests/lib/rules/require-emit-validator.js | 10 +- tests/lib/rules/require-explicit-emits.js | 4 +- .../lib/rules/require-macro-variable-name.js | 8 +- tests/lib/rules/require-prop-comment.js | 8 +- .../rules/require-prop-type-constructor.js | 8 +- tests/lib/rules/require-prop-types.js | 24 +-- tests/lib/rules/require-typed-object-prop.js | 146 +++++++++--------- tests/lib/rules/require-typed-ref.js | 6 +- tests/lib/rules/require-valid-default-prop.js | 30 ++-- .../lib/rules/return-in-computed-property.js | 14 +- ...singleline-html-element-content-newline.js | 12 +- tests/lib/rules/space-in-parens.js | 6 +- tests/lib/rules/space-unary-ops.js | 2 +- tests/lib/rules/template-curly-spacing.js | 2 +- tests/lib/rules/this-in-template.js | 8 +- tests/lib/rules/v-bind-style.js | 12 +- tests/lib/rules/v-for-delimiter-style.js | 4 +- tests/lib/rules/v-on-event-hyphenation.js | 12 +- tests/lib/rules/v-on-function-call.js | 52 +++---- tests/lib/rules/v-on-handler-style.js | 68 ++++---- tests/lib/rules/v-on-style.js | 4 +- tests/lib/rules/v-slot-style.js | 40 ++--- tests/lib/rules/valid-define-emits.js | 16 +- tests/lib/rules/valid-define-options.js | 16 +- tests/lib/rules/valid-define-props.js | 16 +- tests/lib/rules/valid-v-for.js | 24 +-- tests/lib/rules/valid-v-on.js | 8 +- tests/lib/rules/valid-v-slot.js | 8 +- 89 files changed, 915 insertions(+), 915 deletions(-) diff --git a/tests/lib/rules/array-bracket-newline.js b/tests/lib/rules/array-bracket-newline.js index 06e1890ca..0144f45ee 100644 --- a/tests/lib/rules/array-bracket-newline.js +++ b/tests/lib/rules/array-bracket-newline.js @@ -55,20 +55,20 @@ tester.run('array-bracket-newline', rule, { }, { code: '', - options: ['never'], output: '', + options: ['never'], errors: ["There should be no linebreak after '['."] }, { code: '', - options: ['never'], output: '', + options: ['never'], errors: ["There should be no linebreak before ']'."] }, { code: '', - options: ['never'], output: '', + options: ['never'], errors: [ "There should be no linebreak after '['.", "There should be no linebreak before ']'." @@ -76,20 +76,20 @@ tester.run('array-bracket-newline', rule, { }, { code: '', - options: ['always'], output: '', + options: ['always'], errors: ["A linebreak is required before ']'."] }, { code: '', - options: ['always'], output: '', + options: ['always'], errors: ["A linebreak is required after '['."] }, { code: '', - options: ['always'], output: '', + options: ['always'], errors: [ "A linebreak is required after '['.", "A linebreak is required before ']'." @@ -97,8 +97,8 @@ tester.run('array-bracket-newline', rule, { }, { code: '', - options: ['always'], output: '', + options: ['always'], errors: [ "A linebreak is required after '['.", "A linebreak is required before ']'." diff --git a/tests/lib/rules/array-bracket-spacing.js b/tests/lib/rules/array-bracket-spacing.js index 8e437d88e..7d490a4bb 100644 --- a/tests/lib/rules/array-bracket-spacing.js +++ b/tests/lib/rules/array-bracket-spacing.js @@ -54,20 +54,20 @@ tester.run('array-bracket-spacing', rule, { }, { code: '', - options: ['never'], output: '', + options: ['never'], errors: ["There should be no space after '['."] }, { code: '', - options: ['never'], output: '', + options: ['never'], errors: ["There should be no space before ']'."] }, { code: '', - options: ['never'], output: '', + options: ['never'], errors: [ "There should be no space after '['.", "There should be no space before ']'." @@ -75,20 +75,20 @@ tester.run('array-bracket-spacing', rule, { }, { code: '', - options: ['always'], output: '', + options: ['always'], errors: ["A space is required before ']'."] }, { code: '', - options: ['always'], output: '', + options: ['always'], errors: ["A space is required after '['."] }, { code: '', - options: ['always'], output: '', + options: ['always'], errors: [ "A space is required after '['.", "A space is required before ']'." @@ -96,8 +96,8 @@ tester.run('array-bracket-spacing', rule, { }, { code: '', - options: ['always'], output: '', + options: ['always'], errors: [ "A space is required after '['.", "A space is required before ']'." diff --git a/tests/lib/rules/arrow-spacing.js b/tests/lib/rules/arrow-spacing.js index 7d64f88f1..c0452ad1d 100644 --- a/tests/lib/rules/arrow-spacing.js +++ b/tests/lib/rules/arrow-spacing.js @@ -105,11 +105,11 @@ tester.run('arrow-spacing', rule, { `, - options: [{ before: false, after: false }], output: ` `, + options: [{ before: false, after: false }], errors: [ { message: 'Unexpected space before =>.', diff --git a/tests/lib/rules/attributes-order.js b/tests/lib/rules/attributes-order.js index 9abb3a266..33eefb026 100644 --- a/tests/lib/rules/attributes-order.js +++ b/tests/lib/rules/attributes-order.js @@ -716,6 +716,8 @@ tester.run('attributes-order', rule, { { filename: 'test.vue', code: '', + output: + '', options: [ { order: [ @@ -733,8 +735,6 @@ tester.run('attributes-order', rule, { ] } ], - output: - '', errors: [ { message: 'Attribute "is" should go before "propone".', @@ -837,6 +837,21 @@ tester.run('attributes-order', rule, { > `, + output: ``, options: [ { order: [ @@ -854,21 +869,6 @@ tester.run('attributes-order', rule, { ] } ], - output: ``, errors: [ { message: 'Attribute "is" should go before "v-once".', @@ -902,6 +902,15 @@ tester.run('attributes-order', rule, { > `, + output: ``, options: [ { order: [ @@ -917,15 +926,6 @@ tester.run('attributes-order', rule, { ] } ], - output: ``, errors: [ { message: 'Attribute "v-if" should go before "class".', @@ -965,13 +965,13 @@ tester.run('attributes-order', rule, { a-prop="A"> `, - options: [{ alphabetical: true }], output: ``, + options: [{ alphabetical: true }], errors: [ { message: 'Attribute "a-prop" should go before "z-prop".', @@ -987,13 +987,13 @@ tester.run('attributes-order', rule, { :a-prop="A"> `, - options: [{ alphabetical: true }], output: ``, + options: [{ alphabetical: true }], errors: [ { message: 'Attribute ":a-prop" should go before ":z-prop".', @@ -1009,13 +1009,13 @@ tester.run('attributes-order', rule, { @change="foo"> `, - options: [{ alphabetical: true }], output: ``, + options: [{ alphabetical: true }], errors: [ { message: 'Attribute "@change" should go before "@input".', @@ -1031,13 +1031,13 @@ tester.run('attributes-order', rule, { boolean-prop> `, - options: [{ alphabetical: true }], output: ``, + options: [{ alphabetical: true }], errors: [ { message: 'Attribute "boolean-prop" should go before "z-prop".', @@ -1053,13 +1053,13 @@ tester.run('attributes-order', rule, { v-on:[c]="functionCall"> `, - options: [{ alphabetical: true }], output: ``, + options: [{ alphabetical: true }], errors: [ { message: 'Attribute "v-on:[c]" should go before "v-on:click".', @@ -1075,13 +1075,13 @@ tester.run('attributes-order', rule, { v-on:click="functionCall"> `, - options: [{ alphabetical: true }], output: ``, + options: [{ alphabetical: true }], errors: [ { message: 'Attribute "v-on:click" should go before "v-text".', @@ -1097,13 +1097,13 @@ tester.run('attributes-order', rule, { class="bar"> `, - options: [{ alphabetical: true }], output: ``, + options: [{ alphabetical: true }], errors: [ { message: 'Attribute "class" should go before ":class".' @@ -1118,13 +1118,13 @@ tester.run('attributes-order', rule, { v-if="bar"> `, - options: [{ alphabetical: true }], output: ``, + options: [{ alphabetical: true }], errors: [ { message: 'Attribute "v-if" should go before "v-show".' @@ -1139,13 +1139,13 @@ tester.run('attributes-order', rule, { v-bar="bar"> `, - options: [{ alphabetical: true }], output: ``, + options: [{ alphabetical: true }], errors: [ { message: 'Attribute "v-bar" should go before "v-foo".' @@ -1160,13 +1160,13 @@ tester.run('attributes-order', rule, { v-foo.a="a"> `, - options: [{ alphabetical: true }], output: ``, + options: [{ alphabetical: true }], errors: [ { message: 'Attribute "v-foo.a" should go before "v-foo.b".' @@ -1256,7 +1256,6 @@ tester.run('attributes-order', rule, { v-bind="b"> `, - options: [{ alphabetical: true }], output: ` `, + options: [{ alphabetical: true }], errors: ['Attribute "v-bind:id" should go before "v-on:click".'] }, { @@ -1277,7 +1277,6 @@ tester.run('attributes-order', rule, { v-bind="b"> `, - options: [{ alphabetical: true }], output: ` `, + options: [{ alphabetical: true }], errors: ['Attribute "v-bind" should go before "v-on:click".'] }, { @@ -1298,7 +1298,6 @@ tester.run('attributes-order', rule, { v-bind:id="a"> `, - options: [{ alphabetical: true }], output: ` `, + options: [{ alphabetical: true }], errors: ['Attribute "v-bind:id" should go before "v-on:click".'] }, { @@ -1320,7 +1320,6 @@ tester.run('attributes-order', rule, { v-if="x"> `, - options: [{ alphabetical: true }], output: ` `, + options: [{ alphabetical: true }], errors: [ 'Attribute "v-bind:a" should go before "v-on:click".', 'Attribute "v-if" should go before "v-on:click".' @@ -1346,7 +1346,6 @@ tester.run('attributes-order', rule, { v-if="x"> `, - options: [{ alphabetical: true }], output: ` `, + options: [{ alphabetical: true }], errors: [ 'Attribute "v-bind" should go before "v-on:click".', 'Attribute "v-if" should go before "v-on:click".' @@ -1371,7 +1371,6 @@ tester.run('attributes-order', rule, { v-if="x"> `, - options: [{ alphabetical: true }], output: ` `, + options: [{ alphabetical: true }], errors: ['Attribute "v-if" should go before "a".'] }, { @@ -1392,7 +1392,6 @@ tester.run('attributes-order', rule, { v-if="x"> `, - options: [{ alphabetical: true }], output: ` `, + options: [{ alphabetical: true }], errors: [ 'Attribute "v-bind" should go before "v-on:click".', 'Attribute "v-if" should go before "v-on:click".' @@ -1462,7 +1462,6 @@ tester.run('attributes-order', rule, { v-for="a in items"> `, - options: [{ order: ['LIST_RENDERING', 'CONDITIONALS'] }], output: ` `, + options: [{ order: ['LIST_RENDERING', 'CONDITIONALS'] }], errors: ['Attribute "v-for" should go before "v-if".'] }, { @@ -1483,7 +1483,6 @@ tester.run('attributes-order', rule, { v-for="a in items"> `, - options: [{ order: ['LIST_RENDERING', 'CONDITIONALS'] }], output: ` `, + options: [{ order: ['LIST_RENDERING', 'CONDITIONALS'] }], errors: ['Attribute "v-for" should go before "v-if".'] }, // slot { filename: 'test.vue', + code: '', + output: + '', options: [ { order: [ @@ -1516,9 +1519,6 @@ tester.run('attributes-order', rule, { ] } ], - code: '', - output: - '', errors: [ { message: 'Attribute "bar" should go before "v-slot".' @@ -1528,6 +1528,9 @@ tester.run('attributes-order', rule, { { filename: 'test.vue', + code: '', + output: + '', options: [ { order: [ @@ -1546,9 +1549,6 @@ tester.run('attributes-order', rule, { ] } ], - code: '', - output: - '', errors: [ { message: 'Attribute "ref" should go before "bar".' @@ -1630,7 +1630,6 @@ tester.run('attributes-order', rule, { v-bind="object" @input="handleInput"/> `, - options: [{ order: ['UNIQUE', 'EVENTS', 'OTHER_ATTR'] }], output: ` `, + options: [{ order: ['UNIQUE', 'EVENTS', 'OTHER_ATTR'] }], errors: ['Attribute "@input" should go before "v-bind".'] }, @@ -1651,7 +1651,6 @@ tester.run('attributes-order', rule, { @click="handleClick" attr="foo"/> `, - options: [{ order: ['UNIQUE', 'EVENTS', 'OTHER_ATTR'] }], output: ` `, + options: [{ order: ['UNIQUE', 'EVENTS', 'OTHER_ATTR'] }], errors: ['Attribute "@click" should go before "v-bind".'] }, @@ -1671,7 +1671,6 @@ tester.run('attributes-order', rule, { prop-two="b" :prop-three="c"/> `, - options: [{ order: ['ATTR_STATIC', 'ATTR_DYNAMIC'] }], output: ` `, + options: [{ order: ['ATTR_STATIC', 'ATTR_DYNAMIC'] }], errors: ['Attribute "prop-two" should go before "v-bind:prop-one".'] }, @@ -1694,6 +1694,16 @@ tester.run('attributes-order', rule, { class="class" boolean-prop/> `, + output: ` + `, options: [ { order: [ @@ -1709,16 +1719,6 @@ tester.run('attributes-order', rule, { ] } ], - output: ` - `, errors: [ 'Attribute "v-model" should go before ":prop-one".', 'Attribute ":prop-three" should go before "prop-two".' @@ -1736,6 +1736,15 @@ tester.run('attributes-order', rule, { prop-two="b" :prop-three="c"/> `, + output: ` + `, options: [ { order: [ @@ -1754,15 +1763,6 @@ tester.run('attributes-order', rule, { ] } ], - output: ` - `, errors: ['Attribute "v-model" should go before ":prop-one".'] } ] diff --git a/tests/lib/rules/block-spacing.js b/tests/lib/rules/block-spacing.js index c06d54ec9..5fc7d069d 100644 --- a/tests/lib/rules/block-spacing.js +++ b/tests/lib/rules/block-spacing.js @@ -86,11 +86,11 @@ tester.run('block-spacing', rule, { `, - options: ['never'], output: ` `, + options: ['never'], errors: [ { messageId: 'extra', diff --git a/tests/lib/rules/comma-dangle.js b/tests/lib/rules/comma-dangle.js index bbfdbfe01..d55d3616d 100644 --- a/tests/lib/rules/comma-dangle.js +++ b/tests/lib/rules/comma-dangle.js @@ -74,15 +74,15 @@ tester.run('comma-dangle', rule, { `, + output: ` + `, options: [ { functions: 'never' } ], - output: ` - `, errors: [ { message: 'Unexpected trailing comma.', @@ -101,7 +101,6 @@ tester.run('comma-dangle', rule, { ]) }"> `, - options: ['always-multiline'], output: ` `, + options: ['always-multiline'], errors: [ { message: 'Unexpected trailing comma.', diff --git a/tests/lib/rules/comma-spacing.js b/tests/lib/rules/comma-spacing.js index 68b70b324..217fd6b53 100644 --- a/tests/lib/rules/comma-spacing.js +++ b/tests/lib/rules/comma-spacing.js @@ -268,13 +268,13 @@ tester.run('comma-spacing', rule, { fn(a, b) "/> `, - options: [{ before: true, after: false }], output: ` `, + options: [{ before: true, after: false }], errors: [ { message: "A space is required before ','.", diff --git a/tests/lib/rules/comma-style.js b/tests/lib/rules/comma-style.js index f02c3e6d9..b2f7d8cc5 100644 --- a/tests/lib/rules/comma-style.js +++ b/tests/lib/rules/comma-style.js @@ -82,12 +82,12 @@ tester.run('comma-style', rule, { `, - options: ['last', { exceptions: { ArrowFunctionExpression: false } }], output: ` `, + options: ['last', { exceptions: { ArrowFunctionExpression: false } }], errors: [ { message: "',' should be placed last.", @@ -101,12 +101,12 @@ tester.run('comma-style', rule, { `, - options: ['first', { exceptions: { ArrowFunctionExpression: false } }], output: ` `, + options: ['first', { exceptions: { ArrowFunctionExpression: false } }], errors: [ { message: "',' should be placed first." @@ -122,7 +122,6 @@ tester.run('comma-style', rule, {
`, - options: ['first', { exceptions: { FunctionExpression: false } }], output: ` `, - options: ['last', { exceptions: { FunctionExpression: false } }], output: ` `, + options: ['last', { exceptions: { FunctionExpression: false } }], errors: [ { message: "',' should be placed last." diff --git a/tests/lib/rules/component-api-style.js b/tests/lib/rules/component-api-style.js index a33321251..47621d604 100644 --- a/tests/lib/rules/component-api-style.js +++ b/tests/lib/rules/component-api-style.js @@ -43,7 +43,6 @@ tester.run('component-api-style', rule, { }, { filename: 'test.vue', - options: [['options']], code: ` - ` + `, + options: [['options']] }, { filename: 'test.js', @@ -76,7 +76,6 @@ tester.run('component-api-style', rule, { }, { filename: 'test.js', - options: [['options']], code: ` import { defineComponent } from 'vue' defineComponent({ @@ -88,21 +87,21 @@ tester.run('component-api-style', rule, { }, // ... }) - ` + `, + options: [['options']] }, { filename: 'test.vue', - options: [['script-setup']], code: ` - ` + `, + options: [['script-setup']] }, { filename: 'test.js', - options: [['script-setup']], code: ` import { ref, defineComponent } from 'vue' defineComponent({ @@ -115,11 +114,11 @@ tester.run('component-api-style', rule, { } } }) - ` + `, + options: [['script-setup']] }, { filename: 'test.js', - options: [['script-setup']], code: ` import { defineComponent } from 'vue' defineComponent({ @@ -131,11 +130,11 @@ tester.run('component-api-style', rule, { }, // ... }) - ` + `, + options: [['script-setup']] }, { filename: 'test.vue', - options: [['composition']], code: ` - ` + `, + options: [['composition']] }, { filename: 'test.vue', - options: [['composition-vue2']], code: ` - ` + `, + options: [['composition-vue2']] }, { // https://github.com/vuejs/eslint-plugin-vue/issues/1720 filename: 'test.vue', - options: [['composition']], code: ` `, - options: ['always', { exceptions: ['*'] }], output: null, + options: ['always', { exceptions: ['*'] }], errors: [ 'Expected line break after exception block.', 'Expected line break before exception block.' @@ -415,12 +415,12 @@ comment `, - options: ['always', { exceptions: ['#+#-'] }], output: ` `, + options: ['always', { exceptions: ['#+#-'] }], errors: [ 'Expected line break after exception block.', "Expected line break before '-->'." @@ -432,8 +432,8 @@ comment `, - options: ['always', { exceptions: ['*', '++'] }], output: null, + options: ['always', { exceptions: ['*', '++'] }], errors: [ 'Expected line break after exception block.', { @@ -449,8 +449,8 @@ comment `, - options: ['always', { exceptions: ['*', '++'] }], output: null, + options: ['always', { exceptions: ['*', '++'] }], errors: [ 'Expected line break after exception block.', { diff --git a/tests/lib/rules/html-comment-content-spacing.js b/tests/lib/rules/html-comment-content-spacing.js index b29c1a960..3b5831e87 100644 --- a/tests/lib/rules/html-comment-content-spacing.js +++ b/tests/lib/rules/html-comment-content-spacing.js @@ -205,12 +205,12 @@ tester.run('html-comment-content-spacing', rule, { `, - options: ['always'], output: ` `, + options: ['always'], errors: [ { message: "Expected space after ' `, - options: ['never'], output: ` `, + options: ['never'], errors: [ { message: "Unexpected space after ' `, - options: ['never'], output: ` `, + options: ['never'], errors: [ { message: "Unexpected space after ' `, - options: ['always', { exceptions: ['+'] }], output: null, + options: ['always', { exceptions: ['+'] }], errors: [ 'Expected space after exception block.', 'Expected space before exception block.' @@ -300,8 +300,8 @@ tester.run('html-comment-content-spacing', rule, { `, - options: ['always', { exceptions: ['*'] }], output: null, + options: ['always', { exceptions: ['*'] }], errors: [ 'Expected space after exception block.', 'Expected space before exception block.' @@ -313,12 +313,12 @@ tester.run('html-comment-content-spacing', rule, { `, - options: ['always', { exceptions: ['#+#-'] }], output: ` `, + options: ['always', { exceptions: ['#+#-'] }], errors: [ 'Expected space after exception block.', "Expected space before '-->'." @@ -330,8 +330,8 @@ tester.run('html-comment-content-spacing', rule, { `, - options: ['always', { exceptions: ['*', '++'] }], output: null, + options: ['always', { exceptions: ['*', '++'] }], errors: [ 'Expected space after exception block.', { @@ -347,8 +347,8 @@ tester.run('html-comment-content-spacing', rule, { `, - options: ['always', { exceptions: ['*', '++'] }], output: null, + options: ['always', { exceptions: ['*', '++'] }], errors: [ 'Expected space after exception block.', { diff --git a/tests/lib/rules/html-comment-indent.js b/tests/lib/rules/html-comment-indent.js index 4ec5c6ee2..7d07e3b6e 100644 --- a/tests/lib/rules/html-comment-indent.js +++ b/tests/lib/rules/html-comment-indent.js @@ -232,7 +232,6 @@ tester.run('html-comment-indent', rule, { --> `, - options: ['tab'], output: ` `, + options: ['tab'], errors: [ { message: 'Expected relative indentation of 1 tab but found 0 tabs.', @@ -318,7 +318,6 @@ tester.run('html-comment-indent', rule, { --> `, - options: [4], output: ` `, + options: [4], errors: [ { message: @@ -407,7 +407,6 @@ tester.run('html-comment-indent', rule, { --> `, - options: [0], output: ` `, + options: [0], errors: [ { message: diff --git a/tests/lib/rules/html-end-tags.js b/tests/lib/rules/html-end-tags.js index b60c9848a..0d795875d 100644 --- a/tests/lib/rules/html-end-tags.js +++ b/tests/lib/rules/html-end-tags.js @@ -62,6 +62,7 @@ tester.run('html-end-tags', rule, { // https://github.com/vuejs/eslint-plugin-vue/issues/1403 { + filename: 'test.vue', code: ` - `, - filename: 'test.vue' + ` } ], invalid: [ diff --git a/tests/lib/rules/html-self-closing.js b/tests/lib/rules/html-self-closing.js index 5589c3da1..11ae3c6cf 100644 --- a/tests/lib/rules/html-self-closing.js +++ b/tests/lib/rules/html-self-closing.js @@ -69,6 +69,7 @@ tester.run('html-self-closing', rule, { // https://github.com/vuejs/eslint-plugin-vue/issues/1403 { + filename: 'test.vue', code: ` - `, - filename: 'test.vue' + ` } // other cases are in `invalid` tests. diff --git a/tests/lib/rules/key-spacing.js b/tests/lib/rules/key-spacing.js index 519230e23..3d8d48a22 100644 --- a/tests/lib/rules/key-spacing.js +++ b/tests/lib/rules/key-spacing.js @@ -31,8 +31,8 @@ tester.run('key-spacing', rule, { }, { code: '', - options: [{ beforeColon: true }], output: '', + options: [{ beforeColon: true }], errors: [ "Missing space after key 'a'.", "Missing space before value for key 'a'." diff --git a/tests/lib/rules/keyword-spacing.js b/tests/lib/rules/keyword-spacing.js index dad5574e5..dadd553b7 100644 --- a/tests/lib/rules/keyword-spacing.js +++ b/tests/lib/rules/keyword-spacing.js @@ -101,7 +101,6 @@ tester.run('keyword-spacing', rule, { } " /> `, - options: [{ before: false, after: false }], output: ``, + options: [{ before: false, after: false }], errors: [ { message: 'Unexpected space(s) after "if".', diff --git a/tests/lib/rules/max-attributes-per-line.js b/tests/lib/rules/max-attributes-per-line.js index 252bd22c1..457704627 100644 --- a/tests/lib/rules/max-attributes-per-line.js +++ b/tests/lib/rules/max-attributes-per-line.js @@ -93,9 +93,9 @@ v-bind:age="user.age">`, }, { code: ``, - options: [{ singleline: { max: 2 } }], output: ``, + options: [{ singleline: { max: 2 } }], errors: [ { message: "'job' should be on a new line.", @@ -110,13 +110,13 @@ job="Vet">`, job="Vet"> `, - options: [{ singleline: 3, multiline: 1 }], output: ``, + options: [{ singleline: 3, multiline: 1 }], errors: [ { message: "'age' should be on a new line.", @@ -131,13 +131,13 @@ age="30" job="Vet"> `, - options: [{ multiline: { max: 1 } }], output: ``, + options: [{ multiline: { max: 1 } }], errors: [ { message: "'age' should be on a new line.", diff --git a/tests/lib/rules/max-len.js b/tests/lib/rules/max-len.js index 3ff9f2dff..a1141ec22 100644 --- a/tests/lib/rules/max-len.js +++ b/tests/lib/rules/max-len.js @@ -1075,33 +1075,33 @@ var a = /regexploooooooooooooooooooooooooooooooooooooooooooooooooooooong/.test(b { filename: 'test.vue', code: ``, - errors: ['This line has a length of 41. Maximum allowed is 40.'], - options: [40] + options: [40], + errors: ['This line has a length of 41. Maximum allowed is 40.'] }, { filename: 'test.vue', code: ``, - errors: ['This line has a length of 41. Maximum allowed is 40.'], - options: [{ code: 40 }] + options: [{ code: 40 }], + errors: ['This line has a length of 41. Maximum allowed is 40.'] }, // tabWidth { filename: 'test.vue', code: ``, - errors: ['This line has a length of 45. Maximum allowed is 40.'], - options: [40, 4] + options: [40, 4], + errors: ['This line has a length of 45. Maximum allowed is 40.'] }, { filename: 'test.vue', code: ``, - errors: ['This line has a length of 45. Maximum allowed is 40.'], - options: [{ code: 40, tabWidth: 4 }] + options: [{ code: 40, tabWidth: 4 }], + errors: ['This line has a length of 45. Maximum allowed is 40.'] }, { filename: 'test.vue', code: ``, - errors: ['This line has a length of 44. Maximum allowed is 40.'], - options: [{ code: 40, tabWidth: 3 }] + options: [{ code: 40, tabWidth: 3 }], + errors: ['This line has a length of 44. Maximum allowed is 40.'] }, // comments { @@ -1122,6 +1122,7 @@ var a; // 41 cols comment * */ `, + options: [{ comments: 40 }], errors: [ { message: @@ -1148,8 +1149,7 @@ var a; // 41 cols comment * 'This line has a comment length of 41. Maximum allowed is 40.', line: 13 } - ], - options: [{ comments: 40 }] + ] }, // .js { @@ -1159,6 +1159,7 @@ var a = '81 columns ' var b = \`81 columns \`; /* 81 columns */ `, + options: [], errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', @@ -1172,8 +1173,7 @@ var b = \`81 columns message: 'This line has a length of 81. Maximum allowed is 80.', line: 4 } - ], - options: [] + ] }, { filename: 'test.js', @@ -1182,6 +1182,7 @@ var a = '81 columns ignoreStrings ' var b = \`81 columns \`; /* 81 columns */ `, + options: [{ ignoreStrings: true }], errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', @@ -1191,8 +1192,7 @@ var b = \`81 columns message: 'This line has a length of 81. Maximum allowed is 80.', line: 4 } - ], - options: [{ ignoreStrings: true }] + ] }, { filename: 'test.js', @@ -1201,6 +1201,7 @@ var a = '81 columns ' var b = \`81 columns \`; /* 81 columns */ `, + options: [{ ignoreComments: true }], errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', @@ -1210,8 +1211,7 @@ var b = \`81 columns message: 'This line has a length of 81. Maximum allowed is 80.', line: 3 } - ], - options: [{ ignoreComments: true }] + ] }, // only script comment { @@ -1222,6 +1222,7 @@ var b = \`81 columns 41 cols * */ `, + options: [{ comments: 40 }], errors: [ { message: @@ -1238,8 +1239,7 @@ var b = \`81 columns 'This line has a comment length of 41. Maximum allowed is 40.', line: 4 } - ], - options: [{ comments: 40 }] + ] } ] }) diff --git a/tests/lib/rules/multi-word-component-names.js b/tests/lib/rules/multi-word-component-names.js index 96302eec8..3d68364bc 100644 --- a/tests/lib/rules/multi-word-component-names.js +++ b/tests/lib/rules/multi-word-component-names.js @@ -165,14 +165,14 @@ tester.run('multi-word-component-names', rule, { }, { filename: 'test.vue', - options: [{ ignores: ['Todo'] }], code: ` - ` + `, + options: [{ ignores: ['Todo'] }] }, { filename: 'test.js', @@ -314,7 +314,6 @@ tester.run('multi-word-component-names', rule, { }, { filename: 'test.vue', - options: [{ ignores: ['Todo'] }], code: ` `, + options: [{ ignores: ['Todo'] }], errors: [ { message: 'Component name "Item" should always be multi-word.', diff --git a/tests/lib/rules/multiline-html-element-content-newline.js b/tests/lib/rules/multiline-html-element-content-newline.js index d06982955..2d68c7685 100644 --- a/tests/lib/rules/multiline-html-element-content-newline.js +++ b/tests/lib/rules/multiline-html-element-content-newline.js @@ -566,7 +566,6 @@ content
`, - options: [{ allowEmptyLines: true, ignoreWhenEmpty: false }], output: ` `, + options: [{ allowEmptyLines: true, ignoreWhenEmpty: false }], errors: [ 'Expected 1 line break after opening tag (`
`), but no line breaks found.' ] @@ -594,7 +594,6 @@ content content
`, - options: [{ allowEmptyLines: true }], output: ` `, + options: [{ allowEmptyLines: true }], errors: [ 'Expected 1 line break after opening tag (`
`), but no line breaks found.', 'Expected 1 line break before closing tag (`
`), but no line breaks found.' diff --git a/tests/lib/rules/multiline-ternary.js b/tests/lib/rules/multiline-ternary.js index 2922f0e65..d79e82eff 100644 --- a/tests/lib/rules/multiline-ternary.js +++ b/tests/lib/rules/multiline-ternary.js @@ -92,6 +92,7 @@ tester.run('multiline-ternary', rule, { ` : null, + options: ['always-multiline'], errors: [ { message: @@ -99,8 +100,7 @@ tester.run('multiline-ternary', rule, { line: 5, column: 15 } - ], - options: ['always-multiline'] + ] }, { filename: 'test.vue', @@ -123,6 +123,7 @@ tester.run('multiline-ternary', rule, { ` : null, + options: ['never'], errors: [ { message: @@ -130,8 +131,7 @@ tester.run('multiline-ternary', rule, { line: 4, column: 21 } - ], - options: ['never'] + ] }, { filename: 'test.vue', diff --git a/tests/lib/rules/new-line-between-multi-line-property.js b/tests/lib/rules/new-line-between-multi-line-property.js index a302cca7e..31983d7b0 100644 --- a/tests/lib/rules/new-line-between-multi-line-property.js +++ b/tests/lib/rules/new-line-between-multi-line-property.js @@ -280,7 +280,6 @@ ruleTester.run('new-line-between-multi-line-property', rule, { // test set insertLine and minLineOfMultilineProperty to 5 { filename: 'test.vue', - options: [{ minLineOfMultilineProperty: 5 }], code: ` `, + options: [{ minLineOfMultilineProperty: 5 }], errors: [ { message: @@ -331,7 +331,6 @@ ruleTester.run('new-line-between-multi-line-property', rule, { // test js comments { filename: 'test.vue', - options: [{ minLineOfMultilineProperty: 5 }], code: ` `, + options: [{ minLineOfMultilineProperty: 5 }], errors: [ { message: @@ -384,7 +384,6 @@ ruleTester.run('new-line-between-multi-line-property', rule, { // test js doc { filename: 'test.vue', - options: [], code: ` `, + options: [], errors: [ { message: diff --git a/tests/lib/rules/next-tick-style.js b/tests/lib/rules/next-tick-style.js index 24ef50a8e..28e2d338c 100644 --- a/tests/lib/rules/next-tick-style.js +++ b/tests/lib/rules/next-tick-style.js @@ -40,7 +40,6 @@ tester.run('next-tick-style', rule, { }, { filename: 'test.vue', - options: ['promise'], code: `` + }`, + options: ['promise'] }, { filename: 'test.vue', - options: ['callback'], code: `` + }`, + options: ['callback'] }, // https://github.com/vuejs/eslint-plugin-vue/pull/1400#discussion_r550937977 { filename: 'test.vue', - options: ['promise'], code: `` + }`, + options: ['promise'] }, { filename: 'test.vue', - options: ['callback'], code: `` + }`, + options: ['callback'] } ], invalid: [ @@ -173,7 +173,6 @@ tester.run('next-tick-style', rule, { }, { filename: 'test.vue', - options: ['promise'], code: ``, + options: ['promise'], errors: [ { message: @@ -239,7 +239,6 @@ tester.run('next-tick-style', rule, { }, { filename: 'test.vue', - options: ['callback'], code: ``, output: null, + options: ['callback'], errors: [ { message: diff --git a/tests/lib/rules/no-async-in-computed-properties.js b/tests/lib/rules/no-async-in-computed-properties.js index 31950ec5d..2e150b021 100644 --- a/tests/lib/rules/no-async-in-computed-properties.js +++ b/tests/lib/rules/no-async-in-computed-properties.js @@ -303,11 +303,6 @@ ruleTester.run('no-async-in-computed-properties', rule, { { // https://github.com/vuejs/eslint-plugin-vue/issues/1690 filename: 'test.vue', - parser, - parserOptions: { - sourceType: 'module', - ecmaVersion: 2020 - }, code: ` `, + parser: require.resolve('vue-eslint-parser'), parserOptions: { ecmaVersion: 6, sourceType: 'module', parser: require.resolve('@typescript-eslint/parser') - }, - parser: require.resolve('vue-eslint-parser') + } } ], invalid: [ @@ -803,12 +803,12 @@ tester.run('no-undef-components', rule, { `, + parser: require.resolve('vue-eslint-parser'), parserOptions: { ecmaVersion: 6, sourceType: 'module', parser: require.resolve('@typescript-eslint/parser') }, - parser: require.resolve('vue-eslint-parser'), errors: [ { message: diff --git a/tests/lib/rules/no-undef-properties.js b/tests/lib/rules/no-undef-properties.js index 9a97fe1a9..7ba344197 100644 --- a/tests/lib/rules/no-undef-properties.js +++ b/tests/lib/rules/no-undef-properties.js @@ -1169,13 +1169,13 @@ tester.run('no-undef-properties', rule, {
{{ foo }}
{{ unknown }}
`, - ...getTypeScriptFixtureTestOptions(), errors: [ { message: "'unknown' is not defined.", line: 11 } - ] + ], + ...getTypeScriptFixtureTestOptions() } ] }) diff --git a/tests/lib/rules/no-unsupported-features.js b/tests/lib/rules/no-unsupported-features.js index d12109311..77ee72055 100644 --- a/tests/lib/rules/no-unsupported-features.js +++ b/tests/lib/rules/no-unsupported-features.js @@ -45,7 +45,6 @@ tester.run('no-unsupported-features', rule, { `, - options: [{ version: '^2.5.0' }], output: ` `, + options: [{ version: '^2.5.0' }], errors: [ { message: '`v-slot` are not supported until Vue.js "2.6.0".', diff --git a/tests/lib/rules/no-unsupported-features/define-options.js b/tests/lib/rules/no-unsupported-features/define-options.js index 10b2069b2..a53bd776c 100644 --- a/tests/lib/rules/no-unsupported-features/define-options.js +++ b/tests/lib/rules/no-unsupported-features/define-options.js @@ -47,7 +47,6 @@ tester.run('no-unsupported-features/define-options', rule, { `, - options: buildOptions(), output: ` `, + options: buildOptions(), errors: [ { message: @@ -68,7 +68,6 @@ export default { name: 'Foo' } `, - options: buildOptions(), output: ` `, + options: buildOptions(), errors: [ { message: diff --git a/tests/lib/rules/no-unsupported-features/slot-scope-attribute.js b/tests/lib/rules/no-unsupported-features/slot-scope-attribute.js index 5307aa616..8f8b0b136 100644 --- a/tests/lib/rules/no-unsupported-features/slot-scope-attribute.js +++ b/tests/lib/rules/no-unsupported-features/slot-scope-attribute.js @@ -66,8 +66,8 @@ tester.run('no-unsupported-features/slot-scope-attribute', rule, { `, - options: buildOptions(), output: null, + options: buildOptions(), errors: [ { message: @@ -83,8 +83,8 @@ tester.run('no-unsupported-features/slot-scope-attribute', rule, { `, - options: buildOptions(), output: null, + options: buildOptions(), errors: [ { message: @@ -100,8 +100,8 @@ tester.run('no-unsupported-features/slot-scope-attribute', rule, { `, - options: buildOptions({ version: '^3.0.0' }), output: null, + options: buildOptions({ version: '^3.0.0' }), errors: [ { message: diff --git a/tests/lib/rules/no-unsupported-features/v-bind-prop-modifier-shorthand.js b/tests/lib/rules/no-unsupported-features/v-bind-prop-modifier-shorthand.js index 1cefc8ff1..58ffda146 100644 --- a/tests/lib/rules/no-unsupported-features/v-bind-prop-modifier-shorthand.js +++ b/tests/lib/rules/no-unsupported-features/v-bind-prop-modifier-shorthand.js @@ -63,11 +63,11 @@ tester.run('no-unsupported-features/v-bind-prop-modifier-shorthand', rule, { `, - options: buildOptions(), output: ` `, + options: buildOptions(), errors: [ { message: '`.prop` shorthand are not supported until Vue.js "3.2.0".', @@ -80,11 +80,11 @@ tester.run('no-unsupported-features/v-bind-prop-modifier-shorthand', rule, { `, - options: buildOptions({ version: '2.5.99' }), output: ` `, + options: buildOptions({ version: '2.5.99' }), errors: [ { message: '`.prop` shorthand are not supported until Vue.js "3.2.0".', @@ -97,11 +97,11 @@ tester.run('no-unsupported-features/v-bind-prop-modifier-shorthand', rule, { `, - options: buildOptions({ version: '3.1.0' }), output: ` `, + options: buildOptions({ version: '3.1.0' }), errors: [ { message: '`.prop` shorthand are not supported until Vue.js "3.2.0".', diff --git a/tests/lib/rules/no-unsupported-features/v-slot.js b/tests/lib/rules/no-unsupported-features/v-slot.js index 66b3b0b9e..a382a7eda 100644 --- a/tests/lib/rules/no-unsupported-features/v-slot.js +++ b/tests/lib/rules/no-unsupported-features/v-slot.js @@ -81,13 +81,13 @@ tester.run('no-unsupported-features/v-slot', rule, { `, - options: buildOptions(), output: ` `, + options: buildOptions(), errors: [ { message: '`v-slot` are not supported until Vue.js "2.6.0".', @@ -102,13 +102,13 @@ tester.run('no-unsupported-features/v-slot', rule, { `, - options: buildOptions(), output: ` `, + options: buildOptions(), errors: [ { message: '`v-slot` are not supported until Vue.js "2.6.0".', @@ -123,13 +123,13 @@ tester.run('no-unsupported-features/v-slot', rule, { `, - options: buildOptions(), output: ` `, + options: buildOptions(), errors: [ { message: '`v-slot` are not supported until Vue.js "2.6.0".', @@ -144,13 +144,13 @@ tester.run('no-unsupported-features/v-slot', rule, { `, - options: buildOptions(), output: ` `, + options: buildOptions(), errors: [ { message: '`v-slot` are not supported until Vue.js "2.6.0".', @@ -165,13 +165,13 @@ tester.run('no-unsupported-features/v-slot', rule, { `, - options: buildOptions(), output: ` `, + options: buildOptions(), errors: [ { message: '`v-slot` are not supported until Vue.js "2.6.0".', @@ -186,13 +186,13 @@ tester.run('no-unsupported-features/v-slot', rule, { `, - options: buildOptions(), output: ` `, + options: buildOptions(), errors: [ { message: '`v-slot` are not supported until Vue.js "2.6.0".', @@ -207,13 +207,13 @@ tester.run('no-unsupported-features/v-slot', rule, { `, - options: buildOptions(), output: ` `, + options: buildOptions(), errors: [ { message: '`v-slot` are not supported until Vue.js "2.6.0".', @@ -228,13 +228,13 @@ tester.run('no-unsupported-features/v-slot', rule, { `, - options: buildOptions(), output: ` `, + options: buildOptions(), errors: [ { message: '`v-slot` are not supported until Vue.js "2.6.0".', @@ -249,13 +249,13 @@ tester.run('no-unsupported-features/v-slot', rule, { `, - options: buildOptions(), output: ` `, + options: buildOptions(), errors: [ { message: '`v-slot` are not supported until Vue.js "2.6.0".', @@ -271,13 +271,13 @@ tester.run('no-unsupported-features/v-slot', rule, { `, - options: buildOptions(), output: ` `, + options: buildOptions(), errors: [ { message: '`v-slot` are not supported until Vue.js "2.6.0".', @@ -292,8 +292,8 @@ tester.run('no-unsupported-features/v-slot', rule, { `, - options: buildOptions(), output: null, + options: buildOptions(), errors: [ { message: '`v-slot` are not supported until Vue.js "2.6.0".', @@ -310,8 +310,8 @@ tester.run('no-unsupported-features/v-slot', rule, { `, - options: buildOptions(), output: null, + options: buildOptions(), errors: [ { message: '`v-slot` are not supported until Vue.js "2.6.0".', @@ -328,8 +328,8 @@ tester.run('no-unsupported-features/v-slot', rule, { `, - options: buildOptions(), output: null, + options: buildOptions(), errors: [ { message: '`v-slot` are not supported until Vue.js "2.6.0".', diff --git a/tests/lib/rules/no-unused-properties.js b/tests/lib/rules/no-unused-properties.js index 2db132c48..0139559b1 100644 --- a/tests/lib/rules/no-unused-properties.js +++ b/tests/lib/rules/no-unused-properties.js @@ -1651,9 +1651,6 @@ tester.run('no-unused-properties', rule, { { // https://github.com/vuejs/eslint-plugin-vue/issues/1643 filename: 'test.vue', - parserOptions: { - parser: '@typescript-eslint/parser' - }, code: ` `, - options: [ - 'never', - { - objectsInObjects: true - } - ], output: ` `, + options: [ + 'never', + { + objectsInObjects: true + } + ], errors: [ "There should be no space after '{'.", "There should be no space after '{'.", @@ -145,13 +145,13 @@ tester.run('object-curly-spacing', rule, { Hello World
`, - options: ['never'], output: ` `, + options: ['never'], errors: [ "There should be no space after '{'.", "There should be no space after '{'.", diff --git a/tests/lib/rules/order-in-components.js b/tests/lib/rules/order-in-components.js index b12c41a33..669383e52 100644 --- a/tests/lib/rules/order-in-components.js +++ b/tests/lib/rules/order-in-components.js @@ -197,7 +197,6 @@ ruleTester.run('order-in-components', rule, { }, } `, - parserOptions, output: ` export default { name: 'app', @@ -211,6 +210,7 @@ ruleTester.run('order-in-components', rule, { }, } `, + parserOptions, errors: [ { message: @@ -239,11 +239,6 @@ ruleTester.run('order-in-components', rule, { }, } `, - parserOptions: { - ecmaVersion: 6, - sourceType: 'module', - ecmaFeatures: { jsx: true } - }, output: ` export default { name: 'app', @@ -262,6 +257,11 @@ ruleTester.run('order-in-components', rule, { }, } `, + parserOptions: { + ecmaVersion: 6, + sourceType: 'module', + ecmaFeatures: { jsx: true } + }, errors: [ { message: @@ -294,7 +294,6 @@ ruleTester.run('order-in-components', rule, { template: '
' }) `, - parserOptions: { ecmaVersion: 6 }, output: ` Vue.component('smart-list', { name: 'app', @@ -307,6 +306,7 @@ ruleTester.run('order-in-components', rule, { template: '
' }) `, + parserOptions: { ecmaVersion: 6 }, errors: [ { message: @@ -329,7 +329,6 @@ ruleTester.run('order-in-components', rule, { template: '
' }) `, - parserOptions: { ecmaVersion: 6 }, output: ` app.component('smart-list', { name: 'app', @@ -342,6 +341,7 @@ ruleTester.run('order-in-components', rule, { template: '
' }) `, + parserOptions: { ecmaVersion: 6 }, errors: [ { message: @@ -365,7 +365,6 @@ ruleTester.run('order-in-components', rule, { template: '
' }) `, - parserOptions: { ecmaVersion: 6 }, output: ` const { component } = Vue; component('smart-list', { @@ -379,6 +378,7 @@ ruleTester.run('order-in-components', rule, { template: '
' }) `, + parserOptions: { ecmaVersion: 6 }, errors: [ { message: @@ -402,7 +402,6 @@ ruleTester.run('order-in-components', rule, { template: '
' }) `, - parserOptions: { ecmaVersion: 6 }, output: ` new Vue({ el: '#app', @@ -416,6 +415,7 @@ ruleTester.run('order-in-components', rule, { template: '
' }) `, + parserOptions: { ecmaVersion: 6 }, errors: [ { message: @@ -449,7 +449,6 @@ ruleTester.run('order-in-components', rule, { name: 'burger', }; `, - parserOptions, output: ` export default { name: 'burger', @@ -468,6 +467,7 @@ ruleTester.run('order-in-components', rule, { }, }; `, + parserOptions, errors: [ { message: @@ -486,7 +486,6 @@ ruleTester.run('order-in-components', rule, { test: 'ok' }; `, - parserOptions, output: ` export default { data() { @@ -496,6 +495,7 @@ ruleTester.run('order-in-components', rule, { }; `, options: [{ order: ['data', 'test', 'name'] }], + parserOptions, errors: [ { message: @@ -515,7 +515,6 @@ ruleTester.run('order-in-components', rule, { name: 'burger' }; `, - parserOptions, output: ` export default { /** name of vue component */ @@ -525,6 +524,7 @@ ruleTester.run('order-in-components', rule, { } }; `, + parserOptions, errors: [ { message: @@ -544,7 +544,6 @@ ruleTester.run('order-in-components', rule, { name: 'burger' }; `, - parserOptions, output: ` export default { /** name of vue component */ @@ -554,6 +553,7 @@ ruleTester.run('order-in-components', rule, { }/*test*/ }; `, + parserOptions, errors: [ { message: @@ -565,8 +565,8 @@ ruleTester.run('order-in-components', rule, { { filename: 'example.vue', code: `export default {data(){},name:'burger'};`, - parserOptions, output: `export default {name:'burger',data(){}};`, + parserOptions, errors: [ { message: @@ -586,8 +586,8 @@ ruleTester.run('order-in-components', rule, { name: 'burger', }; `, - parserOptions, output: null, + parserOptions, errors: [ { message: @@ -607,8 +607,8 @@ ruleTester.run('order-in-components', rule, { name: 'burger', }; `, - parserOptions, output: null, + parserOptions, errors: [ { message: @@ -628,8 +628,8 @@ ruleTester.run('order-in-components', rule, { name: 'burger', }; `, - parserOptions, output: null, + parserOptions, errors: [ { message: @@ -649,8 +649,8 @@ ruleTester.run('order-in-components', rule, { name: 'burger', }; `, - parserOptions, output: null, + parserOptions, errors: [ { message: @@ -670,8 +670,8 @@ ruleTester.run('order-in-components', rule, { name: 'burger', }; `, - parserOptions, output: null, + parserOptions, errors: [ { message: @@ -691,8 +691,8 @@ ruleTester.run('order-in-components', rule, { name: 'burger', }; `, - parserOptions, output: null, + parserOptions, errors: [ { message: @@ -712,8 +712,8 @@ ruleTester.run('order-in-components', rule, { name: 'burger', }; `, - parserOptions, output: null, + parserOptions, errors: [ { message: @@ -733,8 +733,8 @@ ruleTester.run('order-in-components', rule, { name: 'burger', }; `, - parserOptions, output: null, + parserOptions, errors: [ { message: @@ -754,8 +754,8 @@ ruleTester.run('order-in-components', rule, { name: 'burger', }; `, - parserOptions, output: null, + parserOptions, errors: [ { message: @@ -775,8 +775,8 @@ ruleTester.run('order-in-components', rule, { name: 'burger', }; `, - parserOptions, output: null, + parserOptions, errors: [ { message: @@ -796,8 +796,8 @@ ruleTester.run('order-in-components', rule, { name: 'burger', }; `, - parserOptions, output: null, + parserOptions, errors: [ { message: @@ -817,8 +817,8 @@ ruleTester.run('order-in-components', rule, { name: 'burger', }; `, - parserOptions, output: null, + parserOptions, errors: [ { message: @@ -838,8 +838,8 @@ ruleTester.run('order-in-components', rule, { name: 'burger', }; `, - parserOptions, output: null, + parserOptions, errors: [ { message: @@ -859,7 +859,6 @@ ruleTester.run('order-in-components', rule, { test: fn(), }; `, - parserOptions, output: ` export default { name: 'burger', @@ -868,6 +867,7 @@ ruleTester.run('order-in-components', rule, { test: fn(), }; `, + parserOptions, errors: [ { message: @@ -896,7 +896,6 @@ ruleTester.run('order-in-components', rule, { name: 'burger', }; `, - parserOptions, output: ` export default { name: 'burger', @@ -914,6 +913,7 @@ ruleTester.run('order-in-components', rule, { testOptionalChaining: a?.b?.c, }; `, + parserOptions, errors: [ { message: @@ -934,11 +934,6 @@ ruleTester.run('order-in-components', rule, { }; `, - parser: require.resolve('vue-eslint-parser'), - parserOptions: { - ...parserOptions, - parser: { ts: require.resolve('@typescript-eslint/parser') } - }, output: ` `, + parser: require.resolve('vue-eslint-parser'), + parserOptions: { + ...parserOptions, + parser: { ts: require.resolve('@typescript-eslint/parser') } + }, errors: [ { message: @@ -967,8 +967,6 @@ ruleTester.run('order-in-components', rule, { }) `, - parser: require.resolve('vue-eslint-parser'), - parserOptions, output: ` `, + parser: require.resolve('vue-eslint-parser'), + parserOptions, errors: [ { message: diff --git a/tests/lib/rules/padding-line-between-blocks.js b/tests/lib/rules/padding-line-between-blocks.js index 622839bdc..f53461bae 100644 --- a/tests/lib/rules/padding-line-between-blocks.js +++ b/tests/lib/rules/padding-line-between-blocks.js @@ -125,12 +125,12 @@ tester.run('padding-line-between-blocks', rule, { `, - options: ['never'], output: ` `, + options: ['never'], errors: [ { message: 'Unexpected blank line before this block.', @@ -214,7 +214,6 @@ tester.run('padding-line-between-blocks', rule, { `, - options: ['never'], output: ` @@ -225,6 +224,7 @@ tester.run('padding-line-between-blocks', rule, { `, + options: ['never'], errors: [ { message: 'Unexpected blank line before this block.', @@ -290,7 +290,6 @@ tester.run('padding-line-between-blocks', rule, { `, - options: ['never'], output: ` @@ -304,6 +303,7 @@ tester.run('padding-line-between-blocks', rule, { TEXT `, + options: ['never'], errors: [ { message: 'Unexpected blank line before this block.', diff --git a/tests/lib/rules/padding-line-between-tags.js b/tests/lib/rules/padding-line-between-tags.js index 67aa6b228..70c7a57bb 100644 --- a/tests/lib/rules/padding-line-between-tags.js +++ b/tests/lib/rules/padding-line-between-tags.js @@ -498,18 +498,18 @@ tester.run('padding-line-between-tags', rule, { `, + options: [ + [ + { blankLine: 'always', prev: '*', next: '*' }, + { blankLine: 'never', prev: 'br', next: '*' } + ] + ], errors: [ { message: 'Expected blank line before this tag.', line: 7, column: 13 } - ], - options: [ - [ - { blankLine: 'always', prev: '*', next: '*' }, - { blankLine: 'never', prev: 'br', next: '*' } - ] ] }, { @@ -541,18 +541,18 @@ tester.run('padding-line-between-tags', rule, { `, + options: [ + [ + { blankLine: 'always', prev: '*', next: '*' }, + { blankLine: 'never', prev: '*', next: 'br' } + ] + ], errors: [ { message: 'Expected blank line before this tag.', line: 8, column: 13 } - ], - options: [ - [ - { blankLine: 'always', prev: '*', next: '*' }, - { blankLine: 'never', prev: '*', next: 'br' } - ] ] }, { @@ -586,6 +586,7 @@ tester.run('padding-line-between-tags', rule, { `, + options: [[{ blankLine: 'never', prev: '*', next: '*' }]], errors: [ { message: 'Unexpected blank line before this tag.', @@ -597,8 +598,7 @@ tester.run('padding-line-between-tags', rule, { line: 11, column: 13 } - ], - options: [[{ blankLine: 'never', prev: '*', next: '*' }]] + ] }, { filename: 'test.vue', @@ -624,6 +624,7 @@ tester.run('padding-line-between-tags', rule, { `, + options: [[{ blankLine: 'never', prev: '*', next: '*' }]], errors: [ { message: 'Unexpected blank line before this tag.', @@ -635,8 +636,7 @@ tester.run('padding-line-between-tags', rule, { line: 9, column: 11 } - ], - options: [[{ blankLine: 'never', prev: '*', next: '*' }]] + ] }, { filename: 'test.vue', @@ -669,18 +669,18 @@ tester.run('padding-line-between-tags', rule, { `, + options: [ + [ + { blankLine: 'never', prev: '*', next: '*' }, + { blankLine: 'always', prev: 'br', next: 'div' } + ] + ], errors: [ { message: 'Expected blank line before this tag.', line: 8, column: 13 } - ], - options: [ - [ - { blankLine: 'never', prev: '*', next: '*' }, - { blankLine: 'always', prev: 'br', next: 'div' } - ] ] }, { @@ -712,6 +712,13 @@ tester.run('padding-line-between-tags', rule, { `, + options: [ + [ + { blankLine: 'always', prev: '*', next: '*' }, + { blankLine: 'never', prev: 'br', next: 'div' }, + { blankLine: 'never', prev: 'br', next: 'img' } + ] + ], errors: [ { message: 'Expected blank line before this tag.', @@ -728,13 +735,6 @@ tester.run('padding-line-between-tags', rule, { line: 9, column: 11 } - ], - options: [ - [ - { blankLine: 'always', prev: '*', next: '*' }, - { blankLine: 'never', prev: 'br', next: 'div' }, - { blankLine: 'never', prev: 'br', next: 'img' } - ] ] }, { @@ -764,18 +764,18 @@ tester.run('padding-line-between-tags', rule, { `, + options: [ + [ + { blankLine: 'always', prev: 'br', next: 'div' }, + { blankLine: 'always', prev: 'div', next: 'br' } + ] + ], errors: [ { message: 'Expected blank line before this tag.', line: 8, column: 11 } - ], - options: [ - [ - { blankLine: 'always', prev: 'br', next: 'div' }, - { blankLine: 'always', prev: 'div', next: 'br' } - ] ] }, { @@ -805,18 +805,18 @@ tester.run('padding-line-between-tags', rule, { `, + options: [ + [ + { blankLine: 'always', prev: 'br', next: 'div' }, + { blankLine: 'always', prev: 'br', next: 'br' } + ] + ], errors: [ { message: 'Expected blank line before this tag.', line: 9, column: 11 } - ], - options: [ - [ - { blankLine: 'always', prev: 'br', next: 'div' }, - { blankLine: 'always', prev: 'br', next: 'br' } - ] ] }, { @@ -848,6 +848,12 @@ tester.run('padding-line-between-tags', rule, { `, + options: [ + [ + { blankLine: 'always', prev: '*', next: '*' }, + { blankLine: 'never', prev: 'br', next: 'br' } + ] + ], errors: [ { message: 'Expected blank line before this tag.', @@ -864,12 +870,6 @@ tester.run('padding-line-between-tags', rule, { line: 10, column: 11 } - ], - options: [ - [ - { blankLine: 'always', prev: '*', next: '*' }, - { blankLine: 'never', prev: 'br', next: 'br' } - ] ] }, { @@ -901,14 +901,14 @@ tester.run('padding-line-between-tags', rule, { `, + options: [[{ blankLine: 'never', prev: 'br', next: 'br' }]], errors: [ { message: 'Unexpected blank line before this tag.', line: 11, column: 11 } - ], - options: [[{ blankLine: 'never', prev: 'br', next: 'br' }]] + ] }, { filename: 'test.vue', @@ -935,14 +935,14 @@ tester.run('padding-line-between-tags', rule, { `, + options: [[{ blankLine: 'always', prev: '*', next: 'br' }]], errors: [ { message: 'Expected blank line before this tag.', line: 7, column: 11 } - ], - options: [[{ blankLine: 'always', prev: '*', next: 'br' }]] + ] }, { filename: 'test.vue', @@ -1015,14 +1015,14 @@ tester.run('padding-line-between-tags', rule, { `, + options: [[{ blankLine: 'never', prev: '*', next: '*' }]], errors: [ { message: 'Unexpected blank line before this tag.', line: 6, column: 12 } - ], - options: [[{ blankLine: 'never', prev: '*', next: '*' }]] + ] }, { filename: 'test.vue', @@ -1045,14 +1045,14 @@ tester.run('padding-line-between-tags', rule, { `, + options: [[{ blankLine: 'never', prev: '*', next: '*' }]], errors: [ { message: 'Unexpected blank line before this tag.', line: 7, column: 12 } - ], - options: [[{ blankLine: 'never', prev: '*', next: '*' }]] + ] }, { filename: 'test.vue', @@ -1076,14 +1076,14 @@ tester.run('padding-line-between-tags', rule, { `, + options: [[{ blankLine: 'never', prev: '*', next: '*' }]], errors: [ { message: 'Unexpected blank line before this tag.', line: 8, column: 12 } - ], - options: [[{ blankLine: 'never', prev: '*', next: '*' }]] + ] }, { filename: 'test.vue', @@ -1109,14 +1109,14 @@ tester.run('padding-line-between-tags', rule, { `, + options: [[{ blankLine: 'never', prev: '*', next: '*' }]], errors: [ { message: 'Unexpected blank line before this tag.', line: 10, column: 12 } - ], - options: [[{ blankLine: 'never', prev: '*', next: '*' }]] + ] }, { filename: 'test.vue', @@ -1147,14 +1147,14 @@ tester.run('padding-line-between-tags', rule, {
`, + options: [[{ blankLine: 'consistent', prev: '*', next: '*' }]], errors: [ { message: 'Expected blank line before this tag.', line: 7, column: 11 } - ], - options: [[{ blankLine: 'consistent', prev: '*', next: '*' }]] + ] }, { filename: 'test.vue', @@ -1191,6 +1191,7 @@ tester.run('padding-line-between-tags', rule, {
`, + options: [[{ blankLine: 'consistent', prev: '*', next: '*' }]], errors: [ { message: 'Expected blank line before this tag.', @@ -1207,8 +1208,7 @@ tester.run('padding-line-between-tags', rule, { line: 9, column: 11 } - ], - options: [[{ blankLine: 'consistent', prev: '*', next: '*' }]] + ] }, { filename: 'test.vue', @@ -1243,6 +1243,12 @@ tester.run('padding-line-between-tags', rule, { `, + options: [ + [ + { blankLine: 'consistent', prev: '*', next: '*' }, + { blankLine: 'never', prev: 'br', next: 'br' } + ] + ], errors: [ { message: 'Unexpected blank line before this tag.', @@ -1259,12 +1265,6 @@ tester.run('padding-line-between-tags', rule, { line: 13, column: 11 } - ], - options: [ - [ - { blankLine: 'consistent', prev: '*', next: '*' }, - { blankLine: 'never', prev: 'br', next: 'br' } - ] ] }, { @@ -1288,14 +1288,14 @@ tester.run('padding-line-between-tags', rule, { `, + options: [[{ blankLine: 'consistent', prev: '*', next: '*' }]], errors: [ { message: 'Unexpected blank line before this tag.', line: 7, column: 11 } - ], - options: [[{ blankLine: 'consistent', prev: '*', next: '*' }]] + ] } ] }) diff --git a/tests/lib/rules/prefer-true-attribute-shorthand.js b/tests/lib/rules/prefer-true-attribute-shorthand.js index e7d52ef7f..0bad5c173 100644 --- a/tests/lib/rules/prefer-true-attribute-shorthand.js +++ b/tests/lib/rules/prefer-true-attribute-shorthand.js @@ -157,6 +157,7 @@ tester.run('prefer-true-attribute-shorthand', rule, { `, + output: null, errors: [ { messageId: 'expectShort', @@ -172,8 +173,7 @@ tester.run('prefer-true-attribute-shorthand', rule, { } ] } - ], - output: null + ] }, { filename: 'test.vue', @@ -181,6 +181,7 @@ tester.run('prefer-true-attribute-shorthand', rule, { `, + output: null, errors: [ { messageId: 'expectShort', @@ -196,8 +197,7 @@ tester.run('prefer-true-attribute-shorthand', rule, { } ] } - ], - output: null + ] }, { filename: 'test.vue', @@ -205,6 +205,7 @@ tester.run('prefer-true-attribute-shorthand', rule, { `, + output: null, options: ['always'], errors: [ { @@ -221,8 +222,7 @@ tester.run('prefer-true-attribute-shorthand', rule, { } ] } - ], - output: null + ] }, { filename: 'test.vue', @@ -230,6 +230,7 @@ tester.run('prefer-true-attribute-shorthand', rule, { `, + output: null, options: ['always'], errors: [ { @@ -246,8 +247,7 @@ tester.run('prefer-true-attribute-shorthand', rule, { } ] } - ], - output: null + ] }, { filename: 'test.vue', @@ -255,6 +255,7 @@ tester.run('prefer-true-attribute-shorthand', rule, { `, + output: null, options: ['never'], errors: [ { @@ -276,8 +277,7 @@ tester.run('prefer-true-attribute-shorthand', rule, { } ] } - ], - output: null + ] } ] }) diff --git a/tests/lib/rules/require-emit-validator.js b/tests/lib/rules/require-emit-validator.js index 2b60e8910..d539b55ea 100644 --- a/tests/lib/rules/require-emit-validator.js +++ b/tests/lib/rules/require-emit-validator.js @@ -118,8 +118,8 @@ ruleTester.run('require-emit-validator', rule, { } }) `, - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, - parser: require.resolve('@typescript-eslint/parser') + parser: require.resolve('@typescript-eslint/parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' } }, { filename: 'test.vue', @@ -132,8 +132,8 @@ ruleTester.run('require-emit-validator', rule, { }, }) `, - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, - parser: require.resolve('@typescript-eslint/parser') + parser: require.resolve('@typescript-eslint/parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' } }, { filename: 'test.vue', @@ -333,8 +333,8 @@ ruleTester.run('require-emit-validator', rule, { } }); `, - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, parser: require.resolve('@typescript-eslint/parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, errors: [ { messageId: 'missing', diff --git a/tests/lib/rules/require-explicit-emits.js b/tests/lib/rules/require-explicit-emits.js index 43a3c2599..af90569dd 100644 --- a/tests/lib/rules/require-explicit-emits.js +++ b/tests/lib/rules/require-explicit-emits.js @@ -1975,14 +1975,14 @@ emits: {'foo': null} emit('baz') emit('qux') `, - ...getTypeScriptFixtureTestOptions(), errors: [ { message: 'The "qux" event has been triggered but not declared on `defineEmits`.', line: 8 } - ] + ], + ...getTypeScriptFixtureTestOptions() } ] }) diff --git a/tests/lib/rules/require-macro-variable-name.js b/tests/lib/rules/require-macro-variable-name.js index c54c224a5..ed99a64e5 100644 --- a/tests/lib/rules/require-macro-variable-name.js +++ b/tests/lib/rules/require-macro-variable-name.js @@ -237,6 +237,7 @@ tester.run('require-macro-variable-name', rule, { const attrs = useAttrs({}) `, + options: [customOptions], errors: [ { message: `The variable name of "defineSlots" must be "${customOptions.defineSlots}".`, @@ -289,8 +290,7 @@ tester.run('require-macro-variable-name', rule, { } ] } - ], - options: [customOptions] + ] }, { filename: 'test.vue', @@ -300,6 +300,7 @@ tester.run('require-macro-variable-name', rule, { const attrsCustom = useAttrs({}) `, + options: [{ defineSlots: 'slotsCustom' }], errors: [ { message: `The variable name of "useAttrs" must be "attrs".`, @@ -317,8 +318,7 @@ tester.run('require-macro-variable-name', rule, { } ] } - ], - options: [{ defineSlots: 'slotsCustom' }] + ] } ] }) diff --git a/tests/lib/rules/require-prop-comment.js b/tests/lib/rules/require-prop-comment.js index 900f25ec3..c1a2aff27 100644 --- a/tests/lib/rules/require-prop-comment.js +++ b/tests/lib/rules/require-prop-comment.js @@ -265,16 +265,16 @@ tester.run('require-prop-comment', rule, { const props = defineProps() `, + parserOptions: { + parser: require.resolve('@typescript-eslint/parser') + }, errors: [ { line: 4, column: 9, message: 'The "a" property should have a JSDoc comment.' } - ], - parserOptions: { - parser: require.resolve('@typescript-eslint/parser') - } + ] } ] }) diff --git a/tests/lib/rules/require-prop-type-constructor.js b/tests/lib/rules/require-prop-type-constructor.js index 9cd4eae6e..a4d6766df 100644 --- a/tests/lib/rules/require-prop-type-constructor.js +++ b/tests/lib/rules/require-prop-type-constructor.js @@ -224,13 +224,13 @@ ruleTester.run('require-prop-type-constructor', rule, { } } `, + parser: require.resolve('@typescript-eslint/parser'), errors: [ { message: 'The "a" property should be a constructor.', line: 5 } - ], - parser: require.resolve('@typescript-eslint/parser') + ] }, { filename: 'ExtraCommas.vue', @@ -248,13 +248,13 @@ ruleTester.run('require-prop-type-constructor', rule, { } } `, + parser: require.resolve('@typescript-eslint/parser'), errors: [ { message: 'The "name" property should be a constructor.', line: 4 } - ], - parser: require.resolve('@typescript-eslint/parser') + ] }, { filename: 'LiteralsComponent.vue', diff --git a/tests/lib/rules/require-prop-types.js b/tests/lib/rules/require-prop-types.js index 9b7077fc1..fdb91dd30 100644 --- a/tests/lib/rules/require-prop-types.js +++ b/tests/lib/rules/require-prop-types.js @@ -137,8 +137,8 @@ ruleTester.run('require-prop-types', rule, { } }); `, - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, - parser: require.resolve('@typescript-eslint/parser') + parser: require.resolve('@typescript-eslint/parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' } }, { filename: 'test.vue', @@ -151,8 +151,8 @@ ruleTester.run('require-prop-types', rule, { } }); `, - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, - parser: require.resolve('@typescript-eslint/parser') + parser: require.resolve('@typescript-eslint/parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' } }, { filename: 'test.vue', @@ -163,8 +163,8 @@ ruleTester.run('require-prop-types', rule, { }) `, - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, - parser: require.resolve('vue-eslint-parser') + parser: require.resolve('vue-eslint-parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' } }, { filename: 'test.vue', @@ -173,12 +173,12 @@ ruleTester.run('require-prop-types', rule, { defineProps<{foo:string}>() `, + parser: require.resolve('vue-eslint-parser'), parserOptions: { ecmaVersion: 6, sourceType: 'module', parser: require.resolve('@typescript-eslint/parser') - }, - parser: require.resolve('vue-eslint-parser') + } }, { code: ` @@ -308,8 +308,8 @@ ruleTester.run('require-prop-types', rule, { } }); `, - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, parser: require.resolve('@typescript-eslint/parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, errors: [ { message: 'Prop "foo" should define at least its type.', @@ -326,8 +326,8 @@ ruleTester.run('require-prop-types', rule, { } }); `, - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, parser: require.resolve('@typescript-eslint/parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, errors: [ { message: 'Prop "foo" should define at least its type.', @@ -344,8 +344,8 @@ ruleTester.run('require-prop-types', rule, { }) `, - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, parser: require.resolve('vue-eslint-parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, errors: [ { message: 'Prop "foo" should define at least its type.', @@ -360,8 +360,8 @@ ruleTester.run('require-prop-types', rule, { defineProps(['foo']) `, - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, parser: require.resolve('vue-eslint-parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, errors: [ { message: 'Prop "foo" should define at least its type.', diff --git a/tests/lib/rules/require-typed-object-prop.js b/tests/lib/rules/require-typed-object-prop.js index 5d93965a5..f574e82d8 100644 --- a/tests/lib/rules/require-typed-object-prop.js +++ b/tests/lib/rules/require-typed-object-prop.js @@ -14,235 +14,235 @@ ruleTester.run('require-typed-object-prop', rule, { // empty { filename: 'test.vue', - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, code: ` export default { props: {} } - ` + `, + parserOptions: { ecmaVersion: 6, sourceType: 'module' } }, { filename: 'test.vue', - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, code: ` export default Vue.extend({ props: {} }); - ` + `, + parserOptions: { ecmaVersion: 6, sourceType: 'module' } }, { filename: 'test.vue', - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, code: ` `, - parser: require.resolve('vue-eslint-parser') + parser: require.resolve('vue-eslint-parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' } }, // array props { filename: 'test.vue', - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, code: ` export default { props: ['foo'] } - ` + `, + parserOptions: { ecmaVersion: 6, sourceType: 'module' } }, { filename: 'test.vue', - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, code: ` export default Vue.extend({ props: ['foo'] }); - ` + `, + parserOptions: { ecmaVersion: 6, sourceType: 'module' } }, { filename: 'test.vue', - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, code: ` `, - parser: require.resolve('vue-eslint-parser') + parser: require.resolve('vue-eslint-parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' } }, // primitive props { filename: 'test.vue', - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, code: ` export default { props: { foo: String } } - ` + `, + parserOptions: { ecmaVersion: 6, sourceType: 'module' } }, { filename: 'test.vue', - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, code: ` export default Vue.extend({ props: { foo: String } }); - ` + `, + parserOptions: { ecmaVersion: 6, sourceType: 'module' } }, { filename: 'test.vue', - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, code: ` `, - parser: require.resolve('vue-eslint-parser') + parser: require.resolve('vue-eslint-parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' } }, // union { filename: 'test.vue', - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, code: ` export default { props: { foo: [Number, String, Boolean] } } - ` + `, + parserOptions: { ecmaVersion: 6, sourceType: 'module' } }, { filename: 'test.vue', - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, code: ` export default Vue.extend({ props: { foo: [Number, String, Boolean] } }); - ` + `, + parserOptions: { ecmaVersion: 6, sourceType: 'module' } }, { filename: 'test.vue', - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, code: ` `, - parser: require.resolve('vue-eslint-parser') + parser: require.resolve('vue-eslint-parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' } }, // function { filename: 'test.vue', - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, code: ` export default { props: { foo: someFunction() } } - ` + `, + parserOptions: { ecmaVersion: 6, sourceType: 'module' } }, { filename: 'test.vue', - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, code: ` export default Vue.extend({ props: { foo: someFunction() } }); - ` + `, + parserOptions: { ecmaVersion: 6, sourceType: 'module' } }, { filename: 'test.vue', - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, code: ` `, - parser: require.resolve('vue-eslint-parser') + parser: require.resolve('vue-eslint-parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' } }, // typed object { filename: 'test.vue', - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, code: ` export default { props: { foo: Object as PropType } } `, - parser: require.resolve('@typescript-eslint/parser') + parser: require.resolve('@typescript-eslint/parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' } }, { filename: 'test.vue', - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, code: ` export default { props: { foo: Array as PropType } } `, - parser: require.resolve('@typescript-eslint/parser') + parser: require.resolve('@typescript-eslint/parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' } }, { filename: 'test.vue', - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, code: ` export default Vue.extend({ props: { foo: Object as PropType } }); `, - parser: require.resolve('@typescript-eslint/parser') + parser: require.resolve('@typescript-eslint/parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' } }, { filename: 'test.vue', - parserOptions: { - ecmaVersion: 6, - sourceType: 'module', - parser: require.resolve('@typescript-eslint/parser') - }, code: ` `, - parser: require.resolve('vue-eslint-parser') - }, - - { - filename: 'test.vue', + parser: require.resolve('vue-eslint-parser'), parserOptions: { ecmaVersion: 6, sourceType: 'module', parser: require.resolve('@typescript-eslint/parser') - }, + } + }, + + { + filename: 'test.vue', code: ` export default { props: { foo: Object as () => User } } `, - parser: require.resolve('@typescript-eslint/parser') - }, - { - filename: 'test.vue', + parser: require.resolve('@typescript-eslint/parser'), parserOptions: { ecmaVersion: 6, sourceType: 'module', parser: require.resolve('@typescript-eslint/parser') - }, + } + }, + { + filename: 'test.vue', code: ` export default Vue.extend({ props: { foo: Object as () => User } }); `, - parser: require.resolve('@typescript-eslint/parser') - }, - { - filename: 'test.vue', + parser: require.resolve('@typescript-eslint/parser'), parserOptions: { ecmaVersion: 6, sourceType: 'module', parser: require.resolve('@typescript-eslint/parser') - }, + } + }, + { + filename: 'test.vue', code: ` `, - parser: require.resolve('vue-eslint-parser') + parser: require.resolve('vue-eslint-parser'), + parserOptions: { + ecmaVersion: 6, + sourceType: 'module', + parser: require.resolve('@typescript-eslint/parser') + } }, // any { @@ -252,12 +252,12 @@ ruleTester.run('require-typed-object-prop', rule, { defineProps({ foo: { type: Object as any } }); `, + parser: require.resolve('vue-eslint-parser'), parserOptions: { ecmaVersion: 6, sourceType: 'module', parser: require.resolve('@typescript-eslint/parser') - }, - parser: require.resolve('vue-eslint-parser') + } }, { filename: 'test.vue', @@ -270,12 +270,12 @@ ruleTester.run('require-typed-object-prop', rule, { }; `, + parser: require.resolve('vue-eslint-parser'), parserOptions: { ecmaVersion: 6, sourceType: 'module', parser: require.resolve('@typescript-eslint/parser') - }, - parser: require.resolve('vue-eslint-parser') + } }, { filename: 'test.vue', @@ -288,12 +288,12 @@ ruleTester.run('require-typed-object-prop', rule, { }); `, + parser: require.resolve('vue-eslint-parser'), parserOptions: { ecmaVersion: 6, sourceType: 'module', parser: require.resolve('@typescript-eslint/parser') - }, - parser: require.resolve('vue-eslint-parser') + } }, // unknown { @@ -303,12 +303,12 @@ ruleTester.run('require-typed-object-prop', rule, { defineProps({ foo: { type: Object as unknown } }); `, + parser: require.resolve('vue-eslint-parser'), parserOptions: { ecmaVersion: 6, sourceType: 'module', parser: require.resolve('@typescript-eslint/parser') - }, - parser: require.resolve('vue-eslint-parser') + } }, { filename: 'test.vue', @@ -321,12 +321,12 @@ ruleTester.run('require-typed-object-prop', rule, { }; `, + parser: require.resolve('vue-eslint-parser'), parserOptions: { ecmaVersion: 6, sourceType: 'module', parser: require.resolve('@typescript-eslint/parser') - }, - parser: require.resolve('vue-eslint-parser') + } }, { filename: 'test.vue', @@ -339,12 +339,12 @@ ruleTester.run('require-typed-object-prop', rule, { }); `, + parser: require.resolve('vue-eslint-parser'), parserOptions: { ecmaVersion: 6, sourceType: 'module', parser: require.resolve('@typescript-eslint/parser') - }, - parser: require.resolve('vue-eslint-parser') + } } ], invalid: [ @@ -355,8 +355,8 @@ ruleTester.run('require-typed-object-prop', rule, { defineProps({ foo: Object }); `, - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, parser: require.resolve('vue-eslint-parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, errors: [ { messageId: 'expectedTypeAnnotation', @@ -394,8 +394,8 @@ ruleTester.run('require-typed-object-prop', rule, { defineProps({ foo: Array }); `, - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, parser: require.resolve('vue-eslint-parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, errors: [ { messageId: 'expectedTypeAnnotation', @@ -585,8 +585,8 @@ ruleTester.run('require-typed-object-prop', rule, { defineProps({ foo: { type: Object } }); `, - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, parser: require.resolve('vue-eslint-parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, errors: [ { messageId: 'expectedTypeAnnotation', diff --git a/tests/lib/rules/require-typed-ref.js b/tests/lib/rules/require-typed-ref.js index 571b5c5de..3da293b9a 100644 --- a/tests/lib/rules/require-typed-ref.js +++ b/tests/lib/rules/require-typed-ref.js @@ -75,13 +75,13 @@ tester.run('require-typed-ref', rule, { }, { filename: 'test.vue', - parser: require.resolve('vue-eslint-parser'), code: ` - ` + `, + parser: require.resolve('vue-eslint-parser') }, { filename: 'test.js', @@ -197,13 +197,13 @@ tester.run('require-typed-ref', rule, { }, { filename: 'test.vue', - parser: require.resolve('vue-eslint-parser'), code: ` `, + parser: require.resolve('vue-eslint-parser'), errors: [ { messageId: 'noType', diff --git a/tests/lib/rules/require-valid-default-prop.js b/tests/lib/rules/require-valid-default-prop.js index cec05ba05..1e6f7cd7a 100644 --- a/tests/lib/rules/require-valid-default-prop.js +++ b/tests/lib/rules/require-valid-default-prop.js @@ -122,8 +122,8 @@ ruleTester.run('require-valid-default-prop', rule, { } }); `, - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, - parser: require.resolve('@typescript-eslint/parser') + parser: require.resolve('@typescript-eslint/parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' } }, { filename: 'test.vue', @@ -214,8 +214,8 @@ ruleTester.run('require-valid-default-prop', rule, { } }); `, - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, parser: require.resolve('@typescript-eslint/parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, errors: errorMessage('function') }, { @@ -229,8 +229,8 @@ ruleTester.run('require-valid-default-prop', rule, { } }); `, - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, parser: require.resolve('@typescript-eslint/parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, errors: errorMessage('function') }, { @@ -244,8 +244,8 @@ ruleTester.run('require-valid-default-prop', rule, { } }); `, - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, parser: require.resolve('@typescript-eslint/parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, errors: errorMessage('function') }, { @@ -264,12 +264,12 @@ ruleTester.run('require-valid-default-prop', rule, { num: 1 }); `, + parser: require.resolve('vue-eslint-parser'), parserOptions: { ecmaVersion: 6, sourceType: 'module', parser: require.resolve('@typescript-eslint/parser') - }, - parser: require.resolve('vue-eslint-parser') + } }, { code: ` @@ -614,8 +614,8 @@ ruleTester.run('require-valid-default-prop', rule, { } as PropOptions } });`, - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, parser: require.resolve('@typescript-eslint/parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, errors: errorMessage('function or number') }, @@ -874,8 +874,8 @@ ruleTester.run('require-valid-default-prop', rule, { } }); `, - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, parser: require.resolve('@typescript-eslint/parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, errors: errorMessage('function') }, { @@ -889,8 +889,8 @@ ruleTester.run('require-valid-default-prop', rule, { } }); `, - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, parser: require.resolve('@typescript-eslint/parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, errors: errorMessage('function') }, { @@ -904,8 +904,8 @@ ruleTester.run('require-valid-default-prop', rule, { } }); `, - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, parser: require.resolve('@typescript-eslint/parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, errors: errorMessage('function') }, { @@ -920,8 +920,8 @@ ruleTester.run('require-valid-default-prop', rule, { }) `, - parserOptions: { ecmaVersion: 6, sourceType: 'module' }, parser: require.resolve('vue-eslint-parser'), + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, errors: [ { message: "Type of the default value for 'foo' prop must be a string.", @@ -938,12 +938,12 @@ ruleTester.run('require-valid-default-prop', rule, { }) `, + parser: require.resolve('vue-eslint-parser'), parserOptions: { ecmaVersion: 6, sourceType: 'module', parser: require.resolve('@typescript-eslint/parser') }, - parser: require.resolve('vue-eslint-parser'), errors: [ { message: "Type of the default value for 'foo' prop must be a string.", @@ -967,7 +967,6 @@ ruleTester.run('require-valid-default-prop', rule, { i: ['foo', 'bar'], }) `, - ...getTypeScriptFixtureTestOptions(), errors: [ { message: "Type of the default value for 'a' prop must be a string.", @@ -1006,7 +1005,8 @@ ruleTester.run('require-valid-default-prop', rule, { message: "Type of the default value for 'i' prop must be a function.", line: 13 } - ] + ], + ...getTypeScriptFixtureTestOptions() } ] }) diff --git a/tests/lib/rules/return-in-computed-property.js b/tests/lib/rules/return-in-computed-property.js index 9fbe2c84e..71afcc3eb 100644 --- a/tests/lib/rules/return-in-computed-property.js +++ b/tests/lib/rules/return-in-computed-property.js @@ -94,8 +94,8 @@ ruleTester.run('return-in-computed-property', rule, { } } `, - parserOptions, - options: [{ treatUndefinedAsUnspecified: false }] + options: [{ treatUndefinedAsUnspecified: false }], + parserOptions }, { filename: 'test.vue', @@ -144,8 +144,8 @@ ruleTester.run('return-in-computed-property', rule, { } } `, - parserOptions, - options: [{ treatUndefinedAsUnspecified: false }] + options: [{ treatUndefinedAsUnspecified: false }], + parserOptions } ], @@ -264,8 +264,8 @@ ruleTester.run('return-in-computed-property', rule, { } } `, - parserOptions, options: [{ treatUndefinedAsUnspecified: false }], + parserOptions, errors: [ { message: 'Expected to return a value in "foo" computed property.', @@ -284,8 +284,8 @@ ruleTester.run('return-in-computed-property', rule, { } } `, - parserOptions, options: [{ treatUndefinedAsUnspecified: true }], + parserOptions, errors: [ { message: 'Expected to return a value in "foo" computed property.', @@ -378,8 +378,8 @@ ruleTester.run('return-in-computed-property', rule, { } } `, - parserOptions, options: [{ treatUndefinedAsUnspecified: false }], + parserOptions, errors: [ { message: 'Expected to return a value in computed function.', diff --git a/tests/lib/rules/singleline-html-element-content-newline.js b/tests/lib/rules/singleline-html-element-content-newline.js index a740ff0ed..5bf2c9392 100644 --- a/tests/lib/rules/singleline-html-element-content-newline.js +++ b/tests/lib/rules/singleline-html-element-content-newline.js @@ -372,7 +372,6 @@ content
singleline content
`, - options: [{ ignoreWhenNoAttributes: false }], output: ` `, + options: [{ ignoreWhenNoAttributes: false }], errors: [ 'Expected 1 line break after opening tag (`
`), but no line breaks found.', 'Expected 1 line break before closing tag (`
`), but no line breaks found.' @@ -391,7 +391,6 @@ singleline content singlelinechildren `, - options: [{ ignoreWhenNoAttributes: false }], output: ` `, + options: [{ ignoreWhenNoAttributes: false }], errors: [ 'Expected 1 line break after opening tag (``), but no line breaks found.', 'Expected 1 line break after opening tag (``), but no line breaks found.', @@ -418,7 +418,6 @@ children
`, - options: [{ ignoreWhenNoAttributes: false }], output: ` `, + options: [{ ignoreWhenNoAttributes: false }], errors: [ 'Expected 1 line break after opening tag (`
`), but no line breaks found.', 'Expected 1 line break before closing tag (`
`), but no line breaks found.' @@ -437,7 +437,6 @@ children
singleline element
`, - options: [{ ignoreWhenNoAttributes: false }], output: ` `, + options: [{ ignoreWhenNoAttributes: false }], errors: [ 'Expected 1 line break after opening tag (`
`), but no line breaks found.', 'Expected 1 line break before closing tag (`
`), but no line breaks found.' @@ -456,13 +456,13 @@ singleline element
`, - options: [{ ignoreWhenEmpty: false, ignoreWhenNoAttributes: false }], output: ` `, + options: [{ ignoreWhenEmpty: false, ignoreWhenNoAttributes: false }], errors: [ 'Expected 1 line break after opening tag (`
`), but no line breaks found.' ] @@ -473,13 +473,13 @@ singleline element
`, - options: [{ ignoreWhenEmpty: false, ignoreWhenNoAttributes: false }], output: ` `, + options: [{ ignoreWhenEmpty: false, ignoreWhenNoAttributes: false }], errors: [ 'Expected 1 line break after opening tag (`
`), but no line breaks found.' ] diff --git a/tests/lib/rules/space-in-parens.js b/tests/lib/rules/space-in-parens.js index 8791652ed..ef6fe628e 100644 --- a/tests/lib/rules/space-in-parens.js +++ b/tests/lib/rules/space-in-parens.js @@ -94,13 +94,13 @@ tester.run('space-in-parens', rule, { @click="foo(arg)" /> `, - options: ['always'], output: ` `, + options: ['always'], errors: [ errorMessage({ messageId: 'missingOpeningSpace', @@ -143,13 +143,13 @@ tester.run('space-in-parens', rule, { :value="(1 + 2) + 3" > `, - options: ['always'], output: ` `, + options: ['always'], errors: [ errorMessage({ messageId: 'missingOpeningSpace', @@ -192,13 +192,13 @@ tester.run('space-in-parens', rule, { :[(1+2)]="(1 + 2) + 3" > `, - options: ['always'], output: ` `, + options: ['always'], errors: [ errorMessage({ messageId: 'missingOpeningSpace', diff --git a/tests/lib/rules/space-unary-ops.js b/tests/lib/rules/space-unary-ops.js index 6b3e7c25f..63539a5a7 100644 --- a/tests/lib/rules/space-unary-ops.js +++ b/tests/lib/rules/space-unary-ops.js @@ -50,8 +50,8 @@ tester.run('space-unary-ops', rule, { }, { code: '', - options: [{ nonwords: true }], output: '', + options: [{ nonwords: true }], errors: ["Unary operator '!' must be followed by whitespace."] }, diff --git a/tests/lib/rules/template-curly-spacing.js b/tests/lib/rules/template-curly-spacing.js index 6c4376969..02e711953 100644 --- a/tests/lib/rules/template-curly-spacing.js +++ b/tests/lib/rules/template-curly-spacing.js @@ -79,12 +79,12 @@ tester.run('template-curly-spacing', rule, {
`, - options: ['always'], output: ` `, + options: ['always'], errors: [ { message: "Expected space(s) after '${'.", diff --git a/tests/lib/rules/this-in-template.js b/tests/lib/rules/this-in-template.js index 904aa00c4..5686bf137 100644 --- a/tests/lib/rules/this-in-template.js +++ b/tests/lib/rules/this-in-template.js @@ -248,14 +248,14 @@ ruleTester.run('this-in-template', rule, { { code: ``, output: ``, - errors: ["Unexpected usage of 'this'."], - options: ['never'] + options: ['never'], + errors: ["Unexpected usage of 'this'."] }, { code: ``, output: ``, - errors: ["Unexpected usage of 'this'."], - options: ['never'] + options: ['never'], + errors: ["Unexpected usage of 'this'."] } ] }) diff --git a/tests/lib/rules/v-bind-style.js b/tests/lib/rules/v-bind-style.js index 2fd1ce7c2..0cb67f62f 100644 --- a/tests/lib/rules/v-bind-style.js +++ b/tests/lib/rules/v-bind-style.js @@ -67,44 +67,44 @@ tester.run('v-bind-style', rule, { }, { filename: 'test.vue', - options: ['shorthand'], code: '', output: '', + options: ['shorthand'], errors: ["Unexpected 'v-bind' before ':'."] }, { filename: 'test.vue', - options: ['longform'], code: '', output: '', + options: ['longform'], errors: ["Expected 'v-bind' before ':'."] }, { filename: 'test.vue', - options: ['longform'], code: '', output: '', + options: ['longform'], errors: ["Expected 'v-bind:' instead of '.'."] }, { filename: 'test.vue', - options: ['longform'], code: '', output: '', + options: ['longform'], errors: ["Expected 'v-bind:' instead of '.'."] }, { filename: 'test.vue', - options: ['longform'], code: '', output: '', + options: ['longform'], errors: ["Expected 'v-bind:' instead of '.'."] }, { filename: 'test.vue', - options: ['longform'], code: '', output: '', + options: ['longform'], errors: ["Expected 'v-bind:' instead of '.'."] } ] diff --git a/tests/lib/rules/v-for-delimiter-style.js b/tests/lib/rules/v-for-delimiter-style.js index b1500af50..23665a32c 100644 --- a/tests/lib/rules/v-for-delimiter-style.js +++ b/tests/lib/rules/v-for-delimiter-style.js @@ -94,9 +94,9 @@ tester.run('v-for-delimiter-style', rule, { }, { filename: 'test.vue', - options: ['in'], code: '', output: '', + options: ['in'], errors: [ { message: "Expected 'in' instead of 'of' in 'v-for'.", @@ -106,9 +106,9 @@ tester.run('v-for-delimiter-style', rule, { }, { filename: 'test.vue', - options: ['of'], code: '', output: '', + options: ['of'], errors: [ { message: "Expected 'of' instead of 'in' in 'v-for'.", diff --git a/tests/lib/rules/v-on-event-hyphenation.js b/tests/lib/rules/v-on-event-hyphenation.js index 087e5d00a..beaa5e3fa 100644 --- a/tests/lib/rules/v-on-event-hyphenation.js +++ b/tests/lib/rules/v-on-event-hyphenation.js @@ -73,12 +73,12 @@ tester.run('v-on-event-hyphenation', rule, { `, - options: ['always', { autofix: true }], output: ` `, + options: ['always', { autofix: true }], errors: [ { message: "v-on event '@customEvent' must be hyphenated.", @@ -95,12 +95,12 @@ tester.run('v-on-event-hyphenation', rule, { `, - options: ['never', { autofix: true }], output: ` `, + options: ['never', { autofix: true }], errors: ["v-on event 'v-on:custom-event' can't be hyphenated."] }, { @@ -110,13 +110,13 @@ tester.run('v-on-event-hyphenation', rule, { `, - options: ['always', { autofix: true }], output: ` `, + options: ['always', { autofix: true }], errors: ["v-on event '@update:modelValue' must be hyphenated."] }, { @@ -126,13 +126,13 @@ tester.run('v-on-event-hyphenation', rule, { `, - options: ['never', { autofix: true }], output: ` `, + options: ['never', { autofix: true }], errors: ["v-on event '@update:model-value' can't be hyphenated."] }, { @@ -144,7 +144,6 @@ tester.run('v-on-event-hyphenation', rule, { `, - options: ['always', { autofix: true }], output: ` `, + options: ['always', { autofix: true }], errors: [ "v-on event '@upDate:modelValue' must be hyphenated.", "v-on event '@up-date:modelValue' must be hyphenated.", @@ -168,7 +168,6 @@ tester.run('v-on-event-hyphenation', rule, { `, - options: ['never', { autofix: true }], output: ` `, + options: ['never', { autofix: true }], errors: [ "v-on event '@up-date:modelValue' can't be hyphenated.", "v-on event '@upDate:model-value' can't be hyphenated.", diff --git a/tests/lib/rules/v-on-function-call.js b/tests/lib/rules/v-on-function-call.js index d8486a448..d06bbe231 100644 --- a/tests/lib/rules/v-on-function-call.js +++ b/tests/lib/rules/v-on-function-call.js @@ -161,37 +161,37 @@ tester.run('v-on-function-call', rule, { filename: 'test.vue', code: '', output: null, + options: ['always'], errors: [ "Method calls inside of 'v-on' directives must have parentheses." - ], - options: ['always'] + ] }, { filename: 'test.vue', code: '', output: ``, + options: ['never'], errors: [ "Method calls without arguments inside of 'v-on' directives must not have parentheses." - ], - options: ['never'] + ] }, { filename: 'test.vue', code: '', output: ``, + options: ['never'], errors: [ "Method calls without arguments inside of 'v-on' directives must not have parentheses." - ], - options: ['never'] + ] }, { filename: 'test.vue', code: '', output: null, + options: ['never'], errors: [ "Method calls without arguments inside of 'v-on' directives must not have parentheses." - ], - options: ['never'] + ] }, { filename: 'test.vue', @@ -204,13 +204,13 @@ tester.run('v-on-function-call', rule, { ">
`, output: null, + options: ['never'], errors: [ "Method calls without arguments inside of 'v-on' directives must not have parentheses.", "Method calls without arguments inside of 'v-on' directives must not have parentheses.", "Method calls without arguments inside of 'v-on' directives must not have parentheses.", "Method calls without arguments inside of 'v-on' directives must not have parentheses." - ], - options: ['never'] + ] }, { filename: 'test.vue', @@ -222,10 +222,10 @@ tester.run('v-on-function-call', rule, { `, + options: ['never'], errors: [ "Method calls without arguments inside of 'v-on' directives must not have parentheses." - ], - options: ['never'] + ] }, { filename: 'test.vue', @@ -237,10 +237,10 @@ tester.run('v-on-function-call', rule, { `, + options: ['never'], errors: [ "Method calls without arguments inside of 'v-on' directives must not have parentheses." - ], - options: ['never'] + ] }, { filename: 'test.vue', @@ -254,11 +254,11 @@ tester.run('v-on-function-call', rule, {
`, + options: ['never'], errors: [ "Method calls without arguments inside of 'v-on' directives must not have parentheses.", "Method calls without arguments inside of 'v-on' directives must not have parentheses." - ], - options: ['never'] + ] }, { filename: 'test.vue', @@ -270,10 +270,10 @@ tester.run('v-on-function-call', rule, { `, + options: ['never'], errors: [ "Method calls without arguments inside of 'v-on' directives must not have parentheses." - ], - options: ['never'] + ] }, { filename: 'test.vue', @@ -285,19 +285,19 @@ tester.run('v-on-function-call', rule, { `, + options: ['never'], errors: [ "Method calls without arguments inside of 'v-on' directives must not have parentheses." - ], - options: ['never'] + ] }, { filename: 'test.vue', code: '', output: '', + options: ['never'], errors: [ "Method calls without arguments inside of 'v-on' directives must not have parentheses." - ], - options: ['never'] + ] }, { filename: 'test.vue', @@ -319,10 +319,10 @@ tester.run('v-on-function-call', rule, { } } `, + options: ['never'], errors: [ "Method calls without arguments inside of 'v-on' directives must not have parentheses." - ], - options: ['never'] + ] }, { filename: 'test.vue', @@ -344,10 +344,10 @@ tester.run('v-on-function-call', rule, { } } `, + options: ['never'], errors: [ "Method calls without arguments inside of 'v-on' directives must not have parentheses." - ], - options: ['never'] + ] } ] }) diff --git a/tests/lib/rules/v-on-handler-style.js b/tests/lib/rules/v-on-handler-style.js index e3afd05d5..314bbf8c8 100644 --- a/tests/lib/rules/v-on-handler-style.js +++ b/tests/lib/rules/v-on-handler-style.js @@ -78,12 +78,12 @@ tester.run('v-on-handler-style', rule, {