diff --git a/curriculum/challenges/.markdownlint.yaml b/curriculum/challenges/.markdownlint.yaml new file mode 100644 index 0000000000..ba92d2fa10 --- /dev/null +++ b/curriculum/challenges/.markdownlint.yaml @@ -0,0 +1,10 @@ +default: true # include all rules, with exceptions below +MD002: false # first heading should not be a top level heading +MD013: false # lines can be any length +MD022: false # headings don't need surrounding by newlines +MD025: false # headings are used as markers by the parser +MD031: true # fenced blocks do need surrounding by newlines +MD033: false # inline html is required +MD040: false # TODO: enable this when the challenges have been fixed +MD036: false # TODO: **Example** is the main offender, should that be a heading? +whitespace: false # extra whitespace is ignored, so we don't enforce it. diff --git a/tools/scripts/lint/.markdownlintrc.js b/tools/scripts/lint/.markdownlintrc.js deleted file mode 100644 index 25ea060e88..0000000000 --- a/tools/scripts/lint/.markdownlintrc.js +++ /dev/null @@ -1,11 +0,0 @@ -// JS rather than JSON so comments can be included - -module.exports = { - "default": true, // include all rules, with exceptions below - "MD002": false, // first heading should not be a top level heading - "MD013": false, // lines can be any length - "MD022": false, // headings don't need surrounding by newlines - "MD031": true, // fenced blocks do need surrounding by newlines - "MD033": false, // inline html is required - "whitespace": false // extra whitespace is ignored, so we don't enforce it. -} diff --git a/tools/scripts/lint/fixtures/badFencing.md b/tools/scripts/lint/fixtures/badFencing.md index 3b930a288d..efb2c8781a 100644 --- a/tools/scripts/lint/fixtures/badFencing.md +++ b/tools/scripts/lint/fixtures/badFencing.md @@ -15,12 +15,16 @@ videoUrl: '' ## Tests
+ +text ```yml tests: - text: text testString: testString ``` +moretext +
## Challenge Seed @@ -29,8 +33,6 @@ tests:
- - ## Solution diff --git a/tools/scripts/lint/index.js b/tools/scripts/lint/index.js index f6bbe6fc85..b29e082118 100644 --- a/tools/scripts/lint/index.js +++ b/tools/scripts/lint/index.js @@ -1,10 +1,18 @@ -const lintRules = require('./.markdownlintrc'); -const linter = require('./linter'); +const YAML = require('js-yaml'); +const fs = require('fs'); +const path = require('path'); const argv = require('yargs').argv; +const linter = require('./linter'); +const CONFIG_PATH = path.resolve( + __dirname, + '../../../curriculum/challenges/.markdownlint.yaml' +); const isMDRE = /.*\.md$/; -const lint = linter(lintRules); +const lintRules = fs.readFileSync(CONFIG_PATH, 'utf8'); + +const lint = linter(YAML.load(lintRules)); const files = argv._.filter(arg => isMDRE.test(arg)); files.forEach(path => lint({ path: path }));