Fails to bundle with eslint

Open
#559 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
eslint, typescript

Research direction

Reproduce the report from the TypeScript entry point shown in the issue, using npx ncc src/run.ts and then node dist/index.js. Inspect how the bundled dist/index.js resolves ESLint configuration and dependencies; done means the bundled CLI loads its config without the reported invalid-path error or unwanted dependency files in dist.

Written by the indexing model from the issue text.

Description

If eslint is a dependency this does not work. eslint cli fails to work saying it can not load config files and it creates a whole host of dependency files it loads into the dist folder

import { CLIEngine } from 'eslint';

async function run() {
  const eslintConfig = {
    extensions: ['.js', 'jsx', '.ts', '.tsx'],
    ignorePath: '.gitignore',
    ignore: true,
    useEslintrc: true,
  };

  console.log('[ESLINT] Run With Configuration: ', eslintConfig);

  const eslint = new CLIEngine(eslintConfig);

  const results = await eslint.executeOnFiles(['./src/eslint.ts']);
  console.log(results);
}

run();
npx ncc src/run.ts
node dist/index.js
(node:3673) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
Dominant language
JavaScript
Stars
9.8k
Forks
326
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from vercel/ncc

All issues in vercel/ncc

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.