Skip to content
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

feat: Add sub config for TypeScript projects #433

Merged
merged 1 commit into from Jan 11, 2023
Merged

feat: Add sub config for TypeScript projects #433

merged 1 commit into from Jan 11, 2023

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Jan 10, 2023

This adds a sub-config for typescript projects, e.g. we could use it within our libraries or for users which use TypeScript for app development (vue + ts is pretty common nowadays).

@skjnldsv
Copy link
Contributor

Can't we just support typescript out of the box?
Surely there is a way to define different rules for ts and js files, no?

@susnux susnux force-pushed the typescript branch 3 times, most recently from fe3b7ce to a2a10c9 Compare January 10, 2023 14:46
@susnux
Copy link
Contributor Author

susnux commented Jan 10, 2023

Can't we just support typescript out of the box? Surely there is a way to define different rules for ts and js files, no?

@skjnldsv Good point! I changed it to simply use overrides.

package.json Outdated Show resolved Hide resolved
@susnux susnux force-pushed the typescript branch 2 times, most recently from 3c39fea to 040875a Compare January 10, 2023 17:46
@susnux susnux requested a review from skjnldsv January 10, 2023 17:47
@skjnldsv skjnldsv added the enhancement New feature or request label Jan 10, 2023
@skjnldsv
Copy link
Contributor

skjnldsv commented Jan 10, 2023

Could we maybe disable jsdoc for ts files?

Capture d’écran_2023-01-10_21-07-17

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
@susnux
Copy link
Contributor Author

susnux commented Jan 10, 2023

Could we maybe disable jsdoc for ts files?

This is the same behavior as for js file, why should we treat ts file differently regarding documentation?
One reason I see is the built in type information, thats why I disabled jsdoc/require-param-type.
(I am just curious)

Edit:
For exported functions I think warning on missing parameter documentation is good,
but if you are talking about the now required docs of helper callbacks, then you can circumvent this.
From the linked pull request

await new Promise((resolve, reject): any => docker.pull(SERVER_IMAGE, (_err, stream) => {
	some(onFinished);

	/**
	 *
	 * @param err
	 * @param output
	 */
	function onFinished(err, output) {
	// ...

This can be rewritten to prevent es-lint complaing about missing documentation of onFinished like this:

await new Promise((resolve, reject): any => docker.pull(SERVER_IMAGE, (_err, stream) => {
	const onFinished = (err, output) => {
	}

	some(onFinished);

@skjnldsv
Copy link
Contributor

For exported functions I think warning on missing parameter documentation is good,

Ah right, typing requirements is bad, but param documentation is still quite good to have! 👍

@skjnldsv skjnldsv merged commit 4d3df23 into master Jan 11, 2023
@skjnldsv skjnldsv deleted the typescript branch January 11, 2023 07:29
@skjnldsv skjnldsv mentioned this pull request Jan 11, 2023
parser: '@typescript-eslint/parser',
},
rules: {
'n/no-missing-import': 'off',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@susnux why disabling this rule btw?
If we cannot resolve, maybe it's bad?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants