standard / ts-standard

Typescript style guide, linter, and formatter using StandardJS
https://www.npmjs.com/package/ts-standard
MIT License
473 stars 36 forks source link

Allow `--project` to accept an absolute path #268

Closed lindluni closed 1 year ago

lindluni commented 2 years ago

What version of this package are you using?

v12.0.1

What problem do you want to solve?

Allow --project flag to accept an absolute path, today resolve-tsconfig.js only accepts a path relative to the current working directory: https://github.com/standard/ts-standard/blob/master/resolve-tsconfig.js#L29

What do you think is the correct solution to this problem?

Check if the user provided path is an absolute path.

Are you willing to submit a pull request to implement this change?

Yes

theoludwig commented 2 years ago

Hey, thanks for your report! :wave:

This feature would be an alternative to the --cwd option (introduced in v8.0.1 and dropped in v12.0.0): https://github.com/standard/ts-standard/commit/e3228687428e2d44390a9719e7ddee23c9b0ab55.

What is the best solution? Making --project working with absolute path is a more automatic way to solve this (no need for another option). While new options should be implemented as much as possible in standard-engine.

What are the use cases of this? Would it be beneficial to support both solutions? Is there is use cases that is covered by --cwd option and not covered by allowing --project to be an absolute path or vice-versa?

lindluni commented 1 year ago

Out of curiosity, why was --cwd dropped while it still exists in the standard-engine package?

theoludwig commented 1 year ago

The --cwd option doesn't exist in standard-engine as far as I can tell. You can see all the available CLI options here: https://github.com/standard/standard-engine/blob/master/bin/cmd.js#L29-L49

If we want to implement --cwd, we should implement it in standard-engine.

Supporting absolute path for --project is already a good improvement, so I'm okay for it. :+1:

We'll keep --cwd discussion in another issue if needed (in standard-engine repo).