diff --git a/tools/lint/lib/checks/esid.py b/tools/lint/lib/checks/esid.py index f4e0d586bc66b398e9d00c1705419bfc72260481..cdfcac667845a8d7205e484851818c25c244ff61 100644 --- a/tools/lint/lib/checks/esid.py +++ b/tools/lint/lib/checks/esid.py @@ -8,7 +8,12 @@ class CheckEsid(Check): def __init__(self): #self.es5idRegex = re.compile(r"^S?(B|\d+)(\.\d+)+(-(\d+|[a-z]|i+))*(_A\d(\.\d+)?(_T\d(\.\d+)?)?)?$") self.es6idRegex = re.compile(r"^(S?(B|\d+)(\.\d+)+(((_A\d\.\d)?_T?\d)|[ _]S\d+(\.[a-z])*)?(, |$))+") - self.esidRegex = re.compile(r"^(pending|(prod|sec|sup)-[-_A-Za-z0-9.%@]+)$") + # Simpliiied version of the WhatWG URL specification for fragment + # parsing + # https://url.spec.whatwg.org/#fragment-state + self.esidRegex = re.compile( + u"^[a-z0-9!$&'()*+,\-./:;=?@_~\u00a0-\U0010fffd]+$", re.IGNORECASE + ) def run(self, name, meta, source): if not meta: diff --git a/tools/lint/test/fixtures/esid_invalid.js b/tools/lint/test/fixtures/esid_invalid.js new file mode 100644 index 0000000000000000000000000000000000000000..b98434b88301d86321e8026d5c058b8d703e7bb0 --- /dev/null +++ b/tools/lint/test/fixtures/esid_invalid.js @@ -0,0 +1,10 @@ +ESID +^ expected errors | v input +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: something withaspace +description: Minimal test +---*/ + +function f() {} diff --git a/tools/lint/test/fixtures/valid_esid_alternate.js b/tools/lint/test/fixtures/valid_esid_alternate.js new file mode 100644 index 0000000000000000000000000000000000000000..f079a22a091b8151cd28f9e1728ad24e10c10d42 --- /dev/null +++ b/tools/lint/test/fixtures/valid_esid_alternate.js @@ -0,0 +1,9 @@ +^ expected errors | v input +// Copyright (C) 2017 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: use-strict-directive!@$&*()_+ +description: Minimal test +---*/ + +function f() {}