Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable the no-var linting rule in src/core/{crypto,function}.js #13321

Merged
merged 3 commits into from
May 2, 2021

Commits on May 1, 2021

  1. Enable the no-var linting rule in src/core/function.js

    This is done automatically with `gulp lint --fix` and the following
    manual changes:
    
    ```diff
    diff --git a/src/core/function.js b/src/core/function.js
    index 878001057..b7e3e6ccf 100644
    --- a/src/core/function.js
    +++ b/src/core/function.js
    @@ -131,7 +131,7 @@ function toNumberArray(arr) {
       return arr;
     }
    
    -var PDFFunction = (function PDFFunctionClosure() {
    +const PDFFunction = (function PDFFunctionClosure() {
       const CONSTRUCT_SAMPLED = 0;
       const CONSTRUCT_INTERPOLATED = 2;
       const CONSTRUCT_STICHED = 3;
    @@ -484,7 +484,9 @@ var PDFFunction = (function PDFFunctionClosure() {
             // clip to domain
             const v = clip(src[srcOffset], domain[0], domain[1]);
             // calculate which bound the value is in
    -        for (var i = 0, ii = bounds.length; i < ii; ++i) {
    +        const length = bounds.length;
    +        let i;
    +        for (i = 0; i < length; ++i) {
               if (v < bounds[i]) {
                 break;
               }
    @@ -673,23 +675,21 @@ const PostScriptStack = (function PostScriptStackClosure() {
         roll(n, p) {
           const stack = this.stack;
           const l = stack.length - n;
    -      let r = stack.length - 1,
    -        c = l + (p - Math.floor(p / n) * n),
    -        i,
    -        j,
    -        t;
    -      for (i = l, j = r; i < j; i++, j--) {
    -        t = stack[i];
    +      const r = stack.length - 1;
    +      const c = l + (p - Math.floor(p / n) * n);
    +
    +      for (let i = l, j = r; i < j; i++, j--) {
    +        const t = stack[i];
             stack[i] = stack[j];
             stack[j] = t;
           }
    -      for (i = l, j = c - 1; i < j; i++, j--) {
    -        t = stack[i];
    +      for (let i = l, j = c - 1; i < j; i++, j--) {
    +        const t = stack[i];
             stack[i] = stack[j];
             stack[j] = t;
           }
    -      for (i = c, j = r; i < j; i++, j--) {
    -        t = stack[i];
    +      for (let i = c, j = r; i < j; i++, j--) {
    +        const t = stack[i];
             stack[i] = stack[j];
             stack[j] = t;
           }
    @@ -939,7 +939,7 @@ class PostScriptEvaluator {
     // We can compile most of such programs, and at the same moment, we can
     // optimize some expressions using basic math properties. Keeping track of
     // min/max values will allow us to avoid extra Math.min/Math.max calls.
    -var PostScriptCompiler = (function PostScriptCompilerClosure() {
    +const PostScriptCompiler = (function PostScriptCompilerClosure() {
       class AstNode {
         constructor(type) {
           this.type = type;
    ```
    timvandermeij committed May 1, 2021
    Configuration menu
    Copy the full SHA
    58e568f View commit details
    Browse the repository at this point in the history
  2. Enable the no-var linting rule in src/core/crypto.js

    This is done automatically with `gulp lint --fix`.
    timvandermeij committed May 1, 2021
    Configuration menu
    Copy the full SHA
    1f8b452 View commit details
    Browse the repository at this point in the history

Commits on May 2, 2021

  1. Fix no-var linting rule violations in src/core/crypto.js that cou…

    …ldn't be changed automatically by ESLint
    
    This is done in a separate commit due to the required number of changes
    so that reviewing is easier than in a plain-text diff in the commit
    message.
    timvandermeij committed May 2, 2021
    Configuration menu
    Copy the full SHA
    b661cf2 View commit details
    Browse the repository at this point in the history