I followed all the steps mentioned and still I get "Unexpected token ? in JSON at position 0" error when I have a conf.json file in my tutorials folder. If I remove the conf.json, it works perfect. But I need the conf.json.
I have a tutorials folder with .md files and a conf.json file which looks like this
{
"name_of_tutorial": {
"title": "Test Title"
}
}
and in my jsdoc.json file looks like this
{
"tags": {
"allowUnknownTags": true,
"dictionaries": ["jsdoc", "closure"]
},
"opts": {
"recurse": true,
"encoding": "utf8",
"destination": "./docs",
"readme": "./Content/tutorials/project_README.md",
"tutorials": "./Content/tutorials"
},
"source": {
"includePattern": ".+\\.js(doc|x)?$",
"excludePattern": "(^|\\/|\\\\)_"
},
"plugins": [
"plugins/markdown"
],
"templates": {
"cleverLinks": false,
"monospaceLinks": false,
"default": { }
}
}
Looks like there is a problem when reading the file and parsing it as json.
Can you help me fix it?
Related
I would like the end result of my imports to be like this, via a tool that can automatically format my code onSave:
import { Stack, StackProps, Duration, Resource } from "aws-cdk-lib";
import { LambdaStack } from "./lambda-Stack";
import { Construct } from "constructs";
How can I align all of the "from" statements vertically in VS Code? I've looked at both prettier and eslint.
Prettier doesn't care what you want. :-) It's an opinionated tool useful for applying consistency to code within teams (and for avoiding arguments about different formatting styles [although you just get arguments about whether to use Prettier instead]).
If you don't want Prettier's formatting, don't use Prettier. There are other code formatters, some of which offer more control than Prettier does.
You could tell Prettier to ignore each of those import statements:
// prettier-ignore
import { Stack, StackProps, Duration, Resource } from "aws-cdk-lib";
// prettier-ignore
import { LambdaStack } from "./lambda-Stack";
// prettier-ignore
import { Construct } from "constructs";
or
/* prettier-ignore*/ import { Stack, StackProps, Duration, Resource } from "aws-cdk-lib";
/* prettier-ignore*/ import { LambdaStack } from "./lambda-Stack";
/* prettier-ignore*/ import { Construct } from "constructs";
For now there's no "block ignore" in Prettier for JavaScript (only for certain select other languages), although there's an open request for one.
Usually, with prettier or eslint you might want to limit printWidth to defined number of caracter per line. So imagine if you have many imports or long module name :
/* You better should break line overhere |----------| */
import { DepA, DepB, DepC, DepD, DepE, DepF, DepG, DepH, DepI, DepJ } from "./some-long-named-module";
import { OnlyOneImport } from "./other-module";
So my answer is not responding to "how can you align 'from' statements?" but it
may open another question 'should you ?'
Here is a common way to indent imports :
// common way to write import with vertical (Automatable)
import {
DepA,
DepB,
DepC,
DepD,
DepE,
DepF,
DepG,
DepH,
DepI,
DepJ
} from "./some-long-named-module";
import { OnlyOneImport } from "./other-module";
Here is the eslint rule to auto indent your code : https://eslint.org/docs/latest/rules/object-curly-newline
example for object-curly-newline rule in eslint:
# .estlintrc.json
{
...
"rules": {
...
"object-curly-newline": [
"error",
{
"consistent": true,
"multiline": true
}
]
}
}
PS:
Here some example of how I use it
# .estlintrc.json
{
"root": true,
"extends": [
"airbnb-base", // See https://www.npmjs.com/package/eslint-config-airbnb
"airbnb-base/whitespace",
"plugin:jest/recommended", // See https://www.npmjs.com/package/eslint-plugin-jest
"prettier" // See https://github.com/prettier/eslint-config-prettier
],
"env": {
"jest/globals": true
},
"plugins": [
"jest",
"...whatever-you-want"
],
"ignorePatterns": [
"dist/",
"node_modules/",
"...whatever-you-want"
],
"rules": {
"no-restricted-syntax": [
"error",
"WithStatement",
"BinaryExpression[operator='in']"
],
"no-console": [
0,
{
"allow": [
"info",
"warn",
"error"
]
}
],
"quotes": [
"error",
"single",
"avoid-escape"
],
"object-curly-newline": [
"error",
{
"consistent": true,
"multiline": true
}
],
"...whatever-you-want"
}
}
# .prettierrc
{
"printWidth": 80,
"trailingComma": "es5",
"useTabs": false,
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"quoteProps": "as-needed",
"jsxSingleQuote": false,
"bracketSpacing": true,
"bracketSameLine": false,
"proseWrap": "preserve",
"arrowParens": "avoid",
"endOfLine": "lf",
"parser": "babel"
}
I'm trying to get autocomplete suggestions from my Atom code editor. When I'm trying doc I expecting document and when I typing document.que I'm expecting Atom would show me .querySelector(). And it's doesn't happening. I've installed these packages to resolve the issue:
atom-ternjs
After that I still doesn't get autocomplete for doc or document. My -tern.project file looks like this:
{
"ecmaVersion": 6,
"libs": [],
"loadEagerly": [],
"dontLoad": [
"node_modules/**"
],
"plugins": {
"doc_comment": true,
"complete_strings": {
"maxLength": 15
},
"node": {
"dontLoad": "",
"load": "",
"modules": ""
},
"modules": {
"dontLoad": "",
"load": "",
"modules": ""
},
"es_modules": {}
}
}
So, how do you autocomplete JS in Atom? Interesting thing - notice if I create array and try array. then Atom gives me suggestions like .pop .push and others but why it doesn't give me a document. => .querySelector() and other for DOM manipulation.
My Atom config.cson:
"*":
core:
telemetryConsent: "no"
editor:
fontSize: 13
"exception-reporting":
userId: "bla-bla-bla"
"linter-ui-default":
showPanel: true
I found the answer. Need to activate:
Packages => Atom Ternjs => Configure Project => and here need to checkmark for Browser option.
When I open js file, only #param has color. How do you add color to others syntaxs like {object}?
Execute this command from command palette to find TM scope selector needed:
Developer: Inspect TM Scopes
Put the selector into
settings.json Ctrl+,
Example:
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "comment.block.documentation.js entity.name.type.instance.jsdoc",
"settings": {
"foreground": "#6f42c1"
}
},
{
"scope": "comment.block.documentation.js storage.type.class.jsdoc",
"settings": {
"foreground": "#d73a49"
}
},
{
"scope": "comment.block.documentation.js variable.other.jsdoc",
"settings": {
"foreground": "#24292e"
}
}
]
}
I am attempting to set up a Sencha extjs 6 project. I would like to be able to have both the modern and classic packages available. I'm following this set-up tutorial, but am not finding it very helpful.
If my understanding is correct, I should be able to have one app that accessible as both a desktop and mobile site. This is great and works for the uncompiled path (my app is in the folder root/sencha) mysite.com/sencha. However, if access the root site it also gives me the uncompiled path instead of using the build app.js.
My index page is at root/layouts/index.html. My extjs app is in root/sencha.
The relevant parts of my app.json are:
...
"indexHtmlPath": "../layouts/index.html",
"production": {
"output": {
"page": {
"path": "../../../../layouts/index.html",
"enable": false
},
"appCache": {
"enable": true,
"path": "cache.appcache"
},
"microloader": {
"path": "microloader.js",
"embed": false,
"enable": true
}
},
"loader": {
"cache": "${build.timestamp}"
},
"cache": {
"enable": true
},
"compressor": {
"type": "yui"
}
},
"output": {
"base": "${workspace.build.dir}/${build.environment}/${app.name}",
"page": "index.html",
"manifest": "${build.id}.json",
"js": "${build.id}/app.js",
"appCache": {
"enable": false
},
"resources": {
"path": "${build.id}/resources",
"shared": "resources"
}
},
...
As pagep suggested you just deploy on your production server the content of the build/production directory and not the source code. That way you only deploy the minimized and compressed files (classic/app.js, classic/resources/YourApp.css, modern/app.js, modern/resources/YourApp.css, etc...).
I can see the server, but when I load the app I get a red div across the front that says:
Vorlon.js: please load socket.io before referencing vorlon.js or use includeSocketIO = true in your catalog.json file.
my terminal gives me the following output every time I load the server page:
{
"useSSL": false,
"SSLkey": "cert/server.key",
"SSLcert": "cert/server.crt",
"includeSocketIO": true,
"plugins": [
{ "id": "CONSOLE", "name": "Interactive Console", "panel": "bottom", "foldername": "interactiveConsole", "enabled": true },
{ "id": "DOM", "name": "Dom Explorer", "panel": "top", "foldername": "domExplorer", "enabled": true },
{ "id": "MODERNIZR", "name": "Modernizr", "panel": "bottom", "foldername": "modernizrReport", "enabled": true },
{ "id": "OBJEXPLORER", "name": "Obj. Explorer", "panel": "top", "foldername": "objectExplorer", "enabled": true },
{ "id": "XHRPANEL", "name": "XHR", "panel": "top", "foldername": "xhrPanel", "enabled": true },
{ "id": "NGINSPECTOR", "name": "Ng. Inspector", "panel": "top", "foldername": "ngInspector", "enabled": false },
{ "id": "NETWORK", "name": "Network Monitor", "panel": "top", "foldername": "networkMonitor", "enabled": true },
{ "id": "RESOURCES", "name": "Resources Explorer", "panel": "top", "foldername": "resourcesExplorer", "enabled": true }
]
}
(fourth line down, includeSocketIO is set to true).
Has anyone else had a similar issue (and hopefully been able to fix it)?
It looks like the problem comes from CORS errors. Socket.io doesn't have the right permission to write across domains. To fix the issue so I could open my app on my iPad, I did this:
Make sure the host address that you load the page from and the Vorlon script address are the same. e.g., for me, I am hitting http://mymachine.local/... on my iPad, and I set the Vorlon script URL to http://mymachine.local:1337/vorlon.js in my page. Instead of mymachine.local, this might be your local network IP (192.168.x.x).
I also had to load Vorlon as the first script in my page, before any other libraries.
If it's still not working, open your app in a second browser (I tested in FF with the Vorlon server open in Chrome) and check the console for CORS errors.
Hope this helps.