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
Update prettier config, add eslint, remove package-lock.json #4
Conversation
} | ||
|
||
export const aberrationRatio = (rect: Rect, height: number, amt: number) => | ||
(height - rect.top - rect.bottom) / height * amt; | ||
((height - rect.top - rect.bottom) / height) * amt |
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.
lol
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.
lol, prettier did that!
const { height } = useWindowSize(); | ||
const [rect, setRect] = useState({top: 0, bottom: 0}); | ||
const [ratio, setRatio] = useState(0); | ||
const Aberration: FunctionComponent<{ text?: string }> = ({ text }) => { |
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.
Is importing FunctionComponent from react a special typescript thing?
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.
Yep, that's the type for a function component. It used to be SFC
but that name was deprecated since "stateless functional component" was kind of a misnomer, given function components can now have state, with hooks!
Looks good! Let's revisit eslint later. |
Summary
VS Code was yelling at me about ESLint not being found. I had installed the Prettier extension and noticed some of the code wasn't getting formatted correctly. Those issues seem to be resolved with these changes. I followed Prettier's recommendations for integrating with ESLint.
Also I wanted to try out the new eslint rule that will check react hooks.. haven't been able to get the warnings to display yet, so maybe we should wait to merge this until I can get it working.
Links
eslint-plugin-react-hooks
using Prettier alongside ESLint