Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mantrajs/mantra-lint
Lint your code against Mantra spec (work in progress)
https://github.com/mantrajs/mantra-lint
Last synced: 3 months ago
JSON representation
Lint your code against Mantra spec (work in progress)
- Host: GitHub
- URL: https://github.com/mantrajs/mantra-lint
- Owner: mantrajs
- License: mit
- Created: 2016-03-12T03:17:11.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-04-12T23:43:21.000Z (almost 9 years ago)
- Last Synced: 2024-08-08T15:21:57.204Z (6 months ago)
- Language: JavaScript
- Homepage:
- Size: 28.3 KB
- Stars: 12
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mantra-lint
[![Build Status](https://travis-ci.org/sungwoncho/mantra-lint.svg?branch=master)](https://travis-ci.org/sungwoncho/mantra-lint)
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:
```js
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](https://github.com/sungwoncho/mantra-lint/blob/master/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