eslint-config-extender
shareable ESLint config scaffolder for extending another config
Table of Contents
Usage
Installation
$ npm install @form8ion/eslint-config-extender --save-prod
Example
Import
const {packageManagers} = await import('@form8ion/javascript-core');
const {questionNames: projectQuestionNames} = await import('@form8ion/project');
const {scaffold: javascriptScaffolder, questionNames: jsQuestionNames} = await import('@form8ion/javascript');
const {scaffold, extendEslintConfig} = await import('./lib/index.mjs');
Execute
Scaffolder Plugin
(async () => {
await scaffold({
projectRoot: process.cwd(),
projectName: 'eslint-config-foo',
scope: 'bar'
});
})();
High-Level Scaffolder
(async () => {
await extendEslintConfig(
{
decisions: {
[projectQuestionNames.PROJECT_NAME]: 'eslint-config-foo',
[projectQuestionNames.DESCRIPTION]: 'a description of the project',
[projectQuestionNames.VISIBILITY]: 'Public',
[projectQuestionNames.LICENSE]: 'MIT',
[projectQuestionNames.COPYRIGHT_HOLDER]: 'John Smith',
[projectQuestionNames.COPYRIGHT_YEAR]: '2022',
[projectQuestionNames.GIT_REPO]: true,
[projectQuestionNames.REPO_HOST]: 'GitHub',
[projectQuestionNames.REPO_OWNER]: 'org-name',
[jsQuestionNames.AUTHOR_NAME]: 'John Smith',
[jsQuestionNames.AUTHOR_EMAIL]: 'john@smith.org',
[jsQuestionNames.AUTHOR_URL]: 'https://smith.org',
[jsQuestionNames.SCOPE]: 'org-name',
[jsQuestionNames.PACKAGE_MANAGER]: packageManagers.NPM,
[jsQuestionNames.NODE_VERSION_CATEGORY]: 'LTS',
[jsQuestionNames.CI_SERVICE]: 'Other',
[jsQuestionNames.PROVIDE_EXAMPLE]: false
},
vcsHosts: {
GitHub: {
scaffolder: options => options,
prompt: ({decisions}) => ({[projectQuestionNames.REPO_OWNER]: decisions[projectQuestionNames.REPO_OWNER]})
}
}
},
decisions => options => javascriptScaffolder({...options, decisions, unitTestFrameworks: {}})
);
})();
Contributing
Dependencies
$ nvm install
$ npm install
Verification
$ npm test