]>
git.proxmox.com Git - pve-eslint.git/blob - eslint/lib/rules/no-path-concat.js
8502c511ed903c572936e95b1688671ff3bdccd8
2 * @fileoverview Disallow string concatenation when using __dirname and __filename
3 * @author Nicholas C. Zakas
4 * @deprecated in ESLint v7.0.0
8 //------------------------------------------------------------------------------
10 //------------------------------------------------------------------------------
12 /** @type {import('../shared/types').Rule} */
22 description
: "Disallow string concatenation with `__dirname` and `__filename`",
24 url
: "https://eslint.org/docs/rules/no-path-concat"
30 usePathFunctions
: "Use path.join() or path.resolve() instead of + to create paths."
36 const MATCHER
= /^__(?:dir|file)name$/u;
38 //--------------------------------------------------------------------------
40 //--------------------------------------------------------------------------
44 BinaryExpression(node
) {
46 const left
= node
.left
,
49 if (node
.operator
=== "+" &&
50 ((left
.type
=== "Identifier" && MATCHER
.test(left
.name
)) ||
51 (right
.type
=== "Identifier" && MATCHER
.test(right
.name
)))
56 messageId
: "usePathFunctions"