Skip to content

Maintenance: apply linting to docs/snippets code snippets #1252

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

Closed
1 of 2 tasks
dreamorosi opened this issue Jan 16, 2023 · 3 comments · Fixed by #1259
Closed
1 of 2 tasks

Maintenance: apply linting to docs/snippets code snippets #1252

dreamorosi opened this issue Jan 16, 2023 · 3 comments · Fixed by #1259
Assignees
Labels
automation This item relates to automation completed This item is complete and has been merged/shipped internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)

Comments

@dreamorosi
Copy link
Contributor

Summary

As part of the efforts described in #729 we are extracting the code snippets present in the docs in their own files, so that we can apply linting as part of our CI.

Once all the code has been extracted, and #1251 has been merged, we should apply the same linting that the rest of the project has to these files.

Why is this needed?

So that we can automate checking the correctness of the code snippets that are part of the docs, leading to a better DX.

Which area does this relate to?

Automation

Solution

The steps needed to close the issue would be:

  • add two new npm scripts to the docs/snippets/package.json file:
    • "lint": "eslint --ext .ts --no-error-on-unmatched-pattern logger tracer metrics parameters", - example
    • "lint-fix": "eslint --fix --ext .ts --no-error-on-unmatched-pattern logger tracer metrics parameters", - example
  • verify that the linting rules applied are the one in the main eslintrc.js file at the root of the project
  • run npm run lint -w docs/snippets and fix all the linting issues that show up

Notes

  • in many cases the signature of the handler function contains the any type. I would recommend to type them as unknown for the time being
  • as far as I can tell, there's no missing dependency. If there's any, install them like this npm i -D dependency-name -w docs/snippets

Acknowledgment

@dreamorosi dreamorosi added automation This item relates to automation internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.) confirmed The scope is clear, ready for implementation labels Jan 16, 2023
@niko-achilles
Copy link
Contributor

niko-achilles commented Jan 17, 2023

@dreamorosi i can take this as task for Friday.
I read your notes , point handler function about any type . I will test with the existing eslint rules as given and see what i get in the console , OK ?

@dreamorosi
Copy link
Contributor Author

Sure, that works. I expect the current linting to give errors about any specifically - but happy to discuss this while working on it.

@dreamorosi dreamorosi moved this from Backlog to Working on it in AWS Lambda Powertools for TypeScript Jan 17, 2023
@dreamorosi dreamorosi linked a pull request Jan 24, 2023 that will close this issue
13 tasks
niko-achilles added a commit to niko-achilles/aws-lambda-powertools-typescript that referenced this issue Feb 7, 2023
dreamorosi pushed a commit that referenced this issue Feb 7, 2023
* fix(docs): apply eslint rules to code snippets

* fix(docs): remove overrides, introduce changes to code-snippets

* fix(docs): code-snippet captureAWSAll (#1252)
@github-project-automation github-project-automation bot moved this from Working on it to Coming soon in AWS Lambda Powertools for TypeScript Feb 7, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2023

⚠️ COMMENT VISIBILITY WARNING ⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@github-actions github-actions bot added the pending-release This item has been merged and will be released soon label Feb 7, 2023
@dreamorosi dreamorosi removed the confirmed The scope is clear, ready for implementation label Feb 7, 2023
@dreamorosi dreamorosi added completed This item is complete and has been merged/shipped and removed pending-release This item has been merged and will be released soon labels Feb 21, 2023
@dreamorosi dreamorosi moved this from Coming soon to Shipped in AWS Lambda Powertools for TypeScript Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation This item relates to automation completed This item is complete and has been merged/shipped internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants