Skip to content

Commit 1daf2c3

Browse files
authored
update: Add typecheck fn, kebab case doctype keys, combine mso properties (#12)
* internal: Cleanup module exports * update: Kebab case doctype keys, add util to typecheck data objects * update: Combine standard and alt properties, update file structure * internal: Cleanup lint rules
1 parent 6a504e3 commit 1daf2c3

20 files changed

Lines changed: 758 additions & 749 deletions

.eslintrc.js

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,33 +18,29 @@ module.exports = {
1818
},
1919
},
2020
rules: {
21-
'no-console': 0,
22-
'no-use-before-define': 0,
23-
24-
// prettier
25-
'prettier/prettier': 2,
21+
'prettier/prettier': 'error',
2622
},
2723
overrides: [
2824
{
2925
files: ['*.ts', '*.tsx'],
3026
rules: {
3127
// prefer consistency
32-
'@typescript-eslint/no-inferrable-types': 0,
28+
'@typescript-eslint/no-inferrable-types': 'off',
3329
},
3430
},
3531
{
3632
files: ['*.test.ts'],
37-
extends: ['plugin:jest/recommended'],
33+
extends: ['plugin:jest/recommended', 'plugin:jest/style'],
3834
plugins: ['jest'],
39-
env: {
40-
jest: true,
41-
node: true,
35+
env: { jest: true },
36+
rules: {
37+
'@typescript-eslint/no-empty-function': 'off',
4238
},
39+
},
40+
{
41+
files: ['scripts/**/*'],
4342
rules: {
44-
// jest
45-
'jest/prefer-to-be-null': 2,
46-
'jest/prefer-to-be-undefined': 2,
47-
'jest/prefer-to-have-length': 2,
43+
'no-console': 'off',
4844
},
4945
},
5046
],

packages/data/doctypes.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './dist/doctypes';
1+
export * from './dist/misc/doctypes';

packages/data/doctypes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = require('./dist/doctypes');
1+
module.exports = require('./dist/misc/doctypes');

packages/data/index.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/data/index.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/data/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
"dist",
99
"doctypes.d.ts",
1010
"doctypes.js",
11-
"index.d.ts",
12-
"index.js",
1311
"mso.d.ts",
1412
"mso.js"
1513
],

packages/data/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export * from './mso';
2-
export * from './doctypes';
2+
export * from './misc/doctypes';
3+
export * from './utils/create';
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,56 @@
1-
import { Doctypes, Doctype } from '../types/doctypes';
1+
import { create } from '../utils/create';
2+
import { Doctype } from '../types/doctypes';
23

3-
export { Doctypes, Doctype };
4+
const validate = create<Doctype>();
45

5-
export const doctypes: Doctypes = {
6-
'HTML 5': {
6+
export const doctypes = validate({
7+
'html-5': {
78
description:
89
'A doctype declaration which is very short, due to its lack of references to a Document Type Definition (DTD) in the form of a URL or FPI. All it contains is the tag name of the root element of the document, HTML.',
910
element: 'html',
1011
keyword: null,
1112
publicIdentifier: null,
1213
systemIdentifier: null,
1314
},
14-
'HTML 4.01 Strict': {
15+
'html-4.01-strict': {
1516
description:
1617
'A strict doctype declaration which validates against the HTML 4.01 spec, although it doesn\'t allow any presentational markup or deprecated elements (such as `<font>` elements) or framesets to be used. It validates loose HTML style markup, such as minimized attributes and non-quoted attributes (eg required, rather than required="required")',
1718
element: 'HTML',
1819
keyword: 'PUBLIC',
1920
publicIdentifier: '-//W3C//DTD HTML 4.01//EN',
2021
systemIdentifier: 'http://www.w3.org/TR/html4/strict.dtd',
2122
},
22-
'HTML 4.01 Transitional': {
23+
'html-4.01-transitional': {
2324
description:
2425
'A transitional doctype declaration which validates against the HTML 4.01 spec. It allows some presentational markup and deprecated elements (such as <font> elements) but not framesets. It validates loose HTML style markup, such as minimized attributes and non-quoted attributes (eg required, rather than required="required")',
2526
element: 'HTML',
2627
keyword: 'PUBLIC',
2728
publicIdentifier: '-//W3C//DTD HTML 4.01 Transitional//EN',
2829
systemIdentifier: 'http://www.w3.org/TR/html4/loose.dtd',
2930
},
30-
'XHTML 1.1': {
31+
'xhtml-1.1': {
3132
description: '',
3233
element: 'html',
3334
keyword: 'PUBLIC',
3435
publicIdentifier: '-//W3C//DTD XHTML 1.1//EN',
3536
systemIdentifier: 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd',
3637
},
37-
'XHTML 1.0 Strict': {
38+
'xhtml-1.0-strict': {
3839
description:
3940
"A strict doctype declaration which validates against the HTML 4.01 spec, although it doesn't allow any presentational markup or deprecated elements (such as `<font>` elements) or framesets to be used. Unlike the `HTML 4.01 Strict` doctype, it does not validate loose HTML style markup.",
4041
element: 'html',
4142
keyword: 'PUBLIC',
4243
publicIdentifier: '-//W3C//DTD XHTML 1.0 Strict//EN',
4344
systemIdentifier: 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd',
4445
},
45-
'XHTML 1.0 Transitional': {
46+
'xhtml-1.0-transitional': {
4647
description:
4748
'A transitional doctype declaration which validates against the HTML 4.01 spec. It allows some presentational markup and deprecated elements (such as <font> elements) but not framesets. Unlike the `HTML 4.01 Transitional` doctype, it does not validate loose HTML style markup.',
4849
element: 'html',
4950
keyword: 'PUBLIC',
5051
publicIdentifier: '-//W3C//DTD XHTML 1.0 Transitional//EN',
5152
systemIdentifier: 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd',
5253
},
53-
};
54+
});
55+
56+
export default doctypes;

0 commit comments

Comments
 (0)