Merge pull request #7897 from Snuffleupagus/eslint-switch

Switch to using ESLint, instead of JSHint, for linting
This commit is contained in:
Tim van der Meij 2016-12-16 22:40:41 +01:00 committed by GitHub
commit a719b71e59
86 changed files with 252 additions and 166 deletions

108
.eslintrc Normal file
View File

@ -0,0 +1,108 @@
{
"parserOptions": {
"ecmaVersion": 5,
},
"env": {
"browser": true,
"es6": true,
"worker": true,
"amd": true,
},
globals: {
"PDFJSDev": false,
"require": false,
"exports": false,
},
"rules": {
// Possible errors
"no-cond-assign": ["error", "except-parens"],
"no-constant-condition": ["error", { "checkLoops": false, }],
"no-dupe-args": "error",
"no-dupe-keys": "error",
"no-duplicate-case": "error",
"no-empty": ["error", { "allowEmptyCatch": true, }],
"no-ex-assign": "error",
"no-extra-boolean-cast": "error",
"no-extra-semi": "error",
"no-func-assign": "error",
"no-inner-declarations": ["error", "functions"],
"no-invalid-regexp": "error",
"no-irregular-whitespace": "error",
"no-obj-calls": "error",
"no-regex-spaces": "error",
"no-sparse-arrays": "error",
"no-unexpected-multiline": "error",
"no-unreachable": "error",
"no-unsafe-negation": "error",
"use-isnan": "error",
"valid-typeof": ["error", { "requireStringLiterals": true, }],
// Best Practices
"accessor-pairs": ["error", { "setWithoutGet": true, }],
"curly": ["error", "all"],
"eqeqeq": ["error", "always"],
"no-caller": "error",
"no-eval": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-extra-label": "error",
"no-fallthrough": "error",
"no-global-assign": "error",
"no-implied-eval": "error",
"no-multi-spaces": "error",
"no-multi-str": "error",
"no-new-func": "error",
"no-new-wrappers": "error",
"no-new": "error",
"no-octal-escape": "error",
"no-redeclare": "error",
"no-self-assign": "error",
"no-unused-expressions": "error",
"no-unused-labels": "error",
"no-useless-concat": "error",
"wrap-iife": ["error", "any"],
"yoda": ["error", "never", { "onlyEquality": true, }],
// Strict Mode
"strict": ["error", "global"],
// Variables
"no-catch-shadow": "error",
"no-label-var": "error",
"no-shadow-restricted-names": "error",
"no-undef-init": "error",
"no-undef": ["error", { "typeof": true, }],
// Stylistic Issues
"array-bracket-spacing": ["error", "never"],
"block-spacing": ["error", "always"],
"brace-style": ["error", "1tbs", { "allowSingleLine": true, }],
"comma-spacing": ["error", { "before": false, "after": true, }],
"comma-style": ["error", "last"],
"eol-last": "error",
"func-call-spacing": ["error", "never"],
"key-spacing": ["error", { "beforeColon": false, "afterColon": true, "mode": "strict", }],
"keyword-spacing": ["error", { "before": true, "after": true, }],
"linebreak-style": ["error", "unix"],
"max-len": ["error", 80],
"new-cap": ["error", { "newIsCap": true, "capIsNew": false, }],
"new-parens": "error",
"no-array-constructor": "error",
"no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 0, "maxBOF": 1, }],
"no-tabs": "error",
"no-trailing-spaces": ["error", { "skipBlankLines": false, }],
"no-whitespace-before-property": "error",
"operator-linebreak": ["error", "after", { "overrides": { ":": "ignore", } }],
"quotes": ["error", "single"],
"semi-spacing": ["error", { "before": false, "after": true, }],
"semi": ["error", "always"],
"space-before-blocks": ["error", "always"],
"space-before-function-paren": ["error", { "anonymous": "ignore", "named": "never", }],
"space-in-parens": ["error", "never"],
"space-infix-ops": ["error", { "int32Hint": false }],
"space-unary-ops": ["error", { "words": true, "nonwords": false, "overrides": { "void": false, }, }],
},
}

View File

@ -1,33 +0,0 @@
{
// Environments
"browser": true,
"devel": true,
"worker": true,
"predef": [
"Promise",
"PDFJSDev",
"require",
"define",
"exports"
],
// Enforcing
"maxlen": 80,
"quotmark": "single",
"trailing": true,
"curly": true,
"undef": true,
"noarg": true,
"nonbsp": true,
"eqeqeq": true,
// Relaxing
"boss": true,
"funcscope": true,
"globalstrict": true,
"loopfunc": true,
"maxerr": 1000,
"nonstandard": true,
"sub": true,
"validthis": true
}

View File

@ -12,8 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals PDFJS, Promise */
/* globals PDFJS */
'use strict';

View File

@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/* eslint strict: ["error", "function"] */
/* globals chrome */
(function() {

View File

@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/* globals chrome, Promise */
/* globals chrome */
'use strict';
var storageAreaName = chrome.storage.sync ? 'sync' : 'local';

View File

@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/* eslint strict: ["error", "function"] */
/* globals chrome, getViewerURL */
(function() {

View File

@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/* eslint strict: ["error", "function"] */
/* globals chrome, crypto, Headers, Request */
(function() {

View File

@ -0,0 +1,9 @@
{
"extends": [
../../.eslintrc
],
"parserOptions": {
"ecmaVersion": 6
},
}

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* jshint esnext:true */
/* globals Components, Services, dump, XPCOMUtils, PdfStreamConverter,
APP_SHUTDOWN, PdfjsChromeUtils, PdfjsContentUtils */

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* jshint esnext:true */
/* globals Components, Services, XPCOMUtils, PdfjsContentUtils,
PdfjsContentUtils, PdfStreamConverter, addMessageListener */

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* jshint esnext:true, maxlen:100 */
/* eslint max-len: ["error", 100] */
'use strict';

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* jshint esnext:true */
/* globals Components, Services, XPCOMUtils, PdfjsChromeUtils,
PdfjsContentUtils, PdfStreamConverter */

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* jshint esnext:true, maxlen:120 */
/* eslint max-len: ["error", 120] */
/* globals Components, Services */
'use strict';

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* jshint esnext:true, maxlen: 100 */
/* eslint max-len: ["error", 100] */
/* globals Components, Services */
'use strict';

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* jshint esnext:true */
/* globals Components, Services, XPCOMUtils, NetUtil, PrivateBrowsingUtils,
dump, NetworkManager, PdfJsTelemetry, PdfjsContentUtils */

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* jshint esnext:true */
/* globals Components, Services, XPCOMUtils */
'use strict';

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* jshint esnext:true */
/* globals Components, Services, XPCOMUtils */
'use strict';

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* jshint esnext:true */
/* globals Components, PdfjsContentUtils, PdfJs, Services */
'use strict';

View File

@ -1,4 +1,3 @@
'use strict';
// Small subset of the webL10n API by Fabien Cazenave for pdf.js extension.

10
external/.eslintrc vendored Normal file
View File

@ -0,0 +1,10 @@
{
"extends": [
../.eslintrc
],
"env": {
"node": true,
"shelljs": true,
},
}

View File

@ -1,6 +1,3 @@
/* jshint node:true */
/* globals cp, ls, test */
'use strict';
var fs = require('fs'),
@ -107,10 +104,8 @@ function preprocess(inFilename, outFilename, defines) {
var line;
var state = STATE_NONE;
var stack = [];
var control =
/* jshint -W101 */
var control = // eslint-disable-next-line max-len
/^(?:\/\/|<!--)\s*#(if|elif|else|endif|expand|include|error)\b(?:\s+(.*?)(?:-->)?$)?/;
/* jshint +W101 */
var lineNumber = 0;
var loc = function() {
return fs.realpathSync(inFilename) + ':' + lineNumber;

11
external/builder/fixtures/.eslintrc vendored Normal file
View File

@ -0,0 +1,11 @@
{
"extends": [
../../.eslintrc
],
"rules": {
"no-empty": "off",
"keyword-spacing": "off",
"space-infix-ops": "off",
},
}

View File

@ -1,5 +1,3 @@
/* jshint node:true */
'use strict';
var esprima = require('esprima');
@ -197,8 +195,12 @@ function fixComments(ctx, node) {
}
// Fixes double comments in the escodegen output.
delete node.trailingComments;
// Removes jshint and other service comments.
// Removes ESLint and other service comments.
if (node.leadingComments) {
var CopyrightRegExp = /\bcopyright\b/i;
var BlockCommentRegExp = /^\s*(globals|eslint|falls through|umdutils)\b/;
var LineCommentRegExp = /^\s*eslint\b/;
var i = 0;
while (i < node.leadingComments.length) {
var type = node.leadingComments[i].type;
@ -206,12 +208,12 @@ function fixComments(ctx, node) {
if (ctx.saveComments === 'copyright') {
// Remove all comments, except Copyright notices and License headers.
if (!(type === 'Block' && /\bcopyright\b/i.test(value))) {
if (!(type === 'Block' && CopyrightRegExp.test(value))) {
node.leadingComments.splice(i, 1);
continue;
}
} else if (type === 'Block' &&
/^\s*(globals|jshint|falls through|umdutils)\b/.test(value)) {
} else if ((type === 'Block' && BlockCommentRegExp.test(value)) ||
(type === 'Line' && LineCommentRegExp.test(value))) {
node.leadingComments.splice(i, 1);
continue;
}

View File

@ -1,5 +1,3 @@
/* jshint node:true */
/* globals cat, cd, echo, ls */
'use strict';
require('shelljs/make');

View File

@ -1,5 +1,3 @@
/* jshint node:true */
/* globals cat, cd, echo, ls */
'use strict';
require('shelljs/make');

View File

@ -1,6 +1,3 @@
/* jshint node:true */
/* globals cat, echo, exit, ls */
'use strict';
function checkIfCrlfIsPresent(files) {

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* jshint node:true */
'use strict';

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* jshint node:true */
'use strict';

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* jshint node:true */
/* eslint-env node */
/* globals target */
'use strict';
@ -529,12 +529,12 @@ gulp.task('lint', function (done) {
console.log();
console.log('### Linting JS files');
// Lint the Firefox specific *.jsm files.
var options = ['node_modules/jshint/bin/jshint', '--extra-ext', '.jsm', '.'];
var jshintProcess = spawn('node', options, {stdio: 'inherit'});
jshintProcess.on('close', function (code) {
// Ensure that we lint the Firefox specific *.jsm files too.
var options = ['node_modules/eslint/bin/eslint', '--ext', '.js,.jsm', '.'];
var esLintProcess = spawn('node', options, {stdio: 'inherit'});
esLintProcess.on('close', function (code) {
if (code !== 0) {
done(new Error('jshint failed.'));
done(new Error('ESLint failed.'));
return;
}

View File

@ -12,9 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* jshint node:true */
/* globals cat, cd, cp, echo, env, exec, exit, find, ls, mkdir, mv, process, rm,
sed, target, test */
/* eslint-env node, shelljs */
'use strict';

View File

@ -3,13 +3,13 @@
"version": "0.8.0",
"devDependencies": {
"escodegen": "^1.8.0",
"eslint": "^3.11.1",
"esprima": "^2.7.2",
"gulp": "^3.9.1",
"gulp-util": "^3.0.7",
"gulp-zip": "^3.2.0",
"jasmine-core": "^2.4.1",
"jsdoc": "^3.3.0-alpha9",
"jshint": "~2.8.0",
"mkdirp": "^0.5.1",
"node-ensure": "^0.0.0",
"requirejs": "^2.1.22",

View File

@ -983,7 +983,7 @@ var Font = (function FontClosure() {
// Split the sorted codes into ranges.
var ranges = [];
var length = codes.length;
for (var n = 0; n < length; ) {
for (var n = 0; n < length; ) { // eslint-disable-line space-in-parens
var start = codes[n].fontCharCode;
var codeIndices = [codes[n].glyphId];
++n;

View File

@ -423,7 +423,7 @@ var PDFFunction = (function PDFFunctionClosure() {
// Compiled function consists of simple expressions such as addition,
// subtraction, Math.max, and also contains 'var' and 'return'
// statements. See the generation in the PostScriptCompiler below.
/*jshint -W054 */
// eslint-disable-next-line no-new-func
return new Function('src', 'srcOffset', 'dest', 'destOffset', compiled);
}

View File

@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable no-multi-spaces */
'use strict';

View File

@ -1,4 +1,3 @@
/* Copyright 2014 Opera Software ASA
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -48,6 +47,7 @@ var MurmurHash3_64 = (function MurmurHash3_64Closure(seed) {
!PDFJSDev.test('FIREFOX || MOZCENTRAL || CHROME')) {
// old webkits have issues with non-aligned arrays
try {
// eslint-disable-next-line no-new
new Uint32Array(new Uint8Array(5).buffer, 0, 1);
} catch (e) {
alwaysUseUint32ArrayView = true;

View File

@ -248,29 +248,29 @@ var Parser = (function ParserClosure() {
case 0xC1: // SOF1
case 0xC2: // SOF2
case 0xC3: // SOF3
/* falls through */
case 0xC5: // SOF5
case 0xC6: // SOF6
case 0xC7: // SOF7
/* falls through */
case 0xC9: // SOF9
case 0xCA: // SOF10
case 0xCB: // SOF11
/* falls through */
case 0xCD: // SOF13
case 0xCE: // SOF14
case 0xCF: // SOF15
/* falls through */
case 0xC4: // DHT
case 0xCC: // DAC
/* falls through */
case 0xDA: // SOS
case 0xDB: // DQT
case 0xDC: // DNL
case 0xDD: // DRI
case 0xDE: // DHP
case 0xDF: // EXP
/* falls through */
case 0xE0: // APP0
case 0xE1: // APP1
case 0xE2: // APP2
@ -287,7 +287,7 @@ var Parser = (function ParserClosure() {
case 0xED: // APP13
case 0xEE: // APP14
case 0xEF: // APP15
/* falls through */
case 0xFE: // COM
// The marker should be followed by the length of the segment.
markerLength = stream.getUint16();

View File

@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable no-multi-spaces */
'use strict';

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals NetworkManager, module */
/* globals module */
'use strict';
@ -83,14 +83,13 @@ var WorkerTask = (function WorkerTaskClosure() {
})();
if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) {
/*jshint -W082 */
/**
* Interface that represents PDF data transport. If possible, it allows
* progressively load entire or fragment of the PDF binary data.
*
* @interface
* */
function IPDFStream() {}
*/
function IPDFStream() {} // eslint-disable-line no-inner-declarations
IPDFStream.prototype = {
/**
* Gets a reader for the entire PDF data.
@ -118,7 +117,7 @@ IPDFStream.prototype = {
*
* @interface
*/
function IPDFStreamReader() {}
function IPDFStreamReader() {} // eslint-disable-line no-inner-declarations
IPDFStreamReader.prototype = {
/**
* Gets a promise that is resolved when the headers and other metadata of
@ -179,7 +178,7 @@ IPDFStreamReader.prototype = {
*
* @interface
*/
function IPDFStreamRangeReader() {}
function IPDFStreamRangeReader() {} // eslint-disable-line no-inner-declarations
IPDFStreamRangeReader.prototype = {
/**
* Gets ability of the stream to progressively load binary data.

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
/* globals pdfjsFilePath, pdfjsVersion, pdfjsBuild, requirejs, pdfjsLibs,
WeakMap */
__webpack_require__ */
'use strict';

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals ImageData */
'use strict';

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals FontFace */
'use strict';
@ -426,7 +425,7 @@ var FontFaceObject = (function FontFaceObjectClosure() {
js += 'c.' + current.cmd + '(' + args + ');\n';
}
/* jshint -W054 */
// eslint-disable-next-line no-new-func
this.compiledGlyphs[character] = new Function('c', 'size', js);
} else {
// But fall back on using Function.prototype.apply() if we're

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals Document */
'use strict';

View File

@ -460,7 +460,7 @@ var SVGGraphics = (function SVGGraphicsClosure() {
convertOpList: function SVGGraphics_convertOpList(operatorList) {
var argsArray = operatorList.argsArray;
var fnArray = operatorList.fnArray;
var fnArrayLen = fnArray.length;
var fnArrayLen = fnArray.length;
var REVOPS = [];
var opList = [];

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals WeakMap */
'use strict';

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* jshint -W043 */
/* eslint-disable no-multi-str */
'use strict';

View File

@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable strict */
/*
NOTE: This file is created as a helper to assist with JSDoc html files.

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* jshint globalstrict: false */
/* eslint strict: ["error", "function"] */
/* umdutils ignore */
(function (root, factory) {

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable strict */
(typeof window !== 'undefined' ? window : {}).pdfjsDistBuildPdfWorker =
require('./pdf.worker.js');

View File

@ -73,7 +73,7 @@ function readCharstringEncoding(aString) {
var charstringTokens = [];
var count = aString.length;
for (var i = 0; i < count; ) {
for (var i = 0; i < count; ) { // eslint-disable-line space-in-parens
var value = aString[i++] | 0;
var token = null;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals URL, global */
/* globals global */
'use strict';
@ -620,8 +620,7 @@ function isLittleEndian() {
// Checks if it's possible to eval JS expressions.
function isEvalSupported() {
try {
/* jshint evil: true */
new Function('');
new Function(''); // eslint-disable-line no-new, no-new-func
return true;
} catch (e) {
return false;
@ -1756,6 +1755,8 @@ if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('MOZCENTRAL')) {
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
(function checkURLConstructor(scope) {
/* eslint-disable yoda */
// feature detect for URL constructor
var hasWorkingUrl = false;
try {
@ -2392,6 +2393,8 @@ if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('MOZCENTRAL')) {
}
scope.URL = JURL;
/* eslint-enable yoda */
})(globalScope);
}

11
test/.eslintrc Normal file
View File

@ -0,0 +1,11 @@
{
"extends": [
../.eslintrc
],
"env": {
"node": true,
"shelljs": true,
"jasmine": true,
},
}

View File

@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*jslint node: true */
'use strict';

View File

@ -34,7 +34,7 @@
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*globals jasmineRequire, jasmine, TestReporter */
/* globals jasmineRequire, TestReporter */
// Modified jasmine's boot.js file to load PDF.js libraries async.

View File

@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*jslint node: true */
'use strict';

View File

@ -1,5 +1,3 @@
/*jslint node: true */
'use strict';
var fs = require('fs');

View File

@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*jslint node: true */
'use strict';

View File

@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*jslint node: true */
'use strict';

View File

@ -1,8 +1,7 @@
/* globals expect, it, describe, Dict, Name, Annotation, AnnotationBorderStyle,
AnnotationBorderStyleType, AnnotationType, AnnotationFlag, PDFJS,
beforeEach, afterEach, stringToBytes, AnnotationFactory, Ref, isRef,
beforeAll, afterAll, AnnotationFieldFlag, stringToUTF8String,
StringStream, Lexer, Parser */
/* globals isRef, AnnotationFactory, Dict, Name, Ref, AnnotationType,
AnnotationFlag, Annotation, AnnotationBorderStyle,
AnnotationBorderStyleType, StringStream, Lexer, Parser,
stringToUTF8String, AnnotationFieldFlag, PDFJS, stringToBytes */
'use strict';

View File

@ -1,7 +1,6 @@
/* globals PDFJS, expect, it, describe, Promise, beforeAll,
InvalidPDFException, MissingPDFException, StreamType, FontType,
PDFDocumentProxy, PasswordException, PasswordResponses, afterAll,
PDFPageProxy, createPromiseCapability, afterEach */
/* globals PDFJS, createPromiseCapability, PDFDocumentProxy,
InvalidPDFException, MissingPDFException, PasswordResponses,
PasswordException, PDFPageProxy, StreamType, FontType */
'use strict';

View File

@ -1,6 +1,5 @@
/* globals describe, it, expect, beforeAll, afterAll, beforeEach, afterEach,
Stream, CFFParser, SEAC_ANALYSIS_ENABLED, CFFIndex, CFFStrings,
CFFCompiler */
/* globals Stream, CFFParser, SEAC_ANALYSIS_ENABLED, CFFIndex, CFFParser,
CFFStrings, CFFCompiler */
'use strict';

View File

@ -1,5 +1,4 @@
/* globals expect, it, describe, StringStream, CMapFactory, Name, CMap,
IdentityCMap */
/* globals StringStream, CMapFactory, CMap, IdentityCMap, Name */
'use strict';

View File

@ -1,7 +1,7 @@
/* globals expect, it, describe, calculateMD5, ARCFourCipher, Name, beforeAll,
CipherTransformFactory, calculateSHA256, calculateSHA384, afterAll,
calculateSHA512, AES128Cipher, AES256Cipher, PDF17, PDF20, Dict,
PasswordException, PasswordResponses, stringToBytes */
/* globals stringToBytes, calculateMD5, ARCFourCipher, calculateSHA256,
calculateSHA384, calculateSHA512, AES128Cipher, AES256Cipher, PDF17,
PDF20, Dict, CipherTransformFactory, PasswordException,
PasswordResponses, Name */
'use strict';
@ -482,6 +482,7 @@ describe('CipherTransformFactory', function() {
function ensurePasswordNeeded(done, dict, fileId, password) {
try {
// eslint-disable-next-line no-new
new CipherTransformFactory(dict, fileId, password);
} catch (ex) {
expect(ex instanceof PasswordException).toEqual(true);
@ -495,6 +496,7 @@ describe('CipherTransformFactory', function() {
function ensurePasswordIncorrect(done, dict, fileId, password) {
try {
// eslint-disable-next-line no-new
new CipherTransformFactory(dict, fileId, password);
} catch (ex) {
expect(ex instanceof PasswordException).toEqual(true);

View File

@ -1,5 +1,4 @@
/* globals expect, it, describe, PDFJS, isExternalLinkTargetSet, LinkTarget,
getFilenameFromUrl, beforeAll, afterAll */
/* globals getFilenameFromUrl, PDFJS, LinkTarget, isExternalLinkTargetSet */
'use strict';

View File

@ -1,5 +1,5 @@
/* globals expect, it, describe, PartialEvaluator, StringStream, OPS,
OperatorList, Dict, Name, Stream, WorkerTask */
/* globals OperatorList, WorkerTask, PartialEvaluator, StringStream, OPS, Dict,
Name, Stream */
'use strict';

View File

@ -1,4 +1,4 @@
/* globals describe, it, expect, checkProblematicCharRanges */
/* globals checkProblematicCharRanges */
'use strict';

View File

@ -1,6 +1,5 @@
/* globals jasmine, expect, it, describe, beforeEach, isArray, StringStream,
PostScriptParser, PostScriptLexer, PostScriptEvaluator,
PostScriptCompiler*/
/* globals isArray, StringStream, PostScriptParser, PostScriptLexer,
PostScriptEvaluator, PostScriptCompiler */
'use strict';
@ -433,7 +432,7 @@ describe('function', function() {
expect(compiledCode).toBeNull();
} else {
expect(compiledCode).not.toBeNull();
/*jshint -W054 */
// eslint-disable-next-line no-new-func
var fn = new Function('src', 'srcOffset', 'dest', 'destOffset',
compiledCode);
for (var i = 0; i < samples.length; i++) {

View File

@ -34,7 +34,7 @@
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*globals jasmineRequire, jasmine, TestReporter */
/* globals jasmineRequire, TestReporter */
// Modified jasmine's boot.js file to load PDF.js libraries async.

View File

@ -1,4 +1,4 @@
/* globals expect, it, describe, Metadata */
/* globals Metadata */
'use strict';

View File

@ -1,4 +1,4 @@
/* globals jasmine, expect, it, describe, MurmurHash3_64 */
/* globals MurmurHash3_64 */
'use strict';
@ -49,4 +49,4 @@ describe('MurmurHash3_64', function() {
hexdigest2 = hash.hexdigest();
expect(hexdigest1).not.toEqual(hexdigest2);
});
});
});

View File

@ -1,4 +1,4 @@
/* globals expect, it, describe, PDFNetworkStream */
/* globals PDFNetworkStream */
'use strict';

View File

@ -1,4 +1,4 @@
/* globals expect, it, describe, StringStream, Lexer, Name, Linearization */
/* globals StringStream, Lexer, Name, Linearization */
'use strict';

View File

@ -1,5 +1,4 @@
/* globals jasmine, expect, it, describe, beforeEach, Stream, PredictorStream,
Dict */
/* globals Stream, PredictorStream, Dict */
'use strict';

View File

@ -1,4 +1,3 @@
'use strict';
var TestReporter = function(browser, appPath) {

View File

@ -1,5 +1,4 @@
/* globals describe, it, expect, StringStream, Type1Parser,
SEAC_ANALYSIS_ENABLED */
/* globals StringStream, Type1Parser, SEAC_ANALYSIS_ENABLED */
'use strict';

View File

@ -1,6 +1,6 @@
/* globals describe, it, expect, beforeAll, afterAll, mapSpecialUnicodeValues,
getUnicodeForGlyph, getGlyphsUnicode, getDingbatsGlyphsUnicode,
getUnicodeRangeFor, getNormalizedUnicodes, reverseIfRtl */
/* globals mapSpecialUnicodeValues, getUnicodeForGlyph, getGlyphsUnicode,
getDingbatsGlyphsUnicode, getUnicodeRangeFor, getNormalizedUnicodes,
reverseIfRtl */
'use strict';

View File

@ -1,4 +1,4 @@
/* globals describe, it, expect, stringToPDFString, removeNullCharacters */
/* globals stringToPDFString, removeNullCharacters */
'use strict';

View File

@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*jslint node: true */
'use strict';

View File

@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*jslint node: true */
'use strict';

View File

@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals chrome, DEFAULT_URL */
'use strict';
(function (root, factory) {
@ -201,9 +201,11 @@
// Use Chrome's definition of UI language instead of PDF.js's #lang=...,
// because the shown string should match the UI at chrome://extensions.
// These strings are from chrome/app/resources/generated_resources_*.xtb.
/* eslint-disable no-unexpected-multiline */
var i18nFileAccessLabel =
PDFJSDev.json('$ROOT/web/chrome-i18n-allow-access-to-file-urls.json')
[chrome.i18n.getUILanguage && chrome.i18n.getUILanguage()];
/* eslint-enable no-unexpected-multiline */
if (i18nFileAccessLabel) {
document.getElementById('chrome-file-access-label').textContent =

View File

@ -12,6 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint strict: ["error", "function"] */
/* eslint-disable no-extend-native */
/* globals VBArray, PDFJS */
(function compatibilityWrapper() {

View File

@ -26,7 +26,7 @@
}
}(this, function (exports, pdfjsLib) {
if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC || CHROME')) {
/* jshint -W082 */
// eslint-disable-next-line no-inner-declarations
function download(blobUrl, filename) {
var a = document.createElement('a');
if (a.click) {
@ -63,7 +63,7 @@ if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC || CHROME')) {
}
}
function DownloadManager() {}
function DownloadManager() {} // eslint-disable-line no-inner-declarations
DownloadManager.prototype = {
downloadUrl: function DownloadManager_downloadUrl(url, filename) {

View File

@ -122,7 +122,7 @@
}
if (event.originalTarget) {
try {
/* jshint expr:true */
// eslint-disable-next-line no-unused-expressions
event.originalTarget.tagName;
} catch (e) {
// Mozilla-specific: element is a scrollbar (XUL element)

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* jshint globalstrict: false */
/* eslint strict: ["error", "function"] */
/* umdutils ignore */
(function (root, factory) {

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals DEFAULT_PREFERENCES, chrome */
/* globals DEFAULT_PREFERENCES */
'use strict';

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*globals require, chrome */
/* globals chrome */
'use strict';