From 6e31efce11499ed9088e486eb5f2699c8ff89624 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 18 Feb 2018 10:21:51 -0500 Subject: [PATCH 1/2] fix capitalize warning --- src/validate/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/validate/index.ts b/src/validate/index.ts index da603a437b..f79cb1a55c 100644 --- a/src/validate/index.ts +++ b/src/validate/index.ts @@ -101,7 +101,7 @@ export default function validate( throw error; } - if (name && !/^[A-Z]/.test(name)) { + if (name && /^[a-z]/.test(name)) { const message = `options.name should be capitalised`; onwarn({ message, From fdd9adab4d60ad478726ab9de564d2ea0c875a89 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Fri, 23 Feb 2018 08:40:02 -0500 Subject: [PATCH 2/2] add test for #1179 --- test/validator/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/validator/index.js b/test/validator/index.js index 0a132a7c9e..6fa792dbde 100644 --- a/test/validator/index.js +++ b/test/validator/index.js @@ -88,4 +88,19 @@ describe("validate", () => { } ]); }); + + it("does not warn if options.name begins with non-alphabetic character", () => { + const warnings = []; + svelte.compile("
", { + name: "_", + onwarn(warning) { + warnings.push({ + message: warning.message, + pos: warning.pos, + loc: warning.loc + }); + } + }); + assert.deepEqual(warnings, []); + }); });