Closed jc3lee closed 7 months ago
Name | Link |
---|---|
Latest commit | ca06360e7c6e5148e92f2625d0b2aa7ff23541ab |
Latest deploy log | https://app.netlify.com/sites/goodeworkers/deploys/660e6b794146a30008351e1b |
I'm closing this PR for now to fix the error in Netlify Preview: error: Your "gatsby-config.ts" file failed to compile to "gatsby-config.js". Please run "gatsby clean" and try again.
added "gatsby clean" to clean netlify preview cache
Summary of changes:
typescript, @types/node, @types/react, @types/react-dom
tsconfig.json
following the gatsby minimal ts examplegatsby-browser.js
&gatsby-config.js
togatsby-browser.ts
&gatsby-config.ts
globals.d.ts
. It's a declaration of types file to handle imports (svg, images, etc) following the create react app exampleAnd with that, typescript has been successfully integrated 😃.
That took 10% of the time, the remaining 90% was on figuring out how to add eslint typescript. The hardest part was making eslint work on react js, jsx files while using typescript linting only on ts and tsx files. I've annoted the changes but please tell me if you have any questions. Here are the edits I did on eslintrc:
"plugin:@typescript-eslint/recommended"
to"extends"
"parser": "@typescript-eslint/parser"
"@typescript-eslint"
to"plugins"
"react/prop-types": "off"
since we can handle type check with ts"plugin:import/errors", "plugin:import/warnings"
to"extends"
"import/resolver"
to"settings"
"import/extensions"
to"rules"
"react/jsx-filename-extension"
to"rules"
And with that, we've got linting on both javascript and typescript files!