Suggestion 1
The “Extending generator” section in the “Writing Your Own Yeoman Generator” page uses CommonJS:
var Generator = require('yeoman-generator');
module.exports = class extends Generator {};
However, according to the Node.js documentation,
ECMAScript modules are the official standard format to package JavaScript code for reuse.
Therefore, I suggest changing the code to:
import Generator from 'yeoman-generator';
export default class extends Generator {};
Suggestion 2
The text below the aforementioned code snippet on the “Writing Your Own Yeoman Generator” page links to the URL "https://nodejs.org/api/modules.html#modules_module_exports", which links to a fragment that does not exist anymore. I believe that the updated URL would be "https://nodejs.org/api/modules.html#modules_module_exports". However, if my suggestion of using ESM is accepted, the URL should be updated to link to the page https://nodejs.org/api/esm.html instead.
Suggestion 3
This is a minor suggestion, but it is generally better practice to name default exports. Therefore, I recommend the following modification:
var Generator = require('yeoman-generator');
module.exports = class MyGenerator extends Generator {};
Or, if we insist on CommonJS,
var Generator = require('yeoman-generator');
module.exports = class MyGenerator extends Generator {};
Suggestion 1
The “Extending generator” section in the “Writing Your Own Yeoman Generator” page uses CommonJS:
However, according to the Node.js documentation,
Therefore, I suggest changing the code to:
Suggestion 2
The text below the aforementioned code snippet on the “Writing Your Own Yeoman Generator” page links to the URL "https://nodejs.org/api/modules.html#modules_module_exports", which links to a fragment that does not exist anymore. I believe that the updated URL would be "https://nodejs.org/api/modules.html#modules_module_exports". However, if my suggestion of using ESM is accepted, the URL should be updated to link to the page https://nodejs.org/api/esm.html instead.
Suggestion 3
This is a minor suggestion, but it is generally better practice to name default exports. Therefore, I recommend the following modification:
Or, if we insist on CommonJS,