Implemented eslintbrowser task

dependabot/npm_and_yarn/BuildServer/eslint-7.2.0
Inga 🏳‍🌈 8 years ago
parent ef5f588e26
commit 007bba2093
  1. 31
      BuildServer/lib/tasks/eslintbrowser.js
  2. 38
      BuildServer/lib/tasks/eslintbrowserall.js
  3. 6
      BuildServer/lib/tasks/packform.js
  4. 1
      BuildServer/package.json
  5. 12
      BuildServer/settings-eslint-browser.json

@ -0,0 +1,31 @@
"use strict";
const fs = require('fs');
const path = require('path');
const CLIEngine = require("eslint").CLIEngine;
const settings = require("../../settings");
const cli = new CLIEngine({
configFile: settings.eslintBrowserConfig
});
module.exports = (params, processor) => ({
process: () => {
const filePath = path.normalize(processor.context.exported + "/" + params.filename);
const result = cli.executeOnFiles([filePath]);
processor.onInfo("ESLinted " + params.filename);
result.results.forEach((subresult) => {
subresult.messages.forEach((message) => {
const messageText = params.filename + ":" + message.line + "," + message.column + " (" + message.ruleId + ") " + message.message;
if (message.fatal || message.severity === 2) {
processor.onError(messageText);
} else {
processor.onWarn(messageText);
}
});
});
processor.done();
}
});

@ -0,0 +1,38 @@
"use strict";
const glob = require('glob');
module.exports = (params, processor) => ({
process: () => {
if (processor.context.eslintbrowserallDone) {
processor.onWarn("eslintbrowserall task is executed more than once; this is probably a bug in your mbs.json");
}
processor.context.eslintbrowserallDone = true;
const excludeFiles = params.excludeFiles || [];
glob("**/*.js", {
dot: true,
cwd: processor.context.exported
}, (err, files) => {
if (err) {
processor.onError(err);
return processor.done();
}
return processor.processTask({
type: params.preventParallelTests ? "sequential" : "parallel",
params: {
tasks: files.filter(file => !excludeFiles.includes(file)).map((file) => ({
name: file,
type: "eslintbrowser",
params: {
filename: file
}
}))
}
}, processor.done.bind(processor));
});
}
});

@ -4,6 +4,12 @@ const sequential = require('./sequential');
module.exports = (params, processor) => sequential({ module.exports = (params, processor) => sequential({
tasks: [ tasks: [
{
type: "eslintbrowserall",
params: {
excludeFiles: params.eslintExcludeFiles
}
},
{ {
type: "uglifyjsall" type: "uglifyjsall"
}, },

@ -11,6 +11,7 @@
"body-parser": "^1.15.2", "body-parser": "^1.15.2",
"cssnano": "^3.9.1", "cssnano": "^3.9.1",
"errorhandler": "^1.5.0", "errorhandler": "^1.5.0",
"eslint": "^3.12.2",
"express": "4.14.0", "express": "4.14.0",
"fs-extra": "^1.0.0", "fs-extra": "^1.0.0",
"github": "~7.1.0", "github": "~7.1.0",

@ -0,0 +1,12 @@
{
"env": {
"browser": true
},
"useEslintrc": false,
"extends": "eslint:all",
"rules": {
"quotes": ["warn", "double"],
"no-var": "off",
"require-jsdoc": "off"
}
}
Loading…
Cancel
Save