This commit is contained in:
sim1222 2024-11-28 15:45:41 +09:00
commit 082ce51153
Signed by: sim1222
GPG Key ID: D1AE30E316E44E5D
16 changed files with 10793 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules/

11
.textlintrc.json Normal file
View File

@ -0,0 +1,11 @@
{
"plugins": {},
"filters": {
"allowlist": true,
"comments": true
},
"rules": {
"preset-ja-technical-writing": true,
"textlint-rule-zen-entry": true
}
}

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"editor.wordWrap": "on"
}

12
README.md Normal file
View File

@ -0,0 +1,12 @@
## ⼊学選考
※全⾓・半⾓問わず文字としてカウントされます。※改⾏は1文字としてカウントされます。※改⾏は10回までとしてください。※同じ文字の連続は最大3回までとしてください。※その他入⼒に
あたってはこのシステムのルールに従ってください。
本学では、Web出願時に⼊力する「志望理由・⼩論⽂」による⼊学選考を⾏います。
Web出願時の指⽰に従い、「志望理由・⼩論⽂」の⼊力を⾏ってください。
### 志望理由
下記の志望理由問について、それぞれ50字以上400字以内で記載をしてください。
志望理由「⾃⼰分析⾃⾝の強み弱みを分析志望理由「ZEN大学を志望する理由」
### ⼩論⽂
本学での学びや取り組みを通じて、在学中や卒業後に社会とどのように関わりたいかについて、下記の⼩論⽂2問について、
それぞれ50字以上400字以内で記載をしてください。
⼩論⽂1:「⼊学後に学びたいこと」/⼩論⽂2:「将来(主に卒業後)にやりたいこと」

20
package.json Normal file
View File

@ -0,0 +1,20 @@
{
"name": "syoronbun",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "textlint src/**/*.txt"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"textlint": "^14.3.0",
"textlint-filter-rule-allowlist": "^4.0.0",
"textlint-filter-rule-comments": "^1.2.2",
"textlint-rule-preset-ja-technical-writing": "^10.0.1",
"textlint-rule-zen-entry": "link:textlint-rules\\textlint-rule-zen-entry"
}
}

2774
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,35 @@
### 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
# Publish src/ instead lib/
/lib

View File

@ -0,0 +1,45 @@
# textlint-rule-zen-entry
## Install
Install with [npm](https://www.npmjs.com/):
npm install textlint-rule-zen-entry
## Usage
Via `.textlintrc.json`(Recommended)
```json
{
"rules": {
"zen-entry": true
}
}
```
Via CLI
```
textlint --rule zen-entry README.md
```
### Build
Builds source codes for publish to the `lib` folder.
You can write ES2015+ source codes in `src/` folder.
npm run build
### Tests
Run test code in `test` folder.
Test textlint rule by [textlint-tester](https://github.com/textlint/textlint-tester).
npm test
## License
ISC ©

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,28 @@
{
"version": "1.0.0",
"keywords": [
"textlintrule"
],
"main": "lib/index.js",
"files": [
"lib/",
"src/"
],
"scripts": {
"test": "textlint-scripts test",
"build": "textlint-scripts build",
"prepublish": "npm run --if-present build"
},
"devDependencies": {
"@textlint/types": "^14.3.0",
"textlint-scripts": "^14.3.0",
"textlint-tester": "^14.3.0"
},
"name": "textlint-rule-zen-entry",
"directories": {
"test": "test"
},
"author": "",
"license": "ISC",
"description": ""
}

View File

@ -0,0 +1,50 @@
/**
* @param {import("@textlint/types").TextlintRuleContext} context
* @param {import("@textlint/types").TextlintRuleOptions<{ allows?: string[]}>} options
* @returns {import("@textlint/types").TextlintRuleCreator}
*/
export default function (context, options = {}) {
const { Syntax, RuleError, report, getSource, locator } = context;
const allows = options.allows ?? [];
return {
[Syntax.Document](node) { // "Document" node
const text = getSource(node); // Get text
if (allows.some(allow => text.includes(allow))) {
return;
}
// Max line bleak is 10
const lines = text.split("\n").length
if (lines > 10) {
const ruleError = new RuleError(`Too many lines. (${lines} lines)`, {
index: 0
});
report(node, ruleError);
}
// Min length is 50
if (text.length < 50) {
const ruleError = new RuleError(`Too short. (${text.length} characters)`, {
index: 0
});
report(node, ruleError);
}
// Max length is 400
if (text.length > 400) {
const ruleError = new RuleError(`Too long. (${text.length} characters)`, {
index: 0
});
report(node, ruleError);
}
// warn length is 340
if (text.length < 340) {
const ruleError = new RuleError(`Few short (${text.length} characters)`, {
index: 0
});
report(node, ruleError);
}
}
}
};

View File

@ -0,0 +1,46 @@
import TextLintTester from "textlint-tester";
import rule from "../src/index";
const tester = new TextLintTester();
// ruleName, rule, { valid, invalid }
tester.run("rule", rule, {
valid: [
// no problem
"text",
{
text: "It is bugs, but it should be ignored",
options: {
allows: ["it should be ignored"]
}
}
],
invalid: [
// single match
{
text: "It is bugs.",
errors: [
{
message: "Found bugs.",
range: [6, 10]
}
]
},
// multiple match
{
text: `It has many bugs.
One more bugs`,
errors: [
{
message: "Found bugs.",
range: [12, 16]
},
{
message: "Found bugs.",
range: [28, 32]
}
]
},
]
});