-
Notifications
You must be signed in to change notification settings - Fork 170
chore: run eslint over test files and fix surfaced errors #374
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,11 +1,10 @@ | ||||||||||||||||||||||||
| /* eslint-disable no-param-reassign */ | ||||||||||||||||||||||||
| const NO_EXIST = { __NOT_EXIST: true }; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| export function spyElementPrototypes(Element, properties) { | ||||||||||||||||||||||||
| const propNames = Object.keys(properties); | ||||||||||||||||||||||||
| const originDescriptors = {}; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| propNames.forEach(propName => { | ||||||||||||||||||||||||
| propNames.forEach((propName) => { | ||||||||||||||||||||||||
| const originDescriptor = Object.getOwnPropertyDescriptor(Element.prototype, propName); | ||||||||||||||||||||||||
| originDescriptors[propName] = originDescriptor || NO_EXIST; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
@@ -22,9 +21,10 @@ export function spyElementPrototypes(Element, properties) { | |||||||||||||||||||||||
| ...spyProp, | ||||||||||||||||||||||||
| set(value) { | ||||||||||||||||||||||||
| if (spyProp.set) { | ||||||||||||||||||||||||
| return spyProp.set.call(this, originDescriptor, value); | ||||||||||||||||||||||||
| spyProp.set.call(this, originDescriptor, value); | ||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||
| originDescriptor.set(value); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
Comment on lines
23
to
27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If
Suggested change
|
||||||||||||||||||||||||
| return originDescriptor.set(value); | ||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||
| get() { | ||||||||||||||||||||||||
| if (spyProp.get) { | ||||||||||||||||||||||||
|
|
@@ -39,7 +39,7 @@ export function spyElementPrototypes(Element, properties) { | |||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| return { | ||||||||||||||||||||||||
| mockRestore() { | ||||||||||||||||||||||||
| propNames.forEach(propName => { | ||||||||||||||||||||||||
| propNames.forEach((propName) => { | ||||||||||||||||||||||||
| const originDescriptor = originDescriptors[propName]; | ||||||||||||||||||||||||
| if (originDescriptor === NO_EXIST) { | ||||||||||||||||||||||||
| delete Element.prototype[propName]; | ||||||||||||||||||||||||
|
|
@@ -58,4 +58,3 @@ export function spyElementPrototype(Element, propName, property) { | |||||||||||||||||||||||
| [propName]: property, | ||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| /* eslint-enable no-param-reassign */ | ||||||||||||||||||||||||
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.
In ESLint v9+ (and flat config mode, which is active here via
eslint.config.mjs), the--extcommand-line option has been deprecated and removed. Runningeslintwith--extwill result in a fatal error. Since flat config automatically determines which files to lint based on thefilespatterns in your configuration, you can safely remove the--extoption entirely.