-
Notifications
You must be signed in to change notification settings - Fork 19
Fix ordering linting errors in JS docs #447
Comments
From the call just now: Errors are thrown quite verbosely (multiple per page), so this isn't as bad as I thought. Will is going to look into making it more silent. Also, one thing to look into is Polyfill sections and whether we should add it as optional ingredient. |
I've filed #448 to make the linter log only one error when sections are out of order. |
I have had a go at this and we are now at 175 errors, down from 379 this morning. Mostly this is relocating H2#Polyfill but there were a few other obvious changes too. Some questions. H2#Syntax for propertiesMany of our property pages include an H2#Syntax, but this is not in the "javascript-property" recipe. For example: The same applies to some namespace pages: such as One exception I've seen is Old compat notesSeveral pages include some ancient compat notes under H2 headings:
I think we should delete these. TypedArrayhttps://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray This is a nasty one! It contains an H2#Syntax section, which it should not have since it is tagged as a namespace. I think it should be OK to remove this H2#Syntax: it's actually quite misleading since it describes the "abstract form" of the constructor that's actually implemented in the concrete typed arrays like It's not a class by our definition, because it doesn't have a constructor. So it's tagged as a namespace. But it isn't quite a namespace either because it has instance members, which we currently hide inside a TypedArray prototype section. This can work, from the point of view of linting, because H2#TypedArray_prototype gets treated as a prose.* section. But in terms of semantics and structured content, it's wrong. Maybe we should make Proxyhttps://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy This page and its subpages need work.
Honestly I think we need to rework this piece of the documentation completely. A smaller point here: this page fails the linter because it includes an H2#Licensing_note at the end, which links to a dead wiki. Can we remove this? If not maybe we could move it into the H2#Description. Miscellaneous
|
I also filed #449 about making polyfill an ingredient. |
Thank you so much for digging into content linting, Will! I'm super happy about this discussion on content structures! All what you've found is great insight!
I see Polyfills are now above Examples. Not sure Polyfills are more important than Examples, but I don't know if our section order is by importance or what the criteria is... We probably need to dig into this some more at a later point anyway, so thanks for fixing this for the moment and let's discuss in the issue you've filed and see how we could address this properly.
I agree to everything you say about these. We agreed back when we first created JS recipes that syntax sections for properties make no sense. Also agree about the other cases and for String: thanks for taking the time to rewrite this!
I think we should apply the BCD criteria for "irrelevant features" here as well. If these notes talk about things that date back more than two years ago (roughly older than Firefox 60 at this point), we should remove it.
Yeah, I've been going back on forth on this one. You are right, it is neither a class nor a namespace. It is an abstract class (or "mixin" if you will) and those have no constructors. So, we could eliminate the abstraction and create sub pages under all concrete classes like "Int8Array", but that doesn't seem very practical. In API docs, we will hit exactly this question again as we have documented abstract classes (or mixins) for convenience there, too.
I'm hesitant about this. I wonder if we should rather invent a new recipe called "abstract class" that doesn't allow to have a constructor ingredient but is otherwise the same as a class recipe (or maybe we find additional ingredients for abstract classes, for example a section that mentions all the concrete classes like the TypedArray page currently has)
Yes, this is done poorly right now and doesn't work very well with our structures. I guess you are right about re-doing this completely.
Remove it. As far as I remember the very first version of the Proxy docs were quite close to the ECMAScript wiki, but the content has changed completely since then and the ECMAScript wiki is no more, so there is no reason for this anymore (IANAL, though).
Also happy to remove all of these. Just adds confusion and is not maintainable for us. |
Thanks for your responses @Elchi3 ! I've had another go at this.
Realistically, unless we make polyfill an explicit ingredient it has to go here, because we have to treat it as a prose.* section. I don't actually think we should make it an explicit ingredient yet because it's not clear to me what its structure would look like (we know we don't like the current representation, but haven't worked out what we do want).
It is not by importance. BCD is very important but is at the end. In general, IMO, the start and end are where the most universally important stuff should be, and that's where we have put the more-defined stuff. In the middle is where custom content (prose.*) gets to go.
OK, this is done!
All gone!
All gone! There are now just three pages (AFAICT) generating this error: ArrayThis fails because of the Array instances section. I don't think this is adding anything useful - it just seems like basic JS stuff and not particular to So I would recommend deleting this. If we wanted to keep it perhaps it could live as an H3 in Description? ProxyI filed mdn/sprints#3268 for this. Happy to take it if you like. I don't know if it should be considered to block this work, I suppose technically yes. But it will take a little time. TypedArray
It is hard to know what to do about Perhaps we could say
I'm not sure how useful that is.
I think I would prefer to make Or maybe, like we do for "Specifications", you have to have a "Constructor" section, but it is allowed to say something like: "This class is not directly instantiable." instead of containing a link to the constructor page?
I did find another class that doesn't have a (user-visible) constructor: I agree that mixins seem similar, but I haven't really thought about them yet, so not sure how they would inform this. But perhaps if we can, and unlike |
\o/
It's probably there, because it is very common to extend arrays, but I agree, you can do this with any class, and there is no good reason to have it there. (I also think, given smooshgate etc., we shouldn't really advertise this)
Thanks for splitting this out. If you feel like taking it, go for it, but otherwise lets see if there is time left at the end or if we should schedule it properly next sprint. No need to rush anything.
I think this is interesting, because then you make clear that this is an abstract class. I think I would prefer this option. Mainly because I'm a little bit worried that by making constructor optional, it will be forgotten on pages where we should really have a constructor section (not sure if this is a valid worry given lack of experience with linting, though). For Generator, it might also make sense to explicitly mention that a generator object can be returned from a generator function, but there is no
Interesting take on the mixin debate. I haven't thought about it from this angle, but I think you make a good point. |
OK so before I write an update to the linter, let's ask @ddbeck . Daniel, context:
We thought of three options for dealing with this:
I am happy enough with 3. What do you think? |
@wbamberg I like option 3 a lot! 👍 |
@Elchi3 , now we have an escape hatch for objects that are not instantiable (#461), I have had a go at updating I have:
Unfortunately this uncovers more errors, because the linter complains that:
...are not links. Sigh. I'm very tempted to just delete these. |
Very well done, Will! I like this version of the page a lot better.
I actually deleted these from other JS class pages as they don't any value (and in terms of |
OK, we now have 0 linter errors about ordering!
|
#438 has landed and is quite brutal to us in terms of new errors in JS docs. It seems that over 300 errors are now about wrong ordering.
The text was updated successfully, but these errors were encountered: