Re-factor how the ESLint no-var rule is enabled in the src/ folder

This simplifies/consolidates the ESLint configuration slightly in the `src/` folder, and prevents the addition of any new files where `var` is being used.[1]
Hence we no longer need to manually add `/* eslint no-var: error */` in files, which is easy to forget, and can instead disable the rule in the `src/core/` files where `var` is still in use.

---
[1] Obviously the `no-var` rule can, in the same way as every other rule, be disabled on a case-by-case basis where actually necessary.
This commit is contained in:
Jonas Jenwald 2020-10-03 12:26:25 +02:00
parent 48e27a1a22
commit 9416b14e8b
39 changed files with 25 additions and 26 deletions

View File

@ -1,6 +1,6 @@
{ {
"extends": [ "extends": [
"../../.eslintrc" "../.eslintrc"
], ],
"rules": { "rules": {

View File

@ -4,7 +4,7 @@
}, },
"extends": [ "extends": [
"../../.eslintrc" "../.eslintrc"
], ],
"env": { "env": {

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint no-var: error */
import { import {
AnnotationBorderStyleType, AnnotationBorderStyleType,

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint no-var: error */
// Table C-2 // Table C-2
const QeTable = [ const QeTable = [

View File

@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable no-var */
import { warn } from "../shared/util.js"; import { warn } from "../shared/util.js";

View File

@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable no-var */
import { Dict, isDict } from "./primitives.js"; import { Dict, isDict } from "./primitives.js";
import { CCITTFaxDecoder } from "./ccitt.js"; import { CCITTFaxDecoder } from "./ccitt.js";

View File

@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable no-var */
import { import {
bytesToString, bytesToString,

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint no-var: error */
// prettier-ignore // prettier-ignore
const ISOAdobeCharset = [ const ISOAdobeCharset = [

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint no-var: error */
import { import {
arrayByteLength, arrayByteLength,

View File

@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable no-var */
import { import {
CMapCompressionType, CMapCompressionType,

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint no-var: error */
import { assert, BaseException, warn } from "../shared/util.js"; import { assert, BaseException, warn } from "../shared/util.js";

View File

@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable no-var */
import { import {
bytesToString, bytesToString,

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint no-var: error */
import { import {
assert, assert,

View File

@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable no-var */
import { import {
AbortException, AbortException,

View File

@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable no-var */
import { import {
bytesToString, bytesToString,

View File

@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable no-var */
import { import {
assert, assert,

View File

@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable no-var */
import { Dict, isDict, isStream, Ref } from "./primitives.js"; import { Dict, isDict, isStream, Ref } from "./primitives.js";
import { import {

View File

@ -13,6 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
/* no-babel-preset */ /* no-babel-preset */
/* eslint-disable no-var */
var getLookupTableFactory = require("./core_utils.js").getLookupTableFactory; var getLookupTableFactory = require("./core_utils.js").getLookupTableFactory;

View File

@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable no-var */
import { assert, FormatError, ImageKind, info, warn } from "../shared/util.js"; import { assert, FormatError, ImageKind, info, warn } from "../shared/util.js";
import { isName, isStream, Name } from "./primitives.js"; import { isName, isStream, Name } from "./primitives.js";

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint no-var: error */
import { assert, info, shadow, unreachable } from "../shared/util.js"; import { assert, info, shadow, unreachable } from "../shared/util.js";
import { RefSetCache } from "./primitives.js"; import { RefSetCache } from "./primitives.js";

View File

@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable no-var */
import { BaseException, shadow } from "../shared/util.js"; import { BaseException, shadow } from "../shared/util.js";
import { log2, readInt8, readUint16, readUint32 } from "./core_utils.js"; import { log2, readInt8, readUint16, readUint32 } from "./core_utils.js";

View File

@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable no-var */
import { assert, BaseException, warn } from "../shared/util.js"; import { assert, BaseException, warn } from "../shared/util.js";
import { readUint16 } from "./core_utils.js"; import { readUint16 } from "./core_utils.js";

View File

@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable no-var */
import { BaseException, info, warn } from "../shared/util.js"; import { BaseException, info, warn } from "../shared/util.js";
import { log2, readUint16, readUint32 } from "./core_utils.js"; import { log2, readUint16, readUint32 } from "./core_utils.js";

View File

@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable no-var */
import { getLookupTableFactory } from "./core_utils.js"; import { getLookupTableFactory } from "./core_utils.js";

View File

@ -16,7 +16,6 @@
* Based on https://code.google.com/p/smhasher/wiki/MurmurHash3. * Based on https://code.google.com/p/smhasher/wiki/MurmurHash3.
* Hashes roughly 100 KB per millisecond on i7 3.4 GHz. * Hashes roughly 100 KB per millisecond on i7 3.4 GHz.
*/ */
/* eslint no-var: error */
import { isArrayBuffer, isString } from "../shared/util.js"; import { isArrayBuffer, isString } from "../shared/util.js";

View File

@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable no-var */
import { import {
assert, assert,

View File

@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable no-var */
import { assert, ImageKind, OPS, warn } from "../shared/util.js"; import { assert, ImageKind, OPS, warn } from "../shared/util.js";

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint no-var: error */
import { import {
Ascii85Stream, Ascii85Stream,

View File

@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable no-var */
import { import {
assert, assert,

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* uses XRef */ /* eslint-disable no-var */
import { assert, unreachable } from "../shared/util.js"; import { assert, unreachable } from "../shared/util.js";

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint no-var: error */
import { FormatError, shadow } from "../shared/util.js"; import { FormatError, shadow } from "../shared/util.js";
import { EOF } from "./primitives.js"; import { EOF } from "./primitives.js";

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint no-var: error */
import { getLookupTableFactory } from "./core_utils.js"; import { getLookupTableFactory } from "./core_utils.js";

View File

@ -18,6 +18,7 @@
* of XPDF's implementation, made available under the Apache 2.0 open source * of XPDF's implementation, made available under the Apache 2.0 open source
* license. * license.
*/ */
/* eslint-disable no-var */
import { FormatError, stringToBytes, unreachable } from "../shared/util.js"; import { FormatError, stringToBytes, unreachable } from "../shared/util.js";
import { isDict } from "./primitives.js"; import { isDict } from "./primitives.js";

View File

@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable no-var */
import { getEncoding } from "./encodings.js"; import { getEncoding } from "./encodings.js";
import { isWhiteSpace } from "./core_utils.js"; import { isWhiteSpace } from "./core_utils.js";

View File

@ -13,6 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
/* no-babel-preset */ /* no-babel-preset */
/* eslint-disable no-var */
var getLookupTableFactory = require("./core_utils.js").getLookupTableFactory; var getLookupTableFactory = require("./core_utils.js").getLookupTableFactory;

View File

@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable no-var */
import { import {
AbortException, AbortException,

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint no-var: error */
import { assert } from "../shared/util.js"; import { assert } from "../shared/util.js";

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint no-var: error */
import { bytesToString, escapeString, warn } from "../shared/util.js"; import { bytesToString, escapeString, warn } from "../shared/util.js";
import { Dict, isDict, isName, isRef, isStream, Name } from "./primitives.js"; import { Dict, isDict, isName, isRef, isStream, Name } from "./primitives.js";

View File

@ -1,10 +0,0 @@
{
"extends": [
"../../.eslintrc"
],
"rules": {
// ECMAScript 6
"no-var": "error",
},
}