Skip to content

mantrajs/mantra-lint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mantra-lint

Build Status

Check your code against the official Mantra spec.

You can suggest a new rule by editing [RULES.md] (https://github.com/sungwoncho/mantra-lint/blob/master/RULES.md)

Installation

npm install mantra-lint

Usage

Currently you can lint your code programmatically as follows:

import {lint} from 'mantra-lint';
import fs from 'fs';
let code = fs.readFileSync('/client/modules/core/containers/my_container.js');

lint(code, 'container');
// => [{ message: `The mapper function 'depsMapper' should be exported` }]

API

lint(code, type)

Lints the code against all the rules defined for the provided type. Returns an array that contains violations.

If no violations are found, it returns an empty array.

params

code

  • Type: String
  • the code you want to lint

type

  • Type: String
  • the type of the code you are linting. The supported values are: container, appContext.

List of Rules

Please see RULES.md.

Contributor guide

  • Clone this repository and run npm install.
  • Write your code under /lib.
  • npm run-script compile compiles your ES2015 code in /lib into /dist.
  • npm test compiles the code and runs the tests.

License

MIT

About

Lint your code against Mantra spec (work in progress)

Resources

License

Stars

Watchers

Forks

Packages

No packages published