Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

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

Open
jmatsushita opened this issue Jan 5, 2018 · 9 comments
Open

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

jmatsushita opened this issue Jan 5, 2018 · 9 comments

Comments

@jmatsushita
Copy link

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
Copy link

Experiencing the same issue, has anyone found a workaround?

@AlexWayfer
Copy link

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

@wooorm
Copy link
Contributor

wooorm commented May 17, 2018

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
Copy link

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
Copy link

oupala commented Jun 8, 2018

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
Copy link
Author

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

@oupala
Copy link

oupala commented Jun 28, 2018

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
Copy link

I have suffered with the same issue today.

This seems to be due to the remark-lint issue: remarkjs/remark-lint#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
Copy link

oupala commented Jul 6, 2018

Excellent workaround @kokumura, thanks for sharing it!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants