retextjs / retext-repeated-words Goto Github PK
View Code? Open in Web Editor NEWplugin to check for for repeated words
Home Page: https://unifiedjs.com
License: MIT License
plugin to check for for repeated words
Home Page: https://unifiedjs.com
License: MIT License
No response
Background: I was testing to see how well this plugin worked in the spellchecker-cli package when I ran into an unexpected assertion error. The expression Well, it it doesn’t have to to be. Like a fish in the\r\nthe sea.
didn't catch the repeated the
. Being highly interested in what was causing it; I eventually traced it back to this package and reproduced my example in the local test folder.
I made my local test.js look like the following: https://pastebin.com/ibNziPtb
It had failed. Here is a screenshot.
It hadn't even been caught as an error. I expect it didn't read the \r\n as a whitespace character and maybe need to be take it up with people behind the nlcst
package if my suspicions are correct.
There should have been three strings in the messages array in the example like there is with the \n example.
Windows 10
Other (please specify in steps to reproduce)
Hello,
Thanks for the linter. I successfully got "retext-repeated-words" working with my entire repository, but it took me wayyy longer than it should have due to lacking documentation.
Can you add this example to the main README.md file? I would guess that the main use case for this linter would be to lint more than one file at a time, so this example would help a lot.
// A script to use retext-repeated-words to lint an entire directory / repository
const path = require('path');
const vfileGlob = require('vfile-glob');
const unified = require('unified');
const english = require('retext-english');
const repeated = require('retext-repeated-words');
const stringify = require('retext-stringify');
const report = require('vfile-reporter');
const rootDir = path.join(__dirname, '..'); // The root directory of the project
vfileGlob(`${rootDir}/**`, { // Match every file matching this glob
ignore: [ // Add specific ignore globs here relating to your particular directory structure
`${rootDir}/.git/**`,
`${rootDir}/img/**`,
`${rootDir}/misc/*.pdf`,
`${rootDir}/linters/node_modules/**`,
`${rootDir}/linters/package-lock.json`,
`${rootDir}/LICENSE`,
],
}).subscribe({
next(file) {
unified()
.use(english)
.use(repeated)
.use(stringify)
.process(file, function(err, file) {
const output = report(err || file, {
quiet: true, // Only output on a warning or an error
}).trim();
if (output) {
console.error(output);
}
})
},
});
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.