All Projects → davidhund → retext-assuming

davidhund / retext-assuming

Licence: MIT license
Check for unhelpful ‘assuming’ phrases such as ‘just’, ‘simply’ or ‘obviously’ with retext

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to retext-assuming

retext-profanities
plugin to check for profane and vulgar wording
Stars: ✭ 34 (+126.67%)
Mutual labels:  retext, retext-plugin
retext-spell
plugin to check spelling
Stars: ✭ 53 (+253.33%)
Mutual labels:  retext, retext-plugin
typo3-typoscript-lint
Find coding errors in your TypoScript files.
Stars: ✭ 78 (+420%)
Mutual labels:  linter
nimfmt
Nim code formatter / linter / style checker
Stars: ✭ 75 (+400%)
Mutual labels:  linter
Husky.Net
Git hooks made easy with Husky.Net internal task runner! 🐶 It brings the dev-dependency concept to the .NET world!
Stars: ✭ 394 (+2526.67%)
Mutual labels:  linter
tryceratops
A linter to prevent exception handling antipatterns in Python (limited only for those who like dinosaurs).
Stars: ✭ 381 (+2440%)
Mutual labels:  linter
vscode-linter
Extension for code linting, all in one package. New linters can be easily added through an extension framework.
Stars: ✭ 47 (+213.33%)
Mutual labels:  linter
Best Of Python Dev
🏆 A ranked list of awesome python developer tools and libraries. Updated weekly.
Stars: ✭ 243 (+1520%)
Mutual labels:  linter
flexlint
A flexible linter with rules defined by regular expression
Stars: ✭ 19 (+26.67%)
Mutual labels:  linter
vue-cli-template-library
Template for developing open-source vue.js libraries with Rollup + Jest + Babel + Storybook + TravisCI + SemanticRelease
Stars: ✭ 61 (+306.67%)
Mutual labels:  linter
prlint
GitHub App for linting pull request meta data
Stars: ✭ 122 (+713.33%)
Mutual labels:  linter
f2e-spec
Alibaba Front-end Coding Guidelines and Relevant Tools
Stars: ✭ 548 (+3553.33%)
Mutual labels:  linter
node-lintspaces
A validator for checking different kinds of whitespaces in your files.
Stars: ✭ 31 (+106.67%)
Mutual labels:  linter
yamburger
YAML syntax got you down? That's a YAMBURGER!
Stars: ✭ 32 (+113.33%)
Mutual labels:  linter
spec
🐣 easy to use eslint/stylelint/tslint/prettier/...
Stars: ✭ 60 (+300%)
Mutual labels:  linter
linter-terraform-syntax
terraform validate linter and formatter for atom
Stars: ✭ 19 (+26.67%)
Mutual labels:  linter
Html5validator
Command line tool to validate HTML5 files. Great for continuous integration.
Stars: ✭ 251 (+1573.33%)
Mutual labels:  linter
elm-lint
elm-lint lints Elm source code, to add additional guarantees to your project.
Stars: ✭ 27 (+80%)
Mutual labels:  linter
repolint
Tool to check github user/organization repositories for some simple and common issues.
Stars: ✭ 19 (+26.67%)
Mutual labels:  linter
healthier
🧘‍♀️ Healthier is an opinionated style agnostic code linter – a friendly companion to Prettier
Stars: ✭ 78 (+420%)
Mutual labels:  linter

retext-assuming

npm version XO code style GitHub license

Check for unhelpful ‘assuming’ phrases such as 'just', 'simply' or 'obviously' with retext.

Using these phrases in documentation is unhelpful: “simple” is relative to a users’ knowledge and experience. Often it is fine to leave the phrase out completely:

Avoid:

“Simply run the tests. Just type npm test…”

But use:

“To run the tests type npm test…”

Credits

This plugin is based on the excellent retext (plugins) by Wooorm. Not much of this code is original and it probably could be much improved. PR's welcome 🚀

Installation

Install through npm:

npm install retext-assuming

Usage

Say we have the following file, example.txt:

You can just import an ES6 module.
Everything is simply Javascript.
Obviously you would need NodeJS > 8.
Actually, it's quite easy to use.

And our script, example.js, looks as follows:

var vfile = require('to-vfile');
var report = require('vfile-reporter');
var retext = require('retext');
var dontAssume = require('retext-assuming');

retext()
  .use(dontAssume)
  .process(vfile.readSync('example.txt'), function (err, file) {
    console.error(report(err || file));
  });

Should result in:

example.txt
   1:9-1:13  warning  Avoid “just”, it's not helpful       no-just       retext-assuming
  2:15-2:21  warning  Avoid “simply”, it's not helpful     no-simply     retext-assuming
   3:1-3:10  warning  Avoid “Obviously”, it's not helpful  no-obviously  retext-assuming
    4:1-4:9  warning  Avoid “Actually”, it's not helpful   no-actually   retext-assuming
  4:22-4:26  warning  Avoid “easy”, it's not helpful       no-easy       retext-assuming

⚠ 3 warnings

API

retext().use(dontAssume[, options])

Checks for unhelpful phrases such as “just”, “simply” or “obviously” in processed text.

NOTE dontAssume is the assigned name of our required module. You can name it however you like.

options.phrases

Array.<string> — list of phrases to warn about (defaults to phrases.json)

options.ignore

Array.<string> — phrases not to warn about.

options.verbose

Boolean — If true includes matches that are probably fine (“You should not simply assume”)

Related

License

MIT © David Hund

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].