Irina Glushko 2389e7160b HW1 done | 3 tahun lalu | |
---|---|---|
.. | ||
lib | 3 tahun lalu | |
CHANGELOG.md | 3 tahun lalu | |
LICENSE | 3 tahun lalu | |
README.md | 3 tahun lalu | |
package.json | 3 tahun lalu |
Constants and utilities about visitor keys to traverse AST.
Use npm to install.
$ npm install eslint-visitor-keys
const evk = require("eslint-visitor-keys")
type:
{ [type: string]: string[] | undefined }
Visitor keys. This keys are frozen.
This is an object. Keys are the type of ESTree nodes. Their values are an array of property names which have child nodes.
For example:
console.log(evk.KEYS.AssignmentExpression) // → ["left", "right"]
type:
(node: object) => string[]
Get the visitor keys of a given AST node.
This is similar to Object.keys(node)
of ES Standard, but some keys are excluded: parent
, leadingComments
, trailingComments
, and names which start with _
.
This will be used to traverse unknown nodes.
For example:
const node = {
type: "AssignmentExpression",
left: { type: "Identifier", name: "foo" },
right: { type: "Literal", value: 0 }
}
console.log(evk.getKeys(node)) // → ["type", "left", "right"]
type:
(additionalKeys: object) => { [type: string]: string[] | undefined }
Make the union set with evk.KEYS
and the given keys.
additionalKeys
is at first, then evk.KEYS
is concatenated after that.For example:
console.log(evk.unionWith({
MethodDefinition: ["decorators"]
})) // → { ..., MethodDefinition: ["decorators", "key", "value"], ... }
See GitHub releases.
Welcome. See ESLint contribution guidelines.
npm test
runs tests and measures code coverage.npm run lint
checks source codes with ESLint.npm run coverage
opens the code coverage report of the previous test with your default browser.npm run release
publishes this package to npm registory.