Skip to content

Conversation

aherlihy
Copy link
Contributor

@aherlihy aherlihy commented Jun 15, 2020

We were also missing linting in a few packages, including the service providers so I had the distinct displeasure of linting all those packages.

I commented out skipped tests because they were warning, up to us if we want a warning-free master or not. As is we have 0 warnings or errors. I'm okay with warnings for things that are TODOs, but we should probably discuss.

Also there's a bug with typescript linting where interfaces and types that are used get registered as undefined, so I changed most interface definitions to export default interface xxx which is a workaround.

Copy link
Collaborator

@mcasimir mcasimir left a comment

Choose a reason for hiding this comment

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

Looks great, do you know why it was disabled in the first place? Maybe there is something we have to change in evergreen?

)
).to.equal(1);
});
// it('evaluates object literal after other statements as block', async() => {
Copy link
Collaborator

@mcasimir mcasimir Jun 16, 2020

Choose a reason for hiding this comment

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

this is just a difference we have with the usual node repl or chrome devtools:

in node:

> ;{x: 1}
1
> 

in browser-repl:

;{x: 1}
undefined

I don't know what is your take on this, probably can be just ignored

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh interesting. It's treating {} as a block scope and not as an object...which would explain why if you just put in {x: 1} then it will give you a syntax error. We could make a ticket for it but I don't think it should be a blocker.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here's the ticket: https://jira.mongodb.org/browse/MONGOSH-256

I will keep the tests as skip so they will warn as a reminder TODO.

)
).to.equal(1);
});
// it('can redeclare a top level function as function', async() => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this may really be an issue, again a corner case but this looks more realistic:

function f() { return 1; }
[Function: f]
function f() { return 2; }
[Function: f]
f()
1

Expected:

function f() { return 1; }
[Function: f]
function f() { return 2; }
[Function: f]
f()
2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's worth a ticket, but will also be closed when we do the unify eval epic so I'm happy to keep this as a skip so we're reminded that there's some TODO there

// it('should not wrap multiple statements', () => {
// // TODO: for some reason this is the default behaviour in node repl and devtools,
// // as is now it wraps everything, which breaks the code.
// expect(wrapObjectLiteral('{x: 2}; {x: 2}')).to.equal('{x: 2}; {x: 2}');
Copy link
Collaborator

Choose a reason for hiding this comment

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

super corner case, again we can keep it or drop it, maybe give it a look

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this can go under the ticket https://jira.mongodb.org/browse/MONGOSH-256

// context('when cli args have disableImplicitSessions', () => {
// const cliOptions: CliOptions = { disableImplicitSessions: true };
//
// it('maps to explicitlyIgnoreSession', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

have no clue about this one

});
});
});
// context('when running against a database', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

no idea

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This seems to pass so will keep it for now, unless it breaks later on

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, fails on evergreen, so will remove it

// ).to.equal(2);
// });
//
// it('can redeclare a top level function as var', async() => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is also kinda common and unexpected

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will keep it as a skip then and include it in the ticket

@aherlihy
Copy link
Contributor Author

I think it was originally disabled because it was trying to lint the cli-repl/dist/mongosh.js file and it was causing a buffer overflow with no error. Once we ignore that we don't get any more random failures I think.

@aherlihy aherlihy merged commit d409821 into master Jun 16, 2020
@aherlihy aherlihy deleted the check branch June 16, 2020 15:12
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