Skip to content

Commit

Permalink
update src code names
Browse files Browse the repository at this point in the history
  • Loading branch information
bpmutter committed Jun 8, 2023
1 parent 1049acd commit d0df234
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 14 deletions.
@@ -1,6 +1,11 @@
/**
* @fileoverview Rule to enforce that `const foo` is assigned "bar".
* @author Ben Perlmutter
*/

"use strict";

// The foo-bar rule definition
// The enforce-foo-bar rule definition
module.exports = {
meta: {
type: "fix",
Expand Down
@@ -1,7 +1,7 @@
"use strict";

const {RuleTester} = require("eslint");
const fooBarRule = require("./foo-bar");
const fooBarRule = require("./enforce-foo-bar");

const ruleTester = new RuleTester({
// Must use at least ecmaVersion 2015 because
Expand Down
5 changes: 5 additions & 0 deletions docs/_custom-rule-tutorial-code/eslint-plugin-example.js
@@ -0,0 +1,5 @@
"use strict";

const fooBarRule = require("./enforce-foo-bar");
const plugin = { rules: { "foo-bar": fooBarRule } };
module.exports = plugin;
4 changes: 0 additions & 4 deletions docs/_custom-rule-tutorial-code/eslint-plugin-foo-bar.js

This file was deleted.

8 changes: 4 additions & 4 deletions docs/_custom-rule-tutorial-code/eslint.config.js
@@ -1,7 +1,7 @@
"use strict";

// Import the ESLint plugin
const eslintPluginFooBar = require("./eslint-plugin-foo-bar");
const eslintPluginExample = require("./eslint-plugin-example");

module.exports = [
{
Expand All @@ -10,10 +10,10 @@ module.exports = [
sourceType: "commonjs",
ecmaVersion: "latest",
},
// Using the eslint-plugin-foo-bar plugin downloaded from npm
plugins: {"foo-bar": eslintPluginFooBar},
// Using the eslint-plugin-example plugin downloaded from npm
plugins: {"example": eslintPluginExample},
rules: {
"foo-bar/foo-bar": "error",
"example/foo-bar": "error",
},
}
]
8 changes: 4 additions & 4 deletions docs/_custom-rule-tutorial-code/package.json
@@ -1,8 +1,8 @@
{
"name": "eslint-plugin-foo-bar",
"name": "eslint-plugin-example",
"version": "1.2.0",
"description": "ESLint plugin for foo-bar rule.",
"main": "eslint-plugin-foo-bar.js",
"description": "ESLint plugin for enforce-foo-bar rule.",
"main": "eslint-plugin-example.js",
"keywords": [
"eslint",
"eslintplugin",
Expand All @@ -12,7 +12,7 @@
"eslint": ">=0.8.0"
},
"scripts": {
"test": "node foo-bar.test.js",
"test": "node enforce-foo-bar.test.js",
"pub": "np --yarn false"
},
"author": "",
Expand Down

0 comments on commit d0df234

Please sign in to comment.