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

Add lint #956

Merged
merged 22 commits into from
Oct 10, 2023
Merged

Add lint #956

merged 22 commits into from
Oct 10, 2023

Conversation

Dr-Electron
Copy link
Collaborator

Description of change

Added markdownlint-cli2 to our cli. So now you can run yarn iota-wiki lint glob0 [glob1] [...] [globN] to lint the corresponding files. The command comes with a custom config.
You can override the config by having a file following the .markdownlint-cli2.cjs syntax and running the command with yarn iota-wiki lint -c custom-lint.cjs glob0 [glob1] [...] [globN]

Open Questions:

  • Would it be possible to just use a link for the default config? That way we could just change the default file and wouldn't need a new cli release. Does that even make sense?

  • We need to think about a first default config we want to provide. I tested with wallet.rs and came up with this config:

        "MD007": {
            "indent": 4
        },
        "MD013": false,
        "MD033": {
            "allowed_elements": [
                "Tabs", 
                "TabItem",
                "CodeBlock"
            ]
        },
        "MD034": false,
        "MD041": false,

Although I'm not sure if it makes sense to add the rule MD033 config, because if there are other custom components to ignore the whole array needs to be overridden anyway. And I guess we have custom components in basically all repos.

Links to any relevant issues

Fixes #830

Type of change

  • Enhancement (a non-breaking change which adds functionality)

Change checklist

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own changes
  • I have made sure that added/changed links still work
  • I have commented my code, particularly in hard-to-understand areas

@github-actions
Copy link
Contributor

github-actions bot commented May 7, 2023

This pull request has been deployed to Vercel.

Latest commit: e62f20c

✅ Preview: https://iota-wiki-1x2b5zq1z-iota1.vercel.app

@github-actions
Copy link
Contributor

github-actions bot commented May 7, 2023

This pull request has been deployed to Vercel.

Latest commit: 63d975e

✅ Preview: https://iota-wiki-1ysko9ywz-iota1.vercel.app

@github-actions
Copy link
Contributor

github-actions bot commented May 7, 2023

This pull request has been deployed to Vercel.

Latest commit: 859df35

✅ Preview: https://iota-wiki-1nofhwl5b-iota1.vercel.app

@github-actions
Copy link
Contributor

github-actions bot commented May 8, 2023

This pull request has been deployed to Vercel.

Latest commit: 8c80ee3

✅ Preview: https://iota-wiki-76cs9bjx3-iota1.vercel.app

lucas-tortora
lucas-tortora previously approved these changes May 8, 2023
@Dr-Electron
Copy link
Collaborator Author

Updated this PR.

You can now run yarn linkt:md glob to run the linter and try to automatically fix what is fixable.
Or run yarn lint:md:<environment> to check a certain environment for lint errors.

As a test I suggest to run:

yarn
cd cli
yarn && yarn build
cd -
yarn lint:md iota/**/*.{md,mdx}

.prettierignore Show resolved Hide resolved
cli/src/markdownlint-cli2/default.markdownlint-cli2.cjs Outdated Show resolved Hide resolved
cli/src/markdownlint-cli2/default.markdownlint-cli2.cjs Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
@Dr-Electron
Copy link
Collaborator Author

@jlvandenhout wdyt, should I also run the linter once and fix everything?

@lucas-tortora
Copy link
Collaborator

So we should at least merge this PR, as it works. And decide if we want to wait for the restructure merge to fix the rest or do that in another PR. Wdyt?

I'd wait for the merge. I'm sure most errors are simple to fix, but it makes no sense to me to fix them in the current model which is much more complex than the merge.

lucas-tortora
lucas-tortora previously approved these changes Aug 15, 2023
@Dr-Electron
Copy link
Collaborator Author

Seems like this still contains bugs with the expansion of glob patterns.
On macOS both
yarn lint:md:check:iota
and
yarn iota-wiki lint iota/**/*.{md,mdx}
lint 685 files.

But on linux yarn lint:md:check:iota lints 701. And yarn iota-wiki lint iota/**/*.{md,mdx} only 4.
Same if markdownlint-cli2 --config cli/src/markdownlint-cli2/default.markdownlint-cli2.cjs iota/**/*.{md,mdx} is used.

@Dr-Electron Dr-Electron marked this pull request as draft August 15, 2023 19:56
@lucas-tortora
Copy link
Collaborator

Using Ubuntu 22.04.2 LTS, 64 bit, on Intel® Core™ i7-10750H CPU @ 2.60GHz × 12 I had no issues. I've attached the log file.
lintoutput.log

@Dr-Electron Dr-Electron marked this pull request as ready for review October 2, 2023 13:22
@Dr-Electron
Copy link
Collaborator Author

There is way to many stuff to fix. And as a lot of it is in deprecated docs, we can either:

  • merge this as is and fix the remaining things after the old docs were removed
  • Exclude the deprecated docs and fix everything now

@lucas-tortora
Copy link
Collaborator

There is way to many stuff to fix. And as a lot of it is in deprecated docs, we can either:

  • merge this as is and fix the remaining things after the old docs were removed
  • Exclude the deprecated docs and fix everything now

I think merging and following up with one PR to remove (or archive) deprecated docs and another to fix the issues may make this easier to track, and we'd have a clearer scope for each PR. WDYT?

@Dr-Electron
Copy link
Collaborator Author

There is way to many stuff to fix. And as a lot of it is in deprecated docs, we can either:

  • merge this as is and fix the remaining things after the old docs were removed
  • Exclude the deprecated docs and fix everything now

I think merging and following up with one PR to remove (or archive) deprecated docs and another to fix the issues may make this easier to track, and we'd have a clearer scope for each PR. WDYT?

Yeah, I prefer that too. So that means this PR is ready for review and merge ;)

package.json Outdated Show resolved Hide resolved
.github/workflows/test.yml Outdated Show resolved Hide resolved
Dr-Electron and others added 2 commits October 3, 2023 15:00
Co-authored-by: Jeroen van den Hout <[email protected]>
Co-authored-by: Jeroen van den Hout <[email protected]>
jlvandenhout
jlvandenhout previously approved these changes Oct 3, 2023
jlvandenhout
jlvandenhout previously approved these changes Oct 4, 2023
jlvandenhout
jlvandenhout previously approved these changes Oct 9, 2023
@Dr-Electron Dr-Electron merged commit a002572 into main Oct 10, 2023
11 checks passed
@Dr-Electron Dr-Electron deleted the add-lint branch October 10, 2023 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add markdownlint
3 participants