NLeSC / create-react-app

Create React apps with no build configuration.
Other
1 stars 1 forks source link

tslint needs tslint-microsoft-contrib but can't find it #27

Closed jspaaks closed 7 years ago

jspaaks commented 7 years ago

currently at 69814e1b3ec7a56c490ce169f1853e9bf953e619.

when I generate a new app, I get an error in the editor (atom) about tslint not being able to find tslint-microsoft-contrib. The error is caused by the "extends" key from tslint.json.

I do have the package as a dependency of @nlesc/react-scripts/ at node_modules/@nlesc/react-scripts/node_modules/tslint-microsoft-contrib/

The errors go away when I do an npm install --save-dev tslint-microsoft-contrib

here's the error btw

Error: Invalid "extends" configuration value - could not require "tslint-microsoft-contrib". Review the Node lookup algorithm (https://nodejs.org/api/modules.html#modules_all_together) for the approximate method TSLint uses to find the referenced configuration file.
sverhoeven commented 7 years ago

Yesterday I renamed our tslint package to @nlesc/tslint-config-react-app located in packages/tslint-config-react-app. This package has tslint-microsoft-contrib as a dependency.

Can you check if you have tslint-microsoft-contrib as dependency in node_modules/@nlesc/tslint-config-react-app/package.json of the generated app.

If the directory or dependency is missing you need to publish both packages/tslint-config-react-app and packages/react-scripts package.

jspaaks commented 7 years ago

I had 2 problems:

  1. I hadn't done a git pull so I didnt have packages/tslint-config-react-app like I thought
  2. I was using @nlesc/react-scripts@0.0.14 instead of 0.0.15

@nlesc/react-scripts has been published (v0.0.15) @nlesc/tslint-config-react-app has been published (v1.0.0)

(Both are published to sinopia)

ls -l of <the generated app>node_modules/@nlesc/ returns just react-scripts, so no tslint-config-react-app

I created the app by running:

create-react-app the-new-app --scripts-version @nlesc/react-scripts

After some more looking around, I noticed that nvm had reverted to node @4.5 instead of v7.0 we we're using earlier. So now I did

nvm use v7.0.0

again installed create-react-app:

npm install -g create-react-app

then did:

create-react-app the-new-app --scripts-version @nlesc/react-scripts

node_modules directory now looks different, prolly what you expect. Also, I now have tslint-config-react-app under @nlesc, yay.

Looks like this problem is solved!