# atom-linter

> Helper module for atom linter providers

Latest version **10.0.0** (published 2017-04-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install atom-linter
pnpm add atom-linter
yarn add atom-linter
bun add atom-linter
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 10.0.0 |
| Published | 2017-04-14 |
| First published | 2015-05-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 30 |
| Author | steelbrain |
| Maintainers | arcanemagus, steelbrain |
| Keywords | atom, linter |

## Links

- npm: https://www.npmjs.com/package/atom-linter
- Repository: https://github.com/steelbrain/atom-linter
- Homepage: https://github.com/steelbrain/atom-linter#readme
- Issues: https://github.com/steelbrain/atom-linter/issues
- npm.io page: https://npm.io/package/atom-linter

## Dependencies (4)

- [tmp](https://npm.io/package/tmp.md) ~0.0.28
- [sb-exec](https://npm.io/package/sb-exec.md) ^4.0.0
- [sb-promisify](https://npm.io/package/sb-promisify.md) ^2.0.1
- [named-js-regexp](https://npm.io/package/named-js-regexp.md) ^1.3.1

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@pandacss/eslint-plugin](https://npm.io/package/@pandacss/eslint-plugin.md) — 18.7K weekly downloads

## Recent versions

- 10.0.0 (latest) — 2017-04-14
- 9.0.1 — 2017-03-01
- 9.0.0 — 2017-02-13
- 8.0.0 — 2016-08-26
- 7.0.0 — 2016-07-18
- 6.0.0 — 2016-06-23
- 5.0.2 — 2016-06-13
- 5.0.1 — 2016-05-08
- 5.0.0 — 2016-05-08
- 4.7.0 — 2016-04-15
- 4.6.1 — 2016-03-01
- 4.5.1 — 2016-02-19
- 4.5.0 — 2016-02-11
- 4.4.0 — 2016-02-03
- 4.3.4 — 2016-01-22
- … 41 more at https://npm.io/package/atom-linter/versions

## README

atom-linter
===========

[![Greenkeeper badge](https://badges.greenkeeper.io/steelbrain/atom-linter.svg)](https://greenkeeper.io/)

atom-linter is an npm helper module that you can import in your Linter Providers
and make things easier for yourself.

#### API

For full documentation of `exec` and `execNode` API, please refer to [`sb-exec README`](https://github.com/steelbrain/exec/blob/master/README.md)

```js
export const FindCache: Map
export function exec(command: String, args: Array<string> = [], options: Object): Promise
export function execNode(filePath: String, args: Array<string> = [], options: Object): Promise
export function parse(data: String, regex: String, options: Object = {flags: 'g'}): Array<Linter$Message>
export function generateRange(textEditor: TextEditor, lineNumber: Number = 0, colStart: Number = <firstTextColumn>): Array
export function find(directory: String, names: String | Array<string>): ?String
export function findCached(directory: String, names: String | Array<string>): ?String
export function findAsync(directory: String, names: String | Array<string>): Promise<?String>
export function findCachedAsync(directory: String, names: String | Array<string>): Promise<?String>
export function tempFile<T>(fileName: String, fileContents: String, callback: Function<T>): Promise<T>
export function tempFiles<T>(filesNames: Array<{ name: String, contents: String }>, callback: Function<T>): Promise<T>
```

#### Unique Spawning

To make sure that old processes spawned by your linter provider are terminated on a newer invocation, you can specify `uniqueKey: "my-linter"` in `exec` or `execNode` options. Please note that killed processes will return `null` as return value, so make sure to handle that.

Example:

```js
import atomLinter from 'atom-linter'

const myLinter = {
  // ...
  async lint(textEditor) {
    const output = atomLinter.exec('myprogram', ['parameter1', 'parameter2'], { uniqueKey: 'my-linter' })
    // NOTE: Providers should also return null if they get null from exec
    // Returning null from provider will tell base linter to keep existing messages
    if (output === null) {
      return null
    }
    // ... parse output and return messages
    return []
  }
}
```

#### License

This project is licensed under the terms of MIT License, see the LICENSE file for more info

---
_Source: https://npm.io/package/atom-linter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
