Query:
Are there any ESLint rules that can be applied to enforce the utilization of */index
in imports?
Illustration:
Directory setup:
utils/
- index.js
- a.js
- b.js
main.js
main.js
// INCORRECT
import utils from "./utils";
// CORRECT
import utils from "./utils/index";
Motivation
This requirement stems from the fact that my project employs tscpaths
for substituting absolute paths with relative paths following typescript compilation; however, this replacement does not occur when */index
is omitted.
Solution
If such a rule does not exist, is there a vscode configuration available that would automatically include the index
during auto-imports?