All Projects → mantrajs → Mantra Lint

mantrajs / Mantra Lint

Licence: mit
Lint your code against Mantra spec (work in progress)

Programming Languages

javascript
184084 projects - #8 most used programming language

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].