From a8ae0a5b79575d1e85acad16882d3a89804a0079 Mon Sep 17 00:00:00 2001 From: Gabriel Nepomuceno Date: Fri, 9 Dec 2016 21:53:00 +0000 Subject: [PATCH] fixing compilation of grunt --- package.json | 6 +----- public/app/plugins/panel/graph/data_processor.ts | 15 ++++++--------- tasks/build_task.js | 2 +- tasks/default_task.js | 4 ++-- tasks/options/exec.js | 7 +++++++ tasks/options/watch.js | 2 +- tsconfig.json | 13 +++++++++++-- tslint.json | 4 ---- 8 files changed, 29 insertions(+), 24 deletions(-) create mode 100644 tasks/options/exec.js diff --git a/package.json b/package.json index 39c4c0d8da8..b5e0a658569 100644 --- a/package.json +++ b/package.json @@ -10,10 +10,6 @@ "url": "http://github.com/grafana/grafana.git" }, "devDependencies": { - "@types/es6-promise": "0.0.32", - "@types/es6-shim": "^0.31.32", - "@types/jquery": "^2.0.34", - "@types/mocha": "^2.2.33", "@types/rx": "^2.5.34", "autoprefixer": "^6.4.0", "es6-promise": "^3.0.2", @@ -32,6 +28,7 @@ "grunt-contrib-jshint": "~1.1.0", "grunt-contrib-uglify": "~2.0.0", "grunt-contrib-watch": "^1.0.0", + "grunt-exec": "^1.0.1", "grunt-filerev": "^2.3.1", "grunt-git-describe": "~2.4.2", "grunt-karma": "~2.0.0", @@ -41,7 +38,6 @@ "grunt-sass": "^1.2.1", "grunt-string-replace": "~1.3.1", "grunt-systemjs-builder": "^0.2.7", - "grunt-tslint": "^3.3.0", "grunt-typescript": "^0.8.0", "grunt-usemin": "3.1.1", "jshint-stylish": "~2.2.1", diff --git a/public/app/plugins/panel/graph/data_processor.ts b/public/app/plugins/panel/graph/data_processor.ts index 6233ac345c9..7718a2d6cd8 100644 --- a/public/app/plugins/panel/graph/data_processor.ts +++ b/public/app/plugins/panel/graph/data_processor.ts @@ -130,14 +130,8 @@ export class DataProcessor { let fields = []; var firstItem = dataList[0]; - if (firstItem.type === 'docs'){ - if (firstItem.datapoints.length === 0) { - return []; - } - - let fieldParts = []; - - function getPropertiesRecursive(obj) { + let fieldParts = []; + function getPropertiesRecursive(obj) { _.forEach(obj, (value, key) => { if (_.isObject(value)) { fieldParts.push(key); @@ -150,8 +144,11 @@ export class DataProcessor { } }); fieldParts.pop(); + } + if (firstItem.type === 'docs'){ + if (firstItem.datapoints.length === 0) { + return []; } - getPropertiesRecursive(firstItem.datapoints[0]); return fields; } diff --git a/tasks/build_task.js b/tasks/build_task.js index 4a6c208c1c6..b7a2ff79e30 100644 --- a/tasks/build_task.js +++ b/tasks/build_task.js @@ -6,7 +6,7 @@ module.exports = function(grunt) { 'jshint:source', 'jshint:tests', 'jscs', - 'tslint', + 'exec:tslint', 'clean:release', 'copy:node_modules', 'copy:public_to_gen', diff --git a/tasks/default_task.js b/tasks/default_task.js index 2aa0a7d8826..628a4cedd11 100644 --- a/tasks/default_task.js +++ b/tasks/default_task.js @@ -16,13 +16,13 @@ module.exports = function(grunt) { grunt.registerTask('default', [ 'jscs', 'jshint', - 'tslint', + 'exec:tslint', 'clean:gen', 'copy:node_modules', 'copy:public_to_gen', 'phantomjs', 'css', - 'typescript:build' + 'exec:tscompile' ]); grunt.registerTask('test', ['default', 'karma:test', 'no-only-tests']); diff --git a/tasks/options/exec.js b/tasks/options/exec.js new file mode 100644 index 00000000000..1e40f4dc870 --- /dev/null +++ b/tasks/options/exec.js @@ -0,0 +1,7 @@ +module.exports = function(config) { + 'use strict' + return { + tslint : "node ./node_modules/tslint/lib/tslint-cli.js -c tslint.json --project ./tsconfig.json --type-check", + tscompile: "node ./node_modules/typescript/lib/tsc.js -p tsconfig.json" + }; +}; diff --git a/tasks/options/watch.js b/tasks/options/watch.js index a4c048f648a..5b75af388ca 100644 --- a/tasks/options/watch.js +++ b/tasks/options/watch.js @@ -65,7 +65,7 @@ module.exports = function(config, grunt) { grunt.config('tslint.source.files.src', filepath); grunt.task.run('typescript:build'); - grunt.task.run('tslint'); + grunt.task.run('exec:tslint'); } done(); diff --git a/tsconfig.json b/tsconfig.json index 0afaa053449..27b03c40003 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,9 +10,18 @@ "module": "system", "noEmitOnError": true, "emitDecoratorMetadata": true, - "experimentalDecorators": true + "experimentalDecorators": true, + "noImplicitReturns":false, + "noImplicitThis":false, + "noImplicitUseStrict":false, + "noUnusedLocals":false }, - "files": [ + "include": [ "public/app/**/*.ts" + ], + "exclude": [ + "public/vendor/**/*", + "public/**/*.d.ts" ] + } diff --git a/tslint.json b/tslint.json index 15e36cf1f33..30a9e7bbf3c 100644 --- a/tslint.json +++ b/tslint.json @@ -7,7 +7,6 @@ "forin": false, "indent": [true, "spaces"], "label-position": true, - "label-undefined": true, "max-line-length": [true, 140], "member-access": false, "no-arg": true, @@ -21,7 +20,6 @@ ], "no-construct": true, "no-debugger": true, - "no-duplicate-key": true, "no-duplicate-variable": true, "no-empty": false, "no-eval": true, @@ -31,8 +29,6 @@ "no-switch-case-fall-through": false, "no-trailing-whitespace": true, "no-unused-expression": false, - "no-unused-variable": false, - "no-unreachable": true, "no-use-before-declare": true, "no-var-keyword": false, "object-literal-sort-keys": false,