There is surely nothing other than the single purpose of the present moment. A man's whole life is a succession of moment after moment. There will be nothing else to do, and nothing else to pursue. Live being true to the single purpose of the moment.
(c) Yamamoto Tsunetomo "Hagakure"
That's awesome 👏! Check out good first issues
,
most likely you can do some contribution using web interface, otherwise worry not 😏.
Make fork of a repo, clone it and run:
cd putout
npm install
npm run bootstrap
No matter what package
you are interested in, you always have 4 little friends:
- 🦊
lint
- 🐺
fix:lint
- 🦏
test
- 🦛
coverage
You can call them from each package with npm run
and they will always come 🤙.
🐊Putout is one of projects that have 100% code coverage, it helps a lot, since when code not covered with tests, you have two choices:
- ✅ cover with tests;
- ✅ remove;
That's it! Writing tests is very simple tasks since we have own framework based on 📼supertape
: @putout/test
. We have also @putout/plugin-putout
with test-based rules, that help you write as little code as possible. So how adding tests looks like?
Let's suppose you want to add test for @putout/plugin-remove-unreachable-code
, you open test/remove-unreachable-code.js
and see a lot of lines that ends up with:
test('plugin-remove-unreachable-code: no report: return-no-arg', (t) => {
t.noReport('return-no-arg');
t.end();
});
What you need to do is copy this 4 lines, so you have:
test('plugin-remove-unreachable-code: no report: return-no-arg', (t) => {
t.noReport('return-no-arg');
t.end();
});
+test('plugin-remove-unreachable-code: no report: return-no-arg', (t) => {
+ t.noReport('return-no-arg');
+ t.end();
+});
Then you add fixture
named fixture/return-with-some-of-your-case
(try to add name that mirrors the problem) and change argument of noReport
:
test('plugin-remove-unreachable-code: no report: return-no-arg', (t) => {
t.noReport('return-no-arg');
t.end();
});
test('plugin-remove-unreachable-code: no report: return-no-arg', (t) => {
- t.noReport('return-no-arg');
+ t.noReport('return-with-some-of-your-case');
t.end();
});
Then you write in terminal:
$ cat > fixture/return-with-some-of-your-case.js
if (a) {
return 'some of your case';
}
^c
$ UPDATE=1 npm run fix:lint && npm test
This command will fix test for you and generate fixture. Most likely you will need two types of tests:
- ✅
noReport()
- when rule has false positive; - ✅
transform()
- when new case added;
The command UPDATE=1 npm run test
will generate fixture
for you, so you need not to worry about it, also @putout/plugin-putout
will fix test message and other things, so you can also warry not about it 😏. Always remember that all things should be simple and automated: 🐊Putout fixes everything, including itself.
When your made changes, added coverage and your package is ready for publishing 📦 , run: npm run fresh
,
in the root of the repository, it will run lint
and test
over all packages
.
When adding new plugin, add it to package.json
and putout.json
.
Update Built-in Transformations
and Plugins
.
Format of the commit message: type: scope: subject
Type:
feature: scope: subject
fix: scope: subject
docs: scope: subject
refactor: scope: subject
test: scope: subject
chore: scope: subject
Scope:
Scope could be anything specifying place of the commit change.
For example @putout/plugin-remove-unused-variables
, @putout/cli-ruler
, putout
etc...
Subject text:
- use imperative, present tense: “change” not “changed” nor “changes”
- don't capitalize first letter
- no dot (.) at the end Message body:
- just as in use imperative, present tense: “change” not “changed” nor “changes”
- includes motivation for the change and contrasts with previous