Skip to content

chore(scripts): add lint scripts for CI and release #4099

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

Merged
merged 2 commits into from
Oct 26, 2022

Conversation

trivikr
Copy link
Member

@trivikr trivikr commented Oct 26, 2022

Issue

Fixes: #4074

Description

Adds lint scripts for CI and release

Testing

$ git checkout -b test-lint

# Commit from https://github.com/aws/aws-sdk-js-v3/pull/3833 which only updates util-dynamodb
$ git cherry-pick 334fa3dbc6ec38359dc0e4ca93ba1c5b266ecf06

$ git clean -dfx && yarn

$ yarn lerna exec --since origin/main --exclude-dependents 'eslint --quiet src/**/*.ts'
...
lerna notice cli v5.5.2
lerna notice filter changed since "main"
lerna notice filter excluding dependents
lerna info Looking for changed packages since main
lerna info Executing command in 1 package: "eslint --quiet src/**/*.ts"
lerna success exec Executed command in 1 package: "eslint --quiet src/**/*.ts"

# Swap every two lines in export to introduce lint error
$ temp_file=$(mktemp)
$ source_file=packages/util-dynamodb/src/index.ts
$ sed -n '{h;${p;q;};n;G;p;}' $source_file > $temp_file && cp $temp_file $source_file

$ git diff
diff --git a/packages/util-dynamodb/src/index.ts b/packages/util-dynamodb/src/index.ts
index 453bae2a94..45915b1cb0 100644
--- a/packages/util-dynamodb/src/index.ts
+++ b/packages/util-dynamodb/src/index.ts
@@ -1,6 +1,6 @@
-export * from "./calculateTtl";
 export * from "./convertToAttr";
-export * from "./convertToNative";
+export * from "./calculateTtl";
 export * from "./marshall";
-export * from "./models";
+export * from "./convertToNative";
 export * from "./unmarshall";
+export * from "./models";

$ yarn lerna exec --since main --exclude-dependents 'eslint --quiet src/**/*.ts'
...
lerna notice cli v5.5.2
lerna notice filter changed since "main"
lerna notice filter excluding dependents
lerna info Looking for changed packages since main
lerna info Executing command in 1 package: "eslint --quiet src/**/*.ts"

/local/home/trivikr/workspace/aws-sdk-js-v3/packages/util-dynamodb/src/index.ts
  2:1  error  "export * from './calculateTtl'" should occur before "export * from './convertToAttr'"  sort-export-all/sort-export-all
  4:1  error  "export * from './convertToNative'" should occur before "export * from './marshall'"    sort-export-all/sort-export-all
  6:1  error  "export * from './models'" should occur before "export * from './unmarshall'"           sort-export-all/sort-export-all

✖ 3 problems (3 errors, 0 warnings)
  3 errors and 0 warnings potentially fixable with the `--fix` option.

lerna ERR! eslint --quiet src/**/*.ts exited 1 in '@aws-sdk/util-dynamodb'
lerna ERR! eslint --quiet src/**/*.ts exited 1 in '@aws-sdk/util-dynamodb'
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
$ yarn lerna exec --ignore '@aws-sdk/client-*' --ignore '@aws-sdk/aws-*' 'eslint --quiet src/**/*.ts'
...
lerna notice cli v5.5.2
lerna notice filter excluding ["@aws-sdk/client-*","@aws-sdk/aws-*"]
lerna info filter [ '!@aws-sdk/client-*', '!@aws-sdk/aws-*' ]
lerna info Executing command in 112 packages: "eslint --quiet src/**/*.ts"
lerna success exec Executed command in 112 packages: "eslint --quiet src/**/*.ts"
...

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@trivikr trivikr requested a review from a team as a code owner October 26, 2022 17:14
@trivikr trivikr force-pushed the add-lint-script-packages branch from 7a8670c to 24a1b69 Compare October 26, 2022 17:35
@trivikr trivikr marked this pull request as draft October 26, 2022 18:09
@trivikr
Copy link
Member Author

trivikr commented Oct 26, 2022

Converted to draft, as CI required specifying origin/main

The fix is in build/test scripts in #4101, this PR will be updated once it's merged.

@trivikr trivikr marked this pull request as ready for review October 26, 2022 21:42
@trivikr trivikr merged commit 8d26e15 into aws:main Oct 26, 2022
@trivikr trivikr deleted the add-lint-script-packages branch October 26, 2022 21:42
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Run lint on packages
3 participants