JSPM

  • Created
  • Published
  • Downloads 385070
  • Score
    100M100P100Q172422F
  • License MIT

Utils for ESLint TypeScript rules

Package Exports

  • eslint-etc

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (eslint-etc) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

eslint-etc

More utils for use with eslint.

I use these utils to implement and test my own ESLint rules. That's their primary purpose, so the documentation is ... light.

fromFixture

fromFixture allows TSLint-like fixtures to be used to test ESlint rules. Using fixtures means that you don't have to specify lines and columns. Instead, you underline the failure locations within the fixture, like this:

fromFixture(stripIndent`
  const name = "alice";
        ~~~~ [whoops { "identifier": "name" }]
`);

which is equivalent to the following:

{
  code: `const name = "alice";`,
  column: 7,
  endColumn: 11,
  line: 1,
  endLine: 1,
  messageId: "whoops",
  data: {
    identifier: "name",
  },
}

Specifying data in the fixture is optional. If it's omitted, data defaults to {}.