Skip to content

extends is ignored in tslint.json #123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alan-agius4 opened this issue Mar 16, 2018 · 2 comments
Closed

extends is ignored in tslint.json #123

alan-agius4 opened this issue Mar 16, 2018 · 2 comments

Comments

@alan-agius4
Copy link
Contributor

alan-agius4 commented Mar 16, 2018

tslint rules config from an external node_modules are not being parsed by typescript-formatter.

Example

{
	"extends": [
		"node_modules/@obg/tools.core/config/tslint.json"
	],
	"rulesDirectory": [
		"@obg/tools.lint-rules",
		"tslint-consistent-codestyle",
		"node_modules/tslint-eslint-rules/dist/rules"
	]
}

This won't work due to https://github.com/vvakame/typescript-formatter/blob/master/lib/provider/tslintjson.ts#L49

Ideally for this you use tslint API to read the configuration or another way is to use another library that is capable of extends the json example https://www.npmjs.com/package/@speedy/json-extends.

I'll happy do a PR with any of them. If you tell me which one you prefer.

@alan-agius4 alan-agius4 changed the title Reading tslint config is not working when using extends tslint rules config from an external node_modules are not being parsed Mar 16, 2018
@alan-agius4 alan-agius4 changed the title tslint rules config from an external node_modules are not being parsed extends is ignored in tslint.json Mar 16, 2018
@vvakame
Copy link
Owner

vvakame commented Mar 27, 2018

sorry for late response.
I'd like to use tslint API pattern.
I want to avoid adding tslint package to dependencies.
We should use dynamic import and change makeFormatCodeOptions function signature (return types will change ts.FormatCodeSettings to Promise<ts.FormatCodeSettings>)

        const tslint = await import("tslint");
        const config = tslint.Configuration.loadConfigurationFromPath(configFileName!);
        const v = config.rules.get("indent")!;
        // .....

@alan-agius4
Copy link
Contributor Author

alan-agius4 commented Mar 27, 2018 via email

alan-agius4 added a commit to alan-agius4/typescript-formatter that referenced this issue Mar 31, 2018
alan-agius4 added a commit to alan-agius4/typescript-formatter that referenced this issue Mar 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants