Skip to content

Commit

Permalink
fix(param-names): remove fixer (#146)
Browse files Browse the repository at this point in the history
Fixes #145
  • Loading branch information
adrianmcli authored and macklinu committed Sep 7, 2018
1 parent 764f004 commit af28d6f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -80,7 +80,7 @@ or start with the recommended rule set:
| -------------------------------------------------------- | -------------------------------------------------------------------------------- | ----------- | -------- |
| [`catch-or-return`][catch-or-return] | Enforces the use of `catch()` on un-returned promises. | :bangbang: | |
| [`no-return-wrap`][no-return-wrap] | Avoid wrapping values in `Promise.resolve` or `Promise.reject` when not needed. | :bangbang: | |
| [`param-names`][param-names] | Enforce consistent param names and ordering when creating new promises. | :bangbang: | :wrench: |
| [`param-names`][param-names] | Enforce consistent param names and ordering when creating new promises. | :bangbang: | |
| [`always-return`][always-return] | Return inside each `then()` to create readable and reusable Promise chains. | :bangbang: | |
| [`no-native`][no-native] | In an ES5 environment, make sure to create a `Promise` constructor before using. | | |
| [`no-nesting`][no-nesting] | Avoid nested `then()` or `catch()` statements | :warning: | |
Expand Down
12 changes: 4 additions & 8 deletions __tests__/param-names.js
Expand Up @@ -22,23 +22,19 @@ ruleTester.run('param-names', rule, {
invalid: [
{
code: 'new Promise(function(reject, resolve) {})',
errors: [{ message }],
output: 'new Promise(function(resolve, reject) {})'
errors: [{ message }]
},
{
code: 'new Promise(function(resolve, rej) {})',
errors: [{ message }],
output: 'new Promise(function(resolve, reject) {})'
errors: [{ message }]
},
{
code: 'new Promise(yes => {})',
errors: [{ message }],
output: 'new Promise(resolve => {})'
errors: [{ message }]
},
{
code: 'new Promise((yes, no) => {})',
errors: [{ message }],
output: 'new Promise((resolve, reject) => {})'
errors: [{ message }]
}
]
})
8 changes: 1 addition & 7 deletions rules/param-names.js
Expand Up @@ -26,13 +26,7 @@ module.exports = {
context.report({
node,
message:
'Promise constructor parameters must be named resolve, reject',
fix(fixer) {
return [
fixer.replaceText(params[0], 'resolve'),
params[1] && fixer.replaceText(params[1], 'reject')
].filter(Boolean)
}
'Promise constructor parameters must be named resolve, reject'
})
}
}
Expand Down

0 comments on commit af28d6f

Please sign in to comment.