Skip to content
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

Find unused (dead) class fields #14742

Closed
jridgewell opened this issue Apr 19, 2018 · 4 comments · Fixed by #22626
Closed

Find unused (dead) class fields #14742

jridgewell opened this issue Apr 19, 2018 · 4 comments · Fixed by #22626

Comments

@jridgewell
Copy link
Contributor

I found in #14739 two unused class fields:

class Example {
  constructor() {
    this.field_ = something(window);
  }
}

Even though these private fields were not being accessed at all, they were still present in the v0.js:

function Xk(a) {
  this.A = gd(window);
}

Bytes add up. We can detect things like this, and lint them out.

@rsimha
Copy link
Contributor

rsimha commented May 14, 2019

@jridgewell Reopening this issue, since we still have a couple dozen warnings for the amphtml-internal/unused-private-field rule that are preventing it from being made into an error.

https://travis-ci.org/ampproject/amphtml/jobs/532446854#L316

@rsimha
Copy link
Contributor

rsimha commented May 31, 2019

Tooling is in place to detect this. All that's left to do is remove instances of this from the runtime.

@dreamofabear
Copy link

I think this can be closed now that the lint rule is an error.

@rsimha
Copy link
Contributor

rsimha commented Jun 25, 2019

I think this can be closed now that the lint rule is an error.

A possible cleanup task: See if any of the @protected class fields in #22626 are unnecessary, and if so, delete them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants