Skip to content

Conversation

@yakov116
Copy link
Member

@fregante I went through them all only @typescript-eslint/require-await': 'error' am I not sure if they are correct.

@fregante
Copy link
Member

Everything else looks good so far. Let me know when you’re done making changes, I might have other rule suggestions

@yakov116
Copy link
Member Author

I am good except for my first comment

@fregante
Copy link
Member

fregante commented Aug 20, 2020

Ok, can you sort all the rules them?

  1. Group by state (2 groups: either disabled from the shared config, or new rule)
  2. Alphabetically in each group
rules: {
	/* Disable rules */
	a: "off",
	b: "off",

	/* Add rules */
	c: "error",
	d: "error",
}

I think in the future we should keep an eye on these 2 shared configs so we can restore the rules it disables or remove them from here if they're not necessary

https://github.com/xojs/eslint-config-xo-typescript
https://github.com/xojs/eslint-config-xo-react

.xo-config.js Outdated
'unicorn/no-fn-reference-in-iterator': 'off',
'@typescript-eslint/no-extra-non-null-assertion': 'error',
'@typescript-eslint/consistent-type-definitions':'error',
'@typescript-eslint/require-await': 'error',
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

I remember this. It looks like the lint is failing because of this one.

If it works painlessly on the current code, we can enable it.

Copy link
Member Author

Choose a reason for hiding this comment

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

This was the only one I was having issues with (hence my first comment)

.xo-config.js Outdated
'unicorn/no-fn-reference-in-iterator': 'off'
'unicorn/no-fn-reference-in-iterator': 'off',
'@typescript-eslint/no-extra-non-null-assertion': 'error',
'@typescript-eslint/consistent-type-definitions':'error',
Copy link
Member

@sindresorhus sindresorhus Aug 20, 2020

Choose a reason for hiding this comment

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

While it might default to interface, this is not documented and also not clear. Please include the option explicitly.

Also, any reasoning to defaulting to interface?

https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-definitions.md

The only benefit of interface is declaration merging, but type has other benefits too: https://stackoverflow.com/a/52682220

Copy link
Member

@fregante fregante Aug 20, 2020

Choose a reason for hiding this comment

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

but type has other benefits too

The only benefit I see is that you can use primitives, like type S = string, but this rule doesn't seem to prevent us from using that.

From the replacements I see in this PR, it only affects types that can as well be interfaces.

Copy link
Member

Choose a reason for hiding this comment

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

The only benefit I see is that you can use primitives, like type S = string, but this rule doesn't seem to prevent us from using that.

Sure, but if you ever need that, you're back to inconsistency. Which is why I slightly prefer type, but it doesn't matter much. 🤷‍♂️

Kinda annoying that TS has such similar duplicate things.

Copy link
Member

@fregante fregante Aug 20, 2020

Choose a reason for hiding this comment

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

any reasoning to defaulting to interface

I like definitions over declarations. The former looks cleaner to me:

interface X {}
type X = {};

Kinda like I prefer function X() {} over const X = () => {};.

In the end, it's more about consistency than anything else. If they can be an interface, let them all be interfaces.

@fregante fregante added the meta Related to Refined GitHub itself label Aug 23, 2020
@fregante fregante changed the title Lint Meta: enable more lint rules Aug 23, 2020
@fregante fregante merged commit 0a58069 into refined-github:master Aug 24, 2020
@fregante
Copy link
Member

If you want to update the dependencies, this would be useful: fregante/webext-storage-cache#20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

meta Related to Refined GitHub itself

Development

Successfully merging this pull request may close these issues.

3 participants