AtomLinter / linter-markdown

Lint markdown files within atom
https://atom.io/packages/linter-markdown
MIT License
43 stars 8 forks source link

Cannot deactivate rule with global user ~/.remarkrc #156

Open jmatsushita opened 6 years ago

jmatsushita commented 6 years ago

I'm trying to use a global ~/.remarkrc file. It is correctly picked up, except that deactivating rules doesn't work.

That's the .remarkrc:

{
  "plugins": [
    "remark-frontmatter",
    "remark-preset-lint-markdown-style-guide",
    ["remark-lint-maximum-line-length", false]
  ]
}
omfgnuts commented 6 years ago

Experiencing the same issue, has anyone found a workaround?

AlexWayfer commented 6 years ago

The same. Is there any movement to support external configuration or explain how-to better?

wooorm commented 6 years ago

You could use a remark config file like that, but you currently cannot use globally installed plugins (those installed with npm install -g).

You could install these plugins in ~/node_modules, by going to your home directory (cd ~), and installing npm install (without -g) remark plugins and presets there.

AlexWayfer commented 6 years ago

You could use a remark config file like that, but you currently cannot use globally installed plugins (those installed with npm install -g).

You could install these plugins in ~/node_modules, by going to your home directory (cd ~), and installing npm install (without -g) remark plugins and presets there.

@wooorm, thank you! It works.

oupala commented 6 years ago

Does the workaround proposed by @wooorm solve the problem of deactivating a rule in a config file?

If yes, I did not understood how.

jmatsushita commented 6 years ago

I confirm this workaround also works for me! Thanks @wooorm ! It also solves #115 for me. 👻

oupala commented 6 years ago

The problem with this workaround is that it becomes hard to maintain these packages up to date.

It creates a third category of packages that are neither local, neither global.

So it is a good thing to have a workaround, but there should be a real fix to allow rule desactivation without having to hack.

kokumura commented 6 years ago

I have suffered with the same issue today.

This seems to be due to the remark-lint issue: https://github.com/remarkjs/remark-lint/issues/165.

I have no idea how to solve the problem completely, but found another workaround. I gave up trying to use remark-presets and installed individual remark-lint plugins globally, then worked.

For example, following ~/.remarkrc is equivalent to remark-preset-lint-markdown-style-guide. You can change, add and remove lines as you like.

{
  "plugins": [
    ["remark-lint-file-extension", "md"],
    ["remark-lint-no-file-name-mixed-case"],
    ["remark-lint-no-file-name-articles"],
    ["remark-lint-no-file-name-irregular-characters"],
    ["remark-lint-no-file-name-consecutive-dashes"],
    ["remark-lint-no-file-name-outer-dashes"],
    ["remark-lint-no-consecutive-blank-lines"],
    ["remark-lint-maximum-line-length", 80],
    ["remark-lint-no-shell-dollars"],
    ["remark-lint-hard-break-spaces"],
    ["remark-lint-heading-style", "atx"],
    ["remark-lint-heading-increment"],
    ["remark-lint-no-duplicate-headings"],
    ["remark-lint-no-multiple-toplevel-headings"],
    ["remark-lint-maximum-heading-length"],
    ["remark-lint-no-heading-punctuation", ":."],
    ["remark-lint-blockquote-indentation", 2],
    ["remark-lint-no-blockquote-without-marker"],
    ["remark-lint-unordered-list-marker-style", "-"],
    ["remark-lint-ordered-list-marker-style", "."],
    ["remark-lint-ordered-list-marker-value", "one"],
    ["remark-lint-list-item-indent", "mixed"],
    ["remark-lint-list-item-content-indent"],
    ["remark-lint-list-item-spacing"],
    ["remark-lint-code-block-style", "fenced"],
    ["remark-lint-fenced-code-flag", {"allowEmpty": false}],
    ["remark-lint-fenced-code-marker", "`"],
    ["remark-lint-rule-style", "---"],
    ["remark-lint-no-table-indentation"],
    ["remark-lint-table-pipes"],
    ["remark-lint-table-pipe-alignment"],
    ["remark-lint-table-cell-padding", "padded"],
    ["remark-lint-no-inline-padding"],
    ["remark-lint-no-shortcut-reference-image"],
    ["remark-lint-no-shortcut-reference-link"],
    ["remark-lint-final-definition"],
    ["remark-lint-definition-case"],
    ["remark-lint-definition-spacing"],
    ["remark-lint-link-title-style", "\""],
    ["remark-lint-strong-marker", "*"],
    ["remark-lint-emphasis-marker", "*"],
    ["remark-lint-no-emphasis-as-heading"],
    ["remark-lint-no-literal-urls"],
    ["remark-lint-no-auto-link-without-protocol"]
  ]
}

Then install all remark-lint-* plugins in the ~/.remarkrc with this command.

perl -nle 'print $1 while /(remark-lint-[-\w]*)/g' < ~/.remarkrc | xargs npm install -g

I prefer this workaround that not requires '~/node_modules' directory.

oupala commented 6 years ago

Excellent workaround @kokumura, thanks for sharing it!