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
addons-linter uses cheerio to validate the HTML, currently there are two rules1 and cheerio is unreasonably large just for that (2.80MB!)2.
Cheerio wraps parse5 to parse the AST and addons-linter could use it directly, saving almost 2 megabytes.3 The issue is that parse5 only returns an object4, no querying ability.
💡 I'm not sure whether this is actually possible, but would you be open to a PR that passes current tests?
Given the number of rules (2!) would it make sense to try and walk the AST directly? Maybe a simple walker would be as simple as:
addons-linter
usescheerio
to validate the HTML, currently there are two rules1 and cheerio is unreasonably large just for that (2.80MB!)2.Cheerio wraps
parse5
to parse the AST andaddons-linter
could use it directly, saving almost 2 megabytes.3 The issue is thatparse5
only returns an object4, no querying ability.💡 I'm not sure whether this is actually possible, but would you be open to a PR that passes current tests?
Given the number of rules (2!) would it make sense to try and walk the AST directly? Maybe a simple walker would be as simple as:
And then the rules would look something like:
Footnotes
https://github.com/mozilla/addons-linter/tree/5c608c102ed926099f6ed0a6b5d53c93ff9c8ae3/src/rules/html ↩
https://packagephobia.com/result?p=cheerio ↩
https://packagephobia.com/[email protected] ↩
https://astexplorer.net/#/1CHlCXc4n4 ↩
The text was updated successfully, but these errors were encountered: