Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 34bfbfe

Browse filesBrowse files
tniessenMylesBorins
authored andcommitted
tools: avoid using process.cwd in tools/lint-js
The first occurrence of path.join() can easily be replaced with path.resolve(). The second occurrence should be unnecessary as ESLint will resolve the path internally, and the old check probably did not work as intended anyway. PR-URL: #17121 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent c4eb683 commit 34bfbfe
Copy full SHA for 34bfbfe

File tree

Expand file treeCollapse file tree

1 file changed

+1
-6
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+1
-6
lines changed
Open diff view settings
Collapse file

‎tools/lint-js.js‎

Copy file name to clipboardExpand all lines: tools/lint-js.js
+1-6Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const totalCPUs = require('os').cpus().length;
1313
const CLIEngine = require('./eslint').CLIEngine;
1414
const glob = require('./eslint/node_modules/glob');
1515

16-
const cwd = process.cwd();
1716
const cliOptions = {
1817
rulePaths: rulesDirs,
1918
extensions: extensions,
@@ -82,9 +81,7 @@ if (cluster.isMaster) {
8281
if (i !== -1) {
8382
if (!process.argv[i + 1])
8483
throw new Error('Missing output filename');
85-
var outPath = process.argv[i + 1];
86-
if (!path.isAbsolute(outPath))
87-
outPath = path.join(cwd, outPath);
84+
const outPath = path.resolve(process.argv[i + 1]);
8885
fd = fs.openSync(outPath, 'w');
8986
outFn = function(str) {
9087
fs.writeSync(fd, str, 'utf8');
@@ -176,8 +173,6 @@ if (cluster.isMaster) {
176173
while (paths.length) {
177174
var dir = paths.shift();
178175
curPath = dir;
179-
if (dir.indexOf('/') > 0)
180-
dir = path.join(cwd, dir);
181176
const patterns = cli.resolveFileGlobPatterns([dir]);
182177
dir = path.resolve(patterns[0]);
183178
files = glob.sync(dir, globOptions);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.