unifiedjs / unified-engine Goto Github PK
View Code? Open in Web Editor NEWEngine to process multiple files with unified
Home Page: https://unifiedjs.com
License: MIT License
Engine to process multiple files with unified
Home Page: https://unifiedjs.com
License: MIT License
Do not throw error when running with ignored file
I am using remark-cli with lint-staged, lint-staged doesn't know the content in .remarkignore, so it will try to run on all modified md files with remark-cli. But as the file is ignored by remark-cli, it throws error Cannot process specified file: it’s ignored
I can use remark-cli with lint-staged without any errors
As it may be a breaking change, maybe a flag to enable?
That would be great, at the moment only eslint
have cache
, in stylelint
we working at this stylelint/stylelint#2270 👍 Moved from remarkjs/remark-lint#120
Sometimes certain checks depend on context, not just language.
For example, typically markdown documents need to contain complete and valid markdown documents. Some specific documents may need some specific checks to be included or excluded though. For example:
ESLint has pretty much the exact problem. They solved it using overrides
The same could be done for unified-engine
. For example:
plugins:
- remark-gfm
- [remark-lint-first-heading-level, 1]
overrides:
- files: ['*.mdx']
plugins:
- remark-mdx
- files: [.github/]
plugins:
- [remark-lint-first-heading-level, false]
ESLint also uses the globs to determine additional file extensions to check.
I can’t really think of anything else
Executing this command with the option output: true
will create an empty file test.html
cli.js test.html
An error is displayed but the file is still created.
test.html
1:1 error No such file or directory
× 1 error
I expect that no file is created and an error is emitted.
It's really useful that the second argument is the path to the config file, but it makes me nervous that this could go away if it's not actually documented. Thanks! 😄
[email protected], remark-lint
No response
remark-lint
, configured using a remarkrc.js
file.settings.handlers
and provide the expected key-value pairs for nodes such as text, paragraph, etctext
, try to take advantage of search and replace support from remark-stringify
by defining some regex + replace values:import remarkFrontmatter from 'remark-frontmatter';
import remarkGfm from 'remark-gfm';
import remarkLintNoEmptyURL from 'remark-lint-no-empty-url';
import remarkLintNoHtml from 'remark-lint-no-html';
import remarkMdx from 'remark-mdx';
import remarkDirective from 'remark-directive';
import presetLintRecommended from 'remark-preset-lint-recommended';
import {
paragraph,
remarkCustomHeadingId,
remarkLintHttpBackticks,
remarkLintImages,
remarkLintRedirects,
remarkLintSearchReplace,
remarkLintValidLocalLinks,
text,
link,
remarkLintValidHeadings,
} from './dist/packages/remark/src/index.js';
export const SEARCH_REPLACE_RULES = [
{
name: 'curly-double-quotes',
message: "Don't use curly double quotes",
regex: /“|”/,
replace: '"',
},
{
name: 'curly-single-quotes',
message: "Don't use curly single quotes",
regex: /‘|’/,
replace: "'",
},
{
name: 'nbsp',
message: "Don't use no-break spaces",
regex: / /,
replace: ' ',
},
{
name: 'm-dash',
message: "Don't use '--'. Use m-dash — instead",
search: ' -- ',
replace: ' — ',
},
{
name: 'double-spaces',
message: 'Avoid double spaces',
regex: /(?<$1>[^\s>])\s{2,}(?<$2>[^\s|])/,
replace: '$1 $2',
},
{
name: 'incorrect-spelling',
message: 'Incorrect spelling',
regex: /e-mail/,
replace: 'email',
},
{
name: 'incorrect-spelling',
message: 'Incorrect spelling',
regex: /(?<$1>w)eb site/,
replace: '$1ebsite',
},
{
name: 'relative-link',
message: "Internal links should start with '/'",
regex: /\[(?:.*?)\]\((?:internal\/.*?)\)/,
replace: '[$1](/$2)',
},
];
export const remarkConfig = {
extensions: '.mdx',
plugins: [
remarkFrontmatter,
presetLintRecommended,
remarkGfm,
remarkMdx,
remarkDirective,
remarkCustomHeadingId,
remarkLintNoEmptyURL,
remarkLintNoHtml,
remarkLintHttpBackticks,
remarkLintImages,
['remark-lint-no-undefined-references', { allow: [/#[a-zA-Z]/] }],
['remark-lint-checkbox-character-style', { checked: 'x', unchecked: ' ' }],
['remark-lint-blockquote-indentation', 2],
['remark-lint-emphasis-marker', '*'],
['remark-lint-heading-style', 'atx'],
['remark-lint-link-title-style', '"'],
['remark-lint-ordered-list-marker-style', '.'],
['remark-lint-strong-marker', '*'],
['remark-lint-table-cell-padding', 'padded'],
['remark-lint-list-item-bullet-indent', false],
['remark-lint-list-item-indent', 'one'],
['remark-lint-first-heading-level', 2],
['remark-lint-ordered-list-marker-value', 'ordered'],
['remark-lint-unordered-list-marker-style', '-'],
['remark-lint-rule-style', '---'],
['remark-lint-no-literal-urls', false],
'remark-lint-list-item-content-indent',
'remark-lint-fenced-code-flag',
'remark-lint-no-duplicate-headings',
'remark-lint-no-heading-indent',
'remark-lint-no-heading-like-paragraph',
'remark-lint-no-empty-sections',
['remark-lint-no-emphasis-as-heading', false],
['remark-lint-no-duplicate-headings', false],
['remark-lint-no-undefined-references', false],
],
settings: {
bullet: '-',
bulletOrdered: '.',
listItemIndent: 'one',
rule: '-',
handlers: {
paragraph,
text: text(SEARCH_REPLACE_RULES),
link,
},
},
};
export default remarkConfig;
Running eslint should run without errors and correctly highlight instances where the find and replace rules apply in targeted markdown/mdx files. This configuration previously worked when we were on MDX v2 (and [email protected]
), but now that we're updating plugins to work with MDX v3 and unified@11.*
this has come up.
We get an unexpected error:
error Cannot process file
[cause]:
Error: Cannot parse given file `.remarkrc.js`
at file:///Users/sstern/Documents/trashfire/internal/node_modules/unified-engine/lib/find-up.js:137:19
at done (file:///Users/sstern/Documents/trashfire/internal/node_modules/trough/index.js:148:7)
[cause]:
DataCloneError: function(node, _, state, info) {
return defaultHandlers.paragraph(splitAndMapParagraphText(node, VERBS_REGEX,...<omitted>...
} could not be cloned.
at new DOMException (node:internal/per_context/domexception:53:5)
at structuredClone (node:internal/structured_clone:23:17)
at file:///Users/sstern/Documents/trashfire/internal/node_modules/@ungap/structured-clone/esm/index.js:20:46
at addPreset (file:///Users/sstern/Documents/trashfire/internal/node_modules/unified-engine/lib/configuration.js:352:23)
at async merge (file:///Users/sstern/Documents/trashfire/internal/node_modules/unified-engine/lib/configuration.js:328:5)
at async Configuration.create (file:///Users/sstern/Documents/trashfire/internal/node_modules/unified-engine/lib/configuration.js:266:7)
Looking at the source for configuration.js
at that line, I see that this change was made in v11.2: 65da801#diff-c47540330d377e9cd0e6b633a168ffa74b2781e7a7f14ab6a8e934bd39576e22L265
- target.settings = Object.assign({}, target.settings, result.settings)
+ target.settings = structuredClone({...target.settings, ...result.settings})
I think this stylistic change may have unintentionally broken this element of support for settings.handlers
, as functions cannot be cloned.
If this is the case and it would not break anything, I would be happy to open a PR to revert back to normal Object.assign
or another object merge method that would still preserve functions.
No response
No response
Hi,
is it possible to access the original sourcecode inside a plugin? I have to inspect the original sourcecode via the tag, attribute positions. Thanks.
As titled. The quiet
options will print also untouched files.
Paths, Symbols, Colors aren't tested for windows.
TAP version 13
# engine
# engine
ok 1 should throw w/o `callback`
ok 2 should fail when w/o options
ok 3 should fail when w/o processor
# should fail w/ `output` and w/ `out`
ok 4 should fail
# should fail w/ `detectConfig` w/o `rcName`
ok 5 should fail
# should fail w/ `detectIgnore` w/o `ignoreName`
ok 6 should fail
# input
# should fail without input
ok 7 should fail
# should not fail on empty input stream
ok 8 should report
# should not fail on unmatched given globs
ok 9 should work
# should report unfound given files
not ok 10 should report
---
operator: deepEqual
expected: |-
[ null, 1, 'readme.md\n 1:1 error No such file or directory\n\nΓ£û 1 error\n' ]
actual: |-
[ null, 1, 'readme.md\n 1:1 error No such file or directory\n\n× 1 error\n' ]
at: onrun (D:\Repositories\unified-engine\test\input.js:106:10)
stack: |-
Error: should report
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\input.js:106:10)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# should not report unfound given directories
ok 11 should be equivalent
# should search for extensions
not ok 12 should report
---
operator: deepEqual
expected: |-
[ null, 0, 'bar.text: no issues found\nfoo.txt: no issues found\nnested/quux.text: no issues found\nnested/qux.txt: no issues found\n' ]
actual: |-
[ null, 0, 'bar.text: no issues found\nfoo.txt: no issues found\nnested\\quux.text: no issues found\nnested\\qux.txt: no issues found\n' ]
at: onrun (D:\Repositories\unified-engine\test\input.js:155:10)
stack: |-
Error: should report
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\input.js:155:10)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# should search a directory for extensions
not ok 13 should report
---
operator: deepEqual
expected: |-
[ null, 0, 'nested/quux.text: no issues found\nnested/qux.txt: no issues found\n' ]
actual: |-
[ null, 0, 'nested\\quux.text: no issues found\nnested\\qux.txt: no issues found\n' ]
at: onrun (D:\Repositories\unified-engine\test\input.js:182:10)
stack: |-
Error: should report
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\input.js:182:10)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# should search for globs matching files (#1)
ok 14 should report
# should search for globs matching files (#2)
ok 15 should report
# should search for globs matching dirs
not ok 16 should report
---
operator: deepEqual
expected: |-
[ null, 0, 'nested/no-3.txt: no issues found\nnested/no-4.text: no issues found\n' ]
actual: |-
[ null, 0, 'nested\\no-3.txt: no issues found\nnested\\no-4.text: no issues found\n' ]
at: onrun (D:\Repositories\unified-engine\test\input.js:263:10)
stack: |-
Error: should report
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\input.js:263:10)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# should search vfileΓÇÖs pointing to directories
not ok 17 should report
---
operator: deepEqual
expected: |-
[ null, 0, 'nested/three.txt: no issues found\n' ]
actual: |-
[ null, 0, 'nested\\three.txt: no issues found\n' ]
at: onrun (D:\Repositories\unified-engine\test\input.js:285:10)
stack: |-
Error: should report
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\input.js:285:10)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# should not ignore implicitly ignored files in globs
ok 18 should report
# should include given ignored files (#1)
not ok 19 should report
---
operator: deepEqual
expected: |-
[ null, 1, 'nested/three.txt: no issues found\nnested/two.txt\n 1:1 error Cannot process specified file: itΓÇÖs ignored\n\none.txt: no issues found\n\nΓ£û 1 error\n' ]
actual: |-
[ null, 1, 'nested\\three.txt: no issues found\nnested\\two.txt\n 1:1 error Cannot process specified file: it’s ignored\n\none.txt: no issues found\n\n× 1 error\n' ]
at: onrun (D:\Repositories\unified-engine\test\input.js:355:10)
stack: |-
Error: should report
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\input.js:355:10)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# should not atempt to read files with `contents` (1)
not ok 20 should report
---
operator: deepEqual
expected: |-
[ null, 1, 'not-existing.txt\n 1:1 error Cannot process specified file: itΓÇÖs ignored\n\nΓ£û 1 error\n' ]
actual: |-
[ null, 1, 'not-existing.txt\n 1:1 error Cannot process specified file: it’s ignored\n\n× 1 error\n' ]
at: onrun (D:\Repositories\unified-engine\test\input.js:386:10)
stack: |-
Error: should report
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\input.js:386:10)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# should not atempt to read files with `contents` (2)
ok 21 should report
# should include given ignored files (#2)
not ok 22 should report
---
operator: deepEqual
expected: |-
[ null, 1, 'nested/three.txt: no issues found\nnested/two.txt\n 1:1 error Cannot process specified file: itΓÇÖs ignored\n\none.txt: no issues found\n\nΓ£û 1 error\n' ]
actual: |-
[ null, 1, 'nested/three.txt: no issues found\nnested/two.txt\n 1:1 error Cannot process specified file: it’s ignored\n\none.txt: no issues found\n\n× 1 error\n' ]
at: onrun (D:\Repositories\unified-engine\test\input.js:445:10)
stack: |-
Error: should report
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\input.js:445:10)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# silentlyIgnore: skip detected ignored files (#1)
not ok 23 should report
---
operator: deepEqual
expected: |-
[ null, 0, 'nested/three.txt: no issues found\none.txt: no issues found\n' ]
actual: |-
[ null, 0, 'nested\\three.txt: no issues found\none.txt: no issues found\n' ]
at: onrun (D:\Repositories\unified-engine\test\input.js:478:10)
stack: |-
Error: should report
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\input.js:478:10)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# silentlyIgnore: skip detected ignored files (#2)
ok 24 should report
# should search if given files
not ok 25 should report
---
operator: deepEqual
expected: |-
[ null, 0, 'nested/three.txt: no issues found\nnested/two.txt: no issues found\none.txt: no issues found\n' ]
actual: |-
[ null, 0, 'nested\\three.txt: no issues found\nnested\\two.txt: no issues found\none.txt: no issues found\n' ]
at: onrun (D:\Repositories\unified-engine\test\input.js:535:10)
stack: |-
Error: should report
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\input.js:535:10)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# ignore
# should fail fatally when given ignores are not found
ok 26 should fail
# should support custom ignore files
not ok 27 should report
---
operator: deepEqual
expected: |-
[ null, 0, 'nested/three.txt: no issues found\none.txt: no issues found\n' ]
actual: |-
[ null, 0, 'nested\\three.txt: no issues found\none.txt: no issues found\n' ]
at: onrun (D:\Repositories\unified-engine\test\ignore.js:75:10)
stack: |-
Error: should report
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\ignore.js:75:10)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# should support searching ignore files
not ok 28 should report
---
operator: deepEqual
expected: |-
[ null, 0, 'nested/three.txt: no issues found\none.txt: no issues found\n' ]
actual: |-
[ null, 0, 'nested\\three.txt: no issues found\none.txt: no issues found\n' ]
at: onrun (D:\Repositories\unified-engine\test\ignore.js:104:10)
stack: |-
Error: should report
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\ignore.js:104:10)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# should not look into hidden files
ok 29 should report
# should support no ignore files
not ok 30 should report
---
operator: deepEqual
expected: |-
[ null, 0, 'nested/three.txt: no issues found\nnested/two.txt: no issues found\none.txt: no issues found\n' ]
actual: |-
[ null, 0, 'nested\\three.txt: no issues found\nnested\\two.txt: no issues found\none.txt: no issues found\n' ]
at: onrun (D:\Repositories\unified-engine\test\ignore.js:160:10)
stack: |-
Error: should report
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\ignore.js:160:10)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# configuration
# should fail fatally when custom rc files are missing
ok 31 should fail
# should fail fatally when custom rc files are empty
ok 32 should fail
# should fail fatally when custom rc files are invalid
ok 33 should fail
# should support `.rc.js` modules (1)
ok 34 should fail
# should support `.rc.js` modules (2)
ok 35 should support valid .rc modules
# should support `.rc.js` modules (3)
ok 36 should use NodeΓÇÖs module caching (coverage)
# should support `.rc.yaml` modules
ok 37 should fail fatally when custom .rc files are malformed
# should support custom rc files
not ok 38 should report
---
operator: deepEqual
expected: |-
[ null, 0, 'nested/four.txt: no issues found\nnested/three.txt: no issues found\none.txt: no issues found\ntwo.txt: no issues found\n' ]
actual: |-
[ null, 0, 'nested\\four.txt: no issues found\nnested\\three.txt: no issues found\none.txt: no issues found\ntwo.txt: no issues found\n' ]
at: onrun (D:\Repositories\unified-engine\test\configuration.js:261:10)
stack: |-
Error: should report
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\configuration.js:261:10)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# should support searching package files
ok 39 should report
# should support custom rc files
not ok 40 should report
---
operator: deepEqual
expected: |-
[ null, 0, 'nested/four.txt: no issues found\nnested/three.txt: no issues found\none.txt: no issues found\ntwo.txt: no issues found\n' ]
actual: |-
[ null, 0, 'nested\\four.txt: no issues found\nnested\\three.txt: no issues found\none.txt: no issues found\ntwo.txt: no issues found\n' ]
at: onrun (D:\Repositories\unified-engine\test\configuration.js:324:10)
stack: |-
Error: should report
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\configuration.js:324:10)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# should support no config files
not ok 41 should report
---
operator: deepEqual
expected: |-
[ null, 0, 'nested/three.txt: no issues found\nnested/two.txt: no issues found\none.txt: no issues found\n' ]
actual: |-
[ null, 0, 'nested\\three.txt: no issues found\nnested\\two.txt: no issues found\none.txt: no issues found\n' ]
at: onrun (D:\Repositories\unified-engine\test\configuration.js:354:10)
stack: |-
Error: should report
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\configuration.js:354:10)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# should not search if `detectConfig` is `false`
ok 42 should not search for config if `detectConfig` is set to `false`
# should cascade `settings`
ok 43 should configure
ok 44 should report
# configuration
# should cascade `plugins`
ok 45 (unnamed assert)
not ok 46 should work
---
operator: deepEqual
expected: |-
[ null, 0, 'nested/one.txt: no issues found\n' ]
actual: |-
[ null, 0, 'nested\\one.txt: no issues found\n' ]
at: onrun (D:\Repositories\unified-engine\test\configuration-plugins.js:36:10)
stack: |-
Error: should work
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\configuration-plugins.js:36:10)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# should handle failing plugins
ok 47 should work
# should handle missing plugins
ok 48 should work
# should handle invalid plugins
ok 49 should work
# should handle throwing plugins
ok 50 should work
# should handle injected plugins
ok 51 should support a plug-in
ok 52 should support a plug-in--options tuple
ok 53 should work
# configuration-presets
# should fail on invalid `presets`
ok 54 should fail
# should support plugins with the same name
ok 55 should pass the correct options to the deep plugin
ok 56 should pass the correct options to the local plugin
ok 57 should succeed
# should handle missing plugins in presets
ok 58 should succeed
# should reconfigure plugins
ok 59 should pass the correct options to the preset plugin
ok 60 should succeed
# should reconfigure required plugins
ok 61 should pass the correct options to the preset plugin
ok 62 should succeed
# Should reconfigure: turn plugins off
ok 63 should succeed
# should reconfigure settings
ok 64 should configure
ok 65 should succeed
# should reconfigure settings (2)
ok 66 should configure
ok 67 should succeed
# `configTransform`
# should work
ok 68 should pass the correct options to plugin `test`
ok 69 should have one cache entry
ok 70 should set the correct settings
ok 71 should pass the correct options to plugins
ok 72 should succeed
# `defaultConfig`
# should use default config if no config file is found
ok 73 should set the correct configuration
ok 74 should pass the correct options to plugin `test-defaults`
ok 75 should work
# should use found otherwise
ok 76 should set the correct configuration
ok 77 should pass the correct options to plugin `test-found`
ok 78 should work
# stdin
# should support stdin
ok 79 should report
# should not output if `out: false`
ok 80 should report
# should support config files on stdin
ok 81 should configure
ok 82 should work
# output
# should not write to stdout on dirs
ok 83 should report
# should write to stdout on one file
ok 84 should report
# should not write to stdout without `out`
ok 85 should report
# should not write multiple files to stdout
ok 86 should report
# should output files
ok 87 should report
# should write to a path
ok 88 should report
# should write to directories
not ok 89 should report
---
operator: deepEqual
expected: |-
[ null, 0, '', 'two', 'one.txt > nested/one.txt: written\n' ]
actual: |-
[ null, 0, '', 'two', 'one.txt > nested\\one.txt: written\n' ]
at: onrun (D:\Repositories\unified-engine\test\output.js:269:10)
stack: |-
Error: should report
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\output.js:269:10)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# should not create intermediate directories
ok 90 should report
# should write injected files
ok 91 should report
# should not write without file-path
not ok 92 should report
---
operator: deepEqual
expected: |-
[ null, 1, '', '<stdin>\n 1:1 error Error: Cannot write file without an output path ' ]
actual: |-
[ null, 1, '', '<stdin>\n 1:1 error Error: Cannot write file without an output path' ]
at: onrun (D:\Repositories\unified-engine\test\output.js:388:10)
stack: |-
Error: should report
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\output.js:388:10)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# should fail when writing files to one path
not ok 93 should report
---
operator: deepEqual
expected: |-
[ null, 1, 'one.txt\n 1:1 error Error: Cannot write multiple files to single output' ]
actual: |-
[ null, 1, 'one.txt\n 1:1 error Error: Cannot write multiple files to single output: D' ]
at: onrun (D:\Repositories\unified-engine\test\output.js:437:10)
stack: |-
Error: should report
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\output.js:437:10)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# should fail when writing to non-existent dirs
not ok 94 should report
---
operator: deepEqual
expected: |-
[ null, 1, 'one.txt\n 1:1 error Error: Cannot read output directory. Error:' ]
actual: |-
[ null, 1, 'one.txt\n 1:1 error Error: Cannot write multiple files to single output: D:\\Repositories\\unified-engine\\test\\fixtures\\two-files\\three' ]
at: onrun (D:\Repositories\unified-engine\test\output.js:470:10)
stack: |-
Error: should report
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\output.js:470:10)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# tree
# should fail on malformed input
ok 95 should report
# should read and write JSON when `tree` is given
ok 96 should report
# should read JSON when `treeIn` is given
ok 97 should report
# should write JSON when `treeOut` is given
ok 98 should report
# should support `treeOut` for stdin
ok 99 should work
# should support `treeIn` for stdin
ok 100 should work
# should write injected files
ok 101 should work
# inspect
# should write text when `inspect` is given
ok 102 should work
# should support `inspect` for stdin
ok 103 should work
# should support `inspect` with colour
ok 104 should work
# file-path
# should throw on `file-path` with files
ok 105 should fail
# should support `file-path`
ok 106 should report
# color
not ok 107 should support color
---
operator: deepEqual
expected: |-
[ null, 1, '\x1b[4m\x1b[31mreadme.md\x1b[39m\x1b[24m\n 1:1 \x1b[31merror\x1b[39m No such file or directory\n\n\x1b[31mΓ£û\x1b[39m 1 error\n' ]
actual: |-
[ null, 1, '\x1b[4m\x1b[31mreadme.md\x1b[39m\x1b[24m\n 1:1 \x1b[31merror\x1b[39m No such file or directory\n\n\x1b[31m×\x1b[39m 1 error\n' ]
at: onrun (D:\Repositories\unified-engine\test\color.js:38:7)
stack: |-
Error: should support color
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\color.js:38:7)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# reporting
# should fail for warnings with `frail`
not ok 108 should report
---
operator: deepEqual
expected: |-
[ null, 1, 'one.txt\n 1:1 warning Warning\n\nΓÜá 1 warning\n' ]
actual: |-
[ null, 1, 'one.txt\n 1:1 warning Warning\n\n‼ 1 warning\n' ]
at: onrun (D:\Repositories\unified-engine\test\reporting.js:43:10)
stack: |-
Error: should report
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\reporting.js:43:10)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# should not report succesful files when `quiet` (#1)
not ok 109 should report
---
operator: deepEqual
expected: |-
[ null, 0, 'two.txt\n 1:1 warning Warning\n\nΓÜá 1 warning\n' ]
actual: |-
[ null, 0, 'two.txt\n 1:1 warning Warning\n\n‼ 1 warning\n' ]
at: onrun (D:\Repositories\unified-engine\test\reporting.js:77:10)
stack: |-
Error: should report
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\reporting.js:77:10)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# should not report succesful files when `quiet` (#2)
ok 110 should not report
# should not report succesful files when `silent`
not ok 111 should report
---
operator: deepEqual
expected: |-
[ null, 1, 'two.txt\n 1:1 error Error\n\nΓ£û 1 error\n' ]
actual: |-
[ null, 1, 'two.txt\n 1:1 error Error\n\n× 1 error\n' ]
at: onrun (D:\Repositories\unified-engine\test\reporting.js:135:10)
stack: |-
Error: should report
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\reporting.js:135:10)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# should support custom reporters (without prefix)
ok 112 should be equivalent
# should support custom reporters (with prefix)
ok 113 should be equivalent
# should fail on an unfound reporter
ok 114 should be equal
# completers
# should pass `fileSet` to plug-ins
ok 115 should pass a set
ok 116 should have a `use` method
ok 117 should have an `add` method
ok 118 should be able to `use` a completer
ok 119 should be able to `add` a file
ok 120 should pass a set
ok 121 should have a `use` method
ok 122 should have an `add` method
ok 123 should be able to `use` a completer
ok 124 should be able to `add` a file
ok 125 should expose the files and set to `completer` (1)
ok 126 should expose the files and set to `completer` (2)
ok 127 should work
# should pass `fileSet` to plug-ins
not ok 128 should work
---
operator: deepEqual
expected: |-
[ null, 0, '', 'foo.txt > nested/foo.txt: written\n' ]
actual: |-
[ null, 0, '', 'foo.txt > nested\\foo.txt: written\n' ]
at: onrun (D:\Repositories\unified-engine\test\completers.js:118:10)
stack: |-
Error: should work
at Test.assert [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:224:54)
at Test.bound [as _assert] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at Test.tapeDeepEqual (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:421:10)
at Test.bound [as deepEqual] (D:\Repositories\unified-engine\node_modules\tape\lib\test.js:76:32)
at onrun (D:\Repositories\unified-engine\test\completers.js:118:10)
at next (D:\Repositories\unified-engine\lib\index.js:7:6842)
at next (D:\Repositories\unified-engine\node_modules\trough\index.js:60:14)
at Immediate.done [as _onImmediate] (D:\Repositories\unified-engine\node_modules\trough\wrap.js:56:16)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
...
# settings
# should use `settings`
ok 129 should configure
ok 130 should report
# should cascade `settings`
ok 131 should configure
ok 132 should report
# plugins
# should use `plugins` as list of functions
ok 133 transformer
ok 134 transformer
ok 135 should report
# should use `plugins` as list of strings
ok 136 should pass the correct options to the preset plugin
ok 137 should report
# should use `plugins` as list of objects
ok 138 should pass the correct options to the preset plugin
ok 139 should report
1..139
# tests 139
# pass 113
# fail 26
ERROR: Coverage for lines (99.87%) does not meet global threshold (100%)
ERROR: Coverage for branches (99.75%) does not meet global threshold (100%)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test-coverage: `nyc --reporter lcov tape test/index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test-coverage script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\deusd\AppData\Roaming\npm-cache\_logs\2018-12-15T17_07_15_619Z-debug.log
npm ERR! Test failed. See above for more details.
Files that are in the ignore list are still added to the list of files to process. This makes it difficult to easily run the engine against a large directory (e.g. one that contains node_modules) using a **/**
glob as it will find the argument list is too long. Additionally, it makes it more difficult to use within CI, as trying to process and ignored file results in an error being produced rather than silently skipping over files the user has already marked as not wanting to be accounted for.
ignoreName
list when calling engineThe engine silently ignored the file, acting as if the file doesn't exist and not attempting to process it. The engine would producing a 'no files were found' message if the user tried to process only ignored file.
The error message error Cannot process specified file: it’s ignored
is produced and a non-zero return code returned.
Was trying to process all files except for readme.md, so I tried remark . !readme.md
, which doesn’t work, probably because glob.hasMagic('!readme.md')
yields false
.
Doing remark . !**/readme.md
also doesn’t work, and writes a \!readme.md
file 🤔
Another direction to go would be to allow inline ignore patterns with something like --ignore
, but I thought normal globs would work as well 🤷♂️
The blanket ban on any path containing node_modules
is problematic; see finder.js. Specifying whether files/paths should be ignored should be left to the .remarkignore
file.
For instance, suppose I wanted to ignore only the top-level node_modules
directory. My .remarkignore
file (just as with a .gitignore
file) would be
/node_modules/
If I wanted to ignore all paths containing node_modules
, I could do
node_modules/
**/node_modules
But this is not how the unified-engine
currently works. Instead, it just assumes that any path which has node_modules
is off limits. This is problematic for project structures like
bin/
lib/node_modules/
lib/node_modules/**/node_modules/
node_modules/
test
where the top-level node_modules
directory is reserved for external libraries and lib
node modules directories are used for local modules. These local node modules are not in any sense "external" and will, for most cases, be considered part of the core library; e.g., tested and used like any other internal file.
Hence, I would suggest removing the blanket ban on node_modules
and leave it to the user to specify if, and how, node_modules
should be ignored.
When I have installed @shinnn/remark-preset-lint
package to the current project directory, add
"remarkConfig": {
"plugins": [
"@shinnn/preset-lint"
]
}
to package.json
and run the code below:
'use strict';
const engine = require('unified-engine')
var remark = require('remark')
engine({
processor: remark,
files: [__filename],
pluginPrefix: 'remark',
packageField: 'remarkConfig'
}, () => {});
it prints this error:
$ node index.js .
index.js
1:1 error Error: Could not find module `@shinnn/preset-lint`
at addModule (/Users/shinnn/github/remark/node_modules/unified-engine/lib/configuration.js:242:27)
at use (/Users/shinnn/github/remark/node_modules/unified-engine/lib/configuration.js:203:7)
at addEach (/Users/shinnn/github/remark/node_modules/unified-engine/lib/configuration.js:188:9)
at addPreset (/Users/shinnn/github/remark/node_modules/unified-engine/lib/configuration.js:164:9)
at merge (/Users/shinnn/github/remark/node_modules/unified-engine/lib/configuration.js:150:5)
at Config.create (/Users/shinnn/github/remark/node_modules/unified-engine/lib/configuration.js:105:5)
at done (/Users/shinnn/github/remark/node_modules/unified-engine/lib/find-up.js:148:20)
As you can see, pluginPrefix
option doesn't automatically prefix scoped packages.
I'd like @${scope}/{plugin name without pluginPrefix}
to be resolved to @${scope}/{full plugin name}
.
@wooorm if this proposal is acceptable to you, I can create a pull request.
In the 7.0.0
release, the ignore
dependency was upgraded to version 5
, a semver major upgrade, which changed how relative paths are ignored (see kaelzhang/node-ignore#20).
At L38 of the ignore.js
file, you resolve a file path to a relative path. This causes ignore
to throw an error because ignore
does not accept relative paths.
For example, when running remark
on a Markdown file, I encounter the following error:
RangeError: path should be a `path.relative()`d string, but got "../../path/to/file.md"
Tell us how to reproduce this issue. Please provide a working and simplified example.
Run a command similar to the following (using remark
and not unified-engine
directly):
$ ./node_modules/.bin/remark --rc-path=./path/to/.remarkrc.js --ignore-path=./path/to/.remarkignore --no-ignore --no-config ./path/to/file.md
For the used .remarkignore
file, see here.
No error should occur.
The following error is encountered:
RangeError: path should be a `path.relative()`d string, but got "../../path/to/file.md"
xtend can easily be replaced with Object.assign
This reduce the dependencies and possible also avoid duplicated versions where some package don't use the same version range for the xtend package
// immutable
Object.assign({}, a, b)
// mutable
Object.assign(a, b)
Currently there’s a “No input” error:
λ remark . -qfo
Error: No input
at stdin (/Users/niftylettuce/Public/lad/template/node_modules/unified-engine/lib/file-set-pipeline/stdin.js:30:10)
...
...but as there’s actually “input”, the error is weird.
I think the exception should still be thrown if nothing is passed in.
Supersedes remarkjs/remark#294.
The plugins.md
documentation refers to injectPlugins
, however, this doesn't seem to be an option for unified-engine. Looking at the source code, it appears that a plugin function can be passed directly in the plugins
array.
EditorConfig defines certain code-style preferences.
Some of those can be done by the engine (charset
, insert_final_newline
).
Others by the processor (syntax-tree/mdast-util-to-markdown#51, syntax-tree/mdast-util-to-markdown#50; what about HTML though where the whitespace is part of the AST?).
Some are ambiguous (end_of_line
).
Can we load (as an option), editorconfig files, and pass their keys, camelcased, to settings?
That passes them to *-parse
and *-stringify
.
We could pass a nested object if there’s fear that it would conflict, but I don’t think it does?
remark-cli
to the engine) that transform an EditorConfig into certain settings? Could be modules, e.g., called editorconfig-to-remark-settings
or so?🚀 example: rehype --tree-out -s position:false <<< '<p>Regular. <tt>toString()</tt>. Regular.</p>'
<stdin>
1:1 error Error: Setting `extname` requires `path` to be set too
at assertPath (/Users/tilde/.nvm/versions/node/v8.1.2/lib/node_modules/rehype-cli/node_modules/vfile/index.js:269:11)
at VFile.set (/Users/tilde/.nvm/versions/node/v8.1.2/lib/node_modules/rehype-cli/node_modules/vfile/index.js:122:5)
at stringify (/Users/tilde/.nvm/versions/node/v8.1.2/lib/node_modules/rehype-cli/node_modules/unified-engine/lib/file-pipeline/stringify.js:29:18)
at wrapped (/Users/tilde/.nvm/versions/node/v8.1.2/lib/node_modules/rehype-cli/node_modules/trough/index.js:93:19)
at next (/Users/tilde/.nvm/versions/node/v8.1.2/lib/node_modules/rehype-cli/node_modules/trough/index.js:56:24)
at Object.run (/Users/tilde/.nvm/versions/node/v8.1.2/lib/node_modules/rehype-cli/node_modules/trough/index.js:30:10)
at run (/Users/tilde/.nvm/versions/node/v8.1.2/lib/node_modules/rehype-cli/node_modules/unified-engine/lib/file-pipeline/index.js:30:10)
at wrapped (/Users/tilde/.nvm/versions/node/v8.1.2/lib/node_modules/rehype-cli/node_modules/trough/index.js:93:19)
at next (/Users/tilde/.nvm/versions/node/v8.1.2/lib/node_modules/rehype-cli/node_modules/trough/index.js:56:24)
at done (/Users/tilde/.nvm/versions/node/v8.1.2/lib/node_modules/rehype-cli/node_modules/trough/index.js:124:12)
✖ 1 error
No response
Run the following script:
#!/usr/bin/env node
import {unified} from 'unified'
import {engine} from 'unified-engine'
import {VFile} from 'vfile'
function plugin() {
this.Parser = () => ({type: 'root'})
this.Compiler = () => ''
return (ast, file) => {
file.message('Oh noez!')
}
}
const files = [
new VFile({path: new URL('file:///a.txt'), value: 'a'}),
new VFile({path: new URL('file:///b.txt'), value: 'b'})
]
engine(
{
files,
processor: unified().use(plugin)
},
(error, code, context) => {
console.dir(context.files, {depth: 3})
}
)
For all given files the unified plugins are ran.
Unified plugins are only run for the first vfile given.
If file paths are given as strings instead of vfiles, all given paths are processed.
If a combination of vfiles and string paths is given, all string paths are processed up to the first vfile.
Node v16
npm v6
Linux
Other (please specify in steps to reproduce)
unified-engine
No response
Install without desperation warning
warning
No response
No response
No response
No response
Configuration
is used in eslint-mdx
for loading remark configuration by using unified-engine/lib/configuration
It should be considered as private API path, I see we are migrating to exports
field in package.json
, which might make Configuration
unavailable later.
export Configuration
from root at the same time.
N/A
I've created an NPM module that is supposed to work as a remark preset inside other modules. Linting rules are defined in index.js
. What I would like to do is to lint README.md
in my preset module with the same rules as well.
I tried the following in package.json
, but it did not work:
"remarkConfig": {
"presets": ["./index.js"]
},
The solution was to create .remarkrc.js
next to package.json
with the following content:
module.exports = require('./index.js');
After I've don this, remark-cli
has started picking up my rules.
Although my problem is solved in general, I'm wondering if it is possible to avoid this extra .remarkrc.js
file by being able to refer to a local preset in package.json
. Maybe it is allowed already, it's just me doing something wrong. Sharing my solution as someone else might face the same problem.
Project root folders being stuck with a bunch of .
configs files for various tools, remark
or rehype
being just one of many.
As a result, it is harder to find actual source files in the project.
.config/
is a convention supported by cosmiconfig, and by extension a number command line tools (stylelint
, prettier
, eslint-mdx
, and others).
Which allows top level configuration files to be moved out of the root folder and into .config/
folder, clarifying the intent of the files, and separating source code from configuration files/code.
Leave configuration system as it is today, adding notes/recommendations pointing towards either:
remarkConfig
property as a way to combine files--rc-path
a layer of abstraction up in https://github.com/unifiedjs/unified-args#cli to point to the .config
folder on their own.latest
No response
file.value
set to ''
should not result in file system read. testing out unified-language-server
(which handles the FS itself), checking an empty file (''
), results in an error about a file not existing on disk in tests.
no fs read
fs read
No response
No response
No response
No response
Current behaviour is to switch based on whether multiple files are found. This means that changing the file-system could change the engine. Should switch to whether globs
could match multiple files, or not.
out
should default to whether there’s one value in globs
and it points to a file.
Supersedes remarkjs/remark#184.
This also opens up the door for allowing out: true
on multiple files, similar to cat foo.txt bar.txt
Trough native supports middle-ware return promises, but all of the unified middle-ware are sync functions. This cause a problem when creating some plugins.
Update at least the stringify functions to be async and add a await
call to the context.prcessor.stringify() .
Could assert that all plug-ins are sync, but no need when trough handles async for us.
🚀 example: rehype --output <<< '<p>Regular. <tt>toString()</tt>. Regular.</p>'
...currently silently does not output to the file-system.
Either choose a file-name: perhaps a name of index
and an extension of extensions[0]
(in the case of rehype
, html
, for remark
, md
) or json
with treeOut
?
Or throw an exception, which makes more sense than picking a potentially overwriting file-path.
The configuration cascade is rather unusable (proof: remarkjs/remark-lint#96). I think that some cascading could be useful though. Here’s some ideas.
cascade: true
);root: true
);warning remark-cli > unified-args > unified-engine > [email protected]: Just use Array.isArray directly
Latest stable node version support Array.isArray
. Can we use this instead isarray
?
The js-yaml
package doesn't strictly follow the YAML 1.2 spec. It supports some YAML 1.1 features.
Replace it with the more compliant yaml
.
It can be configured to behave the same as js-yaml
, so the change could be made as semver patch.
This package also has builtin TypeScript support.
🤷
.use(plugin, 'option')
.use(plugin, [1, 2])
...seems to fail: remarkjs/remark-lint#223 (comment)
I think if an object is given, and a non-object is defined, then the given object should be used.
The non-object is merged with the object, causing an exception.
/cc @AlexWayfer
Originally reported in remarkjs/remark-lint#223.
IMO it’s a bad practice to exclude dotfiles from a project’s code quality standards such as remark-lint
. I.e. I don’t understand why one wouldn’t want to check the various markdown files in the .github
or .gitlab
directory.
Currently there appears to be no way to include dotfiles, except by explicitly passing the dotfile to the CLI.
I think this idea originates from ESLint (where I also think it’s a bad idea), but at least ESLint allows to unignore dotfiles by adding the following .eslintignore
file:
!.*
This doesn’t work for .remarkignore
.
Don’t ignore dotfiles by default.
Allow to unignore dotfiles.
Create a vim errorformat processor like atom's unified processor to https://github.com/wooorm/unified-engine-atom
-- basically having everything on one line with single character (space or colon, doesn't matter) delimiters. This translates to %f:%l:%c %tarning %m
in vim's errorformat (where %t
captures the first character to get the warning/error type, using the literal arning is optional, a %*
group could be used instead)
i am trying to use unified-engine
in a vscode extension to lint markdown/mdx, similar to this one.
this works great when feeding unified-engine
a VFile
with an actual on-disk file path. however, it seems that it is not possible to feed it a VFile
without a valid file path - for example to lint unsaved files, for which vscode does not provide a file path.
the following should work:
import { VFile } from "vfile";
import remark from "remark";
import engine from "unified-engine";
const file = new VFile({ value: "Some text" });
engine(
{
processor: remark,
files: [file],
},
function done(error, code) {
if (error) throw error;
}
);
but throws:
TypeError [ERR_INVALID_ARG_TYPE]: The "to" argument must be of type string. Received undefined
at validateString (internal/validators.js:124:11)
at Object.relative (path.js:1168:5)
at each (/data/Development/playground/engine/node_modules/unified-engine/lib/finder.js:53:24)
not sure
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.