Skip to content

Commit 3e831f6

Browse files
committed
Docs: update README.md
1 parent 9899602 commit 3e831f6

File tree

1 file changed

+5
-57
lines changed

1 file changed

+5
-57
lines changed

README.md

Lines changed: 5 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -10,67 +10,15 @@
1010

1111
This package provides utility functions and classes for make ESLint custom rules.
1212

13-
For example, there is the class which tracks variable references.
13+
For examples:
1414

15-
```js
16-
const { ReferenceTracker } = require("eslint-utils")
17-
18-
module.exports = {
19-
meta: {},
20-
create(context) {
21-
return {
22-
"Program:exit"() {
23-
const tracker = new ReferenceTracker(context.getScope())
24-
25-
// Track the references of global variables.
26-
for (const { node, path } of tracker.iterateGlobalReferences({
27-
// Iterate the call expressions of `console.log`, `console.info`
28-
console: {
29-
log: { [ReferenceTracker.CALL]: true },
30-
info: { [ReferenceTracker.CALL]: true },
31-
},
32-
})) {
33-
context.report({
34-
node,
35-
message: "Don't use {{name}}.",
36-
data: { name: path.join(".") },
37-
})
38-
}
39-
40-
// Track the references of CommonJS modules.
41-
for (const { node, path } of tracker.iterateCjsReferences({
42-
// Iterate the access of `fs.exists`.
43-
fs: {
44-
exists: { [ReferenceTracker.READ]: true },
45-
},
46-
})) {
47-
context.report({
48-
node,
49-
message: "Don't use {{name}}.",
50-
data: { name: path.join(".") },
51-
})
52-
}
53-
}
54-
}
55-
},
56-
}
57-
```
58-
59-
## 💿 Installation
60-
61-
Use [npm](https://www.npmjs.com/) or [yarn](https://yarnpkg.com/).
62-
63-
```
64-
npm install eslint-utils
65-
```
66-
67-
### Requirements
68-
69-
- Node.js `6.5.0` or newer.
15+
- [getStaticValue](https://mysticatea.github.io/eslint-utils/api/ast-utils.html#getstaticvalue) evaluates static value on AST.
16+
- [PatternMatcher](https://mysticatea.github.io/eslint-utils/api/ast-utils.html#patternmatcher-class) finds a regular expression pattern as handling escape sequences.
17+
- [ReferenceTracker](https://mysticatea.github.io/eslint-utils/api/scope-utils.html#referencetracker-class) checks the members of modules/globals as handling assignments and destructuring.
7018

7119
## 📖 Usage
7220

73-
See [API reference](https://mysticatea.github.io/eslint-utils/).
21+
See [documentation](https://mysticatea.github.io/eslint-utils/).
7422

7523
## 📰 Changelog
7624

0 commit comments

Comments
 (0)