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

remark-lint #27

Closed
5 tasks done
arcticicestudio opened this issue Aug 24, 2019 · 0 comments · Fixed by #28
Closed
5 tasks done

remark-lint #27

arcticicestudio opened this issue Aug 24, 2019 · 0 comments · Fixed by #28

Comments

@arcticicestudio
Copy link
Owner

arcticicestudio commented Aug 24, 2019

Integrate remark-lint which is built on remark, the powerful Markdown processor powered by plugins such as remark-lint.

Ensuring theMarkdown you (and contributors) write is of great quality will provide better rendering in all the different markdown parsers, and makes sure less refactoring is needed afterwards.

remark-lint can be used via remark-cli and a rule preset. This preset will be remark-preset-lint-arcticicestudio, the custom preset that implements the Arctic ice Studio Markdown Style Guide.

Since the custom preset is still in major version 0 note that the version range should be >=0.x.x <1.0.0 to avoid the “SemVer Major Zero Caveat”. When defining package versions with the the carat ^ or tilde ~ range selector it won't affect packages with a major version of 0. yarn will resolve these packages to their exact version until the major version is greater or equal to 1.
To avoid this caveat the more detailed version range >=0.x.x <1.0.0 should be used to resolve all versions greater or equal to 0.x.x but less than 1.0.0. This will always use the latest 0.x.x version and removes the need to increment the version manually on each new release.

Configuration

The .remarkrc.js configuration file will be placed in the project root as well as the .remarkignore file to also define ignore pattern.

Package script/task

To allow to run the Markdown linting separately a lint:md package script/task will be added to be included in the main lint script flow.

Tasks

  • Install remark-cli and remark-preset-lint-arcticicestudio packages as development dependency.
  • Implement .remarkrc.js configuration file.
  • Implement .remarkignore ignore pattern file.
  • Implement package lint:md script/task.
  • Lint current code base for the first time and fix possible Markdown style guide violations.
@arcticicestudio arcticicestudio added this to the 0.1.0 milestone Aug 24, 2019
arcticicestudio added a commit that referenced this issue Aug 24, 2019
Installed `remark-lint` (1) that is part of `remark-cli` (2).
`remark-preset-lint-arcticicestudio` (3) is used as rule preset that
implements the Arctic ice Studio Markdown Style Guide (4).

References:
  (1) https://github.com/remarkjs/remark-lint
  (2) https://github.com/remarkjs/remark/tree/master/packages/remark-cli
  (3) https://github.com/arcticicestudio/remark-preset-lint-arcticicestudio
  (4) https://github.com/arcticicestudio.github.io/styleguide-markdown

GH-27
arcticicestudio added a commit that referenced this issue Aug 24, 2019
Created the main "remark" (1) configuration file and initially sets up
the `remark-preset-lint-arcticicestudio` (2) preset.
Also added the `.remarkignore` file with defined ignore pattern.

References:
  (1) https://remark.js.org
  (2) https://github.com/remarkjs/remark-lint
  (3) https://github.com/arcticicestudio/remark-preset-lint-arcticicestudio

GH-27
arcticicestudio added a commit that referenced this issue Aug 24, 2019
The package script/task allows to run the Markdown linting separately
and is included in the main linting script flow.

References:
  (1) https://github.com/mysticatea/npm-run-all

GH-27
arcticicestudio added a commit that referenced this issue Aug 24, 2019
Integrated `remark-lint` (1), that is built on remark (2), the powerful
Markdown processor powered by plugins like "remark-lint".

  "Ensuring the Markdown you (and contributors) write is of great
  quality will provide better rendering in all the different markdown
  parsers, and makes sure less refactoring is needed afterwards."

"remark-lint" can be used via remark-cli (3) and a rule preset.
This preset is `remark-preset-lint-arcticicestudio` (4), the custom
preset that implements the "Arctic ice Studio Markdown Style Guide" (5).

Since the custom preset is still in major version `0` note that the
version range is `>=0.x.x <1.0.0` to avoid the "SemVer Major Zero
Caveat". When defining package versions with the the carat `^` or tilde
`~` range selector it won't affect packages with a major version of `0`.
"yarn" will resolve these packages to their exact version until the
major version is greater or equal to `1`.
To avoid this caveat the more detailed version range `>=0.x.x <1.0.0`
is used to resolve all versions greater or equal to `0.x.x` but less
than `1.0.0`. This will always use the latest `0.x.x` version and
removes the need to increment the version manually on each new release.

>>> Configuration

The `.remarkrc.js` configuration file is placed in the project root as
well as the `.remarkignore` file to also define ignore pattern.

>>> Package script/task

To allow to run the Markdown linting separately a `lint:md` package
script/task has been added to be including the main `lint` script flow.

References:
  (1) https://github.com/remarkjs/remark-lint
  (2) https://remark.js.org
  (3) https://www.npmjs.com/package/remark-cli
  (4) https://github.com/arcticicestudio/remark-preset-lint-arcticicestudio
  (5) https://arcticicestudio.github.io/styleguide-markdown

Resolves GH-27
@arcticicestudio arcticicestudio mentioned this issue Aug 24, 2019
2 tasks
arcticicestudio added a commit that referenced this issue Aug 24, 2019
Integrated `lint-staged` (1) to run linters against staged Git files to
prevent to add code that violates any style guide into the code base.

>>> Configuration

The configuration file `lint-staged.config.js` is placed in the project
root and includes the command that should be run for matching file
extensions (globs). It includes at least the three following entries
with the same order as listed here:

1. `prettier --list-different` - Run Prettier (GH-32) against
   `*.{js,json,md,mdx,ts,tsx,yml}` to ensure all files are formatted
   correctly. The `--list-different` prints the found files that are not
   conform to the Prettier configuration.
2. `eslint` - Run ESLint (GH-30) against `*.{js,ts,tsx}` to ensure all
   TypeScript and JavaScript files are compliant to the style guide
   after being formatted with Prettier.
3. `remark --no-stdout` - Run remark-lint (GH-27) against `*.md` to
   ensure all Markdown files are compliant to the style guide.
   The `--no-stdout` flag suppresses the output of the parsed file
   content.

References:
  (1) https://github.com/okonet/lint-staged
  (2) https://www.npmjs.com/package/lint-staged

Resolves GH-33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants