Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Monorepo with Remark packages #12

Merged
merged 1 commit into from
Apr 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
{
"name": "styleguide-markdown",
"title": "Styleguide Markdown",
"version": "0.2.0",
"description": "The Arctic Ice Studio Markdown Code Style.",
"author": {
"name": "Arctic Ice Studio",
"email": "development@arcticicestudio.com",
"url": "http://arcticicestudio.com"
},
"description": "Arctic Ice Studio Markdown code style",
"author": "Arctic Ice Studio <development@arcticicestudio.com> (https://www.arcticicestudio.com)",
"homepage": "https://arcticicestudio.github.io/styleguide-markdown",
"repository": {
"type": "git",
Expand All @@ -25,7 +20,9 @@
"config",
"preset"
],
"private": true,
"workspaces": [
"packages/@arcticicestudio/*"
],
"scripts": {
"clean": "del build",
"docs:build": "gitbook install src && gitbook build src build/docs",
Expand Down
126 changes: 126 additions & 0 deletions packages/@arcticicestudio/remark-preset-lint/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<p align="center"><img src="https://raw.githubusercontent.com/arcticicestudio/styleguide-markdown/develop/assets/images/packages/@arcticicestudio/remark-preset-lint/repository-hero.svg?sanitize=true"/></p>

<p align="center">The <a href="https://github.com/arcticicestudio/styleguide-markdown" target="_blank" rel="noreferrer">Arctic Ice Studio Markdown code style guide</a> rules as an extensible <a href="https://github.com/remarkjs/remark-lint" target="_blank" rel="noreferrer">remark-lint</a> rule preset.</p>

<p align="center"><a href="https://github.com/arcticicestudio/styleguide-markdown/releases/latest" target="_blank" rel="noreferrer"><img src="https://img.shields.io/github/release/arcticicestudio/styleguide-markdown.svg?style=flat-square&label=Release&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0"/></a> <a href="https://arcticicestudio.github.io/styleguide-markdown" target="_blank" rel="noreferrer"><img src="https://img.shields.io/github/release/arcticicestudio/styleguide-markdown.svg?style=flat-square&label=Docs&logo=read-the-docs&logoColor=eceff4&colorA=4c566a&colorB=88c0d0"/></a> <a href="https://github.com/arcticicestudio/styleguide-markdown/blob/develop/CHANGELOG.md" target="_blank" rel="noreferrer"><img src="https://img.shields.io/github/release/arcticicestudio/styleguide-markdown.svg?style=flat-square&label=Changelog&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0"/></a></p>

<p align="center"><a href="https://www.npmjs.com/package/@arcticicestudio/remark-preset-lint" target="_blank" rel="noreferrer"><img src="https://img.shields.io/npm/v/@arcticicestudio/remark-preset-lint.svg?style=flat-square&label=npm&logoColor=eceff4&colorA=4c566a&colorB=88c0d0&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PHBhdGggZmlsbD0iI2Q4ZGVlOSIgZD0iTTEyIDE0SDRhMiAyIDAgMCAxLTItMlY0YTIgMiAwIDAgMSAyLTJoOGEyIDIgMCAwIDEgMiAydjhhMiAyIDAgMCAxLTIgMnpNNCAzLjMzMkEuNjcuNjcgMCAwIDAgMy4zMzIgNHY4YzAgLjM2Ny4zLjY2OC42NjguNjY4aDhhLjY3LjY3IDAgMCAwIC42NjgtLjY2OFY0QS42Ny42NyAwIDAgMCAxMiAzLjMzMnptMCAwIi8+PHBhdGggZmlsbD0iI2Q4ZGVlOSIgZD0iTTggNmgyLjY2OHY2LjY2OEg4em0wIDAiLz48L3N2Zz4K"/></a> <a href="https://www.npmjs.com/package/@arcticicestudio/remark-preset-lint" target="_blank" rel="noreferrer"><img src="https://img.shields.io/npm/dt/@arcticicestudio/remark-preset-lint.svg?style=flat-square&label=Downloads&logoColor=eceff4&colorA=4c566a&colorB=88c0d0&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PHBhdGggZmlsbD0iI2Q4ZGVlOSIgZD0iTTEyIDE0SDRhMiAyIDAgMCAxLTItMlY0YTIgMiAwIDAgMSAyLTJoOGEyIDIgMCAwIDEgMiAydjhhMiAyIDAgMCAxLTIgMnpNNCAzLjMzMkEuNjcuNjcgMCAwIDAgMy4zMzIgNHY4YzAgLjM2Ny4zLjY2OC42NjguNjY4aDhhLjY3LjY3IDAgMCAwIC42NjgtLjY2OFY0QS42Ny42NyAwIDAgMCAxMiAzLjMzMnptMCAwIi8+PHBhdGggZmlsbD0iI2Q4ZGVlOSIgZD0iTTggNmgyLjY2OHY2LjY2OEg4em0wIDAiLz48L3N2Zz4K"/></a></p>

<p align="center"><a href="https://github.com/arcticicestudio/styleguide-markdown/releases/latest" target="_blank" rel="noreferrer"><img src="https://img.shields.io/github/release/arcticicestudio/styleguide-markdown.svg?style=flat-square&label=Markdown%20Style%20Guide&logoColor=eceff4&colorA=4c566a&colorB=88c0d0&logo=markdown"/></a> <a href="https://github.com/arcticicestudio/styleguide-javascript/releases/latest" target="_blank" rel="noreferrer"><img src="https://img.shields.io/github/release/arcticicestudio/styleguide-javascript.svg?style=flat-square&label=JavaScript%20Style%20Guide&logoColor=eceff4&colorA=4c566a&colorB=88c0d0&logo=javascript"/></a> <a href="https://github.com/arcticicestudio/styleguide-git/releases/latest" target="_blank" rel="noreferrer"><img src="https://img.shields.io/github/release/arcticicestudio/styleguide-git.svg?style=flat-square&label=Git%20Style%20Guide&logoColor=eceff4&colorA=4c566a&colorB=88c0d0&logo=git"/></a></p>


This project implements the rules of the [“Arctic Ice Studio Markdown Style Guide”][gh-arcticicestudio/styleguide-markdown] as an extensible [remark-lint][gh-remarkjs/remark-lint] rule preset.
The package supports all [official core rules][gh-remarkjs/remark-lint-blob-docs-rules] and [various plugins][gh-remarkjs/remark-blob-docs-plugins] like the [“frontmatter” Markdown extension][gh-remarkjs/remark-frontmatter] for [YAML][] and [TOML][gh-toml-lang/toml] and [“GitHub Flavoured“ Markdown][gh-remarkjs/remark-gfm].

## Getting Started

Note that this project uses [npm version 7.7.0 or higher][gh-blog-npm_v7] as the main package manager, but the documentations also include instructions to work with [Yarn][yarn-classic] (classic / `v1`).

### Installation

Add the package as development dependency to your project:

```sh
# With npm...
npm install --save-dev @arcticicestudio/remark-preset-lint

# or Yarn.
yarn add --dev @arcticicestudio/remark-preset-lint
```

Note that [peer dependencies][node-blog-peer_deps], like the [remark-lint][gh-remarkjs/remark-lint] package itself, are **only installed automatically when using a npm version equal or higher than `7.0.0`**, otherwise they must be installed separately like described in the [peer dependencies](#peer-dependencies) section below.
See the [Node distribution index][node-dist-index] for more information about which npm version is bundled with which Node version.

#### Peer Dependencies

This package depends on [various remark-lint rule packages][gh-remarkjs/remark-lint-tree-pkgs] that are defined as [peer dependencies][node-blog-peer_deps].

##### npm versions `>=7.0.0`

As of **npm version `7.0.0`, peer dependencies are** [**installed automatically**][gh-npm/rfcs-blob-install_peer_deps] and does not require any additional steps.

##### npm versions `>=5.0.0 <7.0.0`

For **npm version equal to or higher than `5.0.0` (pre-bundled with [Node.js 8][node-dist-v8-latest]) but less than `7.0.0`**, all peer dependencies can be auto-installed using the pre-bundled [`npx`][npm-npx] package:

```sh
npx install-peerdeps --dev @arcticicestudio/remark-preset-lint
```
##### npm versions `<5.0.0`

If you’re using a **npm version less than `5.0.0`**, the `npx` package is not pre-bundled, but users can either simply install the [`npx`][npm-npx] package globally to run the above command or use the [install-peerdeps][npm-install-peerdeps] helper package locally/globally to let it handle the installation of all peer dependencies:

```sh
# Install and use the "install-peerdeps" helper package locally...
npm install install-peerdeps
./node_modules/.bin/install-peerdeps --dev @arcticicestudio/remark-preset-lint

# ...or globally.
npm install --global install-peerdeps
install-peerdeps --dev @arcticicestudio/remark-preset-lint
```

To install all peer dependencies manually without `npx` or any helper package, the npm `info` command can be used to get a list of all packages and their versions:

```sh
# List the names and versions of all peer dependencies...
npm info "@arcticicestudio/remark-preset-lint" peerDependencies

# ...and install each listed package manually.
npm install PACKAGE@VERSION
```

##### Using Yarn instead of npm

If you’re not using npm but Yarn, peer dependencies can be installed by either adding them manually or using the [install-peerdeps][npm-install-peerdeps] helper package:

```sh
# Either add all packages manually by listing all required names and their versions and install them manually...
yarn info @arcticicestudio/remark-preset-lint peerDependencies
yarn add --dev remark-lint #...

# ...or use the "install-peerdeps" helper package.
yarn add --dev install-peerdeps
yarn run install-peerdeps --dev @arcticicestudio/remark-preset-lint
```

## Usage

The package can be used as rule preset by adding it to the plugins within your `.remarkrc.js` or `.remarkrc` [configuration file][remark-lint-doc-conf]:

```js
module.exports = {
plugins: ["@arcticicestudio/remark-preset-lint"],
};
```

## Contributing

Please read the [contribution guidelines][ghio-arcticicestudio/styleguide-markdown-dev-contributing] of the [“Arctic Ice Studio Markdown Style Guide”][gh-arcticicestudio/styleguide-markdown] for more details.

<p align="center"><img src="https://raw.githubusercontent.com/arcticicestudio/nord-docs/develop/assets/images/nord/repository-footer-separator.svg?sanitize=true" /></p>

<p align="center">Copyright &copy; 2018-present <a href="https://www.arcticicestudio.com" target="_blank" rel="noreferrer">Arctic Ice Studio</a> and <a href="https://www.svengreb.de" target="_blank" rel="noreferrer">Sven Greb</a></p>

<p align="center"><a href="https://github.com/arcticicestudio/styleguide-markdown/blob/develop/LICENSE" target="_blank" rel="noreferrer"><img src="https://img.shields.io/static/v1.svg?style=flat-square&label=License&message=MIT&logoColor=eceff4&logo=github&colorA=4c566a&colorB=88c0d0"/></a></p>

[gh-arcticicestudio/styleguide-markdown]: https://github.com/arcticicestudio/styleguide-markdown
[gh-remarkjs/remark-lint]: https://github.com/remarkjs/remark-lint
[gh-remarkjs/remark-frontmatter]: https://github.com/remarkjs/remark-frontmatter
[gh-remarkjs/remark-gfm]: https://github.com/remarkjs/remark-gfm
[gh-remarkjs/remark-blob-docs-plugins]: https://github.com/remarkjs/remark/blob/main/doc/plugins.md
[gh-remarkjs/remark-lint-tree-pkgs]: https://github.com/remarkjs/remark-lint/tree/main/packages
[yarn-classic]: https://classic.yarnpkg.com
[gh-blog-npm_v7]: https://github.blog/2020-10-13-presenting-v7-0-0-of-the-npm-cli
[npm]: https://www.npmjs.com
[node-blog-peer_deps]: https://nodejs.org/en/blog/npm/peer-dependencies
[gh-npm/rfcs-blob-install_peer_deps]: https://github.com/npm/rfcs/blob/latest/implemented/0025-install-peer-deps.md
[npm-install-peerdeps]: https://www.npmjs.com/package/install-peerdeps
[node-dist-v8-latest]: https://nodejs.org/dist/latest-v8.x
[npm-npx]: https://www.npmjs.com/package/npx
[node-dist-index]: https://nodejs.org/dist/index.json
[gh-remarkjs/remark-lint-blob-docs-rules]: https://github.com/remarkjs/remark-lint/blob/main/doc/rules.md#list-of-rules
[gh-toml-lang/toml]: https://github.com/toml-lang/toml
[yaml]: http://yaml.org
[remark-lint-doc-conf]: https://github.com/remarkjs/remark-lint#configuring-remark-lint
[ghio-arcticicestudio/styleguide-markdown-dev-contributing]: https://arcticicestudio.github.io/remark-preset-lint-arcticicestudio/development/contributing.html
36 changes: 36 additions & 0 deletions packages/@arcticicestudio/remark-preset-lint/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (c) 2018-present Arctic Ice Studio <development@arcticicestudio.com>
* Copyright (c) 2018-present Sven Greb <development@svengreb.de>
* This source code is licensed under the MIT license found in the LICENSE file.
*/

/**
* Arctic Ice Studio Markdown Style Guide rules as an extensible remark-lint rule preset.
* @version 0.3.0
* @license MIT
* @author Arctic Ice Studio <development@arcticicestudio.com>
* @author Sven Greb <development@svengreb.de>
* @see https://github.com/remarkjs/remark-lint
* @see https://remark.js.org
* @see https://github.com/remarkjs/remark-lint/blob/master/doc/rules.md#list-of-rules
* @see https://github.com/remarkjs/remark-lint#configuring-remark-lint
*/
module.exports = {
plugins: [
"remark-lint",
"./rules/blockquotes",
"./rules/code",
"./rules/emphasis",
"./rules/headings",
"./rules/horizontal-rules",
"./rules/links",
"./rules/lists",
"./rules/naming-conventions",
"./rules/paragraphs",
"./rules/raw-html",
"./rules/strings",
"./rules/support",
"./rules/tables",
"./rules/whitespace",
].map(require.resolve),
};
105 changes: 105 additions & 0 deletions packages/@arcticicestudio/remark-preset-lint/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
"name": "@arcticicestudio/remark-preset-lint",
"version": "0.3.0",
"description": "Arctic Ice Studio Markdown code style guide rules as an extensible remark-lint rule preset",
"author": "Arctic Ice Studio <development@arcticicestudio.com> (https://www.arcticicestudio.com)",
"homepage": "https://github.com/arcticicestudio/styleguide-markdown",
"repository": {
"type": "git",
"url": "git+https://github.com/arcticicestudio/styleguide-markdown.git",
"directory": "packages/@arcticicestudio/remark-preset-lint"
},
"bugs": {
"url": "https://github.com/arcticicestudio/styleguide-markdown/issues"
},
"license": "MIT",
"keywords": [
"remark",
"lint",
"preset",
"markdown",
"styleguide",
"codestyle"
],
"main": "index.js",
"files": [
"rules",
"index.js"
],
"publishConfig": {
"access": "public"
},
"dependencies": {
"remark-frontmatter": "^1.3.0",
"remark-lint": "^6.0.1",
"remark-lint-blockquote-indentation": "^1.0.1",
"remark-lint-checkbox-character-style": "^1.0.1",
"remark-lint-checkbox-content-indent": "^1.0.1",
"remark-lint-code-block-style": "^1.0.1",
"remark-lint-definition-case": "^1.0.1",
"remark-lint-definition-spacing": "^1.0.1",
"remark-lint-emphasis-marker": "^1.0.1",
"remark-lint-fenced-code-flag": "^1.0.1",
"remark-lint-fenced-code-marker": "^1.0.1",
"remark-lint-file-extension": "^1.0.1",
"remark-lint-final-definition": "^1.0.1",
"remark-lint-final-newline": "^1.0.1",
"remark-lint-first-heading-level": "^1.1.1",
"remark-lint-hard-break-spaces": "^1.0.2",
"remark-lint-heading-increment": "^1.0.1",
"remark-lint-heading-style": "^1.0.1",
"remark-lint-linebreak-style": "^1.0.1",
"remark-lint-link-title-style": "^1.0.1",
"remark-lint-list-item-bullet-indent": "^1.0.1",
"remark-lint-list-item-content-indent": "^1.0.1",
"remark-lint-list-item-indent": "^1.0.1",
"remark-lint-list-item-spacing": "^1.1.1",
"remark-lint-maximum-heading-length": "^1.0.1",
"remark-lint-maximum-line-length": "^1.0.2",
"remark-lint-no-auto-link-without-protocol": "^1.0.1",
"remark-lint-no-blockquote-without-marker": "^2.0.1",
"remark-lint-no-consecutive-blank-lines": "^1.0.1",
"remark-lint-no-duplicate-definitions": "^1.0.1",
"remark-lint-no-duplicate-headings": "^1.0.1",
"remark-lint-no-duplicate-headings-in-section": "^1.0.1",
"remark-lint-no-emphasis-as-heading": "^1.0.1",
"remark-lint-no-empty-url": "^1.0.2",
"remark-lint-no-file-name-articles": "^1.0.1",
"remark-lint-no-file-name-consecutive-dashes": "^1.0.1",
"remark-lint-no-file-name-irregular-characters": "^1.0.1",
"remark-lint-no-file-name-mixed-case": "^1.0.1",
"remark-lint-no-file-name-outer-dashes": "^1.0.2",
"remark-lint-no-heading-content-indent": "^1.0.1",
"remark-lint-no-heading-indent": "^1.0.1",
"remark-lint-no-heading-like-paragraph": "^1.0.1",
"remark-lint-no-heading-punctuation": "^1.0.1",
"remark-lint-no-html": "^1.0.1",
"remark-lint-no-inline-padding": "^1.0.1",
"remark-lint-no-literal-urls": "^1.0.1",
"remark-lint-no-missing-blank-lines": "^1.0.1",
"remark-lint-no-multiple-toplevel-headings": "^1.0.1",
"remark-lint-no-paragraph-content-indent": "^1.0.3",
"remark-lint-no-reference-like-url": "^1.0.1",
"remark-lint-no-shell-dollars": "^1.0.1",
"remark-lint-no-shortcut-reference-image": "^1.0.1",
"remark-lint-no-shortcut-reference-link": "^1.0.2",
"remark-lint-no-table-indentation": "^1.0.1",
"remark-lint-no-tabs": "^1.0.1",
"remark-lint-no-undefined-references": "^1.0.1",
"remark-lint-no-unused-definitions": "^1.0.1",
"remark-lint-ordered-list-marker-style": "^1.0.1",
"remark-lint-ordered-list-marker-value": "^1.0.1",
"remark-lint-rule-style": "^1.0.1",
"remark-lint-strong-marker": "^1.0.1",
"remark-lint-table-cell-padding": "^1.0.1",
"remark-lint-table-pipe-alignment": "^1.0.1",
"remark-lint-table-pipes": "^1.0.1",
"remark-lint-unordered-list-marker-style": "^1.0.1"
},
"devDependencies": {
"remark-cli": "^5.0.0"
},
"peerDependencies": {
"remark-cli": "^5.0.0"
}
}
34 changes: 34 additions & 0 deletions packages/@arcticicestudio/remark-preset-lint/rules/blockquotes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2018-present Arctic Ice Studio <development@arcticicestudio.com>
* Copyright (c) 2018-present Sven Greb <development@svengreb.de>
* This source code is licensed under the MIT license found in the LICENSE file.
*/

/**
* Enforce correct indentation for blockquotes.
*
* @see https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-blockquote-indentation
* @see https://arcticicestudio.github.io/styleguide-markdown/rules/blockquotes.html#indentation
*/
const blockquoteIndentation = require("remark-lint-blockquote-indentation");
/**
* Disallow blank lines without markers ('>') in blockquotes.
*
* @see https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-blockquote-without-marker
* @see https://arcticicestudio.github.io/styleguide-markdown/rules/blockquotes.html#multi-line
*/
const noBlockquoteWithoutMarker = require("remark-lint-no-blockquote-without-marker");

/**
* Official remark-lint core rules for blockquote document nodes.
* @author Arctic Ice Studio <development@arcticicestudio.com>
* @author Sven Greb <development@svengreb.de>
* @since 0.1.0
* @see https://github.com/remarkjs/remark-lint/blob/master/doc/rules.md#list-of-rules
*/
module.exports = {
plugins: [
[blockquoteIndentation, ["error", 2]],
[noBlockquoteWithoutMarker, ["warn"]]
]
};
50 changes: 50 additions & 0 deletions packages/@arcticicestudio/remark-preset-lint/rules/code.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright (c) 2018-present Arctic Ice Studio <development@arcticicestudio.com>
* Copyright (c) 2018-present Sven Greb <development@svengreb.de>
* This source code is licensed under the MIT license found in the LICENSE file.
*/

/**
* Enforce fenced code blocks.
*
* @see https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-code-block-style
* @see https://arcticicestudio.github.io/styleguide-markdown/rules/code.html#blocks
*/
const codeBlockStyle = require("remark-lint-code-block-style");
/**
* Enforce language syntax flags for fenced code blocks.
*
* @see https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-fenced-code-flag
* @see https://arcticicestudio.github.io/styleguide-markdown/rules/code.html#syntax-highlighting
*/
const fencedCodeFlag = require("remark-lint-fenced-code-flag");
/**
* Enforce language syntax flags for fenced code blocks.
*
* @see https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-fenced-code-marker
* @see https://arcticicestudio.github.io/styleguide-markdown/rules/code.html#marker-character-style
*/
const fencedCodeMarker = require("remark-lint-fenced-code-marker");
/**
* Warn when using a dollar sign ("$") in shell code.
*
* @see https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-shell-dollars
* @see https://arcticicestudio.github.io/styleguide-markdown/rules/code.html#no-shell-code-dollar-sign
*/
const noShellDollars = require("remark-lint-no-shell-dollars");

/**
* Official remark-lint core rules for code document nodes.
* @author Arctic Ice Studio <development@arcticicestudio.com>
* @author Sven Greb <development@svengreb.de>
* @since 0.1.0
* @see https://github.com/remarkjs/remark-lint/blob/master/doc/rules.md#list-of-rules
*/
module.exports = {
plugins: [
[codeBlockStyle, ["error", "fenced"]],
[fencedCodeFlag, ["error", { allowEmpty: false }]],
[fencedCodeMarker, ["error", "`"]],
[noShellDollars, ["warn"]]
]
};
Loading