generator-effective
Version:
a opinionated and progressive generator to make package.json and thousands of configs effective
32 lines (28 loc) • 725 B
JavaScript
;
const Generator = require('../Base');
const helper = require('../helper');
module.exports = class extends Generator {
initializing() {
this.composeWith(require.resolve('../lint-staged'));
}
writing() {
const found = helper.searchConfig(this, 'eslint');
if (!found) {
const template = this.templatePath('.eslintrc.yml');
const dest = this.destinationPath('.eslintrc.yml');
this.fs.copy(template, dest);
}
this.fs.extendJSON(this.destinationPath('package.json'), {
devDependencies: {
eslint: '^5.9.0',
},
scripts: {
lint: 'eslint src',
pretest: 'npm run lint',
},
});
}
install() {
super.install();
}
};