Skip to content

Rule: use a particular method of accessing range locations #6

@not-an-aardvark

Description

@not-an-aardvark

Nodes in an AST generally have duplicated range information: start and end properties from acorn, and range array properties. This rule would enforce the usage of one or the other.

// (this isn't a very good rule name, there should probably be a better one.)

/* eslint eslint-plugin/use-range-property: ["error", "always"] */

// Invalid:

foo.start;
foo.end;

// Valid:

foo.range[0];
foo.range[1];
/* eslint eslint-plugin/use-range-property: ["error", "never"] */

// Invalid:

foo.range[0];
foo.range[1];

// Valid:

foo.start;
foo.end;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions