Skip to content

Commit 07758b7

Browse files
authored
JSHint: enforce more rules (#323)
* Add jshint rules esversion, browser, devel, undef, forin, freeze, nocomma and nonew * Update some comments * Enforce strict equality * Remove laxcomma and laxbreak * Removed comment in .jshintrc * Update grunt-contrib-jshint * Better CONTRIBUTING
1 parent 4c207b4 commit 07758b7

File tree

6 files changed

+173
-99
lines changed

6 files changed

+173
-99
lines changed

.jshintrc

+19-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
{
2-
"jquery": true, // true: use jQuery
3-
"unused": true, // true: Warns about declared variable not used
4-
"nonbsp": true, // true: Warns about "non-breaking whitespace" characters
5-
"latedef": true, // true: Require variables/functions to be defined before being used
6-
"noarg": true, // true: Prohibit use of `arguments.caller` and `arguments.callee`
2+
"esversion": 3,
3+
"jquery": true,
4+
"browser": true,
75

8-
"laxcomma": true, // true: allow unsafe line breakings
9-
"laxbreak": true, // true: allow comma-first coding style
6+
"devel": true,
7+
"undef": true,
8+
"unused": true,
9+
"nonbsp": true,
10+
"latedef": true,
11+
"noarg": true,
12+
"eqeqeq": true,
13+
"forin": true,
14+
"freeze": true,
15+
"nocomma": true,
16+
"nonew": true,
1017

1118
"globals": {
12-
"define": true, // for AMD
13-
"require": true, // for CommonJS
14-
"module": true, // for CommonJS
15-
"exports": true, // for CommonJS
16-
"Raphael": true // for Raphael.js
19+
"define": true,
20+
"require": true,
21+
"module": true,
22+
"exports": true,
23+
"Raphael": true
1724
}
1825
}

CONTRIBUTING.md

+74-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
Contributing
2-
------------
1+
# Contributing
32

43
You want to contribute to Mapael? That's great, first of all, thank you !
54

@@ -17,10 +16,79 @@ There are several ways you can contribute :
1716

1817
- **You want to help, but don't know what to do?** Check the [TODO list](https://github.com/neveldo/jQuery-Mapael/wiki/TODO-list) for features/issues we need/are working on.
1918

20-
_ _ _
19+
Here are some readings: <https://guides.github.com/activities/contributing-to-open-source>
2120

22-
Here are some readings:
21+
---
2322

24-
1. <https://guides.github.com/activities/contributing-to-open-source>
23+
# Dev information
2524

26-
2. <http://kbroman.org/github_tutorial/pages/fork.html>
25+
## Cloning the repository
26+
27+
Before making any modification to Mapael, you will need your own Mapael fork!
28+
29+
Here are some reading to get a local Mapael:
30+
1. <https://help.github.com/articles/fork-a-repo/>
31+
1. <http://kbroman.org/github_tutorial/pages/fork.html>
32+
33+
## Environment
34+
35+
Mapael uses [NPM](https://www.npmjs.com/) to manage package dependencies
36+
and [Grunt](https://gruntjs.com/) to run development tasks.
37+
38+
After cloning locally the Mapael repository, run this command-line:
39+
```
40+
npm install
41+
```
42+
43+
Then you will be able to run all related Grunt tasks.
44+
45+
## Code quality
46+
47+
Mapael uses [JSHint](http://jshint.com/about/) to check code quality.
48+
The rules are [explained in the Wiki](https://github.com/neveldo/jQuery-Mapael/wiki/JSHint).
49+
50+
You can run this check with the following command-line:
51+
```
52+
grunt jshint
53+
```
54+
55+
## Test suite
56+
57+
There is a test suite in the `/test` folder, power by [QUnit](http://qunitjs.com/).
58+
While not broken, it is, however, very light. We sadly don't have the time to expand it for now.
59+
60+
When submitting a new PR, it is not expected from you to add any tests.
61+
But if you feel like you can, please do so.
62+
63+
You can run this check with the following command-line
64+
(note: it will run JSHint, then the Test Suite):
65+
```
66+
grunt test
67+
```
68+
69+
## Build (minimified version)
70+
71+
Mapael is distributed as a minified file for production (`jquery.mapael.min.js`).
72+
[UglifyJS](http://lisperator.net/uglifyjs/) is used for this operation.
73+
74+
You can build it with the following command-line
75+
(note: it will run JSHint, then build the minimified files):
76+
```
77+
grunt build
78+
```
79+
80+
When submitting a new PR, it is not expected from you to provide the minified version.
81+
This version is usually generated by maintainers before tagging a new release.
82+
83+
## Continuous Integration (CI)
84+
85+
When submitting a new PR, you will see that [Travis](https://travis-ci.org/) (the CI tool)
86+
will automatically run some tests on your code. It performs two tests:
87+
1. Run JSHint to check code quality
88+
2. Run the Test Suite to check regression
89+
90+
You will be able to check the result then, and perform adjustements if necessary
91+
(by pushing a new commit to the branch).
92+
93+
These two tests are expected to pass when submitting a new PR.
94+
Please check your code so

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ Here is the simplest example that shows how to display an empty map of the world
9191
* [Map with some transformations performed on SVG plotted points](https://rawgit.com/neveldo/jQuery-Mapael/master/examples/advanced/transformations_on_svg_plots.html)
9292
* [Allow the user to add some cities by double-clicking on the map](https://rawgit.com/neveldo/jQuery-Mapael/master/examples/advanced/add_cities_on_map_by_double_click.html)
9393

94+
## Contributing
95+
96+
Want to contribute? See the [CONTRIBUTING](https://github.com/neveldo/jQuery-Mapael/blob/master/CONTRIBUTING.md) file.
97+
9498
## License
9599

96100
Copyright (C) 2013-2017 [Vincent Brouté](https://www.vincentbroute.fr)

0 commit comments

Comments
 (0)