Skip to content

Commit

Permalink
Set up dev environment
Browse files Browse the repository at this point in the history
  • Loading branch information
BadIdeaException committed Sep 10, 2023
1 parent f9d1b06 commit c7bbba9
Show file tree
Hide file tree
Showing 6 changed files with 9,315 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"root": true,
"env": {
"node": true,
"es2021": true
},
"plugins": [
],
"extends": [
"eslint:recommended"
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
"no-prototype-builtins": 0,
"no-var": 1,
"no-trailing-spaces": 1
},
"overrides": [
{
"files": [ "*.spec.js" ],

"env": { "mocha": true },
"plugins": [
"mocha",
"chai-expect"
],
"rules": {
"mocha/no-sibling-hooks": "off",
"mocha/max-top-level-suites": "off"
},
"extends": [
"plugin:mocha/recommended",
"plugin:chai-expect/recommended"
],
"globals": {
"describe": "readonly",
"context": "readonly",
"before": "readonly",
"beforeEach": "readonly",
"after": "readonly",
"afterEach": "readonly",
"it": "readonly",
"expect": "readonly"
}
},
{
"files": [ "*.peg" ],

"plugins": [ "@peggyjs" ],
"extends": ["plugin:@peggyjs/recommended"]
}

]
}
6 changes: 6 additions & 0 deletions .mocharc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
extension: '.spec.js',
loader: 'esmock',
colors: true,
require: 'mocha.conf.js'
}
24 changes: 24 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import gulp from 'gulp';
import tap from 'gulp-tap';
import rename from 'gulp-rename';
import peggy from 'peggy';

const buildParser = function() {
return gulp.src('selector.peg')
.pipe(tap(function(file) {
file.contents = new Buffer(peggy.generate(file.contents.toString('utf-8'), {
output: 'source',
format: 'es'
}));
}))
.pipe(rename(function(path) {
path.extname = '.js';
}))
.pipe(gulp.dest('.'));
}
buildParser.displayName = 'build-parser';

gulp.task(buildParser);
gulp.task(function watch() {
gulp.watch(['*.peg'], { usePolling: process.env.GULP_WATCH_POLLING }, buildParser);
});
5 changes: 5 additions & 0 deletions mocha.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import chai from 'chai';
import sinonChai from 'sinon-chai';

global.expect = chai.expect;
chai.use(sinonChai);
Loading

0 comments on commit c7bbba9

Please sign in to comment.