Switch to unified view

a b/src/worker/src/node_modules/coffeelint/doc/user.md
1
How do I configure CoffeeLint?
2
==============================
3
4
There are two main options. In the root of your project create a
5
`coffeelint.json`, or add a `coffeelintConfig` section to your `package.json`.
6
Either way, the configuration is exactly the same. If CoffeeLint doesn't find
7
any configuration for the current project, it will check for a
8
`$HOME/coffeelint.json` to use.
9
10
`package.json`
11
--------------
12
```json
13
{
14
  "name": "your-project",
15
  "version": "0.0.0",
16
  "coffeelintConfig": {
17
    "indentation" : {
18
        "level" : "error",
19
        "value" : 4
20
    },
21
    "line_endings" : {
22
        "value" : "unix",
23
        "level" : "error"
24
    }
25
  }
26
}
27
```
28
29
`coffeelint.json`
30
-----------------
31
```json
32
{
33
  "indentation" : {
34
    "level" : "error",
35
    "value" : 4
36
  },
37
  "line_endings" : {
38
    "value" : "unix",
39
    "level" : "error"
40
  }
41
}
42
```
43
44
What are the rules?
45
===================
46
47
See [coffeelint.org][options] for all of the built in rules. Every rule has a
48
`level` of `ignore`, `error`, or `warn`. Most rules have a single behavior and
49
`level` is the only thing to configure. `indentation` is one of the exceptions,
50
it has a `value` that defaults to 2.
51
52
How do I temporarily disable a rule?
53
====================================
54
55
```CoffeeScript
56
 # coffeelint: disable=max_line_length
57
 object:
58
   attr: "some/huge/line/string/with/embed/#{values}.that/surpasses/the/max/column/width"
59
 # coffeelint: enable=max_line_length
60
 ```
61
62
What about 3rd party rules?
63
===========================
64
65
CoffeeLint 0.6 to 1.3 required 3rd party rules to be installed globally (`[sudo]
66
npm install -g <coffeelint-rule>`).
67
68
Starting with CoffeeLint 1.4 rules can (and should) be installed per project.
69
Consult the `README.md` or npmjs.org page for exact configuration instructions.
70
It's generally the same as built in rules but with the addition of a `module`
71
attribute to specify the correct module name. It may not exactly match the rule
72
name.
73
74
All rules should have a `coffeelintrule` tag on [npmjs.org][rules].
75
76
How do I use JSX (ReactJS)
77
==========================
78
79
CoffeeLint 1.8 allows you to add transformers that will run over the code
80
before CoffeeLint processes it.
81
82
*WARNING*: CoffeeLint cannot control what these transformers do. They may
83
violate all kinds of rules you have setup. It's up to you to wrap your code in
84
`# coffeelint: disable=max_line_length` or whatever you need.
85
86
*WARNING*: These transformers might not maintain line numbers. If this happens
87
and it's a problem, it's up to you to contact the developers to see if they can
88
keep everything on the same lines.
89
90
In your coffeelint.json:
91
92
```json
93
{
94
    "coffeelint": {
95
        "transforms": [ "coffee-react-transform" ]
96
    }
97
}
98
```
99
100
What about different flavors of CoffeeScript, like IcedCoffeeScript?
101
====================================================================
102
103
While this functionality was added in 1.8, it's basically unsupported. If your
104
chosen flavor breaks things it's up to you to contact the maintainer and see if
105
they are willing to bring their implementation in line with the official
106
CoffeeScript.
107
108
Using IcedCoffeeScript [does break][IcedCoffeeScript] the `cyclomatic_complexity` rule 
109
110
```json
111
{
112
    "coffeelint": {
113
        "coffeescript": [ "iced-coffee-script" ]
114
    }
115
}
116
```
117
 
118
[options]: http://www.coffeelint.org/#options
119
[rules]: https://www.npmjs.org/search?q=coffeelintrule
120
[IcedCoffeeScript]: https://github.com/clutchski/coffeelint/issues/349#issuecomment-67737784