This repository has been archived by the owner on Aug 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore home config from disableWhenNoEslintConfig (#778)
* Ignore home config from disableWhenNoEslintConfig * Move isConfigAtHomeRoot to its own file It needs to be used in both worker and non-worker, so it’s easiest to just put it in its own file for now until we re-structure. * Extract copyFileToTempDir as test helper function * Move temp dir creation to `copyFileToTempDir`
- Loading branch information
Showing
9 changed files
with
155 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.isConfigAtHomeRoot = isConfigAtHomeRoot; | ||
|
||
var _userHome = require('user-home'); | ||
|
||
var _userHome2 = _interopRequireDefault(_userHome); | ||
|
||
var _path = require('path'); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
|
||
/** | ||
* Check if a config is directly inside a user's home directory. | ||
* Such config files are used by ESLint as a fallback, only for situations | ||
* when there is no other config file between a file being linted and root. | ||
* | ||
* @param {string} configPath - The path of the config file being checked | ||
* @return {Boolean} True if the file is directly in the current user's home | ||
*/ | ||
/* eslint-disable import/prefer-default-export */ | ||
|
||
function isConfigAtHomeRoot(configPath) { | ||
return (0, _path.dirname)(configPath) === _userHome2.default; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/* eslint no-undef: error */ | ||
|
||
foo = 42; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* eslint-disable import/prefer-default-export */ | ||
|
||
import userHome from 'user-home' | ||
import { dirname } from 'path' | ||
|
||
/** | ||
* Check if a config is directly inside a user's home directory. | ||
* Such config files are used by ESLint as a fallback, only for situations | ||
* when there is no other config file between a file being linted and root. | ||
* | ||
* @param {string} configPath - The path of the config file being checked | ||
* @return {Boolean} True if the file is directly in the current user's home | ||
*/ | ||
export function isConfigAtHomeRoot(configPath) { | ||
return (dirname(configPath) === userHome) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters