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

grab own package version from regular require #1442

Merged
merged 5 commits into from
Sep 30, 2020
Merged

Conversation

davidjgoss
Copy link
Contributor

Fixes #1439

@aslakhellesoy
Copy link
Contributor

aslakhellesoy commented Sep 17, 2020

I wonder if the new import causes the depth of the lib directory to change. I think it might work better with JSON.parse(fs.readFileSync(...))

@davidjgoss
Copy link
Contributor Author

davidjgoss commented Sep 17, 2020

I wonder if the new import causes the depth of the lib directory to change.

Yeah exactly that happened when doing import pkg from "../../package.json", and this was fixed by switching to the require - the TypeScript compiler leaves those as they are and doesn't use them to calculate what it things the root should be.

The problem with the builds is a couple of ESLint rules failing, but I can't reproduce them locally, despite how my dependencies should be identical due to the lockfile. Would be good to know if you get the same or it's just me. Never mind, fixed with a fresh clone.

@davidjgoss
Copy link
Contributor Author

Should be good to go now

@@ -28,7 +28,7 @@ Before(function (
this.tmpDir = path.join(
projectPath,
'tmp',
`${path.basename(pickle.uri)}_${line.toString()}`
`${path.basename(pickle.uri) ?? ''}_${(line ?? '').toString()}`
Copy link
Member

Choose a reason for hiding this comment

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

What's the need for this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A new eslint rule that bubbled up

Copy link
Member

Choose a reason for hiding this comment

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

I don't understand how that is possible. If you revert this does the build fail?

Copy link
Contributor

Choose a reason for hiding this comment

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

We've recently upgraded the linter, which has new rules. Rules are only validated against modified files (that's how husky is set up).

So the linter only kicked in now that @davidjgoss modified the file.

Perhaps we should configure husky to lint/format everything? It will make commits a bit slower, but we avoid these kinds of surprised.

Copy link
Member

Choose a reason for hiding this comment

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

What is husky? Can you point me to the commit that introduced that? I personally prefer to lint everything each build and think linting modified files only is only useful if you are starting linting and don't want to fix everything at once (though there are also other ways of dealing with that too, ie disable the rules with errors and enable each separately when fixing them all)

Copy link
Contributor Author

@davidjgoss davidjgoss Sep 21, 2020

Choose a reason for hiding this comment

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

AFAIK we lint all files not just changed - previously had to fix some new errors to help renovate do a eslint version bump for example. And the only change in this file is the one I made to fix the lint issue.

I can't quite figure out what has happened, but I wasn't getting the error locally, then saw it on Travis, then rm -r'd my node_modules and did a fresh yarn install, and then was able to see the error. This should be impossible because of lockfiles, unless some package is getting config from outside the versioned dependency tree.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's curious, but I don't think it's worthwhile spending more time understanding how this happened.

Is anything holding up merging this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree could be a rabbit hole. FWIW I do think it's a bit of an over-the-top rule.

Copy link
Member

Choose a reason for hiding this comment

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

Can you please revert this change? I'd like to see the commit this error occur on CI? If it is still happening can we fix this in another PR? I'd like to narrow the discussion around it as I don't think both changes are needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted - and of course now it looks to be passing.

Here's the build where it failed on this rule so I don't look totally mad.

@aslakhellesoy
Copy link
Contributor

Thanks @davidjgoss - are we ready to merge?

@davidjgoss
Copy link
Contributor Author

@aslakhellesoy yep

@davidjgoss davidjgoss merged commit eaaca2d into master Sep 30, 2020
@davidjgoss davidjgoss deleted the meta-pkg-json branch September 30, 2020 22:46
Adam-ARK pushed a commit to Adam-ARK/cucumber-js that referenced this pull request Oct 21, 2020
* grab own package version from regular require

* use const not import

* lint

* lint

* revert mysterious lint fix change
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.

Wrong version in meta message
3 participants