Skip to content

Commit 8ba6cf8

Browse files
committed
Update to use latest eslint and docs generation process
And even more thanks @brettz9!
1 parent 6d9b546 commit 8ba6cf8

23 files changed

+3832
-252
lines changed

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
docs/jsdoc
3+
scratch

.eslintrc.js

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
"use strict";
2+
3+
module.exports = {
4+
"env": {
5+
"browser": true,
6+
"commonjs": true,
7+
"es6": true,
8+
"node": true,
9+
"mocha": true
10+
},
11+
"extends": ["ash-nazg/sauron-node", "plugin:node/recommended-script"],
12+
"parserOptions": {
13+
"ecmaVersion": 2018
14+
},
15+
"settings": {
16+
"polyfills": [
17+
"Error",
18+
"Object.defineProperties",
19+
"Object.defineProperty"
20+
]
21+
},
22+
"overrides": [
23+
{
24+
files: ["**/*.md"],
25+
rules: {
26+
"eol-last": "off",
27+
"no-console": "off",
28+
"no-undef": "off",
29+
"padded-blocks": "off",
30+
"import/unambiguous": "off",
31+
"import/no-unresolved": "off",
32+
"node/no-missing-import": "off",
33+
"no-unused-vars": ["warn"],
34+
"no-unused-vars": ["error", {
35+
"varsIgnorePattern": "Point2D"
36+
}],
37+
"node/no-missing-require": ["error", {
38+
"allowModules": ["kld-intersections"]
39+
}]
40+
}
41+
}
42+
],
43+
"rules": {
44+
"indent": [
45+
"error",
46+
4,
47+
{"SwitchCase": 1}
48+
],
49+
"quotes": [
50+
"error",
51+
"double"
52+
],
53+
"space-before-function-paren": [
54+
"error",
55+
"never"
56+
],
57+
"brace-style": [
58+
"error",
59+
"stroustrup"
60+
],
61+
"arrow-parens": [
62+
"error",
63+
"as-needed"
64+
],
65+
"no-console": "off",
66+
"no-multiple-empty-lines": "off",
67+
"max-len": "off",
68+
"node/exports-style": "off",
69+
"unicorn/no-zero-fractions": "off",
70+
"require-unicode-regexp": "off",
71+
"yoda": "off",
72+
"valid-jsdoc": 0,
73+
"import/unambiguous": 0,
74+
"global-require": 0,
75+
"import/no-commonjs": 0,
76+
"consistent-this": "off",
77+
"unicorn/prefer-type-error": "off",
78+
"node/shebang": "off"
79+
}
80+
};

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
.DS_Store
22

33
npm-debug.log
4+
45
node_modules
6+
7+
docs/jsdoc

.npmignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
docs/jsdoc
2+
test
3+
scratch

docs/jsdoc-config.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"use strict";
2+
3+
module.exports = {
4+
plugins: [],
5+
recurseDepth: 10,
6+
source: {
7+
exclude: [
8+
"node_modules",
9+
"dist",
10+
"test"
11+
],
12+
excludePattern: "rollup*"
13+
},
14+
sourceType: "module",
15+
tags: {
16+
allowUnknownTags: false
17+
},
18+
templates: {
19+
cleverLinks: true,
20+
monospaceLinks: false
21+
},
22+
opts: {
23+
recurse: true,
24+
verbose: true,
25+
destination: "docs/jsdoc"
26+
}
27+
};

index.js

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
exports.BoundingBox2D = require('./lib/BoundingBox2D');
1+
"use strict";
2+
3+
exports.BoundingBox2D = require("./lib/BoundingBox2D");
24

35
// Contours
4-
exports.Circle2D = require('./lib/Circle2D');
5-
exports.CubicBezier2D = require('./lib/CubicBezier2D');
6-
exports.Ellipse2D = require('./lib/Ellipse2D');
7-
exports.Line2D = require('./lib/Line2D');
8-
exports.Polygon2D = require('./lib/Polygon2D');
9-
exports.QuadraticBezier2D = require('./lib/QuadraticBezier2D');
10-
exports.Rectangle2D = require('./lib/Rectangle2D');
6+
exports.Circle2D = require("./lib/Circle2D");
7+
exports.CubicBezier2D = require("./lib/CubicBezier2D");
8+
exports.Ellipse2D = require("./lib/Ellipse2D");
9+
exports.Line2D = require("./lib/Line2D");
10+
exports.Polygon2D = require("./lib/Polygon2D");
11+
exports.QuadraticBezier2D = require("./lib/QuadraticBezier2D");
12+
exports.Rectangle2D = require("./lib/Rectangle2D");

lib/BoundingBox2D.js

+15-12
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,36 @@
1+
"use strict";
2+
13
/**
24
* BoundingBox2D
35
*
4-
* @param {Number} x
5-
* @param {Number} y
6-
* @param {Number} width
7-
* @param {Number} height
6+
* @class
7+
* @param {number} x
8+
* @param {number} y
9+
* @param {number} width
10+
* @param {number} height
811
* @returns {BoundingBox2D}
912
*/
1013
function BoundingBox2D(x, y, width, height) {
1114
Object.defineProperties(this, {
12-
"x": {
15+
x: {
1316
value: x,
1417
writable: false,
1518
enumerable: true,
1619
configurable: false
1720
},
18-
"y": {
21+
y: {
1922
value: y,
2023
writable: false,
2124
enumerable: true,
2225
configurable: false
2326
},
24-
"width": {
27+
width: {
2528
value: width,
2629
writable: false,
2730
enumerable: true,
2831
configurable: false
2932
},
30-
"height": {
33+
height: {
3134
value: height,
3235
writable: false,
3336
enumerable: true,
@@ -40,19 +43,19 @@ function BoundingBox2D(x, y, width, height) {
4043
* overlaps
4144
*
4245
* @param {BoundingBox2D} that
43-
* @returns {Boolean}
46+
* @returns {boolean}
4447
*/
4548
BoundingBox2D.prototype.overlaps = function(that) {
4649
return (
47-
this.x < (that.x + that.width) && (this.x + this.width) > that.x &&
50+
this.x < (that.x + that.width) && (this.x + this.width) > that.x &&
4851
this.y < (that.y + that.height) && (this.y + this.height) > that.y
4952
);
5053
};
5154

5255
/**
5356
* isEmpty
5457
*
55-
* @returns {Boolean}
58+
* @returns {boolean}
5659
*/
5760
BoundingBox2D.prototype.isEmpty = function() {
5861
return this.width !== 0 && this.height !== 0;
@@ -61,7 +64,7 @@ BoundingBox2D.prototype.isEmpty = function() {
6164
/**
6265
* toString
6366
*
64-
* @returns {String}
67+
* @returns {string}
6568
*/
6669
BoundingBox2D.prototype.toString = function() {
6770
return (

lib/Circle2D.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
1+
"use strict";
2+
3+
let BoundingBox2D, Polygon2D;
4+
15
if (typeof module !== "undefined") {
2-
let BoundingBox2D = require('./BoundingBox2D'),
3-
Polygon2D = require('./Polygon2D');
6+
BoundingBox2D = require("./BoundingBox2D");
7+
Polygon2D = require("./Polygon2D");
48
}
59

610
/**
711
* Circle2D
812
*
13+
* @class
914
* @param {Point2D} center
10-
* @param {Number} radius
15+
* @param {number} radius
1116
* @returns {Circle2D}
1217
*/
1318
function Circle2D(center, radius) {
1419
Object.defineProperties(this, {
15-
"center": {
20+
center: {
1621
value: center,
1722
writable: false,
1823
enumerable: true,
1924
configurable: false
2025
},
21-
"radius": {
26+
radius: {
2227
value: radius,
2328
writable: false,
2429
enumerable: true,

0 commit comments

Comments
 (0)