Skip to content

Commit

Permalink
HTML Reporter: Move files to src/ directory
Browse files Browse the repository at this point in the history
Simplifies the directory structure, and also fixes an omission
in grunt `watch-repeatable` and `search` tasks, which didn't
monitor the `runner/` directory.

Also simply ESLint config while at it. Moving the config to eslintrc,
means that `eslint .`, `eslint --fix .` and IDE integration also
understands it, instead of being hidden inside Grunt-specific wiring.
  • Loading branch information
Krinkle committed Jan 1, 2021
1 parent 7b7d159 commit 4846d3b
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 37 deletions.
19 changes: 15 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"constructor-super": "error",
"indent": ["error", "tab", {
"CallExpression": {
"arguments": 1
"arguments": 1
},
"MemberExpression": 1,
"SwitchCase": 0,
"outerIIFEBody": 1
"MemberExpression": 1,
"SwitchCase": 0,
"outerIIFEBody": 1
}],
"no-console": "off",
"no-const-assign": "error",
Expand All @@ -33,6 +33,7 @@
"wrap-iife": ["error", "any"]
},
"ignorePatterns": [
"__codeorigin/**",
"coverage/**",
"docs/_site/**",
"dist/**",
Expand Down Expand Up @@ -61,6 +62,16 @@
"rules": {
"no-process-exit": "off"
}
},
{
"files": [
"test/**/*.html"
],
"extends": ["eslint:recommended", "jquery"],
"rules": {
"wrap-iife": ["error", "any"],
"indent": "off"
}
}
]
}
19 changes: 3 additions & 16 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,7 @@ module.exports = function( grunt ) {
}
},
eslint: {
js: ".",
html: {
options: {
rules: {
indent: "off"
}
},
src: [

// Linting HTML files via eslint-plugin-html
"test/**/*.html"
]
}
all: "."
},
search: {
options: {
Expand All @@ -85,8 +73,7 @@ module.exports = function( grunt ) {
failOnMatch: true
},
xhtml: [
"src/**/*.js",
"reporter/**/*.js"
"src/**/*.js"
]
},
qunit: {
Expand Down Expand Up @@ -204,7 +191,7 @@ module.exports = function( grunt ) {
".eslintrc.json",
"*.js",
"build/*.js",
"{src,test,reporter}/**/*.js",
"{src,test}/**/*.js",
"src/qunit.css",
"test/*.{html,js}",
"test/**/*.html"
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@
"include": [
"bin/**",
"dist/**",
"reporter/**",
"runner/**",
"src/**"
],
"reporter": [
Expand Down
5 changes: 4 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ module.exports = {
// 1. Must not leak as global variable, since it's not full Map implementation.
// 2. Must be seen by fuzzysort as-is (e.g. not get renamed as normal
// variables in an imported file would be).
return fs.readFileSync( __dirname + "/reporter/es6-map.js", "utf-8" ).toString().trim();
return fs.readFileSync(
__dirname + "/src/html-reporter/es6-map.js",
"utf-8"
).toString().trim();
},

globals: {
Expand Down
1 change: 0 additions & 1 deletion runner/runner.js

This file was deleted.

2 changes: 1 addition & 1 deletion reporter/diff.js → src/html-reporter/diff.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import QUnit from "../src/core";
import QUnit from "../core";
import { escapeText } from "./html";

/*
Expand Down
2 changes: 1 addition & 1 deletion reporter/es6-map.js → src/html-reporter/es6-map.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Support IE 9-10, PhantomJS: Fallback for fuzzysort.js used by /reporter/html.js
// Support IE 9-10, PhantomJS: Fallback for fuzzysort.js used by ./html.js
// eslint-disable-next-line no-unused-vars
var Map = typeof Map === "function" ? Map : function StringMap() {
var store = Object.create( null );
Expand Down
4 changes: 2 additions & 2 deletions runner/fixture.js → src/html-reporter/fixture.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import QUnit from "../src/core";
import { window, document } from "../src/globals";
import QUnit from "../core";
import { window, document } from "../globals";

( function() {

Expand Down
10 changes: 5 additions & 5 deletions reporter/html.js → src/html-reporter/html.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import QUnit from "../src/core";
import Test from "../src/test";
import { extractStacktrace } from "../src/core/stacktrace";
import { now, extend } from "../src/core/utilities";
import { window, document, navigator, console } from "../src/globals";
import QUnit from "../core";
import Test from "../test";
import { extractStacktrace } from "../core/stacktrace";
import { now, extend } from "../core/utilities";
import { window, document, navigator, console } from "../globals";
import "./urlparams";
import fuzzysort from "fuzzysort";

Expand Down
1 change: 1 addition & 0 deletions reporter/reporter.js → src/html-reporter/reporter.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import "./fixture";
import "./diff";
import "./html";
4 changes: 2 additions & 2 deletions reporter/urlparams.js → src/html-reporter/urlparams.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import QUnit from "../src/core";
import { window } from "../src/globals";
import QUnit from "../core";
import { window } from "../globals";

( function() {

Expand Down
3 changes: 1 addition & 2 deletions src/qunit.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
import "./core";
import "../runner/runner";
import "../reporter/reporter";
import "./html-reporter/reporter";

0 comments on commit 4846d3b

Please sign in to comment.