Skip to content

Commit

Permalink
Chore: Update and autofix internal linting (#88)
Browse files Browse the repository at this point in the history
Also switches to a flat/consolidated .eslintrc.js file.
  • Loading branch information
bmish committed Jul 2, 2021
1 parent dc4a493 commit 6d0cc94
Show file tree
Hide file tree
Showing 15 changed files with 28,620 additions and 5,713 deletions.
17 changes: 17 additions & 0 deletions .eslintrc.js
@@ -0,0 +1,17 @@
"use strict";

module.exports = {
root: true,
extends: [
"eslint"
],
env: {
node: true
},
overrides: [
{
files: ["tests/**/*.js"],
env: { mocha: true }
}
]
};
4 changes: 0 additions & 4 deletions .eslintrc.yml

This file was deleted.

12 changes: 6 additions & 6 deletions app/index.js
Expand Up @@ -10,13 +10,13 @@
// Requirements
//------------------------------------------------------------------------------

var yeoman = require("yeoman-generator");
const yeoman = require("yeoman-generator");

//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------

var NAMESPACES = {
const NAMESPACES = {
Rule: "eslint:rule",
Plugin: "eslint:plugin"
};
Expand All @@ -26,18 +26,18 @@ var NAMESPACES = {
//------------------------------------------------------------------------------

module.exports = yeoman.Base.extend({
prompting: function() {
var done = this.async();
prompting() {
const done = this.async();

this.prompt({
type: "list",
name: "outputType",
message: "Do you want to generate a rule or a plugin?",
choices: ["Rule", "Plugin"],
default: "Rule"
}, function(answers) {
}, answers => {
this.composeWith(NAMESPACES[answers.outputType]);
done();
}.bind(this));
});
}
});
11 changes: 4 additions & 7 deletions lib/validators.js
Expand Up @@ -8,7 +8,7 @@
* Regex for valid IDs
* @type {RegExp}
*/
var rValidId = /^(?:[a-z0-9]+(?:-[a-z0-9]+)*)$/;
const rValidId = /^(?:[a-z0-9]+(?:-[a-z0-9]+)*)$/u;

/**
* Determines if a given pluginId is valid. This is used by the prompt system.
Expand All @@ -18,9 +18,8 @@ var rValidId = /^(?:[a-z0-9]+(?:-[a-z0-9]+)*)$/;
function isPluginId(pluginId) {
if (rValidId.test(pluginId)) {
return true;
} else {
return "Plugin ID must be all lowercase with dashes as separators.";
}
return "Plugin ID must be all lowercase with dashes as separators.";
}
exports.isPluginId = isPluginId;

Expand All @@ -32,9 +31,8 @@ exports.isPluginId = isPluginId;
function isRuleId(ruleId) {
if (rValidId.test(ruleId)) {
return true;
} else {
return "Rule ID must be all lowercase with dashes as separators.";
}
return "Rule ID must be all lowercase with dashes as separators.";
}
exports.isRuleId = isRuleId;

Expand All @@ -48,8 +46,7 @@ exports.isRuleId = isRuleId;
function isRequired(value) {
if (value === "") {
return "Please provide a value";
} else {
return true;
}
return true;
}
exports.isRequired = isRequired;

0 comments on commit 6d0cc94

Please sign in to comment.