coffeelint
Advanced tools
Comparing version 1.9.4 to 1.9.5
{ | ||
"name": "coffeelint", | ||
"description": "Lint your CoffeeScript", | ||
"version": "1.9.4", | ||
"version": "1.9.5", | ||
"homepage": "http://www.coffeelint.org", | ||
@@ -29,3 +29,4 @@ "keywords": [ | ||
"optimist": "^0.6.1", | ||
"resolve": "^0.6.3" | ||
"resolve": "^0.6.3", | ||
"strip-json-comments": "^1.0.2" | ||
}, | ||
@@ -32,0 +33,0 @@ "devDependencies": { |
@@ -10,3 +10,3 @@ | ||
(function() { | ||
var Cache, CoffeeScript, coffeelint, config, configfinder, coreReporters, data, deprecatedReporter, errorReport, findCoffeeScripts, fs, getFallbackConfig, glob, ignore, lintFiles, lintSource, optimist, options, os, path, paths, read, reportAndExit, resolve, ruleLoader, scripts, stdin, thisdir; | ||
var Cache, CoffeeScript, coffeelint, config, configfinder, coreReporters, data, deprecatedReporter, errorReport, findCoffeeScripts, fs, getFallbackConfig, glob, ignore, lintFiles, lintSource, loadConfig, optimist, options, os, path, paths, read, reportAndExit, resolve, ruleLoader, scripts, stdin, stripComments, thisdir; | ||
@@ -27,2 +27,4 @@ resolve = require('resolve').sync; | ||
stripComments = require('strip-json-comments'); | ||
thisdir = path.dirname(fs.realpathSync(__filename)); | ||
@@ -86,2 +88,6 @@ | ||
loadConfig = function(path) { | ||
return JSON.parse(stripComments(read(path))); | ||
}; | ||
getFallbackConfig = function(filename) { | ||
@@ -182,3 +188,3 @@ if (filename == null) { | ||
if (options.argv.f) { | ||
config = JSON.parse(read(options.argv.f)); | ||
config = loadConfig(options.argv.f); | ||
if (config.coffeelintConfig) { | ||
@@ -188,3 +194,3 @@ config = config.coffeelintConfig; | ||
} else if (process.env.COFFEELINT_CONFIG && fs.existsSync(process.env.COFFEELINT_CONFIG)) { | ||
config = JSON.parse(read(process.env.COFFEELINT_CONFIG)); | ||
config = loadConfig(process.env.COFFEELINT_CONFIG); | ||
} | ||
@@ -191,0 +197,0 @@ } |
@@ -8,3 +8,3 @@ | ||
(function() { | ||
var findFile, findFileResults, fs, loadJSON, loadNpmConfig, path; | ||
var expandModuleNames, findFile, findFileResults, fs, getConfig, loadJSON, loadNpmConfig, path, resolve, stripComments; | ||
@@ -15,2 +15,6 @@ fs = require('fs'); | ||
stripComments = require('strip-json-comments'); | ||
resolve = require('resolve').sync; | ||
findFileResults = {}; | ||
@@ -46,3 +50,3 @@ | ||
try { | ||
return JSON.parse(fs.readFileSync(filename).toString()); | ||
return JSON.parse(stripComments(fs.readFileSync(filename).toString())); | ||
} catch (_error) { | ||
@@ -55,12 +59,4 @@ e = _error; | ||
exports.getConfig = function(filename) { | ||
var dir, envs, home, npmConfig, projConfig; | ||
if (filename == null) { | ||
filename = null; | ||
} | ||
if (filename) { | ||
dir = path.dirname(path.resolve(filename)); | ||
} else { | ||
dir = process.cwd(); | ||
} | ||
getConfig = function(dir) { | ||
var envs, home, npmConfig, projConfig; | ||
npmConfig = loadNpmConfig(dir); | ||
@@ -81,2 +77,46 @@ if (npmConfig) { | ||
expandModuleNames = function(dir, config) { | ||
var coffeelint, data, ruleName; | ||
for (ruleName in config) { | ||
data = config[ruleName]; | ||
if ((data != null ? data.module : void 0) != null) { | ||
config[ruleName].module = resolve(data.module, { | ||
basedir: dir | ||
}); | ||
} | ||
} | ||
coffeelint = config.coffeelint; | ||
if ((coffeelint != null ? coffeelint.transforms : void 0) != null) { | ||
coffeelint.transforms = coffeelint.transforms.map(function(moduleName) { | ||
return resolve(moduleName, { | ||
basedir: dir | ||
}); | ||
}); | ||
} | ||
if ((coffeelint != null ? coffeelint.coffeescript : void 0) != null) { | ||
coffeelint.coffeescript = resolve(coffeelint.coffeescript, { | ||
basedir: dir | ||
}); | ||
} | ||
return config; | ||
}; | ||
exports.getConfig = function(filename) { | ||
var config, dir; | ||
if (filename == null) { | ||
filename = null; | ||
} | ||
if (filename) { | ||
dir = path.dirname(path.resolve(filename)); | ||
} else { | ||
dir = process.cwd(); | ||
} | ||
config = getConfig(dir); | ||
console.log('config', config); | ||
if (config) { | ||
config = expandModuleNames(dir, config); | ||
} | ||
return config; | ||
}; | ||
}).call(this); |
{ | ||
"name": "coffeelint", | ||
"description": "Lint your CoffeeScript", | ||
"version": "1.9.4", | ||
"version": "1.9.5", | ||
"homepage": "http://www.coffeelint.org", | ||
@@ -29,3 +29,4 @@ "keywords": [ | ||
"optimist": "^0.6.1", | ||
"resolve": "^0.6.3" | ||
"resolve": "^0.6.3", | ||
"strip-json-comments": "^1.0.2" | ||
}, | ||
@@ -32,0 +33,0 @@ "devDependencies": { |
@@ -46,3 +46,3 @@ CoffeeLint | ||
[![Build Status](https://secure.travis-ci.org/clutchski/coffeelint.png)](http://travis-ci.org/clutchski/coffeelint) | ||
[![Build Status](https://secure.travis-ci.org/clutchski/coffeelint.svg)](http://travis-ci.org/clutchski/coffeelint) | ||
@@ -49,0 +49,0 @@ ### Updating documentation when adding a new rule |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
233953
3077
6
+ Addedstrip-json-comments@^1.0.2
+ Addedstrip-json-comments@1.0.4(transitive)