-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
9adfa76
commit 97613ab
Showing
41 changed files
with
622 additions
and
575 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
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 |
---|---|---|
@@ -1,62 +1,111 @@ | ||
'use strict'; | ||
import remarkLint from 'remark-lint'; | ||
import blockquoteIndentation from 'remark-lint-blockquote-indentation'; | ||
import checkboxCharacterStyle from 'remark-lint-checkbox-character-style'; | ||
import checkboxContentIndent from 'remark-lint-checkbox-content-indent'; | ||
import codeBlockStyle from 'remark-lint-code-block-style'; | ||
import definitionCase from 'remark-lint-definition-case'; | ||
import definitionSpacing from 'remark-lint-definition-spacing'; | ||
import emphasisMarker from 'remark-lint-emphasis-marker'; | ||
import fencedCodeMarker from 'remark-lint-fenced-code-marker'; | ||
import fileExtension from 'remark-lint-file-extension'; | ||
import finalNewline from 'remark-lint-final-newline'; | ||
import hardBreakSpaces from 'remark-lint-hard-break-spaces'; | ||
import headingStyle from 'remark-lint-heading-style'; | ||
import linkTitleStyle from 'remark-lint-link-title-style'; | ||
import listItemBulletIndent from 'remark-lint-list-item-bullet-indent'; | ||
import listItemIndent from 'remark-lint-list-item-indent'; | ||
import noAutoLinkWithoutProtocol from 'remark-lint-no-auto-link-without-protocol'; | ||
import noBlockquoteWithoutMarker from 'remark-lint-no-blockquote-without-marker'; | ||
import noEmphasisAsHeading from 'remark-lint-no-emphasis-as-heading'; | ||
import noFileNameArticles from 'remark-lint-no-file-name-articles'; | ||
import noFileNameConsecutiveDashes from 'remark-lint-no-file-name-consecutive-dashes'; | ||
import noFileNameIrregularCharacters from 'remark-lint-no-file-name-irregular-characters'; | ||
import noFileNameMixedCase from 'remark-lint-no-file-name-mixed-case'; | ||
import noFileNameOuterDashes from 'remark-lint-no-file-name-outer-dashes'; | ||
import noHeadingContentIndent from 'remark-lint-no-heading-content-indent'; | ||
import noHeadingIndent from 'remark-lint-no-heading-indent'; | ||
import noHeadingPunctuation from 'remark-lint-no-heading-punctuation'; | ||
import noInlinePadding from 'remark-lint-no-inline-padding'; | ||
import noMultipleToplevelHeadings from 'remark-lint-no-multiple-toplevel-headings'; | ||
import noShellDollars from 'remark-lint-no-shell-dollars'; | ||
import noTableIndentation from 'remark-lint-no-table-indentation'; | ||
import noUndefinedReferences from 'remark-lint-no-undefined-references'; | ||
import noUnneededFullReferenceImage from 'remark-lint-no-unneeded-full-reference-image'; | ||
import noUnneededFullReferenceLink from 'remark-lint-no-unneeded-full-reference-link'; | ||
import noUnusedDefinitions from 'remark-lint-no-unused-definitions'; | ||
import orderedListMarkerStyle from 'remark-lint-ordered-list-marker-style'; | ||
import orderedListMarkerValue from 'remark-lint-ordered-list-marker-value'; | ||
import ruleStyle from 'remark-lint-rule-style'; | ||
import strongMarker from 'remark-lint-strong-marker'; | ||
import tableCellPadding from 'remark-lint-table-cell-padding'; | ||
import tablePipeAlignment from 'remark-lint-table-pipe-alignment'; | ||
import tablePipes from 'remark-lint-table-pipes'; | ||
import unorderedListMarkerStyle from 'remark-lint-unordered-list-marker-style'; | ||
import matchPunctuation from 'remark-lint-match-punctuation'; | ||
import noRepeatPunctuation from 'remark-lint-no-repeat-punctuation'; | ||
import doubleLink from 'remark-lint-double-link'; | ||
import customRules from './rules/index.js'; | ||
|
||
exports.plugins = [ | ||
require('remark-lint'), | ||
const plugins = [ | ||
remarkLint, | ||
|
||
// Official plugins | ||
[require('remark-lint-blockquote-indentation'), 2], | ||
[require('remark-lint-checkbox-character-style'), 'consistent'], | ||
require('remark-lint-checkbox-content-indent'), | ||
[require('remark-lint-code-block-style'), 'fenced'], | ||
require('remark-lint-definition-case'), | ||
require('remark-lint-definition-spacing'), | ||
[require('remark-lint-emphasis-marker'), 'consistent'], | ||
[require('remark-lint-fenced-code-marker'), '`'], | ||
require('remark-lint-file-extension'), | ||
require('remark-lint-final-newline'), | ||
require('remark-lint-hard-break-spaces'), | ||
[require('remark-lint-heading-style'), 'atx'], | ||
[require('remark-lint-link-title-style'), '\''], | ||
require('remark-lint-list-item-bullet-indent'), | ||
[blockquoteIndentation, 2], | ||
[checkboxCharacterStyle, 'consistent'], | ||
checkboxContentIndent, | ||
[codeBlockStyle, 'fenced'], | ||
definitionCase, | ||
definitionSpacing, | ||
[emphasisMarker, 'consistent'], | ||
[fencedCodeMarker, '`'], | ||
fileExtension, | ||
finalNewline, | ||
hardBreakSpaces, | ||
[headingStyle, 'atx'], | ||
[linkTitleStyle, '\''], | ||
// TODO: this rule doesn't properly handle tab indents | ||
// require('remark-lint-list-item-content-indent'), | ||
[require('remark-lint-list-item-indent'), 'space'], | ||
require('remark-lint-no-auto-link-without-protocol'), | ||
require('remark-lint-no-blockquote-without-marker'), | ||
require('remark-lint-no-emphasis-as-heading'), | ||
require('remark-lint-no-file-name-articles'), | ||
require('remark-lint-no-file-name-consecutive-dashes'), | ||
require('remark-lint-no-file-name-irregular-characters'), | ||
require('remark-lint-no-file-name-mixed-case'), | ||
require('remark-lint-no-file-name-outer-dashes'), | ||
require('remark-lint-no-heading-content-indent'), | ||
require('remark-lint-no-heading-indent'), | ||
require('remark-lint-no-heading-punctuation'), | ||
require('remark-lint-no-inline-padding'), | ||
[require('remark-lint-no-multiple-toplevel-headings'), 1], | ||
require('remark-lint-no-shell-dollars'), | ||
require('remark-lint-no-table-indentation'), | ||
require('remark-lint-no-undefined-references'), | ||
require('remark-lint-no-unneeded-full-reference-image'), | ||
require('remark-lint-no-unneeded-full-reference-link'), | ||
require('remark-lint-no-unused-definitions'), | ||
[require('remark-lint-ordered-list-marker-style'), 'consistent'], | ||
[require('remark-lint-ordered-list-marker-value'), 'ordered'], | ||
[require('remark-lint-rule-style'), '---'], | ||
[require('remark-lint-strong-marker'), 'consistent'], | ||
[require('remark-lint-table-cell-padding'), 'consistent'], | ||
require('remark-lint-table-pipe-alignment'), | ||
require('remark-lint-table-pipes'), | ||
[require('remark-lint-unordered-list-marker-style'), 'consistent'], | ||
listItemBulletIndent, | ||
[listItemIndent, 'space'], | ||
noAutoLinkWithoutProtocol, | ||
noBlockquoteWithoutMarker, | ||
noEmphasisAsHeading, | ||
noFileNameArticles, | ||
noFileNameConsecutiveDashes, | ||
noFileNameIrregularCharacters, | ||
noFileNameMixedCase, | ||
noFileNameOuterDashes, | ||
noHeadingContentIndent, | ||
noHeadingIndent, | ||
noHeadingPunctuation, | ||
noInlinePadding, | ||
[noMultipleToplevelHeadings, 1], | ||
noShellDollars, | ||
noTableIndentation, | ||
noUndefinedReferences, | ||
noUnneededFullReferenceImage, | ||
noUnneededFullReferenceLink, | ||
noUnusedDefinitions, | ||
[orderedListMarkerStyle, 'consistent'], | ||
[orderedListMarkerValue, 'ordered'], | ||
[ruleStyle, '---'], | ||
[strongMarker, 'consistent'], | ||
[tableCellPadding, 'consistent'], | ||
tablePipeAlignment, | ||
tablePipes, | ||
[unorderedListMarkerStyle, 'consistent'], | ||
|
||
// Third-party plugins | ||
// Disabled as it throws `file.warn is not a function` | ||
// require('remark-lint-no-empty-sections'), | ||
|
||
require('remark-lint-match-punctuation'), | ||
require('remark-lint-no-repeat-punctuation'), | ||
require('remark-lint-double-link'), | ||
matchPunctuation, | ||
noRepeatPunctuation, | ||
doubleLink, | ||
|
||
// Custom plugins | ||
...require('./rules/index.js') | ||
...customRules, | ||
]; | ||
|
||
export default plugins; | ||
|
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 |
---|---|---|
@@ -1,14 +1,13 @@ | ||
'use strict'; | ||
const parse = require('parse-github-url'); | ||
const readPkg = require('read-pkg'); | ||
import parseGitHubUrl from 'parse-github-url'; | ||
import {readPackageSync} from 'read-pkg'; | ||
|
||
module.exports = ({repoURL, dirname}) => { | ||
export default function findAuthorName({repoURL, dirname}) { | ||
if (repoURL) { | ||
return parse(repoURL).owner; | ||
return parseGitHubUrl(repoURL).owner; | ||
} | ||
|
||
try { | ||
const json = readPkg.sync({cwd: dirname}); | ||
return parse(json.repository.url).owner; | ||
const json = readPackageSync({cwd: dirname}); | ||
return parseGitHubUrl(json.repository.url).owner; | ||
} catch {} | ||
}; | ||
} |
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,14 +1,12 @@ | ||
'use strict'; | ||
import fs from 'node:fs'; | ||
import path from 'node:path'; | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
module.exports = directory => { | ||
export default function findReadmeFile(directory) { | ||
const readmeFile = fs.readdirSync(directory).find(filename => ( | ||
/readme|readme\.md|readme\.markdown|readme.txt/i.test(filename) | ||
)); | ||
|
||
if (readmeFile) { | ||
return path.join(fs.realpathSync(directory), readmeFile); | ||
} | ||
}; | ||
} |
Oops, something went wrong.