Create Atom Linters for unified processors
JavaScript
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.editorconfig
.gitignore
.npmrc
.travis.yml
LICENSE
index.js
package.json
readme.md

readme.md

unified-engine-atom Build Status

Interface for creating Atom Linters around unified processors. Wrapper around the engine to run it from Atom.

Installation

npm:

npm install unified-engine-atom

Usage

var engine = require('unified-engine-atom')

module.exports.provideLinter = linter

function linter() {
  return {
    grammarScopes: ['source.gfm', 'source.pfm', 'text.md'],
    name: 'remark',
    scope: 'file',
    lintsOnChange: true,
    lint: engine({
      processor: require('remark'),
      rcName: '.remarkrc',
      packageField: 'remarkConfig',
      ignoreName: '.remarkignore',
      pluginPrefix: 'remark'
    })
  }
}

API

engine(options)

Create a lint function for use in an AtomLinter package. Read more about linters in the Linter Docs.

options
options.processor

Unified processor to transform files (Processor, required).

options.rcName

Name of configuration files to load (string, optional).

options.packageField

Property at which configuration can be found in package.json files (string, optional).

options.detectConfig

Whether to search for configuration files (boolean, default: whether rcName or packageField is given).

options.rcPath

File-path to a configuration file to load (string, optional).

options.settings

Configuration for the parser and compiler of the processor (Object, optional).

options.ignoreName

Name of ignore files to load (string, optional).

options.detectIgnore

Whether to search for ignore files (boolean, default: whether ignoreName is given).

options.ignorePath

File-path to an ignore file to load (string, optional).

options.silentlyIgnore

Skip given files if they are ignored (boolean, default: false).

options.plugins

Map of plug-in names or paths and options to use (Object, optional).

options.pluginPrefix

When given, optional prefix to use when searching for plug-ins (string, optional).

Returns

Function — Can be used as provider.lint, where provider is the returned value of provideLinter. This function takes an Atom Editor instance, resolves an array of LinterMessages, or rejects a fatal Error.

Todo

  • If anyone knows how to add coverage to Atom tests, I’d love to hear about it.

Contribute

See contributing.md in unifiedjs/unified for ways to get started.

This organisation has a Code of Conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.

License

MIT © Titus Wormer