Skip to content
Permalink
Browse files

Fix: Hide `configuration-all` from the user

This configuration is only for internal consumption to get easy access
to all the documentation and should never be used by a user as it can
cause problems when extending from it.

This PR filters it when running `npm init hintrc` and verifies the
`.hintrc` doesn't `extends` from it.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Fix #3097
  • Loading branch information
molant committed Nov 18, 2019
1 parent dab1c16 commit b628eb4a0336615cbe8f8cb053692daf30704f97
@@ -64,13 +64,17 @@ const extendConfig = async (): Promise<InitUserConfig | null> => {
return null;
}

const choices = configPackages.map((pkg) => {
const configNames = configPackages.map((pkg) => {
return {
name: getConfigurationName(pkg.name),
value: pkg.name
};
});

const choices = configNames.filter((config) => {
return config.name !== 'all';
});

const questions: inquirer.Questions = [{
choices,
message: 'Choose the configuration you want to extend from',
@@ -98,7 +98,8 @@
"description": "Base configuration to use.",
"type": "array",
"items": {
"type": "string"
"type": "string",
"pattern": "^(?!all$).*$"
},
"uniqueItems": true
},
@@ -64,6 +64,7 @@ const invalidHintsConfigArrayFormArrayInverted = {
hints: [[{}, 'no-html-only-headers:error']]
};

const invalidExtends = { extends: ['all'] };

test('If config has an invalid schema, it should return false', (t) => {
const valid = configValidator.validateConfig(invalidConfig as any);
@@ -118,3 +119,9 @@ test('If the configuration uses shorthands, it should validate', (t) => {

t.true(valid);
});

test('If config extends from "all" is should not validate', (t) => {
const invalid = configValidator.validateConfig(invalidExtends as any);

t.false(invalid);
});

0 comments on commit b628eb4

Please sign in to comment.
You can’t perform that action at this time.