The pluggable natural language linter for text and markdown.
MIT License
Bot releases are visible (Hide)
This release includes typing fixes only.
No change API from [email protected].
Changes between https://github.com/textlint/textlint/compare/[email protected]@11.2.0
Rule creator can use constant value for *:exit
.
- [Syntax.Str + ":exit"](node) {
+ [Syntax.StrExit](node) {
report(node, new RuleError("message"));
}
For more details, See https://textlint.github.io/docs/txtnode.html#type
This changes add constant type for *:exit
Syntax like DocumentExit
.
For more details, See https://textlint.github.io/docs/txtnode.html#type
This minor release does not includes breaking change.
Almost changes is related with TypeScript definition.
In other words, almost changes is not related textlint
CLI user.
AnyTxtNode
#562@textlint/types
pacakge #561 #562This pacakge define types for textlint.
Move following types to @textlint/types
from @textlint/kernel
.
Also, @textlint/kernel
export these types for back-compatible reason.
Move following codes to @textlint/types
from @textlint/kernel
.
Also, @textlint/types
export it.
@textlint/types
and @textlint/kernel
export these new types.
@textlint/ast-node-types
@textlint/linter-formatter
: use @textlint/types
instead of @textlint/kernel
@textlint/fixer-formatter
: use @textlint/types
instead of @textlint/kernel
For more details, see #561
Published by azu almost 6 years ago
Published by azu over 6 years ago
This version will fix regression of [email protected] #517
Move core pacakges to @textlint
scoped.
PR | Before | After |
---|---|---|
#473 | txt-to-ast |
@textlint/text-to-ast |
#460 | markdown-to-ast |
@textlint/markdown-to-ast |
#483 | textlint-ast-test |
@textlint/ast-tester |
#484 | txt-ast-traverse |
@textlint/ast-traverse |
#482 | textlint-fixer-formatter |
@textlint/fixer-formatter |
#474 | textlint-formatter |
@textlint/linter-formatter |
#485 | textlint-plugin-markdown |
@textlint/textlint-plugin-markdown |
#486 | textlint-plugin-text |
@textlint/textlint-plugin-text |
For more details, see #455
If you have seen following deprecated warning, please update latester textlint
, textlint-tester
, or textlint-scripts
.
warning textlint-scripts > textlint-tester > textlint > [email protected]: See https://github.com/textlint/textlint/issues/455
warning textlint-scripts > textlint-tester > textlint > [email protected]: See https://github.com/textlint/textlint/issues/455
warning textlint-scripts > textlint-tester > textlint > [email protected]: See https://github.com/textlint/textlint/issues/455
warning textlint-scripts > textlint-tester > textlint > [email protected]: See https://github.com/textlint/textlint/issues/455
warning textlint-scripts > textlint-tester > textlint > textlint-plugin-text > [email protected]: See https://github.com/textlint/textlint/issues/455
warning textlint-scripts > textlint-tester > textlint > textlint-plugin-markdown > [email protected]: See https://github.com/textlint/textlint/issues/455
warning textlint-scripts > textlint-tester > textlint > @textlint/kernel > [email protected]: See https://github.com/textlint/textlint/issues/455
Update latest version
npm install textlint@latest
npm install textlint-scripts@latest
If you use someone of Migration pacakges, please move to scoped version.
For example, If you use markdown-to-ast
, you migrate from markdown-to-ast
to @textlint/markdown-to-ast
.
npm uninstall markdown-to-ast
npm install @textlint/markdown-to-ast
And, you should change require("markdown-to-ast")
to require("@textlint/markdown-to-ast")
.
textlint-tester
support multiple rules and plugins.
You can write a test for using plugins.
const TextLintTester = require("textlint-tester");
const htmlPlugin = require("textlint-plugin-html");
const noTodoRule = require("textlint-rule-no-todo");
const maxNumberOfLineRule = require("textlint-rule-max-number-of-lines");
const tester = new TextLintTester();
tester.run(
"new-style-of-test: rule and plugin",
{
plugins: [
{
pluginId: "html",
plugin: htmlPlugin
}
],
rules: [
{
ruleId: "no-todo",
rule: noTodoRule
}
]
},
{
valid: [
{
text: "<p>日本語 is Japanese.</p>",
ext: ".html"
}
],
invalid: [
// line, column
{
text: `<p>TODO: no todo</p>
<p>Another paragraph</p>
<p>Yet another paragraph</p>`,
ext: ".html",
errors: [
{
message: "Found TODO: 'TODO: no todo'",
line: 1,
column: 4
}
]
}
]
}
);
publishConfig
(2ceeb99)plugins
at TestConfig
optional (3ebc1d7)TestTarget
to TestConfig
(59ed69d)Published by azu almost 7 years ago
@textlint
pacakgesCurrently, textlint move to scoped pacakge(@textlint
). #455
This release is progress report in this migration.
PR | Before | After |
---|---|---|
#473 | txt-to-ast |
@textlint/text-to-ast |
#460 | markdown-to-ast |
@textlint/markdown-to-ast |
#483 | textlint-ast-test |
@textlint/ast-tester |
txt-ast-traverse |
@textlint/ast-traverse |
|
#482 | textlint-fixer-formatter |
@textlint/fixer-formatter |
#474 | textlint-formatter |
@textlint/linter-formatter |
textlint-plugin-markdown |
@textlint/textlint-plugin-markdown |
|
textlint-plugin-text |
@textlint/textlint-plugin-text |
If you use someone of Migration pacakges, please move to scoped version.
For example, If you use markdown-to-ast
, you migrate from markdown-to-ast
to @textlint/markdown-to-ast
.
npm uninstall markdown-to-ast
npm install @textlint/markdown-to-ast
And, you should change require("markdown-to-ast")
to require("@textlint/markdown-to-ast")
.
publishConfig
(e7a150b)publishConfig
(3e89e3c)publishConfig
(9f54a5a)[email protected] includes following changes.
ASTNodeTypes
string enum #422getFormatterList
method is renamed.textlint --help
#85 by @0x6btextlint -h
show available formatter name list.
textlint [options] file.md [file|dir|glob*]
Options:
-h, --help Show help.
-c, --config path::String Use configuration from this file or sharable config.
--init Create the config file if not existed. - default: false
--fix Automatically fix problems
--dry-run Enable dry-run mode for --fix. Only show result, don't change the file.
--debug Outputs debugging information
-v, --version Outputs the version number.
Using stdin:
--stdin Lint text provided on <STDIN>. - default: false
--stdin-filename String Specify filename to process STDIN as
Output:
-o, --output-file path::String Enable report to be written to a file.
-f, --format String Use a specific output format.
Available formatter : checkstyle, compact, jslint-xml, json, junit, pretty-error, stylish, table, tap,
unix
Available formatter for --fix: compats, diff, json, stylish
--no-color Disable color in piped output.
--quiet Report errors only. - default: false
Specifying rules and plugins:
--plugin [String] Set plugin package name
--rule [path::String] Set rule package name
--preset [path::String] Set preset package name and load rules from preset package.
--rulesdir [path::String] Set rules from this directory and set all default rules to off.
Caching:
--cache Only check changed files - default: false
--cache-location path::String Path to the cache file or directory
Experimental:
--experimental Enable experimental flag.Some feature use on experimental.
--rules-base-directory path::String Set module base directory. textlint load modules(rules/presets/plugins) from the base directory.
.textlintrc
Return an exit status(code 0
) when no rules found (#408) (3dc76e4), closes #406 by @sapegin
TextLintFormatterOption
interface (31146c7){ createFormatter }
instead of { default }
Published by azu almost 7 years ago
TxtNode
type interface@textlint/ast-node-types
get TxtNode
type interface #358
It is useful for TypeScript user.
For more details. see https://github.com/textlint/textlint/blob/master/docs/txtnode.md
@textlint/kernel and textlint export type interfaces.
// Types
import {
TextlintResult,
TextlintFixResult,
TextlintFixCommand,
TextlintMessage,
// Kernel rule/filter/plugin format
TextlintKernelRule,
TextlintKernelFilterRule,
TextlintKernelPlugin,
// Notes: Following interface will be separated module in the future.
// textlint rule interface
TextlintRuleCreator,
TextlintRuleOptions,
// textlint filter rule interface
TextlintFilterRuleCreator,
TextlintFilterRuleOptions,
// textlint plugin interface
TextlintPluginCreator,
TextlintPluginOptions,
TextlintPluginProcessor,
TextlintPluginProcessorConstructor
} from "@textlint/kernel";
If you want to improve TypeScript integration, please file issue or track following issue.
inputPath
option #394textlint-tester support inputPath
options.
It can test path-based rules.
A breaking change, but this changes not affect to textlint tool user.
This changes affect to user that user textlint as node modules.
Export as common js module.
module.exports = {
textlint,
TextLintEngine,
}
Export as named module.
export {
textlint,
TextLintEngine
}
You can import it as es named import.
import { textlint } from "textlint"
or
You can import it as common js module
const textlint = require("textlint").textlint
We have removed following from textlint.
TextLintNodeType
TextLintMessageSeverityLevel
TextLintMessageType
@textlint/ast-node-types
insteadof itIssues/PR: #380 #379 #355 #352 #353 #341 #387 by @Leko and @0x6b
We have improved Contributing Guide.
This Contributing Guide help you to contribute to textlint.
If you want to contribute to texltlint, let's see issues with the good first issue
label.
Import following modules into this monorepo.
Thanks to @Leko
[email protected] add shorthand of scoped pacakge support in .textlintrc
#326
But it is not working on preset module #327
texlint 9.1.1 just fixes the scoped preset module bug #329
Work following shorthand of preset module.
{
"rules": {
"@textlint-rule/preset-google": true
}
}
You can write @scope/name
in .textlintrc
.
@scope/name
is shortcut name of @scope/textlint-rule-name
.
For more details, See Configuration document.
Published by azu almost 7 years ago
Convert @textlint/kernel from JavaScript to Typescript.
If you instersting in TypeScript support, please see #248 .
Currently, Type definition is unstable. It means that break change in minor version.
Allow to specify following options.
{
"plugins": {
"text": { "custom": "value" }
}
}
For mode details, See document of plugin.
Allow to write following index
based testing.
const TextLintTester = require("textlint-tester");
const tester = new TextLintTester();
tester.run("rule", rule, {
invalid: [
// index
{
text: "- [ ] string",
errors: [
{
message: "Found TODO: '- [ ] string'",
index: 2
}
]
}
]
});
Fix to use correct exit code. Thanks to @buzztaiki
These breaking change is for plugin/rule author.
context.config
#294 #295You can use context.getConfigBaseDir()
instead of context.config
.
getConfigBaseDir()
return config base directory path that is the place of .textlintrc
getConfigBaseDir()
return "/path/to/dir/"
.Related rules changes:
config.getConfigBaseDir()
by azu · Pull Request #8 · azu/textlint-rule-eslintYou can use preset
feature instead of plugin.
The textlint plugin should focus on processor.
context.report
function #316It prevent wrong usage of report
function:
NG:
report(node,
new RuleError(`using "please" in a set of instructions is overdoing the politeness.`), {
index,
fix: fixer.replaceTextRange(range, result.replace)
}
)
OK:
report(node,
new RuleError(`using "please" in a set of instructions is overdoing the politeness.`, {
index,
fix: fixer.replaceTextRange(range, result.replace)
});
)