You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I originally added our extension to unbound-method, I wanted to allow people to be able to enable it in shared ESLint configs themed around Jest rather than JavaScript or TypeScript i.e. so you could use such a config in projects regardless of if they were using TypeScript without needing to do anything extra.
We achieve this in two ways:
We internally handle MODULE_NOT_FOUND errors when attempting to require the rule:
I think 2. is actually the wrong thing to do because notably it includes the "project property not specified" error that is thrown if you attempt to use the base rule without sufficient configuration for the parser services to be generated, without which the rule cannot work.
I don't think it would be a breaking change, but if we do a new major in the near-future we might as well include it at the same time - I will also be trying this on some of my projects at work to check I've not forgotten anything (tbh though I can't remember why I didn't think checking that @typescript-eslint/eslint-plugin was sufficient)
For reference, we do have a test that covers the current behaviour which'd effectively be inverted by this:
G-Rath
changed the title
[unbound-method] don't suppress thrown errors when rule can be found
[unbound-method] don't suppress errors thrown by base rule
Jul 23, 2022
When I originally added our extension to
unbound-method
, I wanted to allow people to be able to enable it in shared ESLint configs themed around Jest rather than JavaScript or TypeScript i.e. so you could use such a config in projects regardless of if they were using TypeScript without needing to do anything extra.We achieve this in two ways:
We internally handle
MODULE_NOT_FOUND
errors when attempting to require the rule:eslint-plugin-jest/src/rules/unbound-method.ts
Lines 25 to 43 in 78a7141
We swallow any errors thrown by the rule itself when attempting to create it:
eslint-plugin-jest/src/rules/unbound-method.ts
Lines 45 to 53 in 78a7141
I think 2. is actually the wrong thing to do because notably it includes the "project property not specified" error that is thrown if you attempt to use the base rule without sufficient configuration for the parser services to be generated, without which the rule cannot work.
I don't think it would be a breaking change, but if we do a new major in the near-future we might as well include it at the same time - I will also be trying this on some of my projects at work to check I've not forgotten anything (tbh though I can't remember why I didn't think checking that
@typescript-eslint/eslint-plugin
was sufficient)For reference, we do have a test that covers the current behaviour which'd effectively be inverted by this:
eslint-plugin-jest/src/rules/__tests__/unbound-method.test.ts
Lines 186 to 203 in 78a7141
cc @SimenB @bradzacher for thoughts
The text was updated successfully, but these errors were encountered: