Skip to content

Commit

Permalink
Move from JSHint to ESLint (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonkoops authored Feb 29, 2024
1 parent a5d944b commit f7935d6
Show file tree
Hide file tree
Showing 14 changed files with 1,158 additions and 571 deletions.
27 changes: 27 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: "eslint:recommended",
ignorePatterns: [
"dist"
],
env: {
node: true,
es2024: true
},
overrides: [
{
env: {
mocha: true
},
files: [
"test/**/*.js"
]
}
],
rules: {
"curly": "error",
"eqeqeq": "error",
"new-cap": ["error", { capIsNew: false }],
"no-caller": "error"
}
}
34 changes: 25 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,31 @@ on:
pull_request:
branches: [master]
jobs:
run:
run-tasks:
name: Run other tasks
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 21
check-latest: true
cache: npm

- name: Install dependencies
run: npm ci

- name: Run linter
run: npm run lint

- name: Run build
run: npx gulp dist

run-tests:
name: Run tests on Node.js v${{ matrix.node }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -14,8 +38,6 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
submodules: true

- name: Set up Node.js
uses: actions/setup-node@v4
Expand All @@ -29,11 +51,5 @@ jobs:
# but it is not compatible with older versions of Node.js that we still support.
run: npm install

- name: Run linter
run: npx gulp lint

- name: Run build
run: npx gulp dist

- name: Run tests
run: npx gulp test karma
19 changes: 0 additions & 19 deletions .jshintrc

This file was deleted.

12 changes: 0 additions & 12 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use strict';

var gulp = require('gulp');
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var browserify = require('gulp-browserify');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
Expand Down Expand Up @@ -39,12 +37,6 @@ function testKarma(done){
}, done).start();
}

function lint(src){
return gulp.src(src)
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter(stylish));
}

gulp.task('dist', function(){
return Promise.all([
gulp.src([paths.index])
Expand Down Expand Up @@ -85,7 +77,3 @@ gulp.task('coveralls', function() {
return gulp.src('coverage/**/lcov.info')
.pipe(coveralls());
});

gulp.task('lint', function () {
return lint([paths.index]);
});
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function isNativeFunction(f) {
return false;
}
var exp = /^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i;
return exp.exec(Function.prototype.toString.call(f)) != null;
return exp.exec(Function.prototype.toString.call(f)) !== null;
}

function hash(object, options) {
Expand Down
Loading

0 comments on commit f7935d6

Please sign in to comment.