-
Notifications
You must be signed in to change notification settings - Fork 1
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
Move to TypeScript #9
Conversation
.eslintrc.js
Outdated
'react-app', | ||
'prettier/@typescript-eslint', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the ejected defaults via yarn lint --write-file
so I could use the hooks plugin. Do we want to be explicit here with our own standards?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question, I've never looked, but do you know if there a good way to diff between different eslint configs?
Since we're currently in a reset phase, this may also be a good time to standardize an eslint config for JS and TS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about this and I really like the idea of standardising around a single opinionated tool. The more of this configuration we can offload the more we can focus on the building, so for the TS projects I was thinking we could just straight up use the provided values and leave it there, see how we get on?
These customisations I made were actually unnecessary, the tool ships with all the setting we would want, my editor just couldn't see the configuration.
I followed their suggested fix jaredpalmer/tsdx#379 (comment) and exported unedited default settings in 9dd0d73
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, so VSC can't automatically resolve TSDX's default config without ejecting them?
I've been procrastinating on setting up "standard" linting configs in https://github.com/aragon/github for forever, but now is a good chance. I'll get a structure going—I was mainly thinking of packaging something like eslint-config-aragon-ts-react
(and etc. for other environments).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a package for our config would be lovely! And yeah, for some reason VSCode sometimes has a hard time reading configs with TSDX 😅
76e5cae
to
0eac3c6
Compare
0eac3c6
to
4cd0220
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a couple of notes but looking good for me; let's also have @Evalir have a look once he's back :).
.eslintrc.js
Outdated
'react-app', | ||
'prettier/@typescript-eslint', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question, I've never looked, but do you know if there a good way to diff between different eslint configs?
Since we're currently in a reset phase, this may also be a good time to standardize an eslint config for JS and TS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good 😍 ! tested locally with a few projects and all seems fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀 🚀 🚀
"dist" | ||
], | ||
"engines": { | ||
"node": ">=10" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can safely remove support for Node 10 everywhere:
"node": ">=10" | |
"node": ">=12" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm it seems the codesandbox containers only run v10 and fail unless we explicitly install a node version in the examples. I'm thinking unless we have a strong need to drop the support it'll be simpler to leave it for now: https://codesandbox.io/docs/faq#can-i-change-the-node-version-used-in-a-container-sandbox
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, let’s leave it then 👍
.eslintrc.js
Outdated
}, | ||
settings: { | ||
react: { | ||
pragma: 'React', | ||
version: '16.6', | ||
version: '999.999.999', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would you think about doing this?
version: '999.999.999', | |
version: require('./package.json').peerDependencies.react, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a good idea! but I think keeping the config free of side effects would be simpler and more portable. For consistency I've reverted to being explicit with the version and pragma.
Co-authored-by: Pierre Bertet <[email protected]>
Co-authored-by: Pierre Bertet <[email protected]>
Co-authored-by: Pierre Bertet <[email protected]>
I wanted to start setting up typescript for some of our packages and this one was a simple, easy first go.
I thought it was a good idea to standardise around TSDX inline with @bpierre's work on use-wallet aragon/use-wallet#51
I moved us away from class components but otherwise the logic is the same but typed.