no-relative-parent-imports does not work at all? (repro repo included)
See original GitHub issueI can’t seem to get this rule to work. I’m using the @typescript-eslint/parser
Example repo: https://github.com/sarink/eslint-plugin-import-no-relative-parent-imports-bug
I believe the relevant lines from the debug log are:
2020-01-14T20:05:00.042Z eslint:file-enumerator Yield: child.ts
2020-01-14T20:05:00.042Z eslint:cascading-config-array-factory Load config files for /Users/sarink/Projects/eslint-plugin-import-no-relative-parent-imports-bug/src/children.
2020-01-14T20:05:00.042Z eslint:cascading-config-array-factory Cache hit: /Users/sarink/Projects/eslint-plugin-import-no-relative-parent-imports-bug/src/children.
2020-01-14T20:05:00.042Z eslint:cli-engine Lint /Users/sarink/Projects/eslint-plugin-import-no-relative-parent-imports-bug/src/children/child.ts
2020-01-14T20:05:00.042Z eslint:linter Linting code for /Users/sarink/Projects/eslint-plugin-import-no-relative-parent-imports-bug/src/children/child.ts (pass 1)
2020-01-14T20:05:00.042Z eslint:linter Verify
2020-01-14T20:05:00.042Z eslint:linter With ConfigArray: /Users/sarink/Projects/eslint-plugin-import-no-relative-parent-imports-bug/src/children/child.ts
2020-01-14T20:05:00.075Z eslint:linter Generating fixed text for /Users/sarink/Projects/eslint-plugin-import-no-relative-parent-imports-bug/src/children/child.ts (pass 1)
2020-01-14T20:05:00.075Z eslint:source-code-fixer Applying fixes
2020-01-14T20:05:00.075Z eslint:source-code-fixer shouldFix parameter was false, not attempting fixes
2020-01-14T20:05:00.076Z eslint:file-enumerator Leave the directory: /Users/sarink/Projects/eslint-plugin-import-no-relative-parent-imports-bug/src/children
2020-01-14T20:05:00.076Z eslint:ignore-pattern Check {
filePath: '/Users/sarink/Projects/eslint-plugin-import-no-relative-parent-imports-bug/src/parent.ts',
dot: false,
relativePath: 'src/parent.ts',
result: false
}
It looks like the plugin is seeing "src/parent.ts"
, but in fact in the code it is written like "../parent"
?
Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:7 (1 by maintainers)
Top Results From Across the Web
no-relative-parent-imports does not work at all? (repro repo ...
I'm using the @typescript-eslint/parser Example repo: https://github.com/sarink/eslint-plugin-import-no-relative-parent-imports-bug I ...
Read more >ImportError : Attempted relative import with no known parent ...
I cannot reproduce OP's problem (imports work fine) and your solutions don't work, resulting in ModuleNotFoundError , while I'm using Python 3.8 ...
Read more >Understanding relative and absolute imports in Next.js
Let's discuss Next.js absolute imports, relative imports, and different ways to implement them in your application.
Read more >eslint-plugin-import - npm
This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, and prevent issues with misspelling of file paths and import ...
Read more >Import and transfer tools - Alfresco Docs
It is not designed to fully synchronize the repository with the local file system ... If you need to troubleshoot or diagnose any...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just bumped into this as well. Looks like workaround is easy, use common rule?
For what it’s worth, @ljharb’s suggestion to set up eslint to use the typescript resolver fixed the issue on my system; see the
eslintrc.js
settings in the description of https://github.com/import-js/eslint-plugin-import/issues/1392. That said, @FDIM’s suggestion is what I actually wanted for my project.