Package Exports
- marlint
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (marlint) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Marlint 
Simple Linter for Traveloka JS styleguide (based on Marlint)
Enforce strict code style. Never discuss code style on a code review again
No decision-making. No .eslintrc, .jshintrc, .jscsrc to manage. It just works!
Uses babel-eslint underneath.
Basic feature
- ES6 support by default
- Flowtype compatible
Code style
- 2 Space indentation
- Semicolons
- Single-quotes
- No unused variables
- Space after keyword
if (condition) {} - Always
===instead of==
Any of these can be overridden if necessary.
Check out an example and the ESLint rules.
Install
$ npm install --global marlintUsage
$ marlint --help
Usage
$ marlint [<file|glob> ...]
Options
--init Add Marlint to your project
--compact Compact output
--stdin Validate code from stdin
--env Environment preset [Can be set multiple times]
--global Global variable [Can be set multiple times]
--ignore Additional paths to ignore [Can be set multiple times]
Examples
$ marlint
$ marlint index.js
$ marlint *.js !foo.js
$ marlint --env=node --env=mocha
Tips
Put options in package.json instead of using flags so other tools can read it.Workflow
The recommended workflow is to add Marlint locally to your project and run it with the tests.
Simply run $ marlint --init to add Marlint to your package.json:
Before
{
"name": "your-project",
"scripts": {
"test": "mocha"
},
"devDependencies": {
"mocha": "^2.0.0"
}
}After
{
"name": "your-project",
"scripts": {
"test": "marlint && mocha"
},
"devDependencies": {
"mocha": "^2.0.0",
"marlint": "^0.1.0"
}
}Config
You can configure some options in Marlint by putting it in package.json:
{
"name": "your-project",
"marlint": {
"envs": ["node", "mocha"]
}
}Globals and rules can be configured inline in files.
envs
Type: array
Default: ['node']
Which environments your code is designed to run in. Each environment brings with it a certain set of predefined global variables.
globals
Type: array
Additional global variables your code accesses during execution.
ignores
Type: array
Some paths are ignored by default. Additional ignores can be added here.
space
Type: boolean, number
Default: false (tab indentation)
Set it to true to get 2-space indentation or specify the number of spaces.
This option exists for pragmatic reasons, but I would strongly recommend you read "Why tabs are superior".
rules
Type: object
Override any of the default rules. See the ESLint docs for more info on each rule.
Please take a moment to consider if you really need to use this option.
FAQ
Why not ESLint?
Marlint is based on babel-eslint (and also ESLint). This project aims to simplify code convention across Traveloka javascripts code. Just type marlint and be done. No decision-making. No config. However, you can still get most of the Marlint benefits while using ESLint directly with the ESLint shareable config.
Editors
Coming Soon
Related
- eslint-config-marlint - ESLint shareable config for Marlint
License
MIT © Traveloka