-
Notifications
You must be signed in to change notification settings - Fork 245
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(jsii): improve checks around peerDependencies #2997
Conversation
There are two changes here: - The check that forces package authors to list all `dependencies` in `peerDependencies` is superfluous, and has been removed. This effectively removes the `--fix-peer-dependencies` flag as well. - Add a warning to tell people that when they add a `peerDependency`, they should have a dependency in `devDependencies` as well. Fixes #2994.
packages/jsii/bin/jsii.ts
Outdated
const result = argv.watch ? compiler.watch() : compiler.emit(); | ||
return { projectRoot, emitResult: await result }; | ||
})() | ||
.then(({ projectRoot, emitResult }) => { | ||
for (const diagnostic of emitResult.diagnostics) { | ||
utils.logDiagnostic(diagnostic, projectRoot); | ||
} | ||
if (emitResult.emitSkipped) { | ||
process.exit(1); | ||
} | ||
}) | ||
.catch((e) => { | ||
console.error(`Error: ${e.stack}`); | ||
process.exit(-1); | ||
}); | ||
const emitResult = await result; | ||
|
||
const allDiagnostics = [...projectInfoDiagnostics, ...emitResult.diagnostics]; | ||
|
||
for (const diagnostic of allDiagnostics) { | ||
utils.logDiagnostic(diagnostic, projectRoot); | ||
} | ||
if (emitResult.emitSkipped) { | ||
process.exitCode = 1; | ||
} | ||
})().catch((e) => { | ||
console.error(`Error: ${e.stack}`); | ||
process.exitCode = -1; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const result = argv.watch ? compiler.watch() : compiler.emit(); | |
return { projectRoot, emitResult: await result }; | |
})() | |
.then(({ projectRoot, emitResult }) => { | |
for (const diagnostic of emitResult.diagnostics) { | |
utils.logDiagnostic(diagnostic, projectRoot); | |
} | |
if (emitResult.emitSkipped) { | |
process.exit(1); | |
} | |
}) | |
.catch((e) => { | |
console.error(`Error: ${e.stack}`); | |
process.exit(-1); | |
}); | |
const emitResult = await result; | |
const allDiagnostics = [...projectInfoDiagnostics, ...emitResult.diagnostics]; | |
for (const diagnostic of allDiagnostics) { | |
utils.logDiagnostic(diagnostic, projectRoot); | |
} | |
if (emitResult.emitSkipped) { | |
process.exitCode = 1; | |
} | |
})().catch((e) => { | |
console.error(`Error: ${e.stack}`); | |
process.exitCode = -1; | |
}); | |
const result = await (argv.watch ? compiler.watch() : compiler.emit()); | |
const allDiagnostics = [...projectInfoDiagnostics, ... result.diagnostics]; | |
for (const diagnostic of allDiagnostics) { | |
utils.logDiagnostic(diagnostic, projectRoot); | |
} | |
if (result.emitSkipped) { | |
process.exitCode = 1; | |
} | |
})().catch((e) => { | |
console.error(`Error: ${e.stack}`); | |
process.exitCode = -1; | |
}); |
@@ -238,6 +238,20 @@ export class JsiiDiagnostic implements ts.Diagnostic { | |||
name: 'metadata/missing-peer-dependency', | |||
}); | |||
|
|||
public static readonly JSII_0006_MISSING_DEV_DEPENDENCY = Code.warning({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe drop a comment here stating that for now, it is not possible to increase the severity of this because it's generated before the severity settings are applied?
Co-authored-by: Romain Marcadier <rmuller@amazon.com>
Co-authored-by: Romain Marcadier <rmuller@amazon.com>
Co-authored-by: Romain Marcadier <rmuller@amazon.com>
…nto huijbers/peer-deps-checks
Thank you for contributing! ❤️ I will now look into making sure the PR is up-to-date, then proceed to try and merge it! |
Merging (with squash)... |
Merging (with squash)... |
There are two changes here:
dependencies
inpeerDependencies
is superfluous, and has been removed. Thiseffectively removes the
--fix-peer-dependencies
flag as well.peerDependency
,they should have a dependency in
devDependencies
as well.Fixes #2994.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.