babel-jscs
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -5,2 +5,4 @@ var traverse = require("babel-core").traverse; | ||
var source = ""; | ||
exports.toToken = function (token) { | ||
@@ -49,6 +51,6 @@ var type = token.type; | ||
token.type = "Numeric"; | ||
token.value = String(token.value); | ||
token.value = source.slice(token.range[0], token.range[1]); | ||
} else if (type === tt.string) { | ||
token.type = "String"; | ||
token.value = JSON.stringify(token.value); | ||
token.value = source.slice(token.range[0], token.range[1]); | ||
} else if (type === tt.regexp) { | ||
@@ -60,3 +62,3 @@ token.type = "RegularExpression"; | ||
}; | ||
token.value = String(token.value.value); | ||
token.value = source.slice(token.range[0], token.range[1]); | ||
} | ||
@@ -72,5 +74,6 @@ | ||
exports.toTokens = function (tokens) { | ||
exports.toTokens = function (tokens, code) { | ||
// transform tokens to type "Template" | ||
convertTemplateType(tokens); | ||
source = code; | ||
@@ -77,0 +80,0 @@ return tokens.map(exports.toToken); |
@@ -99,3 +99,3 @@ var acornToEsprima = require("./acorn-to-esprima"); | ||
ranges: true, | ||
strictMode: mode === 'loose' ? false : true | ||
strictMode: !mode || mode === "strict" | ||
}; | ||
@@ -127,3 +127,3 @@ | ||
// convert tokens | ||
ast.tokens = acornToEsprima.toTokens(tokens); | ||
ast.tokens = acornToEsprima.toTokens(tokens, code); | ||
@@ -130,0 +130,0 @@ // add comments |
{ | ||
"name": "babel-jscs", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -46,3 +46,3 @@ # babel-jscs [![Build Status][travis-image]][travis-url] | ||
"esprima": "./node_modules/babel-jscs", // local | ||
"verbose": "true", // prints out rule names | ||
"verbose": true, // prints out rule names | ||
"preset" : "airbnb" | ||
@@ -49,0 +49,0 @@ } |
15153
338