src/rbs/parser.js in prettier-1.5.5 vs src/rbs/parser.js in prettier-1.6.0
- old
+ new
@@ -6,15 +6,13 @@
// process of parser.rb and reading JSON off STDOUT.
function parse(text, _parsers, opts) {
return parseSync("rbs", text, opts);
}
-const pragmaPattern = /#\s*@(prettier|format)/;
-
// This function handles checking whether or not the source string has the
// pragma for prettier. This is an optional workflow for incremental adoption.
function hasPragma(text) {
- return pragmaPattern.test(text);
+ return /^\s*#[^\S\n]*@(format|prettier)\s*(\n|$)/.test(text);
}
// This function is critical for comments and cursor support, and is responsible
// for returning the index of the character within the source string that is the
// beginning of the given node.