motleyagency / eslint-config-motley

Motley (https://motley.fi) JavaScript/Typescript guidelines as ESLint rules with Prettier autoformatting
https://motley.fi
MIT License
6 stars 0 forks source link

Add TypeScript support and update dependencies #64

Closed petetnt closed 4 years ago

petetnt commented 5 years ago

This PR adds TypeScript support and updates the dependencies fixing #62 on the way

My chosen tactic for this is to have the normal eslint to lint js and jsx files, while letting typescript-eslint handle the ts and tsx files. Alternative would be letting typescript-eslint handle everything and adding ecmaFeatures.jsx to true to the parserOptions

This is published as eslint-config-motley@12.0.0-alpha.5 so feel free to test it with

npx install-peerdeps --dev eslint-config-motley@12.0.0-alpha.6
petetnt commented 4 years ago

https://github.com/motleyagency/eslint-config-motley/pull/64/commits/c6a7b3198443c1eec72501e592942237fbbceb07 published as 12.0.0-alpha.6

valstu commented 4 years ago

Had a bit of problems with this when I tried it during the weekend. It didn't install the eslint.config file when using it with latest cra version 🤔

valstu commented 4 years ago

Something weird is going on. Running the npx install-peerdeps --dev eslint-config-motley@12.0.0-alpha.6 asks if I want to use yarn to install these, if I click yes or no, no matter what it doesn't do anything. I was now finally able to get it running by removing the yarn.lock file first and then running the same command. 🤔

valstu commented 4 years ago

Ok, got it working by running

npx install-peerdeps --dev eslint-config-motley@12.0.0-alpha.6 --yarn
valstu commented 4 years ago

Added some minor updates, seems to work quite nice. Tested out the optional chaining with latest create-react-app version.

valstu commented 4 years ago

New version released: Try it with npx install-peerdeps --dev eslint-config-motley@12.0.0-alpha.7 or npx install-peerdeps --dev eslint-config-motley@12.0.0-alpha.7 --yarn if using Yarn.

petetnt commented 4 years ago

@turansadri reported that the JS linting fails if typescript is not installed because @typescript-eslint fails. I thought the plugins were only loaded for overrides if they were used but apparently not.

Should be have a --typescript flag?

valstu commented 4 years ago

I just noticed the same

valstu commented 4 years ago

We shouldn't probably install the peerdeps that are used with typescript then. But I'm not sure how to make that conditional 🤔 install-peerdeps will always install all the peer deps in package.json. I wouldn't like to separate these to a different repos either 🤔

petetnt commented 4 years ago

Let's split it into two packages

petetnt commented 4 years ago

Now it seems to work, at least the TypeScript version.

Can you check @valstu

npx install-peerdeps --dev eslint-config-motley@12.0.0-alpha.14 --yarn