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

Multiple slashes in path doesn't throw error on windows. #557

Closed
bsouthga opened this issue Sep 12, 2016 · 4 comments
Closed

Multiple slashes in path doesn't throw error on windows. #557

bsouthga opened this issue Sep 12, 2016 · 4 comments

Comments

@bsouthga
Copy link

bsouthga commented Sep 12, 2016

A "nice" difference between *nix and windows systems is that unix treats duplicate slashes in paths /User/ben////my////path/// As one slash /User/ben/my/path/.

Windows however does not. This means that on windows, the module loader will be unable to find paths that are okeyed by the linter, for example:

// fine on unix, bad on windows...
import workflow from './/workflow';

Is there a way we could add a platform specific check? or maybe just disallow duplicate slashes, as they will be removed automatically on unix?

@benmosher
Copy link
Member

Yeah, sounds like a good thing to do, in addition to checking that the actual filesystem case matches.

@danny-andrews
Copy link
Contributor

danny-andrews commented Jul 19, 2017

Ran into this issue today. Maybe we could name the rule no-multiple-slashes. Either that or make a general rule called no-extraneous-slashes which could optionally check for trailing slashes, e.g. import workflow from './workflow/';.

@danny-andrews
Copy link
Contributor

danny-andrews commented Jul 19, 2017

@bsouthga As a workaround, you can use the no-restricted-imports rule with a **// pattern. Example config:

rules:
  no-restricted-imports:
    - error
    - patterns: ['**//']

@ljharb
Copy link
Member

ljharb commented Aug 16, 2017

I'm going to close this as a duplicate of #471, since #912's no-useless-path-segments rule should presumably cover it.

@ljharb ljharb closed this as completed Aug 16, 2017
@import-js import-js deleted a comment from danny-andrews Aug 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants