Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hcodes/yaspeller
π Search tool typos in the text, files and websites
https://github.com/hcodes/yaspeller
cli javascript nodejs spellcheck speller spelling-checker yandex
Last synced: 29 days ago
JSON representation
π Search tool typos in the text, files and websites
- Host: GitHub
- URL: https://github.com/hcodes/yaspeller
- Owner: hcodes
- License: mit
- Archived: true
- Created: 2014-11-09T21:31:46.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2024-04-24T07:46:11.000Z (8 months ago)
- Last Synced: 2024-05-17T18:03:18.787Z (7 months ago)
- Topics: cli, javascript, nodejs, spellcheck, speller, spelling-checker, yandex
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/yaspeller
- Size: 1.27 MB
- Stars: 641
- Watchers: 10
- Forks: 39
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-robotic-tooling - Yaspeller - Command line tool for spell checking. (Documentation and Presentation)
- awesome-robotic-tooling - Yaspeller - Command line tool for spell checking (Documentation and Presentation)
- awesome-robotic-tooling - Yaspeller - Command line tool for spell checking. (Documentation and Presentation)
README
yaspeller
=========
[![NPM version](https://img.shields.io/npm/v/yaspeller.svg)](https://www.npmjs.com/package/yaspeller)
[![NPM Downloads](https://img.shields.io/npm/dm/yaspeller.svg?style=flat)](https://www.npmjs.org/package/yaspeller)
[![Coverage Status](https://img.shields.io/coveralls/hcodes/yaspeller.svg)](https://coveralls.io/r/hcodes/yaspeller)
[![install size](https://packagephobia.com/badge?p=yaspeller)](https://packagephobia.com/result?p=yaspeller)**This project is closed, use [CSpell](https://cspell.org/) or another alternative. [Example of using CSpell](https://habr.com/ru/articles/809889/)**
This README is also available [in Russian](./README.ru.md).
Search tool typos in the text, files and websites.
Used API [Yandex.Speller](https://tech.yandex.ru/speller/doc/dg/concepts/About-docpage/).
![yaspeller](https://raw.githubusercontent.com/hcodes/yaspeller/master/images/cli.en.png)
## Installation
`npm install yaspeller -g`## Using CLI
`yaspeller [options] `## Using with [pre-commit](https://pre-commit.com/)
Add this to your `.pre-commit-config.yaml`:
```yaml
- repo: https://github.com/hcodes/yaspeller.git
rev: '' # Use the sha / tag you want to point at
hooks:
- id: yaspeller
```### Examples
+ `yaspeller README.md` β search typos in the file.
+ `yaspeller "*.md"` β node glob syntax for Windows.
+ `yaspeller -e ".md,.html,.txt" ./texts/` β finding typos in files in the folder.
+ `yaspeller https://ru.wikipedia.org/wiki/%D0%9E%D0%BF%D0%B5%D1%87%D0%B0%D1%82%D0%BA%D0%B0` β search typos in the page.
+ `yaspeller http://bem.info/sitemap.xml` β search typos at the addresses specified in the sitemap.xml.
+ `echo "Hello, world!" | yaspeller --stdin`
+ `echo "Hello, world!" | yaspeller --stdin --stdin-filename hello.txt`### Options
#### `-f, --format `
Formats: `plain`, `html`, `markdown` or `auto`.
Default: `auto`.#### `-l, --lang `
Languages: `en`, `ru` or `uk`.
Default: `en,ru`.#### `-c, --config `
Configuration file path.#### `-e, --file-extensions `
Set file extensions to search for files in a folder.
Example: `.md,.htm,.txt`.#### `--dictionary `
JSON file for own dictionary.
```js
[
"someword1", // someword1 = someword1 and Someword1
"Someword2", // Someword2 = Someword2
"someword3"
]
```Regular expressions are supported:
```js
[
"unknownword",
"unknown(W|w)ord[12]?", // unknown(W|w)ord[12]? = unknown(W|w)ord[12]? and Unknown(W|w)ord[12]?
"Unknown(W|w)ord[34]?" // Unknown(W|w)ord[34]? = Unknown(W|w)ord[34]?
]
```Examples:
`yaspeller --dictionary my_dict.json .`
`yaspeller --dictionary my_dict.json:my_dict2.json .`If you have tons of markdown and introduce this linter, you're likely to want
generation of initial dictionary with [yaspeller-dictionary-builder](https://github.com/razum2um/yaspeller-dictionary-builder),
so one line will cover all word's forms.#### `--report `
Set type of report: `console`, `html`, `markdown`, `junit` or `json`.
Default: `console`
Example: `console,html,custom_report.js`#### `--check-yo`
Check the correctness of using the letter βΠβ (Yo) in Russian texts.#### `--find-repeat-words`
Highlight repetitions of words, consecutive. For example, `I flew to to to Cyprus`.#### `--ignore-tags `
Ignore HTML tags.
Default: `code,kbd,object,samp,script,style,var`
Option to formats `html` and` markdown`.#### `--ignore-text `
Remove the text from the scan using regular expressions.#### `--ignore-capitalization`
Ignore the incorrect use of UPPERCASE / lowercase letters, for example, in the word `moscow`.#### `--ignore-digits`
Ignore words with numbers, such as `avp17h4534`.#### `--ignore-urls`
Ignore Internet addresses, email addresses and filenames.#### `--max-requests `
Max count of requests in parallel.
Default: `2`.#### `--no-color`
Clean output without colors.#### `--only-errors`
Output only errors.#### `--stdin`
Process files on ``. Default: false#### `--stdin-filename `
Specify filename to process `` as. Used in reports.#### `--debug`
Debug mode.## Configuration
`npm install yaspeller --save-dev`Add the text in `package.json` / `scripts`:
` "yaspeller": "yaspeller .",`To run the linter:
`npm run yaspeller``yaspeller` is configured using JSON file at the root of the project:
- `.yaspellerrc`
- `.yaspellerrc.js`
- `.yaspellerrc.json`
- `.yaspeller.json`
- `package.json`, field `yaspeller````JSON
{
"excludeFiles": [
".git",
"libs",
"node_modules",
"yaspeller"
],
"lang": "ru",
"fileExtensions": [
".md",
".css"
],
"dictionary": [
"someword1"
]
}
```**Advanced example:**
```js
{
"excludeFiles": [
".git",
"yaspeller",
"node_modules",
"libs"
],
"format": "html",
"lang": "en",
"fileExtensions": [
".md",
".css"
],
"report": ["console", "html"],
"dictionary": [
// JSON comments
"someword1", // someword1 = someword1 and Someword1
"Someword2", // Someword2 = Someword2
"some(w|W)ord[23]", // some(w|W)ord[23] = some(w|W)ord[23] and Some(w|W)ord[23]
"Some(w|W)ord" // Some(w|W)ord = Some(w|W)ord
],
"ignoreText": [
"", // Shortly
["", "g"] // Longly
],
"ignoreTags": ["code", "script"],
"ignoreUrls": true,
"findRepeatWords": true,
"maxRequests": 5
}
```| PropertyΒ | Type | Details |
|----------|------|---------|
| `format` | `String` | [`--format`](#-f---format-value) |
| `lang` | `String` | [`--lang`](#-l---lang-value) |
| `excludeFiles` | `Array` | |
| `fileExtensions` | `Array` | [`--file-extension`](#--file-extensions-value) |
| `dictionary` | `Array` | [`--dictionary`](#--dictionary-file) |
| `report` | `Array` | [`--report`](#--report-type) |
| `checkYo` | `Boolean` | [`--check-yo`](#--check-yo) |
| `findRepeatWords` | `Boolean` | [`--find-repeat-words`](#--find-repeat-words) |
| `ignoreTags` | `Array` | [`--ignore-tags`](#--ignore-tags-tags) |
| `ignoreText` | `Array` | [`--ignore-text`](#--ignore-text-regexp) |
| `ignoreCapitalization` | `Boolean` | [`--ignore-capitalization`](#--ignore-capitalization) |
| `ignoreDigits` | `Boolean` | [`--ignore-digits`](#--ignore-digits) |
| `ignoreUrls` | `Boolean` | [`--ignore-urls`](#--ignore-urls) |
| `maxRequests` | `Number` | [`--max-requests`](#--max-requests-value) |## Ignore text from checking
### Ignore a line
```js
var re = /a-z/; // yaspeller ignore
```
```js
var re = /a-z/; /* yaspeller ignore */
```
```html
a-z
```### Ignore a block
```js
/* yaspeller ignore:start */
const reUpper = /A-Z/;
const reLower = /a-z/;
/* yaspeller ignore:end */
``````html
A-Z
a-z```
## [Gulp](http://gulpjs.com) plugin
```js
const gulp = require('gulp');
const run = require('gulp-run'); // npm install gulp-run --save-devgulp.task('yaspeller', function (cb) {
run('./node_modules/.bin/yaspeller .').exec()
.on('error', function (err) {
console.error(err.message);
cb();
})
.on('finish', cb);
});
```## [Grunt](http://gruntjs.com) plugin
```js
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-shell'); // npm install grunt-shell --save-dev
grunt.initConfig({
shell: {
yaspeller: {
options: {stderr: false},
command: './node_modules/.bin/yaspeller .'
}
}
});
grunt.registerTask('lint', ['shell:yaspeller']);
};
```## [Restrictions API Yandex.Speller](http://legal.yandex.ru/speller_api/)
## Links
- [Yaspeller for CI](https://github.com/ai/yaspeller-ci)
- [Github Action for Yaspeller](https://github.com/heytitle/github-action-yaspeller)## [License](./LICENSE.md)
MIT License