Skip to content

Commit d993a3b

Browse files
committed
Update documentation builder to resolveConfig API
1 parent 047d868 commit d993a3b

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,14 @@ To get the most out of this config, it is assumed that projects have the followi
367367
- [`scss/operator-no-newline-after`](https://github.com/kristerkari/stylelint-scss/blob/master/src/rules/operator-no-newline-after/README.md)
368368
- [`scss/operator-no-newline-before`](https://github.com/kristerkari/stylelint-scss/blob/master/src/rules/operator-no-newline-before/README.md)
369369
- [`scss/operator-no-unspaced`](https://github.com/kristerkari/stylelint-scss/blob/master/src/rules/operator-no-unspaced/README.md)
370+
- [`annotation-no-unknown`](https://stylelint.io/user-guide/rules/annotation-no-unknown/)
371+
- [`declaration-property-max-values`](https://stylelint.io/user-guide/rules/declaration-property-max-values/)
372+
- [`function-no-unknown`](https://stylelint.io/user-guide/rules/function-no-unknown/)
373+
- [`import-notation`](https://stylelint.io/user-guide/rules/import-notation/)
374+
- [`keyframe-block-no-duplicate-selectors`](https://stylelint.io/user-guide/rules/keyframe-block-no-duplicate-selectors/)
375+
- [`keyframe-selector-notation`](https://stylelint.io/user-guide/rules/keyframe-selector-notation/)
376+
- [`media-feature-range-notation`](https://stylelint.io/user-guide/rules/media-feature-range-notation/)
377+
- [`selector-not-notation`](https://stylelint.io/user-guide/rules/selector-not-notation/)
370378
- [`color-hex-alpha`](https://stylelint.io/user-guide/rules/color-hex-alpha/)
371379
- [`comment-pattern`](https://stylelint.io/user-guide/rules/comment-pattern/)
372380
- [`rule-selector-property-disallowed-list`](https://stylelint.io/user-guide/rules/rule-selector-property-disallowed-list/)

src/documentation.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ const unusedRules = Object.keys(unusedConfig.rules).filter(
1818
(name) => typeof config.rules[name] === 'undefined',
1919
);
2020

21-
const linter = stylelint.createLinter({
22-
configFile: path.join(__dirname, '..', 'config.js'),
23-
});
24-
2521
const generateList = (items) => {
2622
return `- ${items.join('\n- ')}`;
2723
};
@@ -82,8 +78,10 @@ const README_PATH = path.join(__dirname, '..', 'README.md');
8278
const README_MARKER = '<!-- Generated with: npm run build:docs -->';
8379
const README = fs.readFileSync(README_PATH, 'utf-8').split(README_MARKER)[0];
8480

85-
linter.getConfigForFile().then((result) => {
86-
const { rules } = result.config;
81+
const configFile = path.join(__dirname, '..', 'config.js');
82+
83+
stylelint.resolveConfig(__filename, { configFile }).then((resolvedConfig) => {
84+
const { rules } = resolvedConfig;
8785
const enforcedRules = Object.keys(rules).filter(
8886
(name) => rules[name] !== null,
8987
);

0 commit comments

Comments
 (0)