question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: 'basePath' should be an absolute path.

See original GitHub issue

Command:

$ prettier-eslint 'src/**/*.{ts,tsx}' --write 

Executing this command throws an exception!

but when I use the full path, Like this:

$ prettier-eslint '/Users/cuijianwei/WebstormProjects/testproject/hasaki-cli-demo/gen-demo/src/**/*.{ts,tsx}' --write 
 

no error is reported, but I want to support relative paths

When I use version 6.6.0 of eslint,also no error is reported;

Now I have to reduce the eslint version to solve this problem

Version:

  • prettier-eslint-cli version:4.7.1
  • prettier version: 1.19.1
  • eslint version:6.7.1

Target:

// src/index.ts
const a = () => {
console.log(1);
};

What you did:

$ prettier-eslint 'src/**/*.{ts,tsx}' --write

What happened: Error Log:

prettier-eslint [ERROR]: There was trouble creating the ESLint CLIEngine.
prettier-eslint-cli [ERROR]: There was an error formatting "src/index.ts": 
    AssertionError [ERR_ASSERTION]: 'basePath' should be an absolute path.
        at new IgnorePattern (/Users/cuijianwei/WebstormProjects/testproject/hasaki-cli-demo/gen-demo/node_modules/eslint/lib/cli-engine/config-array/ignore-pattern.js:178:9)
        at ConfigArrayFactory._normalizeObjectConfigDataBody (/Users/cuijianwei/WebstormProjects/testproject/hasaki-cli-demo/gen-demo/node_modules/eslint/lib/cli-engine/config-array-factory.js:651:49)
        at _normalizeObjectConfigDataBody.next (<anonymous>)
        at ConfigArrayFactory._normalizeObjectConfigData (/Users/cuijianwei/WebstormProjects/testproject/hasaki-cli-demo/gen-demo/node_modules/eslint/lib/cli-engine/config-array-factory.js:594:20)
        at _normalizeObjectConfigData.next (<anonymous>)
        at createConfigArray (/Users/cuijianwei/WebstormProjects/testproject/hasaki-cli-demo/gen-demo/node_modules/eslint/lib/cli-engine/config-array-factory.js:338:25)
        at ConfigArrayFactory.create (/Users/cuijianwei/WebstormProjects/testproject/hasaki-cli-demo/gen-demo/node_modules/eslint/lib/cli-engine/config-array-factory.js:393:16)
        at createBaseConfigArray (/Users/cuijianwei/WebstormProjects/testproject/hasaki-cli-demo/gen-demo/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:96:48)
        at new CascadingConfigArrayFactory (/Users/cuijianwei/WebstormProjects/testproject/hasaki-cli-demo/gen-demo/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:211:30)
        at new CLIEngine (/Users/cuijianwei/WebstormProjects/testproject/hasaki-cli-demo/gen-demo/node_modules/eslint/lib/cli-engine/cli-engine.js:563:36)
failure formatting 1 file with prettier-eslint
error Command failed with exit code 1.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:56
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

65reactions
JonDumcommented, Dec 3, 2019

I’m getting the same issue.

It’s a stopgap solution, but adding $PWD in front of your glob seems to fix it. might need to use cross-env if you support non-nix systems.

Example:

    "format": "prettier-eslint --write $PWD/'src/**/*.[jt]s?(x)' && eslint --fix ."
14reactions
MrCheatercommented, Dec 5, 2019

+1

Read more comments on GitHub >

github_iconTop Results From Across the Web

There was trouble creating the ESLint CLIEngine
test.js": AssertionError [ERR_ASSERTION]: 'basePath' should be an absolute path.
Read more >
How to fix Blazor WASM base path problems - elmah.io Blog
This post will show you how to fix a common problem when setting the application base path with Blazor WebAssembly.
Read more >
Argument BasePath must be a path to a folder - Visual Basic
The argument BasePath must consist of a path to a folder. You may be parsing a string incorrectly and supplying a value that...
Read more >
Bountysource
Error : 'basePath' should be an absolute path.
Read more >
Paths and Operations - Swagger
The full request URL is constructed as scheme://host/basePath/path . Path Templating. Swagger supports path templating, meaning you can use curly braces {} to ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found