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

chore: fix the use of mixed dep/devdeps #27652

Merged
merged 7 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/aws-cdk-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"organization": true
},
"license": "Apache-2.0",
"bundledDependencies": [
"bundleDependencies": [
Copy link
Contributor

Choose a reason for hiding this comment

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

😂

"@balena/dockerignore",
"case",
"fs-extra",
Expand Down Expand Up @@ -176,7 +176,6 @@
"delay": "5.0.0",
"esbuild": "^0.19.4",
"fast-check": "^3.13.1",
"fs-extra": "^11.1.1",
"jest": "^29.7.0",
"jest-each": "^29.7.0",
"lambda-tester": "^4.0.1",
Expand Down
18 changes: 18 additions & 0 deletions tools/@aws-cdk/pkglint/lib/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1301,6 +1301,24 @@ export class NoStarDeps extends ValidationRule {
}
}

export class NoMixedDeps extends ValidationRule {
public readonly name = 'dependencies/no-mixed-deps';

public validate(pkg: PackageJson) {
const deps = Object.keys(pkg.json.dependencies ?? {});
const devDeps = Object.keys(pkg.json.devDependencies ?? {});

const shared = deps.filter((dep) => devDeps.includes(dep));
for (const dep of shared) {
pkg.report({
ruleName: this.name,
message: `dependency may not be both in dependencies and devDependencies: ${dep}`,
fix: () => pkg.removeDevDependency(dep),
});
}
}
}

interface VersionCount {
version: string;
count: number;
Expand Down
Loading