Skip to content

Commit

Permalink
feature(putout) ruler: add ability to set on/off, when disable/enable
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser committed Aug 12, 2019
1 parent 8f14973 commit 705d5c8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions packages/putout/lib/ruler.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ module.exports.enable = enable;

function enable(config, rule) {
initRules(config);
config.rules[rule] = true;
config.rules[rule] = 'on';

return config;
}

module.exports.disable = disable;
function disable(config, rule) {
initRules(config);
config.rules[rule] = false;
config.rules[rule] = 'off';

return config;
}
Expand Down
16 changes: 8 additions & 8 deletions packages/putout/lib/ruler.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test('putout: ruler: enable', (t) => {
const config = enable({}, 'remove-unused-variables');
const expected = {
rules: {
'remove-unused-variables': true,
'remove-unused-variables': 'on',
},
};

Expand All @@ -24,7 +24,7 @@ test('putout: ruler: enable: exists', (t) => {
const config = enable({rules: {}}, 'remove-unused-variables');
const expected = {
rules: {
'remove-unused-variables': true,
'remove-unused-variables': 'on',
},
};

Expand All @@ -36,7 +36,7 @@ test('putout: ruler: disable', (t) => {
const config = disable({}, 'remove-unused-variables');
const expected = {
rules: {
'remove-unused-variables': false,
'remove-unused-variables': 'off',
},
};

Expand All @@ -48,7 +48,7 @@ test('putout: ruler: disable: exists', (t) => {
const config = disable({}, 'remove-unused-variables');
const expected = {
rules: {
'remove-unused-variables': false,
'remove-unused-variables': 'off',
},
};

Expand All @@ -64,7 +64,7 @@ test('putout: ruler: disableAll', (t) => {
const config = disableAll({}, places);
const expected = {
rules: {
'remove-unused-variables': false,
'remove-unused-variables': 'off',
},
};

Expand All @@ -86,7 +86,7 @@ test('putout: ruler: disable: exists', (t) => {
const config = disableAll(data, places);
const expected = {
rules: {
'remove-unused-variables': false,
'remove-unused-variables': 'off',
},
};

Expand All @@ -101,7 +101,7 @@ test('putout: ruler: enableAll', (t) => {
const config = enableAll({}, places);
const expected = {
rules: {
'remove-unused-variables': true,
'remove-unused-variables': 'on',
},
};

Expand All @@ -121,7 +121,7 @@ test('putout: ruler: enableAll: exists', (t) => {
const config = enableAll(data, places);
const expected = {
rules: {
'remove-unused-variables': true,
'remove-unused-variables': 'on',
},
};

Expand Down

0 comments on commit 705d5c8

Please sign in to comment.