mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Fix the remaining cases of inconsistent spacing and trailing commas in objects, and enable the comma-dangle
and object-curly-spacing
ESLint rules
http://eslint.org/docs/rules/comma-dangle http://eslint.org/docs/rules/object-curly-spacing *Please note:* This patch was created automatically, using the ESLint `--fix` command line option. In a couple of places this caused lines to become too long, and I've fixed those manually; please refer to the interdiff below for the only hand-edits in this patch. ```diff diff --git a/gulpfile.js b/gulpfile.js index d18b9c58..7d47fd8d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1247,7 +1247,8 @@ gulp.task('gh-pages-git', ['gh-pages-prepare', 'wintersmith'], function () { var reason = process.env['PDFJS_UPDATE_REASON']; safeSpawnSync('git', ['init'], { cwd: GH_PAGES_DIR, }); - safeSpawnSync('git', ['remote', 'add', 'origin', REPO], { cwd: GH_PAGES_DIR, }); + safeSpawnSync('git', ['remote', 'add', 'origin', REPO], + { cwd: GH_PAGES_DIR, }); safeSpawnSync('git', ['add', '-A'], { cwd: GH_PAGES_DIR, }); safeSpawnSync('git', [ 'commit', '-am', 'gh-pages site created via gulpfile.js script', ```
This commit is contained in:
parent
a3fae906a6
commit
4a906955c4
7 changed files with 107 additions and 98 deletions
16
external/builder/preprocessor2.js
vendored
16
external/builder/preprocessor2.js
vendored
|
@ -22,7 +22,7 @@ function evalWithDefines(code, defines, loc) {
|
|||
if (!code || !code.trim()) {
|
||||
throw new Error('No JavaScript expression given');
|
||||
}
|
||||
return vm.runInNewContext(code, defines, {displayErrors: false});
|
||||
return vm.runInNewContext(code, defines, { displayErrors: false, });
|
||||
}
|
||||
|
||||
function handlePreprocessorAction(ctx, actionName, args, loc) {
|
||||
|
@ -36,7 +36,7 @@ function handlePreprocessorAction(ctx, actionName, args, loc) {
|
|||
throw new Error('No code for testing is given');
|
||||
}
|
||||
var isTrue = !!evalWithDefines(arg.value, ctx.defines);
|
||||
return {type: 'Literal', value: isTrue, loc: loc};
|
||||
return { type: 'Literal', value: isTrue, loc: loc, };
|
||||
case 'eval':
|
||||
arg = args[0];
|
||||
if (!arg || arg.type !== 'Literal' ||
|
||||
|
@ -46,7 +46,7 @@ function handlePreprocessorAction(ctx, actionName, args, loc) {
|
|||
var result = evalWithDefines(arg.value, ctx.defines);
|
||||
if (typeof result === 'boolean' || typeof result === 'string' ||
|
||||
typeof result === 'number') {
|
||||
return {type: 'Literal', value: result, loc: loc};
|
||||
return { type: 'Literal', value: result, loc: loc, };
|
||||
}
|
||||
if (typeof result === 'object') {
|
||||
var parsedObj = acorn.parse('(' + JSON.stringify(result) + ')');
|
||||
|
@ -94,7 +94,7 @@ function postprocessNode(ctx, node) {
|
|||
return node.consequent;
|
||||
} else if (isLiteral(node.test, false)) {
|
||||
// if (false) stmt1; else stmt2; => stmt2
|
||||
return node.alternate || {type: 'EmptyStatement', loc: node.loc};
|
||||
return node.alternate || { type: 'EmptyStatement', loc: node.loc, };
|
||||
}
|
||||
break;
|
||||
case 'ConditionalExpression':
|
||||
|
@ -110,13 +110,13 @@ function postprocessNode(ctx, node) {
|
|||
if (node.operator === 'typeof' &&
|
||||
isPDFJSPreprocessor(node.argument)) {
|
||||
// typeof PDFJSDev => 'object'
|
||||
return {type: 'Literal', value: 'object', loc: node.loc};
|
||||
return { type: 'Literal', value: 'object', loc: node.loc, };
|
||||
}
|
||||
if (node.operator === '!' &&
|
||||
node.argument.type === 'Literal' &&
|
||||
typeof node.argument.value === 'boolean') {
|
||||
// !true => false, !false => true
|
||||
return {type: 'Literal', value: !node.argument.value, loc: node.loc};
|
||||
return { type: 'Literal', value: !node.argument.value, loc: node.loc, };
|
||||
}
|
||||
break;
|
||||
case 'LogicalExpression':
|
||||
|
@ -157,7 +157,7 @@ function postprocessNode(ctx, node) {
|
|||
return {
|
||||
type: 'Literal',
|
||||
value: (node.operator[0] === '=') === equal,
|
||||
loc: node.loc
|
||||
loc: node.loc,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ function preprocessPDFJSCode(ctx, code) {
|
|||
var format = ctx.format || {
|
||||
indent: {
|
||||
style: ' ',
|
||||
}
|
||||
},
|
||||
};
|
||||
var parseOptions = {
|
||||
locations: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue