Skip to content

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

Closed
@dreamorosi

Description

@dreamorosi

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

Metadata

Metadata

Assignees

Labels

automationThis item relates to automationcompletedThis item is complete and has been merged/shippedinternalPRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions