Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
azu committed May 1, 2016
0 parents commit a47dfcb
Show file tree
Hide file tree
Showing 7 changed files with 174 additions and 0 deletions.
85 changes: 85 additions & 0 deletions .gitignore
@@ -0,0 +1,85 @@
### https://raw.github.com/github/gitignore/608690d6b9a78c2a003affc792e49a84905b3118/Node.gitignore

# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules

# Debug log from npm
npm-debug.log


### https://raw.github.com/github/gitignore/608690d6b9a78c2a003affc792e49a84905b3118/Global/JetBrains.gitignore

# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm

*.iml

## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:

# User-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
# .idea/dictionaries

# Sensitive or high-churn files:
# .idea/dataSources.ids
# .idea/dataSources.xml
# .idea/sqlDataSources.xml
# .idea/dynamic.xml
# .idea/uiDesigner.xml

# Gradle:
# .idea/gradle.xml
# .idea/libraries

# Mongo Explorer plugin:
# .idea/mongoSettings.xml

## File-based project format:
*.ipr
*.iws

## Plugin-specific files:

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties


/lib
3 changes: 3 additions & 0 deletions .travis.yml
@@ -0,0 +1,3 @@
sudo: false
language: node_js
node_js: "stable"
19 changes: 19 additions & 0 deletions LICENSE
@@ -0,0 +1,19 @@
Copyright (c) 2016 azu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Empty file added README.md
Empty file.
26 changes: 26 additions & 0 deletions package.json
@@ -0,0 +1,26 @@
{
"name": "textlint-rule-max-comma",
"version": "1.0.0",
"description": "",
"main": "index.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "mocha"
},
"repository": {
"type": "git",
"url": "git+https://github.com/azu/textlint-rule-max-comma.git"
},
"keywords": [
"textlint",
"english"
],
"author": "azu",
"license": "MIT",
"bugs": {
"url": "https://github.com/azu/textlint-rule-max-comma/issues"
},
"homepage": "https://github.com/azu/textlint-rule-max-comma#readme"
}
14 changes: 14 additions & 0 deletions src/textlint-rule-max-comma.js
@@ -0,0 +1,14 @@
// LICENSE : MIT
"use strict";
const splitSentences = require("sentence-splitter").split;
const Syntax = require("sentence-splitter").Syntax;
module.exports = function (context) {
const {Syntax, RuleError, report, getSource} = context;
return {
[Syntax.Paragraph](node){
const text = getSource(node);
const sentences = splitSentences(text).filter(node => node.type === Syntax.Sentence)
}

}
};
27 changes: 27 additions & 0 deletions test/textlint-rule-max-comma-test.js
@@ -0,0 +1,27 @@
const TextLintTester = require("textlint-tester");
const tester = new TextLintTester();
const rule = require("../src/textlint-rule-max-comma");
// ruleName, rule, { valid, invalid }
tester.run("no-todo", rule, {
valid: [
// no match
"This is text.",
// 3
"0, 1, 2, 3",
{
options: {
max: 5
},
text: "0, 1, 2, 3, 4"
}
],
invalid: [
{
text: "t0, t1, t2, t3, t4",
errors: [
{
message: " exceeds the maximum line length of"
}
]
}]
});

0 comments on commit a47dfcb

Please sign in to comment.