You can contribute to textlint in various ways:
- Reporting issues
- Submitting pull request which fixes known issues, improve documentation, or implement new feature
- Creating an enhancement request or suggestions
- Writing your own rules or plugins
- Writing an article about textlint on your blog
Although we are accepting pull request, we recommend creating an issue first as it enables us to discuss your proposal before you put significant effort into it.
Reporting New Issues or Feature Suggestions
Please create a new issue on GitHub if you found a bug, got a question, or had an idea for improvement. All work on textlint happens on GitHub in English.
As described at the
ISSUE_TEMPLATE.md, please include following information when reporting a bug:
- What version of textlint are you using? (
- What file type (Markdown, plain text, etc.) are you using?
- What did you do? Please include the actual source code causing the issue.
- What did you expect to happen?
- What actually happened? Please include the actual, raw output from textlint. (
textlint --debug <options> ...)
Creating a new repository that can reproduce the issue helps us understand your situation. This repository for example.
Here you can see how to get the source of textlint, build it, and run tests locally. We use GitHub Flow as development workflow.
If you want to contribute to textlint, please check issues labeled
good first issue. These issues are suitable for your first contribution.
Please install following development prerequisites. You also need a GitHub account for contribution.
- Node.js -- we tend to use latest stable Node.js although textlint supports >= 6.0.0
- Yarn -- textlint supports npm >= 2.0.0, but for development purpose, we chose Yarn as package manager
- Text editor
- Terminal emulator
Cloning Copy of textlint
Forking a repository allows you to work with textlint codebase without special permission to the textlint repository itself.
Navigate to textlint repository
In the top–right corner of the page, click Fork button
Create a clone of the fork locally in your terminal:
$ git clone --recursive https://github.com/YOUR_ACCOUNT/textlint YOUR_FORKED_REPOSITORY
See Fork A Repo: GitHub Help for further detail.
After getting your clone, you can start playing with textlint.
Change directory to your clone:
$ cd YOUR_FORKED_REPOSITORY
Install dependencies and build packages:
$ yarn install
Install all of textlint packages' dependencies:
$ yarn bootstrap
$ yarn website
Under the hood, textlint uses Lerna to manage multiple packages:
If you are new to Lerna, it seems to add another layer of complexity but it's simpler than you think; you can edit codes, run tests, commit changes, etc. as usual in most cases.
yarn install also builds a codebase, you can manually build by running
yarn build. We have separate task
yarn website since code and documentation have different life cycle.
Creating a Branch for Your Work
Before adding changes to your clone, please create a new branch (typically called feature branch). Changes made to feature branch don't affect or corrupt
master branch so you will feel safe. In Git, creating a branch is easy and fast:
$ git checkout -b your-new-feature
You have your feature branch with working textlint then it's time to start making changes! Edit codes with text editor of your choice and add commits as you work on. Please don't forget to add or modify test cases and documents according to your changes.
Note: TypeScript's Project References
This monorepo use Project References for faster building.
You can update Project References from
yarn run update:projectReferences
Also, You can check Project References if it is correct.
yarn run test:projectReferences
While working with your idea, please use:
We are migrating entire codes to TypeScript.
Linting and Style
husky to make coding style consistent before commit, but if you have your own Git hooks locally, these setup doesn't work. In such case, please run ESLint and Prettier manually as below after making changes.
$ yarn eslint
Run ESLint with
--fixfeature to fix some wrong style automatically:
$ yarn eslint:fix
Run Prettier to reformat code:
$ yarn prettier
Commit Message Format
We use Angular Convention for commit message.
In order to make repository history clean, please use the following guideline as possible as you can. It also enables us creating comprehensive changelog semi–automatically.
component commit title commit type / / \ | | feat(rule-context): add template url parameter to events (a blank line) body -> The `src` (i.e. the url of the template to load) is now provided to the `$includeContentRequested`, `$includeContentLoaded` and `$includeContentError` events. referenced -> Closes #8453 issues Ref. #8454
- commit type:
docs: create or update document
feat: add new feature
fix: fix a bug
style: change formatting
perf: performance related change
test: update on tests
refactor: refactoring related change
- component: package or file name
- commit title:
- Limit to 50 characters including commit type and component (as possible as you can)
- Do not capitalize first character
- Do not end with a period
- Use imperative mood, in present tense; commit title should always be able to complete the following sentence:
- If applied, this commit will commit title here
- Separate from subject with a blank line
- Wrap texts at 72 characters
- Explain what and why, not how
- GitHub flavored Markdown is ok to use
- Start with
BREAKING CHANGE:when you made significant change in the commit (see versioning section below).
Example commit message:
test(textlint-formatter): check types while testing - Add strict type check option to `ts-node` to make sure future interface changes will be took into account while running test. - Update test case for interface changes made at #430. Closes #448.
We care version number while releasing packages to npm registry so you should not modify
version field of
package.json. For the record, we use Semantic Versioning.
- Patch release (intended to not break your lint build)
- A bug fix to the CLI or core (including formatters)
- Improvements to documentation
- Non-user-facing changes such as refactoring
- Re-releasing after a failed release (i.e., publishing a release that doesn't work for anyone)
- Minor release (might break your lint build)
- A new option
- An existing rule is deprecated
- A new CLI capability is created
- New public API are added (new classes, new methods, new arguments to existing methods, etc.)
- It might break type interface(
- It might break type interface(
- A new formatter is created
- Major release (break your lint build)
- A new option to an existing rule that results in ESLint reporting more errors by default
- An existing formatter is removed
- Part of the public API is removed or changed in an incompatible way
We have four type of tests. You should run at least unit test or documentation test according to your type of changes before submitting a pull request.
All tests should be run at the top directory of your fork.
Run tests under
$ yarn test
While developing, it would be good to run package level unit test since it will run faster:
$ cd packages/PACKAGE $ yarn test
examples as test:
$ yarn test:examples
Run tests with real–world documents:
$ git submodule update --init $ yarn test:integration
$ yarn test:docs
Also you can run all of the above by:
$ yarn test:all
Pushing the Commit and Opening a Pull Request
After finishing your changes and unit tests or documentation test ran fine, you can push your feature branch to GitHub. Please see GitHub Help for detail but typically, run
git push at your terminal.
$ git push origin feature-branch
Then follow another GitHub Help to create a pull request.
Working with Reviews (if any)
Once a pull request has been created, it will initiate continuous integration builds and we can work on your changes. You can push additional commits to your fork according to feedback.
After all participants on pull request are satisfied to the changes, we will merge your code into the textlint master branch. Yay!
A Maintainer release new version of textlint by following way.
- Checkout release branch
# checkout release branch like "release-2019-10-10" git checkout -b "release-$(date '+%Y-%m-%d')" # push current branch git push origin HEAD -u
- Version up and Update CHANGELOG
npm run versionup git push
Tips: Copy changelogs from CHANGELOG.md
## Collect changelog in the versionup yarn run collect-changelog # pbcopy
- Create a Pull Request and Review the release
- If you need, write blog posts in website/blog
- Publish to npm
npm run release