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

Enable Markdown lint option #3034

Merged
merged 29 commits into from
May 26, 2019
Merged

Conversation

AWolf81
Copy link
Contributor

@AWolf81 AWolf81 commented May 24, 2019

After merging #2983 we can add this to toggle markdownLinting.

I've based this on branch roottool:add-markdownlint-rules-form from PR #2983

Description

  • Added enableMarkdownLint setting
  • Add/remove gutter based on enableMarkdownLint

Issue fixed

#3025

Type of changes

  • ⚪ Bug fix (Change that fixed an issue)
  • ⚪ Breaking change (Change that can cause existing functionality to change)
  • ⚪ Improvement (Change that improves the code. Maybe performance or development improvement)
  • 🔘 Feature (Change that adds new functionality)
  • ⚪ Documentation change (Change that modifies documentation. Maybe typo fixes)

Checklist:

  • 🔘 My code follows the project code style
  • ⚪ I have written test for my code and it has been tested
  • 🔘 All existing tests have been passed
  • 🔘 I have attached a screenshot/video to visualize my change if possible

Todos:

  • Fix gutter toggling

Discussion

  • Is the position of the option OK or should it be closer to the config area for markdown lint? I've moved it to the textarea because I think that location is better.
  • Is setting enableMarkdownLint to false by default OK?
  • Any ideas how I can fix the gutter toggling? It seems to not display the linting errors after re-enabling the linting. I've found a work-around by toggling the gutter with style.display and keep it in the config. Not sure if there is a better way to handle it but it's working now.

Screenshot

Current setting
grafik

Below is the location from my first draft (changed it to the above location)
grafik

@AWolf81 AWolf81 marked this pull request as ready for review May 25, 2019 05:37
@ZeroX-DG ZeroX-DG added the awaiting review ❇️ Pull request is awaiting a review. label May 25, 2019
Jsonlint.parse(customMarkdownLintConfig)
lintConfigJson = JSON.parse(customMarkdownLintConfig)
} catch (err) {
throw err
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think throwing an error here is a good thing to do because it will make the app unusable. I think you should put something more "user-friendly" for example not applying the lint config and display error message above the custom lint config box in the setting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right. It's bad to throw an error with-out handling it.
How can I add the error message display? I've tried to change the throw err to

eventEmitter.emit('APP_SETTING_ERROR')
return

But I don't like how it's working. It first shows success message and then the error occured message. It happens pretty fast - short flicker of the green message. Also on a second click it won't show the error again.

The catch can be triggered by entering invalid json for the custom markdown lint rule and then press the save button.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A custom error message wasn't working - not sure why. I wanted to add something like: Failed to apply custom linting rule.

Tried it with eventEmitter.emit('APP_SETTING_ERROR', {message: 'Failed to apply...'})

@ZeroX-DG ZeroX-DG added awaiting changes 🖊️ Pull request has been reviewed, but contributor needs to make changes. and removed awaiting review ❇️ Pull request is awaiting a review. labels May 26, 2019
@ZeroX-DG
Copy link
Member

And please remove all console.log unless you think it's useful for debugging and bug reporting in the future.

@AWolf81 AWolf81 force-pushed the enable-markdownlint-option branch from 213116e to c70cca2 Compare May 26, 2019 08:08
@Rokt33r Rokt33r removed the awaiting changes 🖊️ Pull request has been reviewed, but contributor needs to make changes. label May 26, 2019
@Rokt33r Rokt33r merged commit 56192f0 into BoostIO:master May 26, 2019
@Rokt33r
Copy link
Member

Rokt33r commented May 26, 2019

Submit this pr to https://issuehunt.io/r/BoostIO/Boostnote/issues/3038 :)

@prydda prydda mentioned this pull request May 27, 2019
@judsoniv
Copy link

Thank you! I've enabled linting and configured it the way I want. Thank you for being open to the feedback.

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.

5 participants