-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
Fix bug where package with sub-import would require extension #32
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,11 @@ new RuleTester({ | |
filename: fixture("test.js"), | ||
code: "import '@typescript-eslint/parser'", | ||
}, | ||
{ | ||
filename: fixture("test.ts"), | ||
code: "import {test} from '@typescript-eslint/parser/index'", | ||
options: ["always"], | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if the "exports": {"./index": "...."} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, true, that said, I cannot figure out how to trigger a falling test, like if in code as reported in issue if you have |
||
{ | ||
filename: fixture("test.js"), | ||
code: "import '@typescript-eslint\\parser'", | ||
|
@@ -155,12 +160,6 @@ new RuleTester({ | |
output: "import './a.js'", | ||
errors: [{ messageId: "requireExt", data: { ext: ".js" } }], | ||
}, | ||
{ | ||
filename: fixture("test.ts"), | ||
code: "import './d'", | ||
output: "import './d.js'", | ||
errors: [{ messageId: "requireExt", data: { ext: ".js" } }], | ||
}, | ||
{ | ||
filename: fixture("test.js"), | ||
code: "import './b'", | ||
|
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.
good to have a comment to explain the regex - regex is always easy to write but hard to read :)
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.
Will do!
FYI old regex was matching:
optional @scope/ followed by non-slash characters
which excluded imports like @scope/pkg/dir
new one:
optional @scope/ followed by an optional number of groups containing 1 or more characters ending with a slash followed by by non-slash characters
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.
Here is a quick before and after using my favourite regex renderer 😄
Before:
/^(?:@[^/\\]+[/\\])?[^/\\]+$/u
After:
/^(?:@[^/\\]+[/\\])?(?:[^./\\]+[/\\])*[^/\\]+$/u
It does looks like the change should work too: