Skip to content

Commit

Permalink
Update: Fix linting inconsistencies in template (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmish committed Jul 23, 2021
1 parent d5c7a80 commit 671329e
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 53 deletions.
12 changes: 6 additions & 6 deletions plugin/templates/_.eslintrc.js
@@ -1,19 +1,19 @@
'use strict';
"use strict";

module.exports = {
root: true,
extends: [
'eslint:recommended',
'plugin:eslint-plugin/recommended',
'plugin:node/recommended',
"eslint:recommended",
"plugin:eslint-plugin/recommended",
"plugin:node/recommended",
],
env: {
node: true,
},
overrides: [
{
files: ['tests/**/*.js'],
files: ["tests/**/*.js"],
env: { mocha: true },
},
]
],
};
3 changes: 1 addition & 2 deletions plugin/templates/_plugin.js
Expand Up @@ -22,7 +22,6 @@ module.exports.rules = requireIndex(__dirname + "/rules");
<% if (hasProcessors) { %>
// import processors
module.exports.processors = {

// add your processors here
// add your processors here
};
<% } %>
49 changes: 23 additions & 26 deletions rule/templates/_rule.js
Expand Up @@ -9,36 +9,33 @@
//------------------------------------------------------------------------------

module.exports = {
meta: {
type: null, // `problem`, `suggestion`, or `layout`
docs: {
description: "<%- desc.replace(/"/g, '\\"') %>",
category: "Fill me in",
recommended: false,
url: null, // URL to the documentation page for this rule
},
fixable: null, // or "code" or "whitespace"
schema: [], // Add a schema if the rule has options
meta: {
type: null, // `problem`, `suggestion`, or `layout`
docs: {
description: "<%- desc.replace(/"/g, '\\"') %>",
category: "Fill me in",
recommended: false,
url: null, // URL to the documentation page for this rule
},
fixable: null, // Or `code` or `whitespace`
schema: [], // Add a schema if the rule has options
},

create: function(context) {
create(context) {
// variables should be defined here

// variables should be defined here
//----------------------------------------------------------------------
// Helpers
//----------------------------------------------------------------------

//----------------------------------------------------------------------
// Helpers
//----------------------------------------------------------------------
// any helper functions should go here or else delete this section

// any helper functions should go here or else delete this section
//----------------------------------------------------------------------
// Public
//----------------------------------------------------------------------

//----------------------------------------------------------------------
// Public
//----------------------------------------------------------------------

return {

// give me methods

};
}
return {
// visitor functions for different types of nodes
};
},
};
32 changes: 13 additions & 19 deletions rule/templates/_test.js
Expand Up @@ -8,32 +8,26 @@
// Requirements
//------------------------------------------------------------------------------

var rule = require("../../../lib/rules/<%= ruleId %>"),
<% if (target === "eslint") { %>
RuleTester = require("../../../lib/testers/rule-tester");
const rule = require("../../../lib/rules/<%= ruleId %>"),<% if (target === "eslint") { %>
RuleTester = require("../../../lib/testers/rule-tester");
<% } else { %>
RuleTester = require("eslint").RuleTester;
RuleTester = require("eslint").RuleTester;
<% } %>

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

var ruleTester = new RuleTester();
const ruleTester = new RuleTester();
ruleTester.run("<%= ruleId %>", rule, {
valid: [
// give me some code that won't trigger a warning
],

valid: [

// give me some code that won't trigger a warning
],

invalid: [
{
code: "<%- invalidCode.replace(/"/g, '\\"') %>",
errors: [{
message: "Fill me in.",
type: "Me too"
}]
}
]
invalid: [
{
code: "<%- invalidCode.replace(/"/g, '\\"') %>",
errors: [{ message: "Fill me in.", type: "Me too" }],
},
],
});

0 comments on commit 671329e

Please sign in to comment.