Merge pull request #7897 from Snuffleupagus/eslint-switch
Switch to using ESLint, instead of JSHint, for linting
This commit is contained in:
commit
a719b71e59
108
.eslintrc
Normal file
108
.eslintrc
Normal 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, }, }],
|
||||
},
|
||||
}
|
33
.jshintrc
33
.jshintrc
@ -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
|
||||
}
|
@ -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';
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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';
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
9
extensions/firefox/.eslintrc
Normal file
9
extensions/firefox/.eslintrc
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": [
|
||||
../../.eslintrc
|
||||
],
|
||||
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 6
|
||||
},
|
||||
}
|
1
extensions/firefox/bootstrap.js
vendored
1
extensions/firefox/bootstrap.js
vendored
@ -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 */
|
||||
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
@ -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
10
external/.eslintrc
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": [
|
||||
../.eslintrc
|
||||
],
|
||||
|
||||
"env": {
|
||||
"node": true,
|
||||
"shelljs": true,
|
||||
},
|
||||
}
|
7
external/builder/builder.js
vendored
7
external/builder/builder.js
vendored
@ -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
11
external/builder/fixtures/.eslintrc
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": [
|
||||
../../.eslintrc
|
||||
],
|
||||
|
||||
"rules": {
|
||||
"no-empty": "off",
|
||||
"keyword-spacing": "off",
|
||||
"space-infix-ops": "off",
|
||||
},
|
||||
}
|
14
external/builder/preprocessor2.js
vendored
14
external/builder/preprocessor2.js
vendored
@ -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;
|
||||
}
|
||||
|
2
external/builder/test.js
vendored
2
external/builder/test.js
vendored
@ -1,5 +1,3 @@
|
||||
/* jshint node:true */
|
||||
/* globals cat, cd, echo, ls */
|
||||
'use strict';
|
||||
|
||||
require('shelljs/make');
|
||||
|
2
external/builder/test2.js
vendored
2
external/builder/test2.js
vendored
@ -1,5 +1,3 @@
|
||||
/* jshint node:true */
|
||||
/* globals cat, cd, echo, ls */
|
||||
'use strict';
|
||||
|
||||
require('shelljs/make');
|
||||
|
3
external/crlfchecker/crlfchecker.js
vendored
3
external/crlfchecker/crlfchecker.js
vendored
@ -1,6 +1,3 @@
|
||||
/* jshint node:true */
|
||||
/* globals cat, echo, exit, ls */
|
||||
|
||||
'use strict';
|
||||
|
||||
function checkIfCrlfIsPresent(files) {
|
||||
|
1
external/crlfchecker/normtext.js
vendored
1
external/crlfchecker/normtext.js
vendored
@ -12,7 +12,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* jshint node:true */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
1
external/importL10n/locales.js
vendored
1
external/importL10n/locales.js
vendored
@ -12,7 +12,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* jshint node:true */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
12
gulpfile.js
12
gulpfile.js
@ -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;
|
||||
}
|
||||
|
||||
|
4
make.js
4
make.js
@ -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';
|
||||
|
||||
|
@ -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",
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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.
|
||||
|
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* globals pdfjsFilePath, pdfjsVersion, pdfjsBuild, requirejs, pdfjsLibs,
|
||||
WeakMap */
|
||||
__webpack_require__ */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* globals ImageData */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -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
|
||||
|
@ -12,7 +12,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* globals Document */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -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 = [];
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* globals WeakMap */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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) {
|
||||
|
@ -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');
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
11
test/.eslintrc
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": [
|
||||
../.eslintrc
|
||||
],
|
||||
|
||||
"env": {
|
||||
"node": true,
|
||||
"shelljs": true,
|
||||
"jasmine": true,
|
||||
},
|
||||
}
|
@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*jslint node: true */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -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.
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*jslint node: true */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
/*jslint node: true */
|
||||
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
|
@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*jslint node: true */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*jslint node: true */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* globals expect, it, describe, StringStream, CMapFactory, Name, CMap,
|
||||
IdentityCMap */
|
||||
/* globals StringStream, CMapFactory, CMap, IdentityCMap, Name */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -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);
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* globals expect, it, describe, PDFJS, isExternalLinkTargetSet, LinkTarget,
|
||||
getFilenameFromUrl, beforeAll, afterAll */
|
||||
/* globals getFilenameFromUrl, PDFJS, LinkTarget, isExternalLinkTargetSet */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* globals describe, it, expect, checkProblematicCharRanges */
|
||||
/* globals checkProblematicCharRanges */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -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++) {
|
||||
|
@ -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.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* globals expect, it, describe, Metadata */
|
||||
/* globals Metadata */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* globals expect, it, describe, PDFNetworkStream */
|
||||
/* globals PDFNetworkStream */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* globals expect, it, describe, StringStream, Lexer, Name, Linearization */
|
||||
/* globals StringStream, Lexer, Name, Linearization */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* globals jasmine, expect, it, describe, beforeEach, Stream, PredictorStream,
|
||||
Dict */
|
||||
/* globals Stream, PredictorStream, Dict */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
var TestReporter = function(browser, appPath) {
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* globals describe, it, expect, StringStream, Type1Parser,
|
||||
SEAC_ANALYSIS_ENABLED */
|
||||
/* globals StringStream, Type1Parser, SEAC_ANALYSIS_ENABLED */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* globals describe, it, expect, stringToPDFString, removeNullCharacters */
|
||||
/* globals stringToPDFString, removeNullCharacters */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*jslint node: true */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*jslint node: true */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -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 =
|
||||
|
@ -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() {
|
||||
|
@ -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) {
|
||||
|
@ -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)
|
||||
|
@ -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) {
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user