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

core: convert audit types to modules #12870

Merged
merged 2 commits into from
Aug 7, 2021
Merged

Conversation

brendankenny
Copy link
Member

@brendankenny brendankenny commented Aug 5, 2021

To give an idea of what #12860 would look like, this moves audit.d.ts and audit-details.d.ts to exports instead of directly writing to global.LH.* types, then starts a centralized place to do the global declaration to maintain current type behavior.

Much easier to review with ?w=1 since there's an indentation change. Also divided into two commits if you want to see the changes to the two files (and associated references) separately.

@brendankenny brendankenny requested a review from a team as a code owner August 5, 2021 17:51
@brendankenny brendankenny requested review from connorjclark and removed request for a team August 5, 2021 17:51
@google-cla google-cla bot added the cla: yes label Aug 5, 2021

/**
* @param {LH.Audit.SimpleCriticalRequestNode} tree
* @param {LH.Audit.Details.SimpleCriticalRequestNode} tree
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

going through all of our d.ts files, this was the only type change that needed to happen in a JS file. SimpleCriticalRequestNode really is an audit details type, it just predates the file audit-details.d.ts. Moving it to audit-details avoids a circular dependency of audit-details.d.ts back to SimpleCriticalRequestNode in audit.d.ts.

@@ -5,7 +5,7 @@
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/

import Audit = require('../lighthouse-core/audits/audit.js');
import AuditClass = require('../lighthouse-core/audits/audit.js');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is what I was talking about in #12860, where some changes lead to Audit in this file to refer to the global LH.Audit namespace, not this very explicit local import to a (type) variable named Audit.

This can be reverted when config.d.ts moves off global declarations

Copy link
Collaborator

@connorjclark connorjclark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems there's nothing contentious about this. net positive all around. LGTM

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

Successfully merging this pull request may close these issues.

3 participants