mirror of
https://github.com/nodejs/node.git
synced 2025-05-18 19:31:09 +00:00

PR-URL: https://github.com/nodejs/io.js/pull/2072 Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com> Reviewed-by: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Alex Kocharin <alex@kocharin.ru>
31 lines
774 B
JavaScript
31 lines
774 B
JavaScript
/**
|
|
* @fileoverview Disallow the use of process.env()
|
|
* @author Vignesh Anand
|
|
* @copyright 2014 Vignesh Anand. All rights reserved.
|
|
*/
|
|
"use strict";
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Rule Definition
|
|
//------------------------------------------------------------------------------
|
|
|
|
module.exports = function(context) {
|
|
|
|
return {
|
|
|
|
"MemberExpression": function(node) {
|
|
var objectName = node.object.name,
|
|
propertyName = node.property.name;
|
|
|
|
if (objectName === "process" && !node.computed && propertyName && propertyName === "env") {
|
|
context.report(node, "Unexpected use of process.env.");
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
module.exports.schema = [];
|