Sha256: 46db1cc3991f64b78ef5e7f35c4f48a6cff8cb6f5f34f872dae8077b3ab77b02
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
/** * @fileoverview Disallow string concatenation when using __dirname and __filename * @author Nicholas C. Zakas */ "use strict"; //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ module.exports = function(context) { var MATCHER = /^__(?:dir|file)name$/; //-------------------------------------------------------------------------- // Public //-------------------------------------------------------------------------- return { "BinaryExpression": function(node) { var left = node.left, right = node.right; if (node.operator === "+" && ((left.type === "Identifier" && MATCHER.test(left.name)) || (right.type === "Identifier" && MATCHER.test(right.name))) ) { context.report(node, "Use path.join() or path.resolve() instead of + to create paths."); } } }; }; module.exports.schema = [];
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
eslint_node_modules-1.6.0.1 | vendor/node_modules/eslint/lib/rules/no-path-concat.js |
eslint_node_modules-1.6.0 | vendor/node_modules/eslint/lib/rules/no-path-concat.js |