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
We have lots of TSLint rules today that help us prevent pushing badly layered code. However we fail to detect usage such as process or Buffer in common|browser layer.
I am not an expert in TS and have just thrown together a trivial version that checks on identifier names (in #79222):
I need someone with more expertise to make it smarter (@mjbvz ?). Ideally we can only report a warning if the resolved type is coming from a certain d.ts file (e.g. node.d.ts). Not sure if that is possible.
Implementation:
visitIdentifier(node: ts.Identifier){if(this._config.unsafe.some(unsafe=>unsafe===node.text)){this.addFailureAtNode(node,`Unsafe global usage of ${node.text} in ${this._config.target}`);}super.visitIdentifier(node);}
The text was updated successfully, but these errors were encountered:
We have lots of TSLint rules today that help us prevent pushing badly layered code. However we fail to detect usage such as
process
orBuffer
incommon|browser
layer.I am not an expert in TS and have just thrown together a trivial version that checks on identifier names (in #79222):
I need someone with more expertise to make it smarter (@mjbvz ?). Ideally we can only report a warning if the resolved type is coming from a certain
d.ts
file (e.g.node.d.ts
). Not sure if that is possible.Implementation:
The text was updated successfully, but these errors were encountered: