Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update: Fix linting inconsistencies in templates #106

Merged
merged 1 commit into from
Jul 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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" }],
},
],
});