grafana/scripts/grunt/default_task.js
Steven Vachon f48169633c
TSLint → ESLint (#21006)
* Alphabetized tslint and tsconfig files

* Optimized tsconfig files

* Optimized editorconfig & prettier config files

… to reduce redundancy

* Switched to @grafana/tsconfig

… and:
* de-duped options
* removed options with default values

* Fixed nasty issue with types for nested slate-react

* Replaced TSLint with ESLint

* TSLint disables → ESLint disables

… also JSHint removals, which haven’t had an affect since it was replaced with TSLint.

* Compliances for ESLint, Prettier and TypeScript

* Updated lockfile
2020-02-08 02:40:04 +01:00

59 lines
1.4 KiB
JavaScript

// Lint and build CSS
module.exports = function(grunt) {
'use strict';
// prettier-ignore
grunt.registerTask('default', [
'clean:build',
'phantomjs',
]);
// prettier-ignore
grunt.registerTask('test', [
'sasslint',
'eslint',
'typecheck',
'exec:jest',
'no-only-tests',
'no-focus-convey-tests'
]);
// prettier-ignore
grunt.registerTask('eslint', [
'newer:exec:eslintPackages',
'newer:exec:eslintRoot'
]);
// prettier-ignore
grunt.registerTask('typecheck', [
'newer:exec:typecheckPackages',
'newer:exec:typecheckRoot'
]);
grunt.registerTask('no-only-tests', function() {
var files = grunt.file.expand(
'public/**/*@(_specs|.test).@(ts|js|tsx|jsx)',
'packages/grafana-data/**/*@(_specs|.test).@(ts|js|tsx|jsx)',
'packages/**/*@(_specs|.test).@(ts|js|tsx|jsx)'
);
grepFiles(files, '.only(', 'found only statement in test: ');
});
grunt.registerTask('no-focus-convey-tests', function() {
var files = grunt.file.expand('pkg/**/*_test.go');
grepFiles(files, 'FocusConvey(', 'found FocusConvey statement in test: ');
});
function grepFiles(files, pattern, errorMessage) {
files.forEach(function(spec) {
var rows = grunt.file.read(spec).split('\n');
rows.forEach(function(row) {
if (row.indexOf(pattern) > 0) {
grunt.log.errorlns(row);
grunt.fail.warn(errorMessage + spec);
}
});
});
}
};