Skip to content

Commit 64ff685

Browse files
committed
don't match comments wrapped in quotes as route path
1 parent a892ff4 commit 64ff685

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

rules/vue-router/route-path-one-or-more-named-parameters.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
var chalk = require('chalk')
44

55
module.exports = {
6-
pattern: /([`"'][^`"']*?\/)\*([^`"'\/]+)([^`"']*?[`"'])/,
6+
pattern: /([`"'][^`"']*?\/)\*([^`"'\/\s]+)([^`"']*?[`"'])/,
77
warning: function (match, pre, param, post) {
88
return {
99
reason: 'The syntax for route matching has changed since Vue Router now uses path-to-regexp under the hood',

rules/vue-router/route-path-one-or-more-named-parameters.spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ describe('Rule: route-path-one-or-more-named-parameters', () => {
88
expect(warning).toBe(null)
99
})
1010

11+
it('does not match a JS comment wrapped by quotes', () => {
12+
const warning = check('"/* foo */"')
13+
expect(warning).toBe(null)
14+
})
15+
1116
it('does not match "/foo/bar/baz"', () => {
1217
const warning = check('"/foo/bar/baz"')
1318
expect(warning).toBe(null)

0 commit comments

Comments
 (0)