@@ -36,20 +36,20 @@ function lookup(obj, keypath, backwardsDepth) {
3636 if ( ! keypath ) { return obj ; }
3737
3838 return keypath . split ( "." ) . slice ( 0 , - 1 * backwardsDepth )
39- . reduce ( function ( base , segment ) { return base && base [ segment ] , obj } ) ;
39+ . reduce ( function ( base , segment ) { return base && base [ segment ] , obj ; } ) ;
4040}
4141
4242function parseAndAssertSame ( code ) {
4343 var esAST = espree . parse ( code , {
4444 ecmaFeatures : {
4545 // enable JSX parsing
46- jsx : true ,
46+ jsx : true ,
4747 // enable return in global scope
48- globalReturn : true ,
48+ globalReturn : true ,
4949 // enable implied strict mode (if ecmaVersion >= 5)
50- impliedStrict : true ,
50+ impliedStrict : true ,
5151 // allow experimental object rest/spread
52- experimentalObjectRestSpread : true
52+ experimentalObjectRestSpread : true
5353 } ,
5454 tokens : true ,
5555 loc : true ,
@@ -62,7 +62,7 @@ function parseAndAssertSame(code) {
6262 var babylonAST = babelEslint . parse ( code ) ;
6363 try {
6464 assertImplementsAST ( esAST , babylonAST ) ;
65- } catch ( err ) {
65+ } catch ( err ) {
6666 var traversal = err . message . slice ( 3 , err . message . indexOf ( ":" ) ) ;
6767 if ( esAST . tokens ) {
6868 delete esAST . tokens ;
@@ -145,10 +145,10 @@ describe("babylon-to-esprima", function () {
145145 it ( "template with destructuring #31" , function ( ) {
146146 parseAndAssertSame ( [
147147 "module.exports = {" ,
148- "render() {" ,
149- "var {name} = this.props;" ,
150- "return Math.max(null, `Name: ${name}, Name: ${name}`);" ,
151- "}" ,
148+ "render() {" ,
149+ "var {name} = this.props;" ,
150+ "return Math.max(null, `Name: ${name}, Name: ${name}`);" ,
151+ "}" ,
152152 "};"
153153 ] . join ( "\n" ) ) ;
154154 } ) ;
@@ -199,19 +199,19 @@ describe("babylon-to-esprima", function () {
199199 } ) ;
200200
201201 it ( "default import" , function ( ) {
202- parseAndAssertSame ( ' import foo from "foo";' ) ;
202+ parseAndAssertSame ( " import foo from \ "foo\";" ) ;
203203 } ) ;
204204
205205 it ( "import specifier" , function ( ) {
206- parseAndAssertSame ( ' import { foo } from "foo";' ) ;
206+ parseAndAssertSame ( " import { foo } from \ "foo\";" ) ;
207207 } ) ;
208208
209209 it ( "import specifier with name" , function ( ) {
210- parseAndAssertSame ( ' import { foo as bar } from "foo";' ) ;
210+ parseAndAssertSame ( " import { foo as bar } from \ "foo\";" ) ;
211211 } ) ;
212212
213213 it ( "import bare" , function ( ) {
214- parseAndAssertSame ( ' import "foo";' ) ;
214+ parseAndAssertSame ( " import \ "foo\";" ) ;
215215 } ) ;
216216
217217 it ( "export default class declaration" , function ( ) {
@@ -231,7 +231,7 @@ describe("babylon-to-esprima", function () {
231231 } ) ;
232232
233233 it ( "export all" , function ( ) {
234- parseAndAssertSame ( ' export * from "foo";' ) ;
234+ parseAndAssertSame ( " export * from \ "foo\";" ) ;
235235 } ) ;
236236
237237 it ( "export named" , function ( ) {
@@ -272,11 +272,11 @@ describe("babylon-to-esprima", function () {
272272 it ( "block comments #124" , function ( ) {
273273 parseAndAssertSame ( [
274274 "React.createClass({" ,
275- "render() {" ,
276- "// return (" ,
277- "// <div />" ,
278- "// ); // <-- this is the line that is reported" ,
279- "}" ,
275+ "render() {" ,
276+ "// return (" ,
277+ "// <div />" ,
278+ "// ); // <-- this is the line that is reported" ,
279+ "}" ,
280280 "});"
281281 ] . join ( "\n" ) ) ;
282282 } ) ;
@@ -308,24 +308,24 @@ describe("babylon-to-esprima", function () {
308308 it ( "jsdoc" , function ( ) {
309309 parseAndAssertSame ( [
310310 "/**" ,
311- "* @param {object} options" ,
312- "* @return {number}" ,
313- "*/" ,
311+ "* @param {object} options" ,
312+ "* @return {number}" ,
313+ "*/" ,
314314 "const test = function({ a, b, c }) {" ,
315- "return a + b + c;" ,
315+ "return a + b + c;" ,
316316 "};" ,
317317 "module.exports = test;"
318318 ] . join ( "\n" ) ) ;
319- } )
319+ } ) ;
320320
321321 it ( "empty block with comment" , function ( ) {
322322 parseAndAssertSame ( [
323323 "function a () {" ,
324- "try {" ,
325- "b();" ,
326- "} catch (e) {" ,
327- "// asdf" ,
328- "}" ,
324+ "try {" ,
325+ "b();" ,
326+ "} catch (e) {" ,
327+ "// asdf" ,
328+ "}" ,
329329 "}"
330330 ] . join ( "\n" ) ) ;
331331 } ) ;
@@ -334,7 +334,7 @@ describe("babylon-to-esprima", function () {
334334 it ( "MethodDefinition" , function ( ) {
335335 parseAndAssertSame ( [
336336 "export default class A {" ,
337- "a() {}" ,
337+ "a() {}" ,
338338 "}"
339339 ] . join ( "\n" ) ) ;
340340 } ) ;
@@ -348,17 +348,17 @@ describe("babylon-to-esprima", function () {
348348 it ( "ClassMethod" , function ( ) {
349349 parseAndAssertSame ( [
350350 "class A {" ,
351- "constructor() {" ,
352- "}" ,
351+ "constructor() {" ,
352+ "}" ,
353353 "}"
354354 ] . join ( "\n" ) ) ;
355355 } ) ;
356356
357357 it ( "ClassMethod multiple params" , function ( ) {
358358 parseAndAssertSame ( [
359359 "class A {" ,
360- "constructor(a, b, c) {" ,
361- "}" ,
360+ "constructor(a, b, c) {" ,
361+ "}" ,
362362 "}"
363363 ] . join ( "\n" ) ) ;
364364 } ) ;
@@ -385,16 +385,16 @@ describe("babylon-to-esprima", function () {
385385 it ( "ObjectMethod" , function ( ) {
386386 parseAndAssertSame ( [
387387 "var a = {" ,
388- "b(c) {" ,
389- "}" ,
388+ "b(c) {" ,
389+ "}" ,
390390 "}"
391391 ] . join ( "\n" ) ) ;
392392 } ) ;
393393
394394 it ( "do not allow import export everywhere" , function ( ) {
395395 assert . throws ( function ( ) {
396396 parseAndAssertSame ( "function F() { import a from \"a\"; }" ) ;
397- } , / S y n t a x E r r o r : ' i m p o r t ' a n d ' e x p o r t ' m a y o n l y a p p e a r a t t h e t o p l e v e l / )
397+ } , / S y n t a x E r r o r : ' i m p o r t ' a n d ' e x p o r t ' m a y o n l y a p p e a r a t t h e t o p l e v e l / ) ;
398398 } ) ;
399399
400400 it ( "return outside function" , function ( ) {
@@ -415,31 +415,31 @@ describe("babylon-to-esprima", function () {
415415 parseAndAssertSame ( "class A { get x ( ) { ; } }" ) ;
416416 parseAndAssertSame ( [
417417 "class A {" ,
418- "get x(" ,
419- ")" ,
420- "{" ,
421- ";" ,
422- "}" ,
418+ "get x(" ,
419+ ")" ,
420+ "{" ,
421+ ";" ,
422+ "}" ,
423423 "}"
424424 ] . join ( "\n" ) ) ;
425425 parseAndAssertSame ( "class A { set x (a) { ; } }" ) ;
426426 parseAndAssertSame ( [
427427 "class A {" ,
428- "set x(a" ,
429- ")" ,
430- "{" ,
431- ";" ,
432- "}" ,
428+ "set x(a" ,
429+ ")" ,
430+ "{" ,
431+ ";" ,
432+ "}" ,
433433 "}"
434434 ] . join ( "\n" ) ) ;
435435 parseAndAssertSame ( [
436436 "var B = {" ,
437- "get x () {" ,
438- "return this.ecks;" ,
439- "}," ,
440- "set x (ecks) {" ,
441- "this.ecks = ecks;" ,
442- "}" ,
437+ "get x () {" ,
438+ "return this.ecks;" ,
439+ "}," ,
440+ "set x (ecks) {" ,
441+ "this.ecks = ecks;" ,
442+ "}" ,
443443 "};"
444444 ] . join ( "\n" ) ) ;
445445 } ) ;
0 commit comments