Skip to content

Update: no-identical-tests despite of properties order. #21

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

Merged
merged 7 commits into from
Jul 23, 2017

Conversation

aladdin-add
Copy link
Contributor

fixes #17

@aladdin-add
Copy link
Contributor Author

aladdin-add commented Jul 18, 2017

@not-an-aardvark, SOS!! all the tests passed, but linting errors. is this the eslint-plugin-self issue?

@not-an-aardvark
Copy link
Contributor

It seems like the issue is that the rule is reporting a lot of false positives on the codebase. I don't think this is related to eslint-plugin-self.

@aladdin-add
Copy link
Contributor Author

aladdin-add commented Jul 18, 2017

but when adding test cases that reporting errors, it works well.

@not-an-aardvark
Copy link
Contributor

I think the issue is that it's not accounting for test cases which are just shorthand strings.

Copy link
Contributor

@not-an-aardvark not-an-aardvark left a comment

Choose a reason for hiding this comment

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

Thanks! This generally looks good to me, I just have a few nitpicks.

function eq (ta, tb) {
if (ta.type !== tb.type) {
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

An additional enhancement would be to consider these test cases equal:

  1. 'foo'
  2. { code: 'foo' }

But that doesn't have to be part of this PR.

*compare two test cases despite of properties order.
*@returns {boolean} if eq, return true, else return false.
*/
function eq (ta, tb) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you give these variables longer names rather than abbreviating? I think the abbreviations make it harder to read the code.

For example: ta => testA, pa => propertiesA, paObj => propertiesObjectA, etc.

}

// convert array to object
const paObj = Object.create(null);
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: It would be better to use a Set rather than an object here.

@aladdin-add aladdin-add merged commit 223da80 into eslint-community:master Jul 23, 2017
@aladdin-add aladdin-add deleted the issue17 branch July 23, 2017 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rule changes: no-identical-tests.
2 participants