fix: update linter for new challenge format (#40317)
Also uses yaml for better vscode integration
This commit is contained in:
committed by
GitHub
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
|
## Tests
|
||||||
<section id='tests'>
|
<section id='tests'>
|
||||||
|
|
||||||
|
text
|
||||||
```yml
|
```yml
|
||||||
tests:
|
tests:
|
||||||
- text: text
|
- text: text
|
||||||
testString: testString
|
testString: testString
|
||||||
|
|
||||||
```
|
```
|
||||||
|
moretext
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
## Challenge Seed
|
## Challenge Seed
|
||||||
@ -29,8 +33,6 @@ tests:
|
|||||||
<div id='html-seed'>
|
<div id='html-seed'>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
## Solution
|
## Solution
|
||||||
|
@ -1,10 +1,18 @@
|
|||||||
const lintRules = require('./.markdownlintrc');
|
const YAML = require('js-yaml');
|
||||||
const linter = require('./linter');
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
const argv = require('yargs').argv;
|
const argv = require('yargs').argv;
|
||||||
|
const linter = require('./linter');
|
||||||
|
|
||||||
|
const CONFIG_PATH = path.resolve(
|
||||||
|
__dirname,
|
||||||
|
'../../../curriculum/challenges/.markdownlint.yaml'
|
||||||
|
);
|
||||||
const isMDRE = /.*\.md$/;
|
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));
|
const files = argv._.filter(arg => isMDRE.test(arg));
|
||||||
files.forEach(path => lint({ path: path }));
|
files.forEach(path => lint({ path: path }));
|
||||||
|
Reference in New Issue
Block a user