Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Update dependencies, revise lint rules #12

Merged
merged 5 commits into from
Jun 23, 2020
Merged

Update dependencies, revise lint rules #12

merged 5 commits into from
Jun 23, 2020

Conversation

edsrzf
Copy link
Collaborator

@edsrzf edsrzf commented Jun 23, 2020

This updates dependencies, including some major versions:

  • Prettier v2 - some changes to formatting and now arrowParens: "avoid" is required if we want to keep our single-parameter arrow functions from being reformatted.
  • ESLint v7 - no real breakage for us here.

And while we're breaking things, it makes some changes to rules. Most notably:

  • import/no-default-export is enabled to prevent use of default exports.
  • All accessibility rules from create-react-app are enabled.

Finally, I've also moved the rules from index.js to .eslintrc.js, which makes it easier to use this repo's rules to lint itself and validate the configuration.

Mostly keep things consistent, but add a few new accessibility rules and
also no-default-exports.
Copy link

@unkillbob unkillbob left a comment

Choose a reason for hiding this comment

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

Just had a scan of the rules changes, LGTM 👌 One question - do the new rules, e.g. the a11y ones, require fixing things in monocle etc? Have you had a check to see how big a task that is to upgrade?

@edsrzf
Copy link
Collaborator Author

edsrzf commented Jun 23, 2020

I've got a Monocle change ready for everything but the a11y rules. I see 15 errors due to those rules, which doesn't seem unreasonable.

I'll probably override most of them with an eslint-disable comment for now since the proper fixes may be a bit more involved, but I'll evaluate that on a case-by-case basis.

trailingUnderscore: 'allow',
},
{
selector: 'function',
Copy link

Choose a reason for hiding this comment

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

Can I ask an arrow function defined like const someName = () => {...} will be detected as variable or function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

According to the docs, it's any named function declaration or named function expression. So no, I don't believe it covers arrow functions like that.

I believe arrow functions are why I ended up allowing PascalCase for variables, since React component names often start with capital letters. eg:

const Component = () => ...

@edsrzf edsrzf merged commit 9451949 into master Jun 23, 2020
@edsrzf edsrzf deleted the v5 branch June 23, 2020 04:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants