Skip to content

Commit 55600f3

Browse files
authored
chore(lint): remove obsolete spec exceptions (#29601)
* chore(lint): remove obsolete spec exceptions * refactor(lint): extract spec urls exceptions Exclude it in CODEOWNERS file. * chore(CODEOWNERS): generalize to `lint/common/*.txt`
1 parent 5b8c66a commit 55600f3

4 files changed

Lines changed: 68 additions & 55 deletions

File tree

.github/CODEOWNERS

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# See GOVERNANCE.md for more about this repository's owners
1+
# See GOVERNANCE.md for more about this repository's owners
22
# and this project's governance.
33

44
# Order is important: The last matching pattern takes precedence.
@@ -20,5 +20,6 @@
2020

2121
# Exclude some paths
2222
/.github/ISSUE_TEMPLATE/
23-
/.github/PULL_REQUESET_TEMPLATE.md
23+
/.github/PULL_REQUEST_TEMPLATE.md
24+
/lint/common/*.txt
2425
/*.md
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { readFile } from 'node:fs/promises';
2+
import { dirname, join } from 'node:path';
3+
import { fileURLToPath } from 'node:url';
4+
5+
const __filename = fileURLToPath(import.meta.url);
6+
const __dirname = dirname(__filename);
7+
8+
export const exceptionListPath = join(__dirname, './spec-urls-exceptions.txt');
9+
10+
/**
11+
* @returns {Promise<string[]>}
12+
*/
13+
export const getSpecURLsExceptions = async () =>
14+
(await readFile(exceptionListPath, 'utf-8'))
15+
.split('\n')
16+
.map((line) => line.trim())
17+
.filter((line) => line.length > 0 && !line.startsWith('#'));
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# This file lists spec URLs that are accepted by the spec_url linter
2+
# even though they are not in https://github.com/w3c/browser-specs.
3+
#
4+
# Before adding an exception, open an issue with https://github.com/w3c/browser-specs to
5+
# see if a spec should be added there instead.
6+
# When adding an exception here, provide a reason and indicate how the exception can be removed.
7+
8+
# Remove once https://github.com/whatwg/html/pull/6715 is resolved.
9+
https://wicg.github.io/controls-list/
10+
11+
# Unfortunately this doesn't produce a rendered spec, so it isn't in browser-specs.
12+
# Remove if it is in the main ECMA spec.
13+
https://github.com/tc39/proposal-regexp-legacy-features/
14+
15+
# See https://github.com/w3c/browser-specs/issues/305.
16+
# Features with this URL need to be checked after some time
17+
# if they have been integrated into a real spec.
18+
https://w3c.github.io/webrtc-extensions/
19+
20+
# This is being used to develop Error.captureStackTrace() standard.
21+
# Need to be checked after some time to see if integrated into a real spec.
22+
https://github.com/tc39/proposal-error-capturestacktrace
23+
24+
# Proposals for WebAssembly.
25+
https://github.com/WebAssembly/spec/blob/main/proposals
26+
https://github.com/WebAssembly/exception-handling/blob/main/proposals
27+
https://github.com/WebAssembly/extended-const/blob/main/proposals
28+
https://github.com/WebAssembly/tail-call/blob/main/proposals
29+
https://github.com/WebAssembly/threads/blob/main/proposal
30+
https://github.com/WebAssembly/relaxed-simd/blob/main/proposals
31+
https://github.com/WebAssembly/multi-memory/blob/main/proposals
32+
https://github.com/WebAssembly/memory64/blob/main/proposals/memory64/Overview.md
33+
https://github.com/WebAssembly/js-string-builtins/blob/main/proposals/js-string-builtins/Overview.md
34+
https://github.com/WebAssembly/function-references/blob/main/proposals/function-references/Overview.md
35+
https://github.com/WebAssembly/js-promise-integration
36+
https://github.com/WebAssembly/branch-hinting/blob/main/proposals/branch-hinting/Overview.md
37+
38+
# Media types.
39+
https://developers.google.com/speed/webp/docs/riff_container
40+
https://developers.google.com/speed/webp/docs/webp_lossless_bitstream_specification
41+
https://jpeg.org/jpeg/
42+
https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/
43+
https://www.iso.org/standard/89035.html
44+
https://www.rfc-editor.org/rfc/rfc7903
45+
https://www.w3.org/Graphics/GIF/spec-gif87.txt

lint/linter/test-spec-urls.js

Lines changed: 3 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -5,62 +5,12 @@ import { styleText } from 'node:util';
55

66
import specData from 'web-specs' with { type: 'json' };
77

8+
import { getSpecURLsExceptions } from '../common/spec-urls-exceptions.js';
9+
810
/** @import {Linter, LinterData} from '../types.js' */
911
/** @import {Logger} from '../utils.js' */
1012
/** @import {CompatStatement} from '../../types/types.js' */
1113

12-
/*
13-
* Before adding an exception, open an issue with https://github.com/w3c/browser-specs to
14-
* see if a spec should be added there instead.
15-
* When adding an exception here, provide a reason and indicate how the exception can be removed.
16-
*/
17-
const specsExceptions = [
18-
// Remove once https://github.com/whatwg/html/pull/6715 is resolved
19-
'https://wicg.github.io/controls-list/',
20-
21-
// Exception for April Fools' joke for "418 I'm a teapot"
22-
'https://www.rfc-editor.org/rfc/rfc2324',
23-
24-
// Unfortunately this doesn't produce a rendered spec, so it isn't in browser-specs
25-
// Remove if it is in the main ECMA spec
26-
'https://github.com/tc39/proposal-regexp-legacy-features/',
27-
28-
// Remove once tc39/ecma262#3221 is merged
29-
'https://github.com/tc39/proposal-regexp-modifiers',
30-
31-
// See https://github.com/w3c/browser-specs/issues/305
32-
// Features with this URL need to be checked after some time
33-
// if they have been integrated into a real spec
34-
'https://w3c.github.io/webrtc-extensions/',
35-
36-
// This is being used to develop Error.captureStackTrace() standard
37-
// Need to be checked after some time to see if integrated into a real spec
38-
'https://github.com/tc39/proposal-error-capturestacktrace',
39-
40-
// Proposals for WebAssembly
41-
'https://github.com/WebAssembly/spec/blob/main/proposals',
42-
'https://github.com/WebAssembly/exception-handling/blob/main/proposals',
43-
'https://github.com/WebAssembly/extended-const/blob/main/proposals',
44-
'https://github.com/WebAssembly/tail-call/blob/main/proposals',
45-
'https://github.com/WebAssembly/threads/blob/main/proposal',
46-
'https://github.com/WebAssembly/relaxed-simd/blob/main/proposals',
47-
'https://github.com/WebAssembly/multi-memory/blob/main/proposals',
48-
'https://github.com/WebAssembly/memory64/blob/main/proposals/memory64/Overview.md',
49-
'https://github.com/WebAssembly/js-string-builtins/blob/main/proposals/js-string-builtins/Overview.md',
50-
'https://github.com/WebAssembly/function-references/blob/main/proposals/function-references/Overview.md',
51-
'https://github.com/WebAssembly/js-promise-integration',
52-
'https://github.com/WebAssembly/branch-hinting/blob/main/proposals/branch-hinting/Overview.md',
53-
54-
// Media types
55-
'https://developers.google.com/speed/webp/docs/riff_container',
56-
'https://developers.google.com/speed/webp/docs/webp_lossless_bitstream_specification',
57-
'https://jpeg.org/jpeg/',
58-
'https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/',
59-
'https://www.iso.org/standard/89035.html',
60-
'https://www.rfc-editor.org/rfc/rfc7903',
61-
'https://www.w3.org/Graphics/GIF/spec-gif87.txt',
62-
];
63-
6414
const allowedSpecURLs = [
6515
.../** @type {string[]} */ (
6616
specData
@@ -74,7 +24,7 @@ const allowedSpecURLs = [
7424
.flat()
7525
.filter((url) => !!url)
7626
),
77-
...specsExceptions,
27+
...(await getSpecURLsExceptions()),
7828
];
7929

8030
/**

0 commit comments

Comments
 (0)