Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
  • Loading branch information
bpmutter and mdjermanovic committed May 28, 2023
1 parent 85ec7a8 commit bef27bc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions docs/_custom-rule-tutorial-code/enforce-foo-bar.test.js
Expand Up @@ -9,7 +9,7 @@ const fooBarRule = require("./enforce-foo-bar");

const ruleTester = new RuleTester({
// Must use at least ecmaVersion 2015 because
// that's when `const` variable introduced.
// that's when `const` variable were introduced.
parserOptions: { ecmaVersion: 2015 }
});

Expand All @@ -24,7 +24,7 @@ ruleTester.run(
}],
// 'invalid' checks cases that should not pass
invalid: [{
code:"const foo = 'baz';",
code: "const foo = 'baz';",
output: 'const foo = "bar";',
errors: 1,
}],
Expand Down
4 changes: 2 additions & 2 deletions docs/_custom-rule-tutorial-code/eslint.config.js
Expand Up @@ -14,10 +14,10 @@ module.exports = [
sourceType: "commonjs",
ecmaVersion: "latest",
},
// Using the eslint-plugin-example plugin downloaded from npm
// Using the eslint-plugin-example plugin defined locally
plugins: {"example": eslintPluginExample},
rules: {
"example/foo-bar": "error",
"example/enforce-foo-bar": "error",
},
}
]
2 changes: 1 addition & 1 deletion docs/_custom-rule-tutorial-code/package.json
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-example",
"version": "1.2.0",
"version": "1.0.0",
"description": "ESLint plugin for enforce-foo-bar rule.",
"main": "eslint-plugin-example.js",
"keywords": [
Expand Down
10 changes: 5 additions & 5 deletions docs/src/extend/custom-rule-tutorial.md
Expand Up @@ -58,7 +58,7 @@ First, create a new project for your custom rule. Create a new directory, initia
mkdir eslint-custom-rule-example # create directory
cd eslint-custom-rule-example # enter the directory
npm init -y # init new npm project
touch enforce-foo-bar.js # create file foo-bar.js
touch enforce-foo-bar.js # create file enforce-foo-bar.js
```

## Step 2: Stub Out the Rule File
Expand Down Expand Up @@ -349,7 +349,7 @@ This produces the following output in the terminal:

```text
/<path-to-directory>/eslint-custom-rule-example/example.js
9:11 error Value other than "bar" assigned to `const foo`. Unexpected value: baz example/enforce-foo-bar
8:11 error Value other than "bar" assigned to `const foo`. Unexpected value: baz example/enforce-foo-bar
✖ 1 problem (1 error, 0 warnings)
1 error and 0 warnings potentially fixable with the `--fix` option.
Expand All @@ -373,8 +373,8 @@ A complete annotated example of what a plugin's `package.json` file should look
// Name npm package.
// Add your own package name. eslint-plugin-example is taken!
"name": "eslint-plugin-example",
"version": "1.2.0",
"description": "ESLint plugin for foo-bar rule.",
"version": "1.0.0",
"description": "ESLint plugin for enforce-foo-bar rule.",
"main": "eslint-plugin-example.js", // plugin entry point
"scripts": {
"test": "node enforce-foo-bar.test.js"
Expand Down Expand Up @@ -435,7 +435,7 @@ This produces the following output in the terminal:

```text
/<path-to-directory>/eslint-custom-rule-example/example.js
9:11 error Value other than "bar" assigned to `const foo`. Unexpected value: baz example/enforce-foo-bar
8:11 error Value other than "bar" assigned to `const foo`. Unexpected value: baz example/enforce-foo-bar
✖ 1 problem (1 error, 0 warnings)
1 error and 0 warnings potentially fixable with the `--fix` option.
Expand Down

0 comments on commit bef27bc

Please sign in to comment.