-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add no-error-ctor-with-notthrows
rule
#240
Conversation
Please read and adhere to https://github.com/avajs/eslint-plugin-ava/blob/master/docs/new-rule.md (Probably smart to read it multiple times as it's easy to miss something). The rule needs a more specific name that follows the naming convention of the other rules. |
@novemberborn @sindresorhus can you guys suggest a better name? I think we can go with - |
no-typeerror-with-notthrows
no-typeerror-with-notthrows
rule
@gurungrahul2 thanks for the updates. We do get notifications when commits are pushed so there's no need to remind us. It just may take some time before we can get back to you. |
Sorry @novemberborn , i will take care. |
You missed this:
And:
https://github.com/avajs/eslint-plugin-ava/blob/master/docs/new-rule.md |
The rule should handle |
With #240 (comment), I meant they would be more readable if you format them like normal code, using multiple lines. |
no-typeerror-with-notthrows
ruleno-error-ctor-with-notthrows
rule
Can this be more better? |
I haven't forgotten about this. I just haven't had the chance to review it properly yet. Maybe @JLHwung and @GMartigny have time to help review. |
changed name of test and added more tests with other requested changes.
Review ping. :) @sindresorhus |
@@ -84,6 +85,7 @@ The rules will only activate in test files. | |||
- [no-async-fn-without-await](docs/rules/no-async-fn-without-await.md) - Ensure that async tests use `await`. | |||
- [no-cb-test](docs/rules/no-cb-test.md) - Ensure no `test.cb()` is used. | |||
- [no-duplicate-modifiers](docs/rules/no-duplicate-modifiers.md) - Ensure tests do not have duplicate modifiers. | |||
- [no-error-ctor-with-notthrows](docs/rules/no-error-ctor-with-notthrows.md) - No specifying error type in `t.notThrows()`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- [no-error-ctor-with-notthrows](docs/rules/no-error-ctor-with-notthrows.md) - No specifying error type in `t.notThrows()`. | |
- [no-error-ctor-with-notthrows](docs/rules/no-error-ctor-with-notthrows.md) - Ensure no error constructor is specified in `t.notThrows()`. |
|
||
const errors = [{ruleId: 'no-error-ctor-with-notthrows'}]; | ||
|
||
const header = `const test = require('ava');\n`; // eslint-disable-line quotes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const header = `const test = require('ava');\n`; // eslint-disable-line quotes | |
const header = 'const test = require(\'ava\');\n'; |
ruleTester.run('no-error-ctor-with-notthrows', rule, { | ||
valid: [ | ||
`${header} | ||
test('some test',t => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test('some test',t => { | |
test('some test', t => { |
Could you fix this for all the other times ?
@@ -62,7 +62,7 @@ | |||
"ava": { | |||
"files": [ | |||
"!rules", | |||
"test/*.js" | |||
"test/*js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"test/*js" | |
"test/*.js" |
Why change this ?
Closing for lack of activity. |
fixes #178
added rule with tests (100% coverage).