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
feat: fix no-restricted-properties false negatives with unknown objects #17818
Changes from 5 commits
9dc3044
7ce90cc
205695e
fef9efb
bb01ac2
c51934a
fef463c
12e3a0b
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 | ||||
---|---|---|---|---|---|---|
|
@@ -546,6 +546,138 @@ ruleTester.run("no-restricted-properties", rule, { | |||||
}, | ||||||
type: "MemberExpression" | ||||||
}] | ||||||
}, { | ||||||
code: "const { bar: { bad } = {} } = foo;", | ||||||
options: [{ property: "bad" }], | ||||||
parserOptions: { ecmaVersion: 6 }, | ||||||
errors: [{ | ||||||
messageId: "restrictedProperty", | ||||||
data: { | ||||||
propertyName: "bad", | ||||||
message: "" | ||||||
} | ||||||
}] | ||||||
}, { | ||||||
code: "const { bar: { bad } } = foo;", | ||||||
options: [{ property: "bad" }], | ||||||
parserOptions: { ecmaVersion: 6 }, | ||||||
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.
Suggested change
|
||||||
errors: [{ | ||||||
messageId: "restrictedProperty", | ||||||
data: { | ||||||
propertyName: "bad", | ||||||
message: "" | ||||||
} | ||||||
}] | ||||||
}, { | ||||||
code: "const { bad } = foo();", | ||||||
options: [{ property: "bad" }], | ||||||
parserOptions: { ecmaVersion: 6 }, | ||||||
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.
Suggested change
|
||||||
errors: [{ | ||||||
messageId: "restrictedProperty", | ||||||
data: { | ||||||
propertyName: "bad", | ||||||
message: "" | ||||||
} | ||||||
}] | ||||||
}, { | ||||||
code: "({ bad } = foo());", | ||||||
options: [{ property: "bad" }], | ||||||
parserOptions: { ecmaVersion: 6 }, | ||||||
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.
Suggested change
|
||||||
errors: [{ | ||||||
messageId: "restrictedProperty", | ||||||
data: { | ||||||
propertyName: "bad", | ||||||
message: "" | ||||||
} | ||||||
}] | ||||||
}, { | ||||||
code: "({ bar: { bad } } = foo);", | ||||||
options: [{ property: "bad" }], | ||||||
parserOptions: { ecmaVersion: 6 }, | ||||||
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.
Suggested change
|
||||||
errors: [{ | ||||||
messageId: "restrictedProperty", | ||||||
data: { | ||||||
propertyName: "bad", | ||||||
message: "" | ||||||
} | ||||||
}] | ||||||
}, { | ||||||
code: "({ bar: { bad } = {} } = foo);", | ||||||
options: [{ property: "bad" }], | ||||||
parserOptions: { ecmaVersion: 6 }, | ||||||
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.
Suggested change
|
||||||
errors: [{ | ||||||
messageId: "restrictedProperty", | ||||||
data: { | ||||||
propertyName: "bad", | ||||||
message: "" | ||||||
} | ||||||
}] | ||||||
}, { | ||||||
code: "({ bad }) => {};", | ||||||
options: [{ property: "bad" }], | ||||||
parserOptions: { ecmaVersion: 6 }, | ||||||
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.
Suggested change
|
||||||
errors: [{ | ||||||
messageId: "restrictedProperty", | ||||||
data: { | ||||||
propertyName: "bad", | ||||||
message: "" | ||||||
} | ||||||
}] | ||||||
}, { | ||||||
code: "({ bad } = {}) => {};", | ||||||
options: [{ property: "bad" }], | ||||||
parserOptions: { ecmaVersion: 6 }, | ||||||
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.
Suggested change
|
||||||
errors: [{ | ||||||
messageId: "restrictedProperty", | ||||||
data: { | ||||||
propertyName: "bad", | ||||||
message: "" | ||||||
} | ||||||
}] | ||||||
}, { | ||||||
code: "({ bad: bar }) => {};", | ||||||
options: [{ property: "bad" }], | ||||||
parserOptions: { ecmaVersion: 6 }, | ||||||
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.
Suggested change
|
||||||
errors: [{ | ||||||
messageId: "restrictedProperty", | ||||||
data: { | ||||||
propertyName: "bad", | ||||||
message: "" | ||||||
} | ||||||
}] | ||||||
}, { | ||||||
code: "({ bar: { bad } = {} }) => {};", | ||||||
options: [{ property: "bad" }], | ||||||
parserOptions: { ecmaVersion: 6 }, | ||||||
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.
Suggested change
|
||||||
errors: [{ | ||||||
messageId: "restrictedProperty", | ||||||
data: { | ||||||
propertyName: "bad", | ||||||
message: "" | ||||||
} | ||||||
}] | ||||||
}, { | ||||||
code: "[{ bad }] = foo;", | ||||||
options: [{ property: "bad" }], | ||||||
parserOptions: { ecmaVersion: 6 }, | ||||||
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.
Suggested change
|
||||||
errors: [{ | ||||||
messageId: "restrictedProperty", | ||||||
data: { | ||||||
propertyName: "bad", | ||||||
message: "" | ||||||
} | ||||||
}] | ||||||
}, { | ||||||
code: "const [{ bad }] = foo;", | ||||||
options: [{ property: "bad" }], | ||||||
parserOptions: { ecmaVersion: 6 }, | ||||||
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.
Suggested change
|
||||||
errors: [{ | ||||||
messageId: "restrictedProperty", | ||||||
data: { | ||||||
propertyName: "bad", | ||||||
message: "" | ||||||
} | ||||||
}] | ||||||
} | ||||||
] | ||||||
}); |
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.
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.
I did, ig the ci will fail since the base is an older commit, anything that I should do to fix it ?
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.
CI checks out from a merge commit, so the tests should pass.
Problem is only linting, as
languageOptions
should be at the same place whereparserOptions
were. If you could update that, it would be great.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.
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.
Ye, done.