eslint-plugin-require-path-exists icon indicating copy to clipboard operation
eslint-plugin-require-path-exists copied to clipboard

Test case on case insensitive osx

Open KnutHelland opened this issue 8 years ago • 2 comments

On a default OS X installation, the file system is case insensitive. And a lot of bugs happens when a developer on OS X deploys his code to a case sensitive linux box. It would be very nice if the plugin also detected case errors.

I actually have a custom rule for eslint today that is very similar to yours. And my custom rule tests for case errors with:

// Some of us runs on macs that have case sensitivity = false on the file
// system. So this is a hack to verify that the case is correct:
function isCorrectCase(relativePath) {
    var dir = path.dirname(relativePath);
    var filename = path.basename(relativePath);

    // This one is probably a bit heavy. Possible solutions: cache the result
    // or find another way to detect the original case
    var files = fs.readdirSync(dir);

    return files.indexOf(filename) !== -1;
}

There are probably better and more performant ways to do this. (although I don't notice any significant performance difference when disabling/enabling this rule) And I'm looking for a plugin to replace my own custom one, since I don't want to maintain it. Your plugin looks like a good fit for the job if it just had this additional check as well :)

KnutHelland avatar Aug 04 '16 12:08 KnutHelland

Just in case there's any movement on issues, I'd like to throw a vote for this feature.

rjhilgefort avatar Feb 21 '18 19:02 rjhilgefort

I currently do not have enough capacity to work on this issue, but any PR's are welcome. Alternatively, you can switch to https://github.com/benmosher/eslint-plugin-import which seems to be much more maintained and used in eslint-config-airbnb

BohdanTkachenko avatar Feb 21 '18 19:02 BohdanTkachenko