Skip to content
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

Lint code examples #864

Open
mtrunkat opened this issue Feb 21, 2024 · 3 comments
Open

Lint code examples #864

mtrunkat opened this issue Feb 21, 2024 · 3 comments
Labels
t-tooling Issues with this label are in the ownership of the tooling team.

Comments

@mtrunkat
Copy link
Member

mtrunkat commented Feb 21, 2024

Every code example should be linted (+editorconfig applied) to follow Apify code formatting guidelines.

@B4nan
Copy link
Member

B4nan commented Feb 21, 2024

I've actually enabled eslint on code blocks last week via #861, so this should be done already (for js/json/ts code blocks at least)

Note that this introduces a new problem, we often don't have fully valid code in the code blocks so as part of that PR I had to move some JSON code blocks to json5 which is more loose (but I think it is not syntax highlighted, which might be fixable, want to look into that soon).

+editorconfig applied

I don't think that would be possible, not without too much hustle. If we want that, the code blocks should be moved to regular code files with proper extension and included in the markdown (as we do with some examples in crawlee). Using this approach would also unlock any other kind of linting, including whatever we want to use on python code.

@mtrunkat
Copy link
Member Author

@B4nan - Oh, cool! Let's keep this open to make sure we add Python. But JS is a huge step.

@vdusek
Copy link
Contributor

vdusek commented Mar 1, 2024

Hi, sorry for the late answer, I had to overlook this.

We use Ruff for the Python projects (which is both linter & formatter). I did a quick research and unfortunately, neither linting nor code formatting of markdown code blocks is supported, yet. Here is the open issue - astral-sh/ruff#3792.

In the opened issue someone links the PR astral-sh/ruff#9030. However, it only adds support for linting & formatting the code blocks inside Python docstrings, not code blocks in markdown documents.

@B4nan B4nan added the t-tooling Issues with this label are in the ownership of the tooling team. label Mar 4, 2024
@mtrunkat mtrunkat added the t-docs Issues owned by technical writing team. label Mar 21, 2024
@TC-MO TC-MO removed the t-docs Issues owned by technical writing team. label Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t-tooling Issues with this label are in the ownership of the tooling team.
Projects
None yet
Development

No branches or pull requests

4 participants