Skip to content

Commit 617bcba

Browse files
authored
chore: upgrade to new eslint and switch to flat config (#36272)
Centralize eslint config in a new package, `@aws-cdk/eslint-config` as well because it was duplicated too much. Addresses linting/compilation problems that had gone unnoticed because of nonstandard package configs. - Since the version of `@stylistic/eslint-plugin` that supports flat config forces a move to ESM. Since Node 18 doesn't yet support `require()`ing ESM modules and since config loading needs to be synchronous, our config has to run as ESM. - Rename `.eslintrc.js` -> `eslint.config.mjs` everywhere for the new flat config (and update `.gitignore` and `.npmignore` at the same time) - Introduce `@aws-cdk/eslint-config` to hold a centralized config for all packages in the monorepo. - Found some `.bak` files that seem like they're just hanging out. - Update all packages with `eslint --fix` to the new sets of rules. - Custom resource handler tests were not being type checked and had a bunch of issues that needed to be fixed. - `quote-props` -> `@stylistic/quote-props` - Bulk suppressions for the `Error` rule in dedicated files, because the eslint tool doesn't allow adding suppression comments in bulk. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 3751930 commit 617bcba

File tree

1,259 files changed

+7087
-19980
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,259 files changed

+7087
-19980
lines changed

lerna.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"packages/@aws-cdk-containers/*",
1010
"packages/@aws-cdk-testing/*",
1111
"packages/@aws-cdk/*/lambda-packages/*",
12+
"tools/@aws-cdk/eslint-config",
1213
"tools/@aws-cdk/cdk-build-tools",
1314
"tools/@aws-cdk/user-input-gen",
1415
"tools/@aws-cdk/cdk-release",

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
"packages/awslint",
8181
"packages/@aws-cdk-testing/*",
8282
"packages/@aws-cdk/*/lambda-packages/*",
83+
"tools/@aws-cdk/eslint-config",
8384
"tools/@aws-cdk/cdk-build-tools",
8485
"tools/@aws-cdk/user-input-gen",
8586
"tools/@aws-cdk/cdk-release",

packages/@aws-cdk-testing/framework-integ/.eslintrc.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

packages/@aws-cdk-testing/framework-integ/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
.LAST_BUILD
55
*.snk
66
junit.xml
7-
!.eslintrc.js
7+
!eslint.config.mjs
88
.nyc_output
99
coverage
1010
nyc.config.js

packages/@aws-cdk-testing/framework-integ/.npmignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
.LAST_BUILD
33
*.snk
44
junit.xml
5-
.eslintrc.js
5+
eslint.config.mjs
66
# exclude cdk artifacts
77
**/cdk.out
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { makeConfig } from '@aws-cdk/eslint-config';
2+
3+
const config = makeConfig('tsconfig.json');
4+
for (const c of config) {
5+
// Disable import/order rule, it's being violated all over the place
6+
if (c.rules) {
7+
c.rules['import/order'] = ['off'];
8+
}
9+
}
10+
11+
export default config;

packages/@aws-cdk-testing/framework-integ/jest.config.js.bak

Lines changed: 0 additions & 14 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"Description": "foo bar",
3+
"Resources": {
4+
"TopicProductD757E287": {
5+
"Type": "AWS::SNS::Topic"
6+
}
7+
}
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"Resources": {
3+
"TopicProductD757E287": {
4+
"Type": "AWS::SNS::Topic"
5+
}
6+
}
7+
}

packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-authorizers/test/auth-handler/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-console */
21

32
export const handler = async (event: AWSLambda.APIGatewayProxyEventV2) => {
43
const key = event.headers['x-api-key'];

0 commit comments

Comments
 (0)