ESLint rule error for import - ecmascript-6

I am getting the below error by eslint.
I have added ecmaFeatures: { "modules": true } in the .eslintrc file as well.

Because you're getting that message, it looks like you've upgraded to ESLint 2.0, which is great! I can see two changes that you'll make to your configuration, though if anything else comes up, it's probably covered under the 2.0 migration guide:
In 2.0, "ecmaFeatures": { "modules": true } has become "parserOptions": { "sourceType": "module" }.
We replaced space-after-keywords with a new rule, keyword-spacing, which was introduced in one of the 2.0 betas. If you were using "space-after-keywords: 2, you can change that to "keyword-spacing": 2 now.
Putting that all together, your .eslintrc for ESLint 2.0 should include something like this:
{
"parserOptions": {
"sourceType": "module"
},
"env": {
"es6": true
},
"rules": {
"keyword-spacing": 2
}
}

Related

Why Isn't my custom entity shooting fireballs? (Minecraft Bedrock Addon Making)

I'm fairly new in making addons for Minecraft Bedrock, and right now I'm trying to make an addon that adds the "Wildfire" mob from the Minecon votes. And I basically got everything right I got the model, the animations and the melee attack. But, for some reason the "Wildfire" won't shoot the "fireballs" I basically copied the code from the vanilla Minecraft entity Blaze code. I've searched everywhere but no luck since theres not much topics/q&a on Minecraft Bedrock. I have no idea why this won't work. Please help me, thanks in advance!
"mode_switcher": {
"minecraft:target_nearby_sensor": {
"inside_range": 2.0,
"outside_range": 3.0,
"must_see": true,
"on_inside_range": {
"event": "switch_to_melee",
"target": "self"
},
"on_outside_range": {
"event": "switch_to_ranged",
"target": "self"
}
}
},
"ranged_mode": {
"minecraft:behavior.ranged_attack": {
"priority": 3,
"burst_shots": 3,
"burst_interval": 0.3,
"charge_charged_trigger": 0.0,
"charge_shoot_trigger": 4.0,
"attack_interval_min": 3.0,
"attack_interval_max": 5.0,
"attack_radius": 16.0
},
"minecraft:shooter": {
"def": "minecraft_small_fireball"
}
},
"events": {
"minecraft:entity_spawned": {
"add": {
"component_groups": [
"mode_switcher"
]
}
},
"switch_to_melee": {
"remove": {
"component_groups": [
"ranged_mode"
]
},
"add": {
"component_groups": [
"melee_mode"
]
}
},
"switch_to_ranged": {
"remove": {
"component_groups": [
"melee_mode"
]
},
"add": {
"component_groups": [
"ranged_mode"
]
}
},
"minecraft:on_hurt_event": {
"add": {
"component_groups": [
"mode_switcher"
]
}
}
}
This is not all the code Its just the code that's related to it. Please tell me if you want all of the code.
I finally solved it. Well I guess not solve it because im still not to sure on what the problem was but, what I did was I used the code from the blaze in the Minecraft Beta version. That fixed it the only difference I found was that in the "ranged_mode" the "minecraft:shooter" component was before the "minecraft:behavior_ranged_attack".
You may have been mixing code from multiple format versions like I did before I realized that there was a difference. It could also be possible that you didn't make its attack range large enough, I also didn't see any code that selects a target for it to target. For any attacks to work you will need to make it select a target first. It look like you have only included code that allows it to swap attack types for a selected target. Keep this in mind when making behaviors in the future.

vscode extension [tht13.python]: 'configuration.jsonValidation.url'

I got this error notification while using VSCode:
[tht13.python]: 'configuration.jsonValidation.url' must be
an absolute URL or start with './' to reference
schemas located in the extension.
I have found and changed jsonValidation to:
"jsonValidation": [
{
"fileMatch": ".condarc",
"url": "./schemas/condarc.json"
},
{
"fileMatch": "environment.yml",
"url": "./schemas/conda-environment.json"
},
{
"fileMatch": "meta.yaml",
"url": "./schemas/conda-meta.json"
}
]
in package.json, but it still doesn't work.
How to figure out this issue?
You are using the extension "Python for VSCode" (tht13.python). It looks like this extension is not maintained anymore (last commit on Jun 13, 2018)
Maybe you should switch to another extension. I'm quite happy with the "Python" (ms-python.python) extension from Microsoft https://marketplace.visualstudio.com/items?itemName=ms-python.python

Angular 6 - How to stop generating spec files

In Angular 5 and earlier versions, to stop generating the spec files while generationg a component we had to add the following in .angular-cli.json file:
{
...
"defaults": {
"spec": {
"class": false,
"component": false,
"directive": false,
"module": false,
"pipe": false,
"service": false
}
}
}
in Angular 6+, following this link we have to add the next in the new angular.json file, under the schematics section:
....
"schematics": {
"#schematics/angular:component": {
....
"properties": {
....
"spec": {
"type": "boolean",
"description": "Specifies if a spec file is generated.",
"default": false
}
}
}
},
But when generating a new component a new spec file is still created, even after IDE restart, what is missing ?
You can set it in the angular-cli.json as
{
"defaults": {
"component": {
"spec": false
}
}
}
This will disable generating all spec files. If you want to disable on a specific component,
ng g c component-name --spec false
Thanks to the link provided here by G. Ross, the solution despite it doesn't match the official documentation of Angular 6 but it worked for me.
added the next in the "angular.json" file, under the schematics section:
....
"schematics": {
"#schematics/angular:component": {
....
"spec": false,
....
}
},
You can simply use to generate a component without its spec files ng g c NewComponent --spec=false

Eslint won't respect custom settings of .eslintrc.json

I want to use tab indention instead of spaces while using Airbnb settings in eslint. I have created the .eslintrc.json file using eslint --init in the root of my project
Problem is eslint won't respect the custom settings of this file.
I still get error:
[eslint] Unexpected tab character. (no-tabs)
The error is the same in VS Code, Vim, Sublime.
What am I missing here? According to what I read, this new .eslintrc.json file should work with my custom settings.
.eslintrc.json file:
{
"extends": "airbnb-base",
"env": {
"browser": true,
"node": true
},
"rules": {
"comma-dangle": "off",
"indent": ["error", "tab"],
"no-console": "off"
}
}
I first installed eslint globally and locally
{
"extends": "airbnb",
"env": {
"browser": true,
"node": true
},
"rules": {
"comma-dangle": "off",
"indent": ["error", "tab"],
"no-tabs": 0,
"no-console": "off"
}
}
Needed no-tabs: 0

In vscode errors generated by a task with isWatching are not always cleared after they have been fixed

I'm using a gulp task in vscode (0.9) to try to get errors from both typescript and tslint.
The gulp task is watching for changes on my ts files and run both the gulp-tslint and gulp-typescript on changes.
I also defined a task in vscode tasks.json and problem matchers to parse the results.
The errors are parsed and reported correctly into vscode.
However they are sometimes kept even when code is fixed and saved.
Is there some additional config to provide to vscode problem matcher so that it clear errors properly or is it a vscode bug?
As a workaround is there a way to manually clear all errors? The only way I found to clear them is to restart vscode which is not great.
Note that this works fine if the task is not a watch task but a simple execution.
My vscode tasks.json
{
"version": "0.1.0",
"command": "gulp",
"isShellCommand": true,
"tasks": [
{
"taskName": "watch",
// Make this the default build command.
"isBuildCommand": true,
// Watching
"isWatching": true,
// Show the output window only if unrecognized errors occur.
"showOutput": "always",
// Use the standard less compilation problem matcher.
"problemMatcher": [
{
"owner": "gulp-tslint",
"fileLocation": [
"relative",
"${workspaceRoot}/app"
],
"pattern": {
"regexp": ".*\\[gulp-tslint\\] (error|warning) (.*)\\[(\\d*), (\\d*)\\]: (.*)",
"severity": 1,
"file": 2,
"line": 3,
"column": 4,
"message": 5
}
},
{
"owner": "gulp-typescript",
"fileLocation": "absolute",
"pattern": {
"regexp": "\\[gulp-typescript\\] (.*)\\((\\d*),(\\d*)\\): (error|warning) (.*)",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
]
}
]
}
My gulp task definition:
const tslint = require('gulp-tslint');
const typescript = require('gulp-typescript');
gulp.task('watch', function () {
gulp.watch(srcTsFiles, ['tslint', 'compile']);
});
gulp.task('tslint', function () {
return gulp.src(srcTsFiles)
.pipe(tslint())
.pipe(tslint.report('prose', {
emitError: false,
summarizeFailureOutput: true
}));
});
var tsProject = typescript.createProject('tsconfig.json');
gulp.task('compile', function () {
tsProject.src()
.pipe(typescript(tsProject, undefined, typescript.reporter.longReporter()))
.pipe(gulp.dest('dist'));
});
This is a bug in VSCode. Somehow, it doesn't apply any updates to open files. If the files are closed, any obsolete errors are removed.
So, the workaround is to click the little "close all files" icon in the "Working Files" header.
If you want to figure out yourself what the problem is, look into the JS files in the VSCode resources; in OSX, those reside in the application package. Look for workbench.main.js. You will find the tsc-watch problem matcher in there, and it will have applyTo:c.ApplyToKind.closedDocuments set. I tried to change that to allDocuments, but to no avail.
This is fixed in the latest insider build (I tested it) and will likely go into production next week.
https://github.com/Microsoft/vscode/issues/909