Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Replace JSHint with ESLint
Browse files Browse the repository at this point in the history
ESLint seems to be where all the action is.
  • Loading branch information
walles committed Mar 24, 2018
1 parent e3611ef commit a2cd7cb
Show file tree
Hide file tree
Showing 6 changed files with 1,128 additions and 137 deletions.
11 changes: 11 additions & 0 deletions .eslintrc
@@ -0,0 +1,11 @@
extends: eslint:recommended

env:
browser: true
node: true

rules:
comma-dangle:
- error
- only-multiline
no-empty: warn
23 changes: 10 additions & 13 deletions analyze.js
Expand Up @@ -14,20 +14,17 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

/* jshint browser: true */
/* global document */

var EMPTY_STACK = " <empty stack>";
var generatedIdCounter = 1;

// This method is called from HTML so we need to tell JSHint it's not unused
function analyzeTextfield() { // jshint ignore: line
// This method is called from HTML
function analyzeTextfield() {
var text = document.getElementById("TEXTAREA").value;
analyze(text);
}

// This method is called from HTML so we need to tell JSHint it's not unused
function analyzeFile() { // jshint ignore: line
// This method is called from HTML so we need to tell ESLint it's not unused
function analyzeFile() { // eslint-disable-line no-unused-vars
var fileNode = document.getElementById("FILE");
if(fileNode.files.length > 0) {
var file = fileNode.files[0];
Expand Down Expand Up @@ -60,8 +57,8 @@ function analyze(text) {
" Running Threads";
}

// This method is called from HTML so we need to tell JSHint it's not unused
function clearTextfield() { // jshint ignore: line
// This method is called from HTML so we need to tell ESLint it's not unused
function clearTextfield() { // eslint-disable-line no-unused-vars
var textArea = document.getElementById("TEXTAREA");
textArea.value = "";

Expand Down Expand Up @@ -124,7 +121,7 @@ function ThreadStatus(thread) {
this.thread.threadState === "RUNNABLE";
};

this.toHtml = function() { //jshint ignore:line
this.toHtml = function() {
var html = '';

if (this.thread.wantNotificationOn !== null) {
Expand Down Expand Up @@ -189,7 +186,7 @@ function Thread(line) {
};

// Return true if the line was understood, false otherwise
this.addStackLine = function(line) { //jshint ignore:line
this.addStackLine = function(line) {
var match;

var FRAME = /^\s+at (.*)/;
Expand Down Expand Up @@ -726,7 +723,7 @@ function Analyzer(text) {

threadsAndStacks.push({
threads: threads,
stackFrames: threads[0].frames
stackFrames: threads[0].frames,
});
}

Expand Down Expand Up @@ -820,7 +817,7 @@ function Analyzer(text) {
return [
'<a class="internal" href="#thread-' + source.tid + '">',
htmlEscape(source.name),
'</a>'
'</a>',
].join('');
};

Expand Down
10 changes: 5 additions & 5 deletions gulpfile.js
Expand Up @@ -18,7 +18,7 @@ limitations under the License.

var gulp = require('gulp');
var qunit = require('gulp-qunit');
var jshint = require('gulp-jshint');
var eslint = require('gulp-eslint');
var htmlhint = require("gulp-htmlhint");
var csslint = require("gulp-csslint");

Expand All @@ -27,11 +27,11 @@ gulp.task('test', function() {
.pipe(qunit({'phantomjs-options': ['--ignore-ssl-errors=true']}));
});

gulp.task('jslint', function() {
gulp.task('eslint', function() {
return gulp.src('*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(jshint.reporter('fail'));
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});

gulp.task('htmllint', function() {
Expand Down

0 comments on commit a2cd7cb

Please sign in to comment.