/unified-engine-atom

Create Atom Linters for unified processors

Primary LanguageJavaScriptMIT LicenseMIT

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 = function () {
  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

Unified processor to transform files (Processor, required).

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

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

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

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

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

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

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

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

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

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

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 contribute.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