Robinfr / electron-react-typescript

Electron boilerplate with React, Redux, and TypeScript
MIT License
432 stars 85 forks source link

Migration from tslint to eslint #13

Closed psyycker closed 4 years ago

psyycker commented 5 years ago

Tslint is going to be deprecated. Just migrated the project to eslint and fixed the files based on almost the same configuration as before.

Robinfr commented 5 years ago

Seems good, will check it out! (I somehow completely missed this).

Robinfr commented 5 years ago

Based on your MR I've created a branch for this. Check out the eslint branch and let me know what you think. I want to play around with it a bit more to make sure I'm happy with the rules before I merge it.

Robinfr commented 5 years ago

OK, I'm happy with the rules for now I think. If you have time, check it out, otherwise I'll most likely merge it this weekend.

maury91 commented 4 years ago

Hello there,

I tried the eslint branch, currently, eslint fails due to the rule import/extensions.

I suggest adding to .eslintrc.json.rules;

    "import/extensions": 0,

here are the errors without that rule:

$ eslint --ext=jsx,js,tsx,ts src

./src/renderer/actions/index.ts
  1:31  error  Missing file extension "ts" for "./counterActions"  import/extensions

./src/renderer/app.tsx
  6:25  error  Missing file extension "tsx" for "./components/Application"  import/extensions
  7:19  error  Missing file extension "ts" for "./store"                    import/extensions

./src/renderer/components/Application.tsx
  1:21  error  Missing file extension "ts" for "react-hot-loader/root"           import/extensions
  4:30  error  Missing file extension "ts" for "../containers/CounterContainer"  import/extensions

./src/renderer/containers/CounterContainer.ts
  4:21  error  Missing file extension "tsx" for "../components/Counter"     import/extensions
  5:27  error  Missing file extension "ts" for "../reducers"                import/extensions
  6:53  error  Missing file extension "ts" for "../actions/counterActions"  import/extensions

./src/renderer/reducers/counterReducer.ts
  3:53  error  Missing file extension "ts" for "../actions/counterActions"  import/extensions

./src/renderer/reducers/index.ts
  3:46  error  Missing file extension "ts" for "./counterReducer"  import/extensions

./src/renderer/store/index.ts
  4:40  error  Missing file extension "ts" for "../reducers"  import/extensions

✖ 11 problems (11 errors, 0 warnings)

error Command failed with exit code 1.

it can also be fixed by being specific about the extensions in the import.

Robinfr commented 4 years ago

@maury91 you're probably not using the package-lock file in that case since the version in there does not have that problem.

Anyway, I've updated the dependencies and added the config you mentioned so should be fine now! Thanks for trying out the eslint branch! Let me know if you prefer it over the tslint branch so I can make it the default in the future.

kevinlabx commented 4 years ago

@Robinfr Hey, Thank you for the templates. Coming from JS to TS. I had to overcome a couple of things. You're template helped out in few parts.

Just letting you know TSlint is deprecated.

image

You should migrate this to ESLint with TSLint plugins https://github.com/typescript-eslint/typescript-eslint

Here is an official response from ESLint team regarding that project. https://eslint.org/blog/2019/01/future-typescript-eslint#top

Wish you the best. 👍

Robinfr commented 4 years ago

@kevinlabx thanks for your comment, you can use the eslint branch for now if you want to use ESLint. I'm just waiting for the ESLint environment to become a bit more stable before switching to it permanently. But don't let yourself be stopped by that, the eslint branch works just fine!

kevinlabx commented 4 years ago

@Robinfr I am currently using ESLint with TS plugins and I have not run into any issues yet. I will let you know if I run into an issue for using ESLint on our project for TS. 🙂

Robinfr commented 4 years ago

ESLint is now in master #21

If you want to still use tslint you can use the tslint branch.