title: How do node_modules packages read config files in the project root?
body: <p>I am creating an npm package that needs to be able to read config files from the project root. I'm not sure how to do this.</p>
  
  <p>For example,</p>
  
  <ul>
  <li>Next.js is able to read <code>./pages/</code> and <code>./next.config.js</code> from the project root</li>
  <li>Jest is able to read <code>./jest.config.js</code> from the project root</li>
  <li>ESLint is able to read <code>./.eslintrc.json</code> from the project root</li>
  <li>Prettier is able to read <code>./.prettierrc.js</code> from the project root</li>
  <li>Typescript is able to read <code>./tsconfig.json</code> from the project root</li>
  <li>Babel is able to read <code>./.babelrc</code> from the project root</li>
  </ul>
  
  <p>I've tried looking at their source code to see how they do it but the projects are so large that I can't find the relevant section.</p>
  
  <p>How do they achieve this?</p>