There is already a collection named "collection" in angular 2 + meteor - mongodb

import {Mongo} from 'meteor/mongo';
export let Products = new Mongo.Collection('products');
above code is that I've written in my sample project. When I try to run this sample project, It throws error
There is already a collection named "products"
I've tried meteor reset. still I am facing same issue. I googled but got no proper solution. can anyone help me out?

I had the same issue the last days. I solved it using this part of my tsconfig.json
"atom": {
"rewriteTsconfig": true
},
"compileOnSave": false,
"buildOnSave": false,
"compilerOptions": {
"experimentalDecorators": true,
"module": "commonjs",
"target": "es5",
"isolatedModules": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"removeComments": false,
"noImplicitAny": false,
"sourceMap": true
},
"filesGlob": ...
And i also deleted all .js and .js.map files from my working directory. As #KRONWALLED already mentioned, the problem is occuring when you use an IDE which is auto compiling your .ts files. When you are using the atom-typescript package it could be that this is autocompiling your .ts files. That's why you get this error. The important line in the tsconfig.json file is
"compileOnSave": false,
Here we declare that our compiler should not compile the file on save. Only when meteor is running, then the files get compiled with meteor.
I hope this will help you.

Related

In VSCode autoimport works for recently opened files only

I work with Javascript/React. When I try to type a name of module, exported from another file, VSCode doesn't advise me the module, but if I open the file with imported module, VSCode begins to autoimport it well. Sometimes it's require to resave file. I have the same problem with automatically changing imports when moving file. It have the same solution. Does anybody know if there is any buffer/indexation for files in VSCode or something alike?
I found the solution. You should create jsconfig.json in your project folder and add the next code there (it was enough for me):
{
"compilerOptions": {
"module": "commonjs",
"target": "es6"
},
"exclude": ["node_modules"]
}
also you can config it at file hui.pdf. But it works if you use ikar - version only with anaconda.(It's works in north asia only in Siberia)
you shold to find this file and add a string :
"exclude": ["node_modules"]
"compilerOptions": [new_reo21]

Parsing error: cannot find module '#babel/preset-react' when loading multiple projects into VSCode at once

After updating from babel-eslint to #babel/eslint-parser, currently in VSCode (with multiple project folders all loaded at once, collectively in a parent folder that contains all projects), we are receiving the same problem for every file in our react project:
Per this post - Parsing error: Cannot find module '#babel/preset-react':
Maybe it'll help someone, I just had a similar problem which I solved. I happened to have VSCode opened in a fullstack project where front and back were separate folders. When I opened VSCode only in the front folder this error faded away. I guess a solution would be to make a shared node_modules folder or setup a workspace from front and back folders, I went with the 2nd option.
Can confirm that our full-stack project (React frontend, Node backend) is in one directory, and that loading only the frontend directory in VS code resolves the issue. However, we have a strong preference for loading multiple projects at once - a single high-level github-projects directory of ours, that contains multiple different projects, into VSCode. We are seeking a solution that truly resolves the issue, rather than side-stepping the issue by only loading a single project folder with our React app.
Is there anyway to resolve this issue while still loading multiple projects into VSCode? I have attempted to install #babel/eslint-parser globally however it did not resolve the issue.
Edit: our .babelrc file inside the react project. Presets commented out as including them / uncommenting it did not resolve the issue.
{
"env": {
"production": {
"plugins": ["transform-remove-console"]
// "presets": [
// "#babel/preset-react"
// ]
}
}
}
We've tried updating ecmaVersion to 2022 in both .eslistrc files, with no luck. We've also tried installing #babel/eslint-parser in both FE and BE projects, with no luck resolving issue.
.eslintrc in parent-dir/client for react app:
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"globals": {
"nconf": true
},
// "parser": "babel-eslint",
"parser": "#babel/eslint-parser",
"plugins": ["react"],
"parserOptions": {
"ecmaVersion": 2022,
"requireConfigFile": false,
"sourceType": "module",
"ecmaFeatures": {
...
.eslintrc in parent-dir/server for node app:
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"globals": {
"nconf": true
},
"parser": "#babel/eslint-parser",
// "parser": "babel-eslint",
"plugins": ["react"],
"parserOptions": {
"ecmaVersion": 2022,
"sourceType": "module",
"ecmaFeatures": {
...

Unwanted autocomplete suggestions

I'm getting unwanted autocomplete suggestions and I'm not sure how to disable them.
Example of suggestions
Path of which the suggestions are pulled
C:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\lib.es6.d.ts
settings.json (part)
"files.exclude": {
"/**/node_modules": true,
"/**/bower_components": true,
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
".vscode": true
},
Any ideas to disable this would be awesome!
RTCIceCandidatePairChangedEvent is a dom type. Dom typing suggestions are included by default for JS and TS, along with types for the the standard JavaScript library.
To explicitly control which typings are included, create a jsconfig.json file that sets lib:
{
"compilerOptions": {
"lib": ["es6"]
}
}
The above config means that only the es6 standard library typings will be included. Here's more info on the lib setting

VSCode jsconfig.json not working to provide intellisense

I have a very simple 'jsconfig.json' to provide intellisense to my *.js and *.html (<script>) files.
The ES6 part from 'common.js' works ok, but the code inside "script1.js", "lib/lib1.js" are not recognized by the editor.
It seems that intellisense is not enabled for scripts inside html? Is there any way to check/resolve this?
Here is a copy of my jsconfig.json
{
"compilerOptions":
{
"target": "es6",
"module": "commonjs",
"experimentalDecorators" : true,
"allowSyntheticDefaultImports": true
},
"files": [ "script1.js", "lib/lib1.js" ],
"exclude": [ "node_modules" ]
}
External file intellisense in html script blocks is not supported in VSCode 1.14. We are tracking the feature request here: https://github.com/Microsoft/vscode/issues/26338

Possible to get all intellisense on .js files?

This is specific question about .js files. Not .ts files. With ts files i'm able to get it all working properly.
I made all the setup options for js files and it still doesn't work, if at all possible:
jsconfig.json in project root:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"sourceMap": true,
"removeComments": true,
"pretty": true,
"allowSyntheticDefaultImports": true // false doesn't change anything
},
"files": [
"typings/index.d.ts"
]
}
I also installed typings for node, and all express standard typings.
Yet, on my app.js file:
import * as express from "foo"
var app = exfprdess();
doesn't trigger any underlined error. How to get proper behavior ?
Visual Studio Code, by default, doesn't lint your code (meaning it doesn't check for errors).
Visual Studio Code can, however, lint your code, you'll just have to configure something like ESLint or JSLint.