standard / ts-standard

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

Making eslint config file configurable #103

Closed zekth closed 3 years ago

zekth commented 3 years ago

What version of this package are you using? "ts-standard": "^9.0.0"

What problem do you want to solve? Currently the eslint config file path is almost hardcoded because of this line : https://github.com/standard/ts-standard/blob/master/src/ts-standard.ts#L72 In this case for example in https://github.com/fastify/fastify we cannot use ts-standard because we have 2 different configs for javascript and typescript parts of the project. Currently the typescript configuration is located in types/tsconfig.json and the eslint for TS files is in types/.eslintrc.json.

What do you think is the correct solution to this problem? Adding the eslintConfig file path configurable would fix the issue

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

toddbluhm commented 3 years ago

I'm not really sure the goal of this project is to allow you to configure eslint. The eslint file is hardcoded because it is set to use the standard eslint config. This project follows standard which is also not configurable.

Now if you're saying your using standard on the javascript files and ts-standard on the javascript + typescript files and they are colliding with each other, then that is a bug. standard and ts-standard should be able to lint the same javascript files with the same results (there might be some typing differences if you have checkJS enabled in your tsconfig.json file).

If you need to tell ts-standard to only lint certain typescript files, either make sure your tsconfig.json file only contains those typescript files, or create a tsconfig.eslint.json file with only the files you want linted.

Hopefully that all makes sense. If I am totally off the mark, let me know.

exuanbo commented 3 years ago

You can try https://github.com/exuanbo/ts-standardx as an alternative. It's fully customizable but still WIP.

zekth commented 3 years ago

FYI @toddbluhm , made it work on this PR: https://github.com/fastify/fastify/pull/2699 So we might had an odd project scaffolding. Feel free to tells me if anything is wrong.

toddbluhm commented 3 years ago

@zekth that looks right to me

theoludwig commented 3 years ago

I think, we can close this issue, please reopen if it's a mistake. :smile: