Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Remove unused functions #16868

Merged
merged 1 commit into from Feb 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 0 additions & 37 deletions lib/eslint/eslint-helpers.js
Expand Up @@ -568,41 +568,6 @@ async function findFiles({
];
}


/**
* Checks whether a file exists at the given location
* @param {string} resolvedPath A path from the CWD
* @throws {Error} As thrown by `fs.statSync` or `fs.isFile`.
* @returns {boolean} `true` if a file exists
*/
function fileExists(resolvedPath) {
try {
return fs.statSync(resolvedPath).isFile();
} catch (error) {
if (error && (error.code === "ENOENT" || error.code === "ENOTDIR")) {
return false;
}
throw error;
}
}

/**
* Checks whether a directory exists at the given location
* @param {string} resolvedPath A path from the CWD
* @throws {Error} As thrown by `fs.statSync` or `fs.isDirectory`.
* @returns {boolean} `true` if a directory exists
*/
function directoryExists(resolvedPath) {
try {
return fs.statSync(resolvedPath).isDirectory();
} catch (error) {
if (error && (error.code === "ENOENT" || error.code === "ENOTDIR")) {
return false;
}
throw error;
}
}
Comment on lines -589 to -604
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the directoryExists is also defined in cli-engine.js, should we remove it from there instead of removing it from helpers?

function directoryExists(resolvedPath) {
try {
return fs.statSync(resolvedPath).isDirectory();
} catch (error) {
if (error && (error.code === "ENOENT" || error.code === "ENOTDIR")) {
return false;
}
throw error;
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eslint-helpers.js module is intended for use by the FlatESLint class only.

  • flat-eslint.js and eslint-helpers.js are modules of the new config system.
  • eslint.js and cli-engine.js are modules of the current eslitrc config system.

At some point, we'll remove eslint.js and cli-engine.js, and rename flat-eslint.js to eslint.js (and rename FlatESLint class to ESLint class).


//-----------------------------------------------------------------------------
// Results-related Helpers
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -924,8 +889,6 @@ function getCacheFile(cacheFile, cwd) {

module.exports = {
isGlobPattern,
directoryExists,
fileExists,
findFiles,

isNonEmptyString,
Expand Down