Skip to content

Commit

Permalink
feat: disable style related retext plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Jan 27, 2020
1 parent 4cc1e0b commit dab8e70
Show file tree
Hide file tree
Showing 3 changed files with 966 additions and 1,176 deletions.
33 changes: 22 additions & 11 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export const plugins = [
const pluginMapper = (prefix: string) => (plugin: string) =>
[prefix, plugin].join('-')

export const remarkLintPlugins = [
'blank-lines-1-0-2',
'blockquote-indentation',
'books-links',
Expand Down Expand Up @@ -34,13 +37,21 @@ export const plugins = [
'table-pipe-alignment',
'table-pipes',
'unordered-list-marker-style',
].reduce<Array<[import('unified').Plugin, false]>>((plugins, plugin) => {
try {
plugins.push([
// eslint-disable-next-line @typescript-eslint/no-require-imports
require('remark-lint-' + plugin),
false,
])
} catch (e) {}
return plugins
}, [])
].map(pluginMapper('remark-lint'))

export const retextPlugins = ['quotes', 'sentence-spacing'].map(
pluginMapper('retext'),
)

export const plugins = remarkLintPlugins
.concat(retextPlugins)
.reduce<Array<[import('unified').Plugin, false]>>((plugins, plugin) => {
try {
plugins.push([
// eslint-disable-next-line @typescript-eslint/no-require-imports
require(plugin),
false,
])
} catch (e) {}
return plugins
}, [])
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "remark-preset-prettier",
"version": "0.2.2",
"version": "0.3.0",
"description": "Turns off all rules that are unnecessary or might conflict with Prettier.",
"repository": "[email protected]:JounQin/remark-preset-prettier.git",
"author": "JounQin <[email protected]>",
Expand All @@ -19,7 +19,7 @@
],
"scripts": {
"build": "run-p build:*",
"build:r": "r",
"build:r": "r -p",
"build:ts": "tsc -b",
"lint": "run-p lint:*",
"lint:es": "cross-env PARSER_NO_WATCH=true eslint . --cache --ext js,md,ts -f friendly",
Expand All @@ -31,7 +31,7 @@
"prettier": ">=1.0.0"
},
"devDependencies": {
"@1stg/lib-config": "^0.1.19",
"@1stg/lib-config": "^0.1.20",
"npm-run-all": "^4.1.5",
"type-coverage": "^2.4.0",
"typescript": "^3.7.5",
Expand Down
Loading

0 comments on commit dab8e70

Please sign in to comment.