Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core/defaults): Add core/defaults #2042

Merged
merged 26 commits into from
Feb 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4016ad9
Add core/defaults
pradeepgangwar Jan 23, 2019
faa3d3e
remove unnecessary exports
pradeepgangwar Jan 24, 2019
0bc3693
remove unnecessary exports
pradeepgangwar Jan 24, 2019
9c85dbc
remove license from core/defaults
pradeepgangwar Jan 24, 2019
a8220f6
Add core/defaults
pradeepgangwar Jan 23, 2019
7aaf301
remove unnecessary exports
pradeepgangwar Jan 24, 2019
642817f
remove unnecessary exports
pradeepgangwar Jan 24, 2019
60a3021
remove license from core/defaults
pradeepgangwar Jan 24, 2019
74480fa
Update pluralize to false by default.
pradeepgangwar Jan 24, 2019
5457a3b
Add pluralize to w3c/default
pradeepgangwar Jan 24, 2019
c5d5c55
Remove pluralize from core/default
pradeepgangwar Jan 24, 2019
6a07e49
Update src/w3c/defaults.js
marcoscaceres Jan 24, 2019
0642d94
Update defaults.js
pradeepgangwar Jan 24, 2019
e707f50
Update defaults.js
pradeepgangwar Jan 24, 2019
cb85072
Export coreDefaults and add it to w3c/defaults
pradeepgangwar Jan 29, 2019
53d23db
Export coreDefaults and add it to w3c/defaults
pradeepgangwar Jan 29, 2019
fa5d080
Make proper changes
pradeepgangwar Jan 30, 2019
67b6e15
export core/defaults and add to w3c/defaults
pradeepgangwar Jan 30, 2019
d621490
export core/defaults and add to w3c/defaults
pradeepgangwar Jan 30, 2019
4cab8f5
export core/defaults and add to w3c/defaults
pradeepgangwar Jan 30, 2019
2bdad03
Merge branch 'develop' into issue--2023
saschanaz Feb 5, 2019
d754347
update w3c/defaults
pradeepgangwar Feb 5, 2019
fd763bf
Update src/w3c/defaults
saschanaz Feb 5, 2019
1315564
update w3c/defaults
pradeepgangwar Feb 5, 2019
420c304
Merge branch 'develop' into issue--2023
saschanaz Feb 5, 2019
82188ee
Merge branch 'develop' into issue--2023
pradeepgangwar Feb 5, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/core/defaults.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Sets the core defaults
*/
export const name = "core/defaults";
saschanaz marked this conversation as resolved.
Show resolved Hide resolved
import { rule as checkInternalSlots } from "./linter-rules/check-internal-slots";
import { rule as checkPunctuation } from "./linter-rules/check-punctuation";
import linter from "./linter";
import { rule as localRefsExist } from "./linter-rules/local-refs-exist";
import { rule as noHeadinglessSectionsRule } from "./linter-rules/no-headingless-sections";
import { rule as noHttpPropsRule } from "./linter-rules/no-http-props";

linter.register(
saschanaz marked this conversation as resolved.
Show resolved Hide resolved
noHttpPropsRule,
noHeadinglessSectionsRule,
checkPunctuation,
localRefsExist,
checkInternalSlots
);

export const coreDefaults = {
lint: {
"no-headingless-sections": true,
"no-http-props": true,
"check-punctuation": false,
"local-refs-exist": true,
"check-internal-slots": false,
},
pluralize: false,
saschanaz marked this conversation as resolved.
Show resolved Hide resolved
specStatus: "base",
highlightVars: true,
addSectionLinks: true,
};
37 changes: 12 additions & 25 deletions src/w3c/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,20 @@
* Sets the defaults for W3C specs
*/
export const name = "w3c/defaults";
import { rule as checkInternalSlots } from "../core/linter-rules/check-internal-slots";
import { rule as checkPunctuation } from "../core/linter-rules/check-punctuation";
import { coreDefaults } from "../core/defaults";
import { definitionMap } from "../core/dfn-map";
import linter from "../core/linter";
import { rule as localRefsExist } from "../core/linter-rules/local-refs-exist";
import { rule as noHeadinglessSectionsRule } from "../core/linter-rules/no-headingless-sections";
import { rule as noHttpPropsRule } from "../core/linter-rules/no-http-props";
import { rule as privsecSectionRule } from "./linter-rules/privsec-section";

linter.register(
noHttpPropsRule,
privsecSectionRule,
noHeadinglessSectionsRule,
checkPunctuation,
localRefsExist,
checkInternalSlots
);
linter.register(privsecSectionRule);

const w3cDefaults = {
lint: {
"no-headingless-sections": true,
"privsec-section": true,
"no-http-props": true,
"check-punctuation": false,
"local-refs-exist": true,
"check-internal-slots": false,
},
pluralize: true,
highlightVars: true,
doJsonLd: false,
license: "w3c-software-doc",
specStatus: "base",
logos: [
{
src: "https://www.w3.org/StyleSheets/TR/2016/logos/W3C",
Expand All @@ -43,19 +25,24 @@ const w3cDefaults = {
url: "https://www.w3.org/",
},
],
addSectionLinks: true,
};

export function run(conf) {
if (conf.specStatus === "unofficial") return;
// assign the defaults
const lint =
conf.lint === false
? false
: {
...coreDefaults.lint,
...w3cDefaults.lint,
...conf.lint,
};
Object.assign(conf, {
saschanaz marked this conversation as resolved.
Show resolved Hide resolved
...coreDefaults,
pradeepgangwar marked this conversation as resolved.
Show resolved Hide resolved
...w3cDefaults,
...conf,
});
Object.assign(conf.lint, {
...w3cDefaults.lint,
...conf.lint,
lint,
});

// TODO: eventually, we want to remove this.
Expand Down