10.0.0 • Published 7 years ago

atom-linter v10.0.0

Weekly downloads
6,493
License
MIT
Repository
github
Last release
7 years ago

atom-linter

Greenkeeper badge

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

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:

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

10.0.0

7 years ago

9.0.1

7 years ago

9.0.0

7 years ago

8.0.0

8 years ago

7.0.0

8 years ago

6.0.0

8 years ago

5.0.2

8 years ago

5.0.1

8 years ago

5.0.0

8 years ago

4.7.0

8 years ago

4.6.1

8 years ago

4.6.0

8 years ago

4.5.1

8 years ago

4.5.0

8 years ago

4.4.0

8 years ago

4.3.4

8 years ago

4.3.3

8 years ago

4.3.2

8 years ago

4.3.1

8 years ago

4.3.0

8 years ago

4.2.0

8 years ago

4.1.1

8 years ago

4.1.0

8 years ago

4.0.1

8 years ago

4.0.0

8 years ago

3.4.1

8 years ago

3.4.0

8 years ago

3.3.9

8 years ago

3.3.8

8 years ago

3.3.7

8 years ago

3.3.6

8 years ago

3.3.5

8 years ago

3.3.4

8 years ago

3.3.3

8 years ago

3.3.2

8 years ago

3.3.1

8 years ago

3.3.0

8 years ago

3.2.2

9 years ago

3.2.1

9 years ago

3.2.0

9 years ago

3.1.4

9 years ago

3.1.3

9 years ago

3.1.2

9 years ago

3.1.1

9 years ago

3.1.0

9 years ago

3.0.1

9 years ago

3.0.0

9 years ago

2.0.5

9 years ago

2.0.4

9 years ago

2.0.3

9 years ago

2.0.2

9 years ago

2.0.1

9 years ago

2.0.0

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago