Gathering detailed insights and metrics for @cdklabs/eslint-plugin
Gathering detailed insights and metrics for @cdklabs/eslint-plugin
Gathering detailed insights and metrics for @cdklabs/eslint-plugin
Gathering detailed insights and metrics for @cdklabs/eslint-plugin
npm install @cdklabs/eslint-plugin
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (98.32%)
JavaScript (1.68%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Apache-2.0 License
2 Stars
219 Commits
3 Forks
9 Watchers
3 Branches
51 Contributors
Updated on Jul 08, 2025
Latest Version
1.3.2
Package Id
@cdklabs/eslint-plugin@1.3.2
Unpacked Size
138.89 kB
Size
43.87 kB
File Count
38
NPM Version
10.9.0
Node Version
22.12.0
Published on
Jan 20, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
2
20
Eslint plugin for the CDK repository. Contains rules that need to be applied specific to the CDK repository.
invalid-cfn-imports
: Ensures that imports of Cfn<Resource>
L1 resources come from the stable
aws-cdk-lib
package and not the alpha packages. Rule only applies to alpha modules.
no-core-construct
: Forbid the use of Construct
and IConstruct
from the "@aws-cdk/core" module.
Instead use Construct
and IConstruct
from the "constructs" module.
Rule only applies to typescript files under the test/
folder.
no-invalid-path
: Checks paths specified using path.join()
for validity, including not going backwards ('..'
)
multiple times in the path and not going backwards beyond a package's package.json
.
no-literal-partition
: Forbids the use of literal partitions (usually aws
). Instead, use
Aws.PARTITION
to ensure that the code works for other partitions too.
consider-promise-all
: when using Promise.all()
, attest that there is no unbounded parallelism.
no-throw-default-error
: Forbid throwing the default JavaScript error type. Instead a custom typed error should be thrown.
no-this-in-static
: Forbid the use of the keywords this
and super
in
static methods.
Import the plugin and declare rules with the @cdklabs
prefix:
1module.exports = { 2 plugins: [ 3 // ... other plugins 4 '@cdklabs', 5 ], 6 rules: { 7 '@cdklabs/no-throw-default-error': [ 'error' ], 8 } 9}
lib/rules
. It should export one function called create
. The
create
function should return a visitor object.lib/index.ts
.test/fixtures/<rule name>
. Copy and adjust an eslintrc.js
file
from another test..ts
file, and be sure to add either an expected.ts
or an .error.txt
variant
as well!npx tsc -w
running, then from a debugging terminal, npx jest --no-coverage -it 'your rule name'
), set a breakpoint, and inspect the typeless objects.Use https://ts-ast-viewer.com/ to get a feel for the AST you're trying to analyze. Note
that eslint uses estree
to model AST nodes (not the TypeScript AST nodes), but they are
often comparable. Add type-testing TypeScript helpers to type-checkers.ts
for typing
assistance.
To activate it for real on the repo, also add it to cdk-build-tools/config/eslintrc.js
.
No vulnerabilities found.
No security vulnerabilities found.