GithubHelp home page GithubHelp logo

textlint-rule / textlint-rule-en-max-word-count Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 1.0 168 KB

textlint rule that specify the maximum word count of a sentence.

License: MIT License

TypeScript 100.00%
textlintrule english

textlint-rule-en-max-word-count's Introduction

textlint-rule-en-max-word-count Actions Status: test

textlint rule that specify the maximum word count of a sentence.

Installation

npm install textlint-rule-en-max-word-count

Usage

Via .textlintrc(Recommended)

{
    "rules": {
        "en-max-word-count": {
            "max" : 50
        }
    }
}

Via CLI

textlint --rule en-max-word-count README.md

Options

.textlintrc options.

{
    "rules": {
        "en-max-word-count": {
            // max count of words and report error if exceed
            "max" : 50
        }
    }
}

Example

OK ๐Ÿ’š

max: 4

This is a pen.

NG โŽ

max: 4

So, this is a pen.

// => Exceeds the maximum word count of 4.

Tests

 npm test

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT

textlint-rule-en-max-word-count's People

Contributors

azu avatar dependabot[bot] avatar xertrov avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

xertrov

textlint-rule-en-max-word-count's Issues

TypeError: Cannot read property 'map' of null

I have a markdown file with the following contents:

### JMS Messaging Properties

#### `ep.jms.type`

Developer Default: `org.apache.activemq.pool.PooledConnectionFactory`

The Java Class type of the JMS Broker Connection Factory.	

#### `ep.jms.factory`

Developer Default: `org.apache.activemq.jndi.JNDIReferenceFactory`

The JNDI resource factory used by the application.	

#### `ep.jms.url`

Developer Default: `tcp://localhost:61616`

The URL of the JMS broker.

I am using textlint version 11.2.5 and this rule version 1.0.1. This rule is failing to execute textlint on the file where I have the above contents. If I get rid of that content, everything runs fine. I even removed all the other contents except this, and still unable to execute textlint. I am getting the following error:

I can't figure out what is wrong with the above markdown snippet and why this rule is failing to execute because of it.

โœ– Stack trace
TypeError: Cannot read property 'map' of null
at /Users/amimas/projects/documentation-sites/docs/docs/deployment/configuration/environment-config.md
    at module.exports (/Users/amimas/projects/documentation-sites/docs/website/node_modules/split-string-words/index.js:5:9)
    at /Users/amimas/projects/documentation-sites/docs/website/node_modules/textlint-rule-en-max-word-count/lib/textlint-rule-en-max-word-count.js:48:56
    at Array.forEach (<anonymous>)
    at /Users/amimas/projects/documentation-sites/docs/website/node_modules/textlint-rule-en-max-word-count/lib/textlint-rule-en-max-word-count.js:36:19
    at /Users/amimas/projects/documentation-sites/docs/website/node_modules/textlint/node_modules/@textlint/kernel/lib/kernel/src/task/promise-event-emitter.js:26:36
    at Array.forEach (<anonymous>)
    at RuleTypeEmitter.PromiseEventEmitter.emit (/Users/amimas/projects/documentation-sites/docs/website/node_modules/textlint/node_modules/@textlint/kernel/lib/kernel/src/task/promise-event-emitter.js:25:38)
    at Controller.enter (/Users/amimas/projects/documentation-sites/docs/website/node_modules/textlint/node_modules/@textlint/kernel/lib/kernel/src/task/textlint-core-task.js:130:51)
    at Controller.__execute (/Users/amimas/projects/documentation-sites/docs/website/node_modules/textlint/node_modules/@textlint/ast-traverse/lib/ast-traverse/src/index.js:45:31)
    at Controller.traverse (/Users/amimas/projects/documentation-sites/docs/website/node_modules/textlint/node_modules/@textlint/ast-traverse/lib/ast-traverse/src/index.js:116:28)
    at TextLintCoreTask.startTraverser (/Users/amimas/projects/documentation-sites/docs/website/node_modules/textlint/node_modules/@textlint/kernel/lib/kernel/src/task/textlint-core-task.js:125:28)
    at TextLintCoreTask.start (/Users/amimas/projects/documentation-sites/docs/website/node_modules/textlint/node_modules/@textlint/kernel/lib/kernel/src/task/linter-task.js:34:14)
    at /Users/amimas/projects/documentation-sites/docs/website/node_modules/textlint/node_modules/@textlint/kernel/lib/kernel/src/task/task-runner.js:26:18
    at new Promise (<anonymous>)
    at Function.TaskRunner.process (/Users/amimas/projects/documentation-sites/docs/website/node_modules/textlint/node_modules/@textlint/kernel/lib/kernel/src/task/task-runner.js:14:16)
    at LinterProcessor.process (/Users/amimas/projects/documentation-sites/docs/website/node_modules/textlint/node_modules/@textlint/kernel/lib/kernel/src/linter/linter-processor.js:31:38)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Not in npm registry

When I try to install with npm install textlint-rule-en-max-word-count I get:

npm ERR! 404 Registry returned 404 for GET on http://registry.npmjs.org/textlint-rule-en-max-word-count
npm ERR! 404
npm ERR! 404  'textlint-rule-en-max-word-count' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)

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.