eslint / typescript-eslint-parser

An ESLint custom parser which leverages TypeScript ESTree to allow for ESLint to lint TypeScript source code.
Other
916 stars 75 forks source link

Test failures with eslint 5.11 #585

Closed corbinu closed 5 years ago

corbinu commented 5 years ago

What version of TypeScript are you using? 3.2.1

What version of typescript-eslint-parser are you using? https://github.com/eslint/typescript-eslint-parser/pull/584

This may not at all be important however I did notice that if I bump eslint to the latest version the test suite fails.

jest "--updateSnapshot"

 PASS  tests/lib/jsx.js
 FAIL  tests/lib/tsx.js
  ● TSX › if the filename ends with '.tsx', enable jsx option automatically. › filePath was not provided

    expect(received).toStrictEqual(expected)

    Expected value to equal:
      [{"column": 18, "fatal": true, "line": 1, "message": "Parsing error: '>' expected.", "ruleId": null, "severity": 2, "source": "const element = <T/>"}]
    Received:
      [{"column": 18, "fatal": true, "line": 1, "message": "Parsing error: '>' expected.", "ruleId": null, "severity": 2}]

    Difference:

    - Expected
    + Received

    @@ -4,8 +4,7 @@
          "fatal": true,
          "line": 1,
          "message": "Parsing error: '>' expected.",
          "ruleId": null,
          "severity": 2,
    -     "source": "const element = <T/>",
        },
      ]

      55 |             const messages = linter.verify(code, config);
      56 |
    > 57 |             expect(messages).toStrictEqual([{
         |                              ^
      58 |                 column: 18,
      59 |                 fatal: true,
      60 |                 line: 1,

      at Object.toStrictEqual (tests/lib/tsx.js:57:30)

  ● TSX › if the filename ends with '.tsx', enable jsx option automatically. › test.ts

    expect(received).toStrictEqual(expected)

    Expected value to equal:
      [{"column": 18, "fatal": true, "line": 1, "message": "Parsing error: '>' expected.", "ruleId": null, "severity": 2, "source": "const element = <T/>"}]
    Received:
      [{"column": 18, "fatal": true, "line": 1, "message": "Parsing error: '>' expected.", "ruleId": null, "severity": 2}]

    Difference:

    - Expected
    + Received

    @@ -4,8 +4,7 @@
          "fatal": true,
          "line": 1,
          "message": "Parsing error: '>' expected.",
          "ruleId": null,
          "severity": 2,
    -     "source": "const element = <T/>",
        },
      ]

      86 |             const messages = linter.verify(code, config, { filename: "test.ts" });
      87 |
    > 88 |             expect(messages).toStrictEqual([{
         |                              ^
      89 |                 column: 18,
      90 |                 fatal: true,
      91 |                 line: 1,

      at Object.toStrictEqual (tests/lib/tsx.js:88:30)

  ● TSX › if the filename ends with '.tsx', enable jsx option automatically. › test.ts with 'jsx:true' option

    expect(received).toStrictEqual(expected)

    Expected value to equal:
      [{"column": 18, "fatal": true, "line": 1, "message": "Parsing error: '>' expected.", "ruleId": null, "severity": 2, "source": "const element = <T/>"}]
    Received:
      [{"column": 18, "fatal": true, "line": 1, "message": "Parsing error: '>' expected.", "ruleId": null, "severity": 2}]

    Difference:

    - Expected
    + Received

    @@ -4,8 +4,7 @@
          "fatal": true,
          "line": 1,
          "message": "Parsing error: '>' expected.",
          "ruleId": null,
          "severity": 2,
    -     "source": "const element = <T/>",
        },
      ]

      107 |             const messages = linter.verify(code, config, { filename: "test.ts" });
      108 |
    > 109 |             expect(messages).toStrictEqual([{
          |                              ^
      110 |                 column: 18,
      111 |                 fatal: true,
      112 |                 line: 1,

      at Object.toStrictEqual (tests/lib/tsx.js:109:30)

 PASS  tests/lib/scope-analysis.js
 FAIL  tests/lib/basics.js
  ● basics › https://github.com/eslint/typescript-eslint-parser/issues/476

    expect(received).toStrictEqual(expected)

    Expected value to equal:
      [{"column": 21, "endColumn": 42, "endLine": 2, "line": 2, "message": "called on React.SFC", "nodeType": "TSTypeReference", "ruleId": "test", "severity": 2, "source": "export const Price: React.SFC<PriceProps> = function Price(props) {}"}, {"column": 31, "endColumn": 41, "endLine": 2, "line": 2, "message": "called on PriceProps", "nodeType": "TSTypeReference", "ruleId": "test", "severity": 2, "source": "export const Price: React.SFC<PriceProps> = function Price(props) {}"}]
    Received:
      [{"column": 21, "endColumn": 42, "endLine": 2, "line": 2, "message": "called on React.SFC", "nodeType": "TSTypeReference", "ruleId": "test", "severity": 2}, {"column": 31, "endColumn": 41, "endLine": 2, "line": 2, "message": "called on PriceProps", "nodeType": "TSTypeReference", "ruleId": "test", "severity": 2}]

    Difference:

    - Expected
    + Received

    @@ -6,19 +6,17 @@
          "line": 2,
          "message": "called on React.SFC",
          "nodeType": "TSTypeReference",
          "ruleId": "test",
          "severity": 2,
    -     "source": "export const Price: React.SFC<PriceProps> = function Price(props) {}",
        },
        Object {
          "column": 31,
          "endColumn": 41,
          "endLine": 2,
          "line": 2,
          "message": "called on PriceProps",
          "nodeType": "TSTypeReference",
          "ruleId": "test",
          "severity": 2,
    -     "source": "export const Price: React.SFC<PriceProps> = function Price(props) {}",
        },
      ]

      67 |         const messages = linter.verify(code, config, { filename: "issue.ts" });
      68 |
    > 69 |         expect(messages).toStrictEqual([
         |                          ^
      70 |             {
      71 |                 column: 21,
      72 |                 endColumn: 42,

      at Object.toStrictEqual (tests/lib/basics.js:69:26)
armano2 commented 5 years ago

looks like source got removed in new eslint.

corbinu commented 5 years ago

not sure if it is causing any issues just wanted to notify :)

JamesHenry commented 5 years ago

This issue has been migrated to the new project here: typescript-eslint/typescript-eslint#22

Thanks!