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
improve no-restricted-path rule for win32 paths #47435
base: main
Are you sure you want to change the base?
Conversation
Pinging @elastic/kibana-platform (Team:Platform) |
💚 Build Succeeded |
I made some bogus changes to a couple of the files that failed on my related issue and tried to commit them but I still these
|
@LeeDr that seems right to me? This rule is supposed to prevent you from importing from that path. Maybe I'm missing something though. |
@joshdover Maybe that's the case. But that means we have existing files in Kibana that fail the rule. And if that's the case, it should only block me from committing if I change those files in my branch? |
Oh I didn't see this is an import from within Core. I think we need to just change those imports to be relative rather than from the root. |
@elasticmachine merge upstream |
@joshdover |
💚 Build Succeeded |
I think we can close this based on the discussion to remove support for Windows development: #58069 |
@joshdover I don't think there's been a decision on removing support for Windows development yet? I'm not sure how we finalize that decision. There hasn't been any comments on it from external users. |
@elasticmachine merge upstream |
💚 Build SucceededTo update your PR or re-run it, just comment with: |
* toPosixPath('a\\b\\c') // 'a/b/c' | ||
*/ | ||
function toPosixPath(filePath) { | ||
return filePath.replace(winPathSeparatorRegExp, '/'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I generally find string.split('\\').join('/')
easier to understand and it's technically more performant too.
Summary
micromatch
transforms all win32 paths to POSIX format internally.isSameFolderOrDescendent
can be called with paths in either format. I added the transformation to POSIX format to our logic as well.Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.[ ] This was checked for cross-browser compatibility, including a check against IE11[ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support[ ] Documentation was added for features that require explanation or tutorials[ ] This was checked for keyboard-only and screenreader accessibilityFor maintainers