Skip to content

chore: enable eslint for the repo config #67

Merged
aws-cdk-automation merged 1 commit intomainfrom
mrgrain/chore/lint-repo-config
Feb 19, 2025
Merged

chore: enable eslint for the repo config #67
aws-cdk-automation merged 1 commit intomainfrom
mrgrain/chore/lint-repo-config

Conversation

@mrgrain
Copy link
Contributor

@mrgrain mrgrain commented Feb 19, 2025

Fixes repo config not being linted.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

Comment on lines -41 to -52
// Require all imported dependencies are actually declared in package.json
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [ // Only allow importing devDependencies from:
'**/build-tools/**', // --> Build tools
'**/test/**', // --> Unit tests
],
optionalDependencies: false, // Disallow importing optional dependencies (those shouldn't be in use in the project)
},
],

Copy link
Contributor Author

@mrgrain mrgrain Feb 19, 2025

Choose a reason for hiding this comment

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

Removed this in favor of the projen built-in rule, which is pretty much the same but allows for a dynamic configuration of the paths in devDependencies.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change here and in the other package lint configs are due to now using the projen built-in rule for import/no-extraneous-dependencies.

As you can see these are pretty much the same. The main difference is that we now allow imports of peerDependencies which seems acceptable if not desired.

Comment on lines +184 to +194
// Eslint for projen config
// @ts-ignore
repoProject.eslint = new pj.javascript.Eslint(repoProject, {
tsconfigPath: `./${repoProject.tsconfigDev.fileName}`,
dirs: [],
devdirs: ['projenrc', '.projenrc.ts'],
fileExtensions: ['.ts', '.tsx'],
lintProjenRc: false,
});

const repo = configureProject(repoProject);
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 is the only actual change in here: We are adding a custom eslint config for the repo root.

Base automatically changed from mrgrain/chore/re-add-linter-rules to main February 19, 2025 12:07
@mrgrain mrgrain force-pushed the mrgrain/chore/lint-repo-config branch from 79e828e to b47ba7f Compare February 19, 2025 12:09
@mrgrain mrgrain marked this pull request as ready for review February 19, 2025 12:09
@aws-cdk-automation aws-cdk-automation added this pull request to the merge queue Feb 19, 2025
Merged via the queue into main with commit 10adf4c Feb 19, 2025
21 checks passed
@aws-cdk-automation aws-cdk-automation deleted the mrgrain/chore/lint-repo-config branch February 19, 2025 13:44
github-merge-queue bot pushed a commit that referenced this pull request Feb 20, 2026
The `glob` and `minimatch` packages have been long-standing dependencies
in this project, but they have become problematic for two reasons.

First, there are known security vulnerabilities in the currently pinned
versions. For example, [dependabot alert
#67](https://github.com/aws/aws-cdk-cli/security/dependabot/67) flags an
issue that requires upgrading. However, upgrading to the latest major
versions of `glob` and `minimatch` is not a viable path forward because
newer releases have moved to the BlueOak-1.0.0 license, which is not
compatible with the licensing requirements of this project.

Second, these packages come with a significant transitive dependency
tree that includes `jackspeak`, `path-scurry`, `minipass`, and
`foreground-child` among others. These packages are maintained by the
same author and have historically seen frequent major version bumps that
require attention from dependabot and manual review, creating ongoing
maintenance overhead.

This change replaces `glob` with `fast-glob` and `minimatch` with
`picomatch` across all packages in the monorepo. Both are
well-established, MIT-licensed alternatives that provide equivalent
functionality with a smaller dependency footprint. The `picomatch`
library was already a transitive dependency through `chokidar`, and
`toolkit-lib` already had a direct dependency on `picomatch@^4`, so this
change consolidates the glob matching implementation rather than
introducing something entirely new.

The API migration is straightforward. For globbing, `glob.sync('**',
options)` becomes `globSync('**', options)` from `fast-glob`, with
option names updated to match the `fast-glob` API (e.g. `nodir` →
`onlyFiles`, `follow` → `followSymbolicLinks`). For pattern matching,
`minimatch(str, pattern)` becomes `isMatch(str, pattern)` from
`picomatch`, and `minimatch.filter(expression)` is replaced with a
compiled `picomatch(expression)` matcher function, which is actually
more efficient since it avoids recompiling the pattern for each test.

The `yarn.lock` cleanup removes several packages that are no longer
needed: `glob@^11`, `glob@^9`, `minimatch@10.0.1`, `minimatch@^8`,
`jackspeak@^4`, `minipass@^4`, and `path-scurry@^2`. This reduces the
overall dependency count and install size.

### Checklist
- [ ] This change contains a major version upgrade for a dependency and
I confirm all breaking changes are addressed
  - Release notes for the new version:

---
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache-2.0 license
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.

3 participants