hugoMencoboni / tslint-staged

Run tslint on your staged files only !
MIT License
1 stars 0 forks source link

TSLint --project flag #2

Open striky1 opened 3 years ago

striky1 commented 3 years ago

Hi,

it's possible to run/implement flags into tslint-staged?

I'm getting warning: Warning: The 'deprecation' rule requires type information., what means that I need to define type via --project tsconfig.json flag.

If I tried to run ./node_modules/.bin/tslint-staged --project tsconfig.json it doesn't care about flags.

Based on this closed issue: https://github.com/palantir/tslint/issues/3865, it's not possible to define it via tslint.json what is shame :(

Thank you for your reply.

hugoMencoboni commented 3 years ago

Hello !

I have tried to implement a new option to specify the path of the "tsconfig.json" file.

The idea, has mensioned in the tsLint documentation, was to provide it has a "program" to the Linter constructor.

const program = Linter.createProgram("tsconfig.json"); const linter = new Linter(options, program);

But it seems to disable the possibilities to lint file's content has string (this feature is needed to lint the real content currently in stage for git).

Indeed, when tsLint use "getSourceFile" function they don't use the file content (param "source" in the function) when a "program" is provide.

I'll think of another way to get this feature. If you have any idea feel free!