Respec: Linter should check for “.” in p and li

Created on 14 Mar 2018  ·  9Comments  ·  Source: w3c/respec

Got a code review where I had forgotten full stops in a couple of places. That wastes reviewers time.

Feature request

All 9 comments

let var = doc.querySelector("p");
expect(var).toBeTruthy();
expect(var.textContent).toMatch($("p").text() + /./);

Is this what needs to be done essentially?

something like that, but it would be a bit more involved: basically, I would like to asynchronously (via requestIdleCallback(), if available) check each p.textContent.trim().endsWith(".").

Alright, excellent! I'd like to work on this :100:

Ok, please take a look at:
https://github.com/w3c/respec/blob/develop/src/core/linter.js

And the linterRules directory:
https://github.com/w3c/respec/blob/develop/src/core/

But let’s finish the biblio PR before starting on this one.

@marcoscaceres can I please take up this issue if no one is working on it ?

@shikhar-scs sure, but coordinate with @OrionStar25, as she also wanted to help.

If you do start work on it, you might want to follow this one:
https://github.com/w3c/respec/blob/develop/src/core/linter-rules/no-http-props.js

Also, we should start with just the p elements, as I think they are less difficult than the li. The li checks would be a separate linter rule - as some spec writers prefer to exclude "." from bulleted lists in certain situations).

We should check this list of specs:
https://github.com/w3c/respec/blob/develop/tests/headless.js#L4

To see if there are odd edge cases where missing a "." might be ok.

Awesome ! I'll get started with this :+1:

Should we close this given that #1589 has been merged?

By the way, I think we should only check .:!? in documents with lang=en, because not all languages/scripts use the Latin punctuations, and we do have ReSpec documents in these languages. I can file another issue for this if needed.

Some examples of full stops:

  • "。" in Chinese (zh-hans and zh-hant) and Japanese (ja)
  • "।" in Hindi (hi)
  • "۔" in Urdu (ur)

True, let's leave this open then until we deal with the l10n issues.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marcoscaceres picture marcoscaceres  ·  3Comments

noamr picture noamr  ·  3Comments

marcoscaceres picture marcoscaceres  ·  6Comments

saschanaz picture saschanaz  ·  5Comments

andrea-perego picture andrea-perego  ·  3Comments