forked from kitschpatrol/shared-config
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b35d32b
commit e1e4e2d
Showing
13 changed files
with
2,621 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// eslint-disable-next-line no-unused-vars | ||
import sharedConfig, { overrideRules } from '@envsa/remark-config'; | ||
|
||
const localConfig = { | ||
...sharedConfig, | ||
// Overrides are a special case, working as below (set `false` as the second element to disable): | ||
// plugins: overrideRules(sharedConfig.plugins, [ | ||
// ['remark-lint-first-heading-level', 2], | ||
// ['remarkValidateLinks', { repository: false }], | ||
// ]), | ||
}; | ||
|
||
export default localConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
{ | ||
"recommendations": [ | ||
"dbaeumer.vscode-eslint", | ||
"svelte.svelte-vscode", | ||
"streetsidesoftware.code-spell-checker", | ||
"esbenp.prettier-vscode", | ||
"github.vscode-github-actions", | ||
"johnsoncodehk.vscode-tsconfig-helper", | ||
"streetsidesoftware.code-spell-checker", | ||
"stylelint.vscode-stylelint", | ||
"svelte.svelte-vscode", | ||
"unifiedjs.vscode-mdx", | ||
"usernamehw.errorlens", | ||
"johnsoncodehk.vscode-tsconfig-helper", | ||
"github.vscode-github-actions", | ||
"yoavbls.pretty-ts-errors" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ openforms | |
pcss | ||
pinojs | ||
redactoranchors | ||
remarklint | ||
seomatic | ||
softprops | ||
solspace | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import sharedConfig, { overrideRules } from '@envsa/remark-config'; | ||
|
||
const localConfig = { | ||
...sharedConfig, | ||
// Overrides are a special case, working as below (set `false` as the second element to disable): | ||
// plugins: overrideRules(sharedConfig.plugins, [ | ||
// ['remark-lint-first-heading-level', 2], | ||
// ['remarkValidateLinks', { repository: false }], | ||
// ]), | ||
}; | ||
|
||
export default localConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"recommendations": ["unifiedjs.vscode-mdx"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Liam Rella | ||
|
||
Based on the MIT-licensed "@kitschpatrol/shared-config" project by Eric Mika | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
{ | ||
"name": "@envsa/remark-config", | ||
"version": "1.0.0-beta.3", | ||
"type": "module", | ||
"description": "Markdown and MDX linting for @envsa/shared-config.", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/envsa/shared-config.git", | ||
"directory": "packages/remark-config" | ||
}, | ||
"bugs": "https://github.com/envsa/shared-config/issues", | ||
"author": { | ||
"name": "Liam Rella", | ||
"email": "DEW.ICTWebServices@sa.gov.au", | ||
"url": "https://github.com/rellafella" | ||
}, | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">=18.0.0", | ||
"pnpm": ">=8.0.0" | ||
}, | ||
"bin": { | ||
"remark-config": "bin/cli.js" | ||
}, | ||
"main": "remark.config.js", | ||
"files": [ | ||
"bin/*", | ||
"init/*" | ||
], | ||
"keywords": [ | ||
"shared-config", | ||
"remark-config", | ||
"remark-lint", | ||
"remark", | ||
"cli" | ||
], | ||
"scripts": { | ||
"build": "../../scripts/build.ts && pnpm mdat readme", | ||
"cli": "node ./bin/cli.js", | ||
"prepublishOnly": "pnpm run build" | ||
}, | ||
"dependencies": { | ||
"@pinojs/json-colorizer": "^4.0.0", | ||
"cosmiconfig": "^9.0.0", | ||
"execa": "^8.0.1", | ||
"fs-extra": "^11.2.0", | ||
"remark-cli": "^12.0.1", | ||
"remark-directive": "^3.0.0", | ||
"remark-frontmatter": "^5.0.0", | ||
"remark-gfm": "^4.0.0", | ||
"remark-lint": "^10.0.0", | ||
"remark-lint-checkbox-character-style": "^5.0.0", | ||
"remark-lint-checkbox-content-indent": "^5.0.0", | ||
"remark-lint-code-block-style": "^4.0.0", | ||
"remark-lint-emphasis-marker": "^4.0.0", | ||
"remark-lint-fenced-code-flag": "^4.0.0", | ||
"remark-lint-fenced-code-marker": "^4.0.0", | ||
"remark-lint-final-definition": "^4.0.1", | ||
"remark-lint-first-heading-level": "^4.0.0", | ||
"remark-lint-heading-increment": "^4.0.0", | ||
"remark-lint-linebreak-style": "^4.0.0", | ||
"remark-lint-maximum-heading-length": "^4.0.0", | ||
"remark-lint-no-duplicate-defined-urls": "^3.0.0", | ||
"remark-lint-no-duplicate-definitions": "^4.0.0", | ||
"remark-lint-no-duplicate-headings": "^4.0.0", | ||
"remark-lint-no-duplicate-headings-in-section": "^4.0.0", | ||
"remark-lint-no-empty-url": "^4.0.0", | ||
"remark-lint-no-file-name-articles": "^3.0.0", | ||
"remark-lint-no-file-name-consecutive-dashes": "^3.0.0", | ||
"remark-lint-no-file-name-irregular-characters": "^3.0.0", | ||
"remark-lint-no-file-name-outer-dashes": "^3.0.0", | ||
"remark-lint-no-heading-indent": "^5.0.0", | ||
"remark-lint-no-heading-like-paragraph": "^4.0.0", | ||
"remark-lint-no-literal-urls": "^4.0.0", | ||
"remark-lint-no-multiple-toplevel-headings": "^4.0.0", | ||
"remark-lint-no-paragraph-content-indent": "^5.0.0", | ||
"remark-lint-no-reference-like-url": "^4.0.0", | ||
"remark-lint-no-shell-dollars": "^4.0.0", | ||
"remark-lint-no-shortcut-reference-image": "^4.0.0", | ||
"remark-lint-no-shortcut-reference-link": "^4.0.0", | ||
"remark-lint-no-tabs": "^4.0.0", | ||
"remark-lint-no-undefined-references": "^5.0.0", | ||
"remark-lint-no-unneeded-full-reference-image": "^4.0.0", | ||
"remark-lint-no-unneeded-full-reference-link": "^4.0.0", | ||
"remark-lint-no-unused-definitions": "^4.0.0", | ||
"remark-lint-ordered-list-marker-style": "^4.0.0", | ||
"remark-lint-rule-style": "^4.0.0", | ||
"remark-lint-strikethrough-marker": "^3.0.0", | ||
"remark-lint-strong-marker": "^4.0.0", | ||
"remark-lint-table-cell-padding": "^5.0.0", | ||
"remark-lint-unordered-list-marker-style": "^4.0.0", | ||
"remark-preset-prettier": "^2.0.1", | ||
"remark-validate-links": "^13.0.1" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
<!--+ Warning: Content inside HTML comment blocks was generated by mdat and may be overwritten. +--> | ||
|
||
<!-- title --> | ||
|
||
# @envsa/remark-config | ||
|
||
<!-- /title --> | ||
|
||
<!-- badges --> | ||
|
||
[![NPM Package @envsa/remark-config](https://img.shields.io/npm/v/@envsa/remark-config.svg)](https://npmjs.com/package/@envsa/remark-config) | ||
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) | ||
|
||
<!-- /badges --> | ||
|
||
<!-- description --> | ||
|
||
**Markdown and MDX linting for @envsa/shared-config.** | ||
|
||
<!-- /description --> | ||
|
||
## Overview | ||
|
||
It's a shared [Remark](https://github.com/remarkjs/remark/blob/main/packages/remark-cli/readme.md#example-config-files-json-yaml-js) config for linting. | ||
|
||
**See [`@kitschpatrol/shared-config`](https://www.npmjs.com/package/@kitschpatrol/shared-config) for the recommended single-package approach.** | ||
|
||
## Setup | ||
|
||
To use just this Remark config in isolation: | ||
|
||
1. Install the `.npmrc` in your project root. This is required for correct PNPM behavior: | ||
|
||
```sh | ||
pnpm dlx @kitschpatrol/repo-config --init | ||
``` | ||
|
||
2. Add the package: | ||
|
||
```sh | ||
pnpm add -D @kitschpatrol/remark-config | ||
``` | ||
|
||
3. Add the starter `.remarkrc.js` and files to your project root, and add any customizations you'd like: | ||
```sh | ||
pnpm exec remark-config --init | ||
``` | ||
## Usage | ||
The Remark binary should be picked up automatically by VS Code plugins. | ||
You can call it directly, but it's recommended to use the script bundled with the shared config to invoke the remark lint rules through ESLint. The [`eslint-mdx`](https://github.com/mdx-js/eslint-mdx) plugin is used to bridge these rules into ESLint and the VS Code ESLint plugin. | ||
|
||
Integrate with your `package.json` scripts as you see fit, for example: | ||
|
||
```json | ||
"scripts": { | ||
"lint": "pnpm remark . --quiet --frail" | ||
} | ||
``` | ||
|
||
### CLI | ||
|
||
<!-- cli-help --> | ||
|
||
#### Command: `remark-config` | ||
|
||
Markdown and MDX linting for @envsa/shared-config. | ||
|
||
Usage: | ||
|
||
```txt | ||
remark-config [<file|glob> ...] | ||
``` | ||
|
||
| Option | Argument | Description | | ||
| ------------------------ | -------- | ---------------------------------------------------------------- | | ||
| `--init`<br>`-i` | | Initialize by copying starter config files to your project root. | | ||
| `--print-config`<br>`-p` | `<path>` | Print the effective configuration at a certain path. | | ||
| `--help`<br>`-h` | | Print this help info. | | ||
| `--version`<br>`-v` | | Print the package version. | | ||
|
||
<!-- /cli-help --> | ||
|
||
## Configuration | ||
|
||
### Avoiding errors in non-git projects | ||
|
||
The [remark-validate-links](https://github.com/remarkjs/remark-validate-links) looks for a git remote to validate relative link paths. | ||
|
||
If your project is not a git repository, you will receive warning from remark via eslint: | ||
|
||
```txt | ||
Command failed: git remote -v | ||
fatal: not a git repository (or any of the parent directories): .git | ||
eslint(undefined-undefined) | ||
``` | ||
|
||
To fix this, pass the `repository: false` option in your `.remarkrc.js` file: | ||
|
||
```js | ||
// .remarkrc.js | ||
import sharedConfig, { overrideRules } from '@kitschpatrol/remark-config' | ||
const localConfig = { | ||
...sharedConfig, | ||
plugins: overrideRules(sharedConfig.plugins, [['remarkValidateLinks', { repository: false }]]), | ||
} | ||
export default localConfig | ||
``` | ||
<!-- license --> | ||
## License | ||
[MIT](license.txt) © Liam Rella | ||
<!-- /license --> |
Oops, something went wrong.