fix: update linter for new challenge format (#40317)
Also uses yaml for better vscode integration
This commit is contained in:
parent
f294d9cacc
commit
25429b9f3f
10
curriculum/challenges/.markdownlint.yaml
Normal file
10
curriculum/challenges/.markdownlint.yaml
Normal file
@ -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.
|
@ -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.
|
||||
}
|
@ -15,12 +15,16 @@ videoUrl: ''
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
text
|
||||
```yml
|
||||
tests:
|
||||
- text: text
|
||||
testString: testString
|
||||
|
||||
```
|
||||
moretext
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
@ -29,8 +33,6 @@ tests:
|
||||
<div id='html-seed'>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
|
@ -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 }));
|
||||
|
Loading…
x
Reference in New Issue
Block a user