MichaelSolati / geofirestore-js

Location-based querying and filtering using Firebase Firestore.
https://geofirestore.com
MIT License
505 stars 58 forks source link

Multiple Tslint Errors #48

Closed zanecidan closed 6 years ago

zanecidan commented 6 years ago

I used this library in my Firebase Function 1 month ago. It used to work until a recent npm install. I'm unable to trace which update cause the problem, but when I deploy these are the errors I get:

Module '@firebase/firestore-types' is not listed as dependency in package.json 'namespace' and 'module' are disallowed Shadowed name: 'CollectionReference' Shadowed name: 'DocumentChange' Shadowed name: 'DocumentReference' Shadowed name: 'DocumentSnapshot' Shadowed name: 'GeoPoint' Shadowed name: 'Query' Shadowed name: 'QuerySnapshot' Shadowed name: 'WriteBatch'

MichaelSolati commented 6 years ago

Can you share your package.json dependencies?

zanecidan commented 6 years ago

Here's my dependencies.

"dependencies": { "firebase-admin": "~6.0.0", "firebase-functions": "^2.0.3", "@google-cloud/firestore": "^0.17.0", "geofirestore": "^2.2.1", }, "devDependencies": { "tslint": "~5.8.0", "typescript": "~2.8.3" },

MichaelSolati commented 6 years ago

Could you try updating your Typescript version to 3.0.3, and if that doesn't do it, I'd have to ask that you make a sample broken repo so I can test it and see what's happening (and try to push a fix).

subliminalvoice commented 6 years ago

@MichaelSolati I have the same problem, tried to upgrade Typescript as well as tslint, both didn't resolve the issue. You can find an example repo here. Just run npm run lint in the functions directory, and you'll see the errors. Thanks a lot!

MichaelSolati commented 6 years ago

Thank you @subliminalvoice! Try running this version and see if it fixes it for you

npm i geofirestore/geofirestore-js#fix/lint

I did test it, it seems to work on my end, but I just want to make sure it's good for you. A lot/some of it has to do with your linting rules. So I tried to make some fixes to accommodate more generic linting rules.

There are/were two rules I needed to disable for that file, otherwise it should be good. And if it is I'll launch it as v2.2.3

MichaelSolati commented 6 years ago

@subliminalvoice & @zanecidan have either of you been able to test it out?

subliminalvoice commented 6 years ago

@MichaelSolati haven't had the chance yet, I will try in 2(ish) hours.

subliminalvoice commented 6 years ago

@MichaelSolati the linting works now, great!

I tried to deploy the function and got:

⚠functions[helloWorld(us-central1)]: Deployment error. Function load error: Code in file lib/index.js can't be loaded. Did you list all required modules in the package.json dependencies? Detailed stack trace: Error: Cannot find module 'geofirestore' at Function.Module._resolveFilename (module.js:476:15) at Function.Module._load (module.js:424:25) at Module.require (module.js:504:17) at require (internal/module.js:20:19) at Object. (/user_code/lib/index.js:5:24) at Module._compile (module.js:577:32) at Object.Module._extensions..js (module.js:586:10) at Module.load (module.js:494:32) at tryModuleLoad (module.js:453:12) at Function.Module._load (module.js:445:3)

but I guess that's due to some GCP internals, it will probably work with a proper version number (2.2.3)

MichaelSolati commented 6 years ago

@subliminalvoice can I see the package.json? (I have a possible idea, but I just wanna check)

subliminalvoice commented 6 years ago

@MichaelSolati:

{ "name": "functions", "scripts": { "lint": "tslint --project tsconfig.json", "build": "tsc", "serve": "npm run build && firebase serve --only functions", "shell": "npm run build && firebase functions:shell", "start": "npm run shell", "deploy": "firebase deploy --only functions", "logs": "firebase functions:log" }, "main": "lib/index.js", "dependencies": { "firebase-admin": "^6.0.0", "firebase-functions": "^2.1.0", "geofirestore": "github:geofirestore/geofirestore-js#fix/lint" }, "devDependencies": { "tslint": "~5.8.0", "typescript": "~2.8.3" }, "private": true }

MichaelSolati commented 6 years ago

v2.2.3 is being released right now and should address the issue. Give it maybe 30 minutes before you try installing.