Giter Club home page Giter Club logo

retext-assuming's Introduction

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

retext-assuming's People

Contributors

davidhund avatar davidturnbull avatar dependabot[bot] avatar remcohaszing avatar x4121 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

retext-assuming's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.