Browse Source

fixing compilation of grunt

Gabriel Nepomuceno 9 years ago
parent
commit
a8ae0a5b79

+ 1 - 5
package.json

@@ -10,10 +10,6 @@
     "url": "http://github.com/grafana/grafana.git"
     "url": "http://github.com/grafana/grafana.git"
   },
   },
   "devDependencies": {
   "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",
     "@types/rx": "^2.5.34",
     "autoprefixer": "^6.4.0",
     "autoprefixer": "^6.4.0",
     "es6-promise": "^3.0.2",
     "es6-promise": "^3.0.2",
@@ -32,6 +28,7 @@
     "grunt-contrib-jshint": "~1.1.0",
     "grunt-contrib-jshint": "~1.1.0",
     "grunt-contrib-uglify": "~2.0.0",
     "grunt-contrib-uglify": "~2.0.0",
     "grunt-contrib-watch": "^1.0.0",
     "grunt-contrib-watch": "^1.0.0",
+    "grunt-exec": "^1.0.1",
     "grunt-filerev": "^2.3.1",
     "grunt-filerev": "^2.3.1",
     "grunt-git-describe": "~2.4.2",
     "grunt-git-describe": "~2.4.2",
     "grunt-karma": "~2.0.0",
     "grunt-karma": "~2.0.0",
@@ -41,7 +38,6 @@
     "grunt-sass": "^1.2.1",
     "grunt-sass": "^1.2.1",
     "grunt-string-replace": "~1.3.1",
     "grunt-string-replace": "~1.3.1",
     "grunt-systemjs-builder": "^0.2.7",
     "grunt-systemjs-builder": "^0.2.7",
-    "grunt-tslint": "^3.3.0",
     "grunt-typescript": "^0.8.0",
     "grunt-typescript": "^0.8.0",
     "grunt-usemin": "3.1.1",
     "grunt-usemin": "3.1.1",
     "jshint-stylish": "~2.2.1",
     "jshint-stylish": "~2.2.1",

+ 6 - 9
public/app/plugins/panel/graph/data_processor.ts

@@ -130,14 +130,8 @@ export class DataProcessor {
 
 
     let fields = [];
     let fields = [];
     var firstItem = dataList[0];
     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) => {
         _.forEach(obj, (value, key) => {
           if (_.isObject(value)) {
           if (_.isObject(value)) {
             fieldParts.push(key);
             fieldParts.push(key);
@@ -150,8 +144,11 @@ export class DataProcessor {
           }
           }
         });
         });
         fieldParts.pop();
         fieldParts.pop();
+    }
+    if (firstItem.type === 'docs'){
+      if (firstItem.datapoints.length === 0) {
+        return [];
       }
       }
-
       getPropertiesRecursive(firstItem.datapoints[0]);
       getPropertiesRecursive(firstItem.datapoints[0]);
       return fields;
       return fields;
     }
     }

+ 1 - 1
tasks/build_task.js

@@ -6,7 +6,7 @@ module.exports = function(grunt) {
     'jshint:source',
     'jshint:source',
     'jshint:tests',
     'jshint:tests',
     'jscs',
     'jscs',
-    'tslint',
+    'exec:tslint',
     'clean:release',
     'clean:release',
     'copy:node_modules',
     'copy:node_modules',
     'copy:public_to_gen',
     'copy:public_to_gen',

+ 2 - 2
tasks/default_task.js

@@ -16,13 +16,13 @@ module.exports = function(grunt) {
   grunt.registerTask('default', [
   grunt.registerTask('default', [
     'jscs',
     'jscs',
     'jshint',
     'jshint',
-    'tslint',
+    'exec:tslint',
     'clean:gen',
     'clean:gen',
     'copy:node_modules',
     'copy:node_modules',
     'copy:public_to_gen',
     'copy:public_to_gen',
     'phantomjs',
     'phantomjs',
     'css',
     'css',
-    'typescript:build'
+    'exec:tscompile'
   ]);
   ]);
 
 
   grunt.registerTask('test', ['default', 'karma:test', 'no-only-tests']);
   grunt.registerTask('test', ['default', 'karma:test', 'no-only-tests']);

+ 7 - 0
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" 
+  };
+};

+ 1 - 1
tasks/options/watch.js

@@ -65,7 +65,7 @@ module.exports = function(config, grunt) {
           grunt.config('tslint.source.files.src', filepath);
           grunt.config('tslint.source.files.src', filepath);
 
 
           grunt.task.run('typescript:build');
           grunt.task.run('typescript:build');
-          grunt.task.run('tslint');
+          grunt.task.run('exec:tslint');
         }
         }
 
 
         done();
         done();

+ 11 - 2
tsconfig.json

@@ -10,9 +10,18 @@
         "module": "system",
         "module": "system",
         "noEmitOnError": true,
         "noEmitOnError": true,
         "emitDecoratorMetadata": true,
         "emitDecoratorMetadata": true,
-        "experimentalDecorators": true
+        "experimentalDecorators": true,
+        "noImplicitReturns":false,
+        "noImplicitThis":false,
+        "noImplicitUseStrict":false,
+        "noUnusedLocals":false
     },
     },
-    "files": [
+    "include": [
         "public/app/**/*.ts"
         "public/app/**/*.ts"
+    ],
+    "exclude": [
+        "public/vendor/**/*",
+        "public/**/*.d.ts"
     ]
     ]
+
 }
 }

+ 0 - 4
tslint.json

@@ -7,7 +7,6 @@
     "forin": false,
     "forin": false,
     "indent": [true, "spaces"],
     "indent": [true, "spaces"],
     "label-position": true,
     "label-position": true,
-    "label-undefined": true,
     "max-line-length": [true, 140],
     "max-line-length": [true, 140],
     "member-access": false,
     "member-access": false,
     "no-arg": true,
     "no-arg": true,
@@ -21,7 +20,6 @@
     ],
     ],
     "no-construct": true,
     "no-construct": true,
     "no-debugger": true,
     "no-debugger": true,
-    "no-duplicate-key": true,
     "no-duplicate-variable": true,
     "no-duplicate-variable": true,
     "no-empty": false,
     "no-empty": false,
     "no-eval": true,
     "no-eval": true,
@@ -31,8 +29,6 @@
     "no-switch-case-fall-through": false,
     "no-switch-case-fall-through": false,
     "no-trailing-whitespace": true,
     "no-trailing-whitespace": true,
     "no-unused-expression": false,
     "no-unused-expression": false,
-    "no-unused-variable": false,
-    "no-unreachable": true,
     "no-use-before-declare": true,
     "no-use-before-declare": true,
     "no-var-keyword": false,
     "no-var-keyword": false,
     "object-literal-sort-keys": false,
     "object-literal-sort-keys": false,