From 76149245d8d33bd935ff761261ee672705469b01 Mon Sep 17 00:00:00 2001 From: Mathias Brodala Date: Wed, 5 Mar 2025 09:24:35 +0100 Subject: [PATCH 01/47] Add vue-eslint-parser to Yarn install instructions (#2698) --- docs/user-guide/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-guide/index.md b/docs/user-guide/index.md index fcd7ff45c..30432d511 100644 --- a/docs/user-guide/index.md +++ b/docs/user-guide/index.md @@ -11,7 +11,7 @@ npm install --save-dev eslint eslint-plugin-vue Via [yarn](https://yarnpkg.com/): ```bash -yarn add -D eslint eslint-plugin-vue globals +yarn add -D eslint eslint-plugin-vue vue-eslint-parser globals ``` ::: tip Requirements From 7bd1d9a1b4cc72d6a9078ee0f40384fbd68f3ef3 Mon Sep 17 00:00:00 2001 From: ntnyq Date: Wed, 5 Mar 2025 16:24:54 +0800 Subject: [PATCH 02/47] fix: sync `.eslintrc` configs name changes (#2700) --- lib/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/index.d.ts b/lib/index.d.ts index 19bbc8a9d..8cbff659f 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -9,9 +9,9 @@ declare const vue: { 'vue2-strongly-recommended': Linter.LegacyConfig 'vue2-recommended': Linter.LegacyConfig - 'vue3-essential': Linter.LegacyConfig - 'vue3-strongly-recommended': Linter.LegacyConfig - 'vue3-recommended': Linter.LegacyConfig + essential: Linter.LegacyConfig + 'strongly-recommended': Linter.LegacyConfig + recommended: Linter.LegacyConfig 'flat/base': Linter.FlatConfig[] From 9fab6bd6f646847d5c91727524773c0859410015 Mon Sep 17 00:00:00 2001 From: ntnyq Date: Wed, 5 Mar 2025 19:13:27 +0800 Subject: [PATCH 03/47] fix: fix walking program AST when multiple script blocks (#2703) --- lib/utils/index.js | 2 +- tests/lib/rules/prefer-use-template-ref.js | 88 ++++++++++++++++++++++ 2 files changed, 89 insertions(+), 1 deletion(-) diff --git a/lib/utils/index.js b/lib/utils/index.js index 8d0dfa80d..769362966 100644 --- a/lib/utils/index.js +++ b/lib/utils/index.js @@ -1380,7 +1380,7 @@ module.exports = { * @param {any[]} args */ function callVisitor(key, node, ...args) { - if (visitor[key] && inScriptSetup(node)) { + if (visitor[key] && (node.type === 'Program' || inScriptSetup(node))) { // @ts-expect-error visitor[key](node, ...args) } diff --git a/tests/lib/rules/prefer-use-template-ref.js b/tests/lib/rules/prefer-use-template-ref.js index 414c69830..afc6d6a11 100644 --- a/tests/lib/rules/prefer-use-template-ref.js +++ b/tests/lib/rules/prefer-use-template-ref.js @@ -263,6 +263,40 @@ tester.run('prefer-use-template-ref', rule, { }) ` + }, + { + filename: 'multiple-scripts-setup-first.vue', + code: ` + + + + + + ` + }, + { + filename: 'multiple-scripts-setup-last.vue', + code: ` + + + + + + ` } ], invalid: [ @@ -420,6 +454,60 @@ tester.run('prefer-use-template-ref', rule, { column: 28 } ] + }, + { + filename: 'multiple-scripts-setup-first.vue', + code: ` + + + + + + `, + errors: [ + { + messageId: 'preferUseTemplateRef', + data: { + name: 'ref' + }, + line: 8, + column: 20 + } + ] + }, + { + filename: 'multiple-scripts-setup-last.vue', + code: ` + + + + + + `, + errors: [ + { + messageId: 'preferUseTemplateRef', + data: { + name: 'ref' + }, + line: 12, + column: 20 + } + ] } ] }) From 87bb3ec5edceffa6eea1ea95b87bb6316d343504 Mon Sep 17 00:00:00 2001 From: chouchouji <70570907+chouchouji@users.noreply.github.com> Date: Wed, 5 Mar 2025 21:49:44 +0800 Subject: [PATCH 04/47] fix(no-export-in-script-setup): better report location (#2701) --- lib/rules/no-export-in-script-setup.js | 23 ++++-- tests/lib/rules/no-export-in-script-setup.js | 78 +++++++++++++++++--- 2 files changed, 87 insertions(+), 14 deletions(-) diff --git a/lib/rules/no-export-in-script-setup.js b/lib/rules/no-export-in-script-setup.js index 66286375a..98d41ae38 100644 --- a/lib/rules/no-export-in-script-setup.js +++ b/lib/rules/no-export-in-script-setup.js @@ -28,8 +28,11 @@ module.exports = { }, /** @param {RuleContext} context */ create(context) { - /** @param {ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration} node */ - function verify(node) { + /** + * @param {ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration} node + * @param {SourceLocation} loc + */ + function verify(node, loc) { const tsNode = /** @type {TSESTreeExportAllDeclaration | TSESTreeExportDefaultDeclaration | TSESTreeExportNamedDeclaration} */ ( node @@ -46,14 +49,24 @@ module.exports = { } context.report({ node, + loc, messageId: 'forbidden' }) } return utils.defineScriptSetupVisitor(context, { - ExportAllDeclaration: verify, - ExportDefaultDeclaration: verify, - ExportNamedDeclaration: verify + ExportAllDeclaration: (node) => verify(node, node.loc), + ExportDefaultDeclaration: (node) => verify(node, node.loc), + ExportNamedDeclaration: (node) => { + // export let foo = 'foo', export class Foo {}, export function foo() {} + if (node.declaration) { + verify(node, context.getSourceCode().getFirstToken(node).loc) + } + // export { foo }, export { foo } from 'bar' + else { + verify(node, node.loc) + } + } }) } } diff --git a/tests/lib/rules/no-export-in-script-setup.js b/tests/lib/rules/no-export-in-script-setup.js index 8703dc74a..bf24b8682 100644 --- a/tests/lib/rules/no-export-in-script-setup.js +++ b/tests/lib/rules/no-export-in-script-setup.js @@ -92,20 +92,62 @@ ruleTester.run('no-export-in-script-setup', rule, { export * from 'foo' export default {} export class A {} + export const test = '123' + export function foo() {} + const a = 1 + export { a } + export { fao } from 'bar' `, errors: [ { message: '` `, + ` + + `, + ` + + `, ` + `, + languageOptions: { + parser: require('vue-eslint-parser'), + ...languageOptions + } + }, + { + filename: 'test.vue', + code: ` + + `, + languageOptions: { + parser: require('vue-eslint-parser'), + ...languageOptions, + parserOptions: { parser: require.resolve('@typescript-eslint/parser') } + } } ], @@ -700,6 +725,26 @@ ruleTester.run('require-default-prop', rule, { line: 3 } ] + }, + { + // https://github.com/vuejs/eslint-plugin-vue/issues/2725 + filename: 'type-with-props-destructure.vue', + code: ` + + `, + languageOptions: { + parser: require('vue-eslint-parser'), + ...languageOptions, + parserOptions: { parser: require.resolve('@typescript-eslint/parser') } + }, + errors: [ + { + message: "Prop 'foo' requires default value to be set.", + line: 3 + } + ] } ] }) From 7dec48d730a7889154915e3a043c2dcfedd0cf65 Mon Sep 17 00:00:00 2001 From: Wayne Zhang Date: Thu, 3 Apr 2025 15:10:58 +0800 Subject: [PATCH 15/47] fix(no-dupe-keys): detect props destructure rename (#2731) --- lib/rules/no-dupe-keys.js | 33 +++++++++++++++++++++++++++++++++ tests/lib/rules/no-dupe-keys.js | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/lib/rules/no-dupe-keys.js b/lib/rules/no-dupe-keys.js index 01b85d9f5..ecfa787cf 100644 --- a/lib/rules/no-dupe-keys.js +++ b/lib/rules/no-dupe-keys.js @@ -58,6 +58,33 @@ function isInsideInitializer(node, references) { ) } +/** + * Collects all renamed props from a pattern + * @param {Pattern | null} pattern - The destructuring pattern + * @returns {Set} - Set of prop names that have been renamed + */ +function collectRenamedProps(pattern) { + const renamedProps = new Set() + + if (!pattern || pattern.type !== 'ObjectPattern') { + return renamedProps + } + + for (const prop of pattern.properties) { + if (prop.type !== 'Property') continue + + if ( + prop.key.type === 'Identifier' && + prop.value.type === 'Identifier' && + prop.key.name !== prop.value.name + ) { + renamedProps.add(prop.key.name) + } + } + + return renamedProps +} + module.exports = { meta: { type: 'problem', @@ -115,9 +142,15 @@ module.exports = { node ] + const renamedProps = collectRenamedProps(propsNode) + for (const prop of props) { if (!prop.propName) continue + if (renamedProps.has(prop.propName)) { + continue + } + const variable = findVariable( utils.getScope(context, node), prop.propName diff --git a/tests/lib/rules/no-dupe-keys.js b/tests/lib/rules/no-dupe-keys.js index 124442ec2..2df95908c 100644 --- a/tests/lib/rules/no-dupe-keys.js +++ b/tests/lib/rules/no-dupe-keys.js @@ -466,7 +466,7 @@ ruleTester.run('no-dupe-keys', rule, { { filename: 'test.vue', code: ` - + `, @@ -475,7 +475,7 @@ ruleTester.run('no-dupe-keys', rule, { { filename: 'test.vue', code: ` - + `, @@ -500,6 +500,17 @@ ruleTester.run('no-dupe-keys', rule, { parser: require('vue-eslint-parser'), parserOptions: { parser: require.resolve('@typescript-eslint/parser') } } + }, + { + filename: 'test.vue', + code: ` + + `, + languageOptions: { parser: require('vue-eslint-parser') } } ], @@ -1105,6 +1116,24 @@ ruleTester.run('no-dupe-keys', rule, { line: 5 } ] + }, + { + filename: 'test.vue', + code: ` + + `, + languageOptions: { parser: require('vue-eslint-parser') }, + errors: [ + { + message: + "Duplicate key 'bar'. May cause name collision in script or template tag.", + line: 5 + } + ] } ] }) From 654c3cba946a34a94a938abf1811432ee4fa4078 Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Tue, 29 Apr 2025 09:53:56 +0900 Subject: [PATCH 16/47] 10.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b9d2c00be..5eb6e8113 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-vue", - "version": "10.0.0", + "version": "10.0.1", "description": "Official ESLint plugin for Vue.js", "main": "lib/index.js", "types": "lib/index.d.ts", From c68cb1a49f6dcaede556490b391631aac4940cca Mon Sep 17 00:00:00 2001 From: Wayne Zhang Date: Tue, 29 Apr 2025 09:08:31 +0800 Subject: [PATCH 17/47] feat(no-bare-strings-in-template): `allowlist` support regex (#2734) Co-authored-by: Flo Edelmann --- docs/rules/no-bare-strings-in-template.md | 6 +- lib/rules/no-bare-strings-in-template.js | 48 ++++++++++++--- .../lib/rules/no-bare-strings-in-template.js | 60 +++++++++++++++++++ 3 files changed, 102 insertions(+), 12 deletions(-) diff --git a/docs/rules/no-bare-strings-in-template.md b/docs/rules/no-bare-strings-in-template.md index df1fae123..23a23c116 100644 --- a/docs/rules/no-bare-strings-in-template.md +++ b/docs/rules/no-bare-strings-in-template.md @@ -12,7 +12,7 @@ since: v7.0.0 ## :book: Rule Details -This rule disallows the use of bare strings in ` ` + }, + { + filename: 'test.vue', + code: ` + + `, + options: [{ disallowComments: false }] + }, + { + filename: 'test.vue', + code: ` + + `, + options: [{ disallowComments: false }] + }, + { + filename: 'test.vue', + code: ` + + `, + options: [{ disallowComments: true }] + }, + { + filename: 'test.vue', + code: ` + + `, + options: [{ disallowComments: true }] } ], invalid: [ @@ -104,6 +164,132 @@ ruleTester.run('no-multiple-template-root', rule, { filename: 'test.vue', code: '', errors: ["The template root disallows '`, options: [{ ignore: ['one', 'two', 'my-component'] }] + }, + { + code: ``, + options: [{ ignore: ['/one/', '/^Two$/i', '/^my-.*/i'] }] } ], invalid: [ @@ -644,6 +656,82 @@ tester.run('no-deprecated-slot-attribute', rule, { ], errors: ['`slot` attributes are deprecated.'] }, + { + code: ` + `, + output: ` + `, + options: [ + { + ignore: ['/one/'] + } + ], + errors: [ + { + message: '`slot` attributes are deprecated.', + line: 7, + endLine: 7, + column: 16, + endColumn: 20 + } + ] + }, + { + code: ` + `, + output: ` + `, + options: [ + { + ignore: ['/^one$/'] + } + ], + errors: [ + { + message: '`slot` attributes are deprecated.', + line: 7, + endLine: 7, + column: 16, + endColumn: 20 + } + ] + }, { code: ` `, errors: [ - '`slot` attributes are deprecated.', - '`slot` attributes are deprecated.' + { + message: '`slot` attributes are deprecated.', + line: 4, + column: 41, + endLine: 4, + endColumn: 46 + }, + { + message: '`slot` attributes are deprecated.', + line: 7, + column: 37, + endLine: 7, + endColumn: 42 + } ] }, { @@ -678,7 +828,15 @@ tester.run('no-deprecated-slot-attribute', rule, { ignore: ['one'] } ], - errors: ['`slot` attributes are deprecated.'] + errors: [ + { + message: '`slot` attributes are deprecated.', + line: 7, + column: 16, + endLine: 7, + endColumn: 20 + } + ] }, { code: ` @@ -863,7 +1021,15 @@ tester.run('no-deprecated-slot-attribute', rule, { `, - errors: ['`slot` attributes are deprecated.'] + errors: [ + { + message: '`slot` attributes are deprecated.', + line: 6, + column: 13, + endLine: 6, + endColumn: 18 + } + ] }, { code: ` @@ -876,7 +1042,15 @@ tester.run('no-deprecated-slot-attribute', rule, { `, output: null, - errors: ['`slot` attributes are deprecated.'] + errors: [ + { + message: '`slot` attributes are deprecated.', + line: 4, + column: 16, + endLine: 4, + endColumn: 20 + } + ] } ] }) From cf3c4eb97e83d7190a035275b3e2f339e2ade8af Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Fri, 18 Jul 2025 09:04:24 +0200 Subject: [PATCH 42/47] test(array-bracket-newline): make tests more strict (#2799) --- tests/lib/rules/array-bracket-newline.js | 124 ++++++++++++++++++++--- 1 file changed, 110 insertions(+), 14 deletions(-) diff --git a/tests/lib/rules/array-bracket-newline.js b/tests/lib/rules/array-bracket-newline.js index 380f61e4f..0334d2942 100644 --- a/tests/lib/rules/array-bracket-newline.js +++ b/tests/lib/rules/array-bracket-newline.js @@ -40,61 +40,145 @@ tester.run('array-bracket-newline', rule, { { code: '', output: '', - errors: ["There should be no linebreak after '['."] + errors: [ + { + message: "There should be no linebreak after '['.", + line: 1, + column: 23, + endLine: 1, + endColumn: 24 + } + ] }, { code: '', output: '', - errors: ["There should be no linebreak before ']'."] + errors: [ + { + message: "There should be no linebreak before ']'.", + line: 2, + column: 1, + endLine: 2, + endColumn: 2 + } + ] }, { code: '', output: '', errors: [ - "There should be no linebreak after '['.", - "There should be no linebreak before ']'." + { + message: "There should be no linebreak after '['.", + line: 1, + column: 23, + endLine: 1, + endColumn: 24 + }, + { + message: "There should be no linebreak before ']'.", + line: 3, + column: 1, + endLine: 3, + endColumn: 2 + } ] }, { code: '', output: '', options: ['never'], - errors: ["There should be no linebreak after '['."] + errors: [ + { + message: "There should be no linebreak after '['.", + line: 1, + column: 23, + endLine: 1, + endColumn: 24 + } + ] }, { code: '', output: '', options: ['never'], - errors: ["There should be no linebreak before ']'."] + errors: [ + { + message: "There should be no linebreak before ']'.", + line: 2, + column: 1, + endLine: 2, + endColumn: 2 + } + ] }, { code: '', output: '', options: ['never'], errors: [ - "There should be no linebreak after '['.", - "There should be no linebreak before ']'." + { + message: "There should be no linebreak after '['.", + line: 1, + column: 23, + endLine: 1, + endColumn: 24 + }, + { + message: "There should be no linebreak before ']'.", + line: 3, + column: 1, + endLine: 3, + endColumn: 2 + } ] }, { code: '', output: '', options: ['always'], - errors: ["A linebreak is required before ']'."] + errors: [ + { + message: "A linebreak is required before ']'.", + line: 2, + column: 2, + endLine: 2, + endColumn: 3 + } + ] }, { code: '', output: '', options: ['always'], - errors: ["A linebreak is required after '['."] + errors: [ + { + message: "A linebreak is required after '['.", + line: 1, + column: 23, + endLine: 1, + endColumn: 24 + } + ] }, { code: '', output: '', options: ['always'], errors: [ - "A linebreak is required after '['.", - "A linebreak is required before ']'." + { + message: "A linebreak is required after '['.", + line: 1, + column: 23, + endLine: 1, + endColumn: 24 + }, + { + message: "A linebreak is required before ']'.", + line: 1, + column: 25, + endLine: 1, + endColumn: 26 + } ] }, { @@ -102,8 +186,20 @@ tester.run('array-bracket-newline', rule, { output: '', options: ['always'], errors: [ - "A linebreak is required after '['.", - "A linebreak is required before ']'." + { + message: "A linebreak is required after '['.", + line: 1, + column: 27, + endLine: 1, + endColumn: 28 + }, + { + message: "A linebreak is required before ']'.", + line: 1, + column: 29, + endLine: 1, + endColumn: 30 + } ] } ] From 5bde25ae9995461bd75e29457573d63ea21b63ee Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Fri, 18 Jul 2025 11:23:11 +0200 Subject: [PATCH 43/47] test(array-bracket-spacing): make tests more strict (#2800) --- tests/lib/rules/array-bracket-spacing.js | 124 ++++++++++++++++++++--- 1 file changed, 110 insertions(+), 14 deletions(-) diff --git a/tests/lib/rules/array-bracket-spacing.js b/tests/lib/rules/array-bracket-spacing.js index 1eea108e6..6218d232e 100644 --- a/tests/lib/rules/array-bracket-spacing.js +++ b/tests/lib/rules/array-bracket-spacing.js @@ -39,61 +39,145 @@ tester.run('array-bracket-spacing', rule, { { code: '', output: '', - errors: ["There should be no space after '['."] + errors: [ + { + message: "There should be no space after '['.", + line: 1, + column: 24, + endLine: 1, + endColumn: 25 + } + ] }, { code: '', output: '', - errors: ["There should be no space before ']'."] + errors: [ + { + message: "There should be no space before ']'.", + line: 1, + column: 25, + endLine: 1, + endColumn: 26 + } + ] }, { code: '', output: '', errors: [ - "There should be no space after '['.", - "There should be no space before ']'." + { + message: "There should be no space after '['.", + line: 1, + column: 24, + endLine: 1, + endColumn: 25 + }, + { + message: "There should be no space before ']'.", + line: 1, + column: 26, + endLine: 1, + endColumn: 27 + } ] }, { code: '', output: '', options: ['never'], - errors: ["There should be no space after '['."] + errors: [ + { + message: "There should be no space after '['.", + line: 1, + column: 24, + endLine: 1, + endColumn: 25 + } + ] }, { code: '', output: '', options: ['never'], - errors: ["There should be no space before ']'."] + errors: [ + { + message: "There should be no space before ']'.", + line: 1, + column: 25, + endLine: 1, + endColumn: 26 + } + ] }, { code: '', output: '', options: ['never'], errors: [ - "There should be no space after '['.", - "There should be no space before ']'." + { + message: "There should be no space after '['.", + line: 1, + column: 24, + endLine: 1, + endColumn: 25 + }, + { + message: "There should be no space before ']'.", + line: 1, + column: 26, + endLine: 1, + endColumn: 27 + } ] }, { code: '', output: '', options: ['always'], - errors: ["A space is required before ']'."] + errors: [ + { + message: "A space is required before ']'.", + line: 1, + column: 26, + endLine: 1, + endColumn: 27 + } + ] }, { code: '', output: '', options: ['always'], - errors: ["A space is required after '['."] + errors: [ + { + message: "A space is required after '['.", + line: 1, + column: 23, + endLine: 1, + endColumn: 24 + } + ] }, { code: '', output: '', options: ['always'], errors: [ - "A space is required after '['.", - "A space is required before ']'." + { + message: "A space is required after '['.", + line: 1, + column: 23, + endLine: 1, + endColumn: 24 + }, + { + message: "A space is required before ']'.", + line: 1, + column: 25, + endLine: 1, + endColumn: 26 + } ] }, { @@ -101,8 +185,20 @@ tester.run('array-bracket-spacing', rule, { output: '', options: ['always'], errors: [ - "A space is required after '['.", - "A space is required before ']'." + { + message: "A space is required after '['.", + line: 1, + column: 27, + endLine: 1, + endColumn: 28 + }, + { + message: "A space is required before ']'.", + line: 1, + column: 29, + endLine: 1, + endColumn: 30 + } ] } ] From 468789bfbf67691d4163f5808ce960d7b16f3f83 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Fri, 18 Jul 2025 15:04:17 +0200 Subject: [PATCH 44/47] test(arrow-spacing): make tests more strict (#2801) --- tests/lib/rules/arrow-spacing.js | 40 +++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/tests/lib/rules/arrow-spacing.js b/tests/lib/rules/arrow-spacing.js index d80c255e8..d05c9f269 100644 --- a/tests/lib/rules/arrow-spacing.js +++ b/tests/lib/rules/arrow-spacing.js @@ -48,11 +48,17 @@ tester.run('arrow-spacing', rule, { errors: [ { message: 'Missing space before =>.', - line: 3 + line: 3, + column: 24, + endLine: 3, + endColumn: 25 }, { message: 'Missing space after =>.', - line: 3 + line: 3, + column: 27, + endLine: 3, + endColumn: 28 } ] }, @@ -68,11 +74,17 @@ tester.run('arrow-spacing', rule, { errors: [ { message: 'Missing space before =>.', - line: 3 + line: 3, + column: 25, + endLine: 3, + endColumn: 26 }, { message: 'Missing space after =>.', - line: 3 + line: 3, + column: 28, + endLine: 3, + endColumn: 29 } ] }, @@ -94,11 +106,17 @@ tester.run('arrow-spacing', rule, { errors: [ { message: 'Missing space before =>.', - line: 4 + line: 4, + column: 25, + endLine: 4, + endColumn: 26 }, { message: 'Missing space after =>.', - line: 4 + line: 4, + column: 28, + endLine: 4, + endColumn: 29 } ] }, @@ -115,11 +133,17 @@ tester.run('arrow-spacing', rule, { errors: [ { message: 'Unexpected space before =>.', - line: 3 + line: 3, + column: 24, + endLine: 3, + endColumn: 25 }, { message: 'Unexpected space after =>.', - line: 3 + line: 3, + column: 29, + endLine: 3, + endColumn: 30 } ] } From f75a0030657c49fda257c720fcf9bf43852291a8 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Fri, 18 Jul 2025 15:06:54 +0200 Subject: [PATCH 45/47] test(attribute-hyphenation): make tests more strict (#2802) --- tests/lib/rules/attribute-hyphenation.js | 138 ++++++++++++++++++----- 1 file changed, 110 insertions(+), 28 deletions(-) diff --git a/tests/lib/rules/attribute-hyphenation.js b/tests/lib/rules/attribute-hyphenation.js index 738d59ae9..eac974e4e 100644 --- a/tests/lib/rules/attribute-hyphenation.js +++ b/tests/lib/rules/attribute-hyphenation.js @@ -118,7 +118,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'my-prop' can't be hyphenated.", type: 'VIdentifier', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 37 } ] }, @@ -131,7 +134,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'MyProp' must be hyphenated.", type: 'VIdentifier', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 36 } ] }, @@ -145,7 +151,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute ':my-prop' can't be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 39 } ] }, @@ -158,7 +167,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute ':MyProp' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 38 } ] }, @@ -172,7 +184,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'v-bind:my-prop' can't be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 45 } ] }, @@ -185,7 +200,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'v-bind:MyProp' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 44 } ] }, @@ -198,7 +216,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'v-bind:MyProp' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 44 } ] }, @@ -212,7 +233,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute ':second-prop' can't be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 46, + endLine: 1, + endColumn: 65 } ] }, @@ -226,7 +250,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'v-bind:myProp' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 44 } ] }, @@ -240,7 +267,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'v-bind:propID' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 44 } ] }, @@ -255,7 +285,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'v-model:my-prop' can't be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 46 } ] }, @@ -269,7 +302,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'v-model:myProp' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 45 } ] }, @@ -282,7 +318,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'v-model:MyProp' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 45 } ] }, @@ -307,7 +346,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'third-custom' can't be hyphenated.", type: 'VIdentifier', - line: 3 + line: 3, + column: 111, + endLine: 3, + endColumn: 129 } ] }, @@ -332,12 +374,18 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'custom-hyphen' can't be hyphenated.", type: 'VIdentifier', - line: 3 + line: 3, + column: 71, + endLine: 3, + endColumn: 90 }, { message: "Attribute 'second-custom' can't be hyphenated.", type: 'VIdentifier', - line: 3 + line: 3, + column: 91, + endLine: 3, + endColumn: 110 } ] }, @@ -350,7 +398,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'my-prop' can't be hyphenated.", type: 'VIdentifier', - line: 1 + line: 1, + column: 22, + endLine: 1, + endColumn: 35 } ] }, @@ -363,7 +414,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'MyProp' must be hyphenated.", type: 'VIdentifier', - line: 1 + line: 1, + column: 22, + endLine: 1, + endColumn: 34 } ] }, @@ -376,7 +430,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute ':attr_Gg' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 39 } ] }, @@ -389,7 +446,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute ':Attr_Hh' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 39 } ] }, @@ -402,7 +462,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute ':_attr_Jj' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 40 } ] }, @@ -415,7 +478,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute ':_attrKk' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 39 } ] }, @@ -428,7 +494,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute ':_AttrLl' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 39 } ] }, @@ -441,7 +510,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute ':my-custom_prop' can't be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 46 } ] }, @@ -454,7 +526,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute ':myAge.sync' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 42 } ] }, @@ -467,7 +542,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute ':my-age.sync' can't be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 43 } ] }, @@ -490,7 +568,9 @@ ruleTester.run('attribute-hyphenation', rule, { message: "Attribute 'my-prop' can't be hyphenated.", type: 'VIdentifier', line: 3, - column: 17 + column: 17, + endLine: 3, + endColumn: 24 } ] }, @@ -513,7 +593,9 @@ ruleTester.run('attribute-hyphenation', rule, { message: "Attribute 'myProp' must be hyphenated.", type: 'VIdentifier', line: 3, - column: 17 + column: 17, + endLine: 3, + endColumn: 23 } ] } From c66d6b641d8dd79596d9b31d9223640827c0f870 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Fri, 18 Jul 2025 16:35:14 +0200 Subject: [PATCH 46/47] test(block-lang): make tests more strict (#2804) --- tests/lib/rules/block-lang.js | 52 ++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/tests/lib/rules/block-lang.js b/tests/lib/rules/block-lang.js index 5f7851b54..ad1b9842c 100644 --- a/tests/lib/rules/block-lang.js +++ b/tests/lib/rules/block-lang.js @@ -44,7 +44,9 @@ tester.run('block-lang', rule, { { message: `Only "ts" can be used for the 'lang' attribute of '