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

Fix eslint7 ruletester improvements #10

Merged

Conversation

toshi-toma
Copy link

https://github.com/eslint/rfcs/blob/master/designs/2019-rule-tester-improvements/README.md

  • use range instead of start/end
  • fix mistaken errors property
  • add requisite output property

code: [
'var First = createReactClass({',
' propTypes: {',
' s: PropTypes.shape({,',
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test code was throwing parse error :(

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? what parse error?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, That was my misunderstanding.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change must revert.. 😓

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, Now, I checked with ESLint v7.

The test is throwing error...

  1) forbid-prop-types
       invalid
         var First = createReactClass({
  propTypes: {
    s: PropTypes.shape({,
      o: PropTypes.object
    })
  },
  render: function() {
    return <div />;
  }
});:

      AssertionError [ERR_ASSERTION]: A fatal parsing error occurred: Parsing error: Unexpected token ,
      + expected - actual

      -false
      +true

      at runRuleForItem (node_modules/eslint/lib/rule-tester/rule-tester.js:559:13)
      at testInvalidTemplate (node_modules/eslint/lib/rule-tester/rule-tester.js:650:28)
      at Context.RuleTester.it (node_modules/eslint/lib/rule-tester/rule-tester.js:874:25)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comma may have been the cause ...??

{,
  o: PropTypes.object
}

options: [2],
errors: [{message: 'Expected indentation of 4 space characters but found 0.'}]
}, {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test can't pass because jsx-indent is applying mistakenly indent.
I ignored the test. I could not understand How to fix it 😭

@ljharb ljharb force-pushed the fix-eslint7-ruletester-Improvements branch 2 times, most recently from 084ef41 to 72aeab3 Compare May 9, 2020 06:03
code: [
'var First = createReactClass({',
' propTypes: {',
' s: PropTypes.shape({,',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? what parse error?

@ljharb ljharb force-pushed the fix-eslint7-ruletester-Improvements branch from 72aeab3 to b2f1f14 Compare May 9, 2020 06:21
@ljharb ljharb merged commit b2f1f14 into ljharb:eslint7 May 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants