Skip to content
This repository was archived by the owner on Jun 10, 2020. It is now read-only.

Commit 32e5300

Browse files
committed
feat(api github): eslint
1 parent bab6ecc commit 32e5300

24 files changed

+1593
-998
lines changed

.editorconfig

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
15
root = true
26

7+
38
[*]
4-
charset = utf-8
9+
10+
# Change these settings to your own preference
511
indent_style = space
6-
indent_size = 2
12+
indent_size = 4
13+
14+
# We recommend you to keep these unchanged
715
end_of_line = lf
8-
insert_final_newline = true
16+
charset = utf-8
917
trim_trailing_whitespace = true
18+
insert_final_newline = true
19+
20+
[*.md]
21+
trim_trailing_whitespace = false
22+
23+
[{package,bower}.json]
24+
indent_style = space
25+
indent_size = 2

.eslintrc.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
module.exports = {
2+
"env": {
3+
"browser": true,
4+
"es6": true,
5+
"jquery": true,
6+
"jasmine": true,
7+
"mocha": true,
8+
"node": true
9+
},
10+
"extends": "ovh",
11+
"rules": {
12+
"newline-per-chained-call": 0,
13+
"no-restricted-properties": [0, {
14+
"object": "Math",
15+
"property": "pow"
16+
}],
17+
"no-magic-numbers": 0,
18+
"no-underscore-dangle": 0,
19+
"prefer-arrow-callback": 0,
20+
"prefer-template": 0,
21+
"object-shorthand": 0,
22+
"class-methods-use-this": 0
23+
},
24+
"globals": {
25+
"_": true,
26+
"$": true,
27+
"JSURL": true,
28+
"angular": true,
29+
"moment": true,
30+
"punycode": true,
31+
"URI": true,
32+
"ipaddr": true,
33+
"JustGage": true,
34+
"validator": true,
35+
"CSV": true,
36+
"jsPlumb": true,
37+
"jsPlumbUtil": true,
38+
"Raven": true,
39+
},
40+
"parserOptions": {
41+
"sourceType": "module",
42+
},
43+
};

build/build.js

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
1-
'use strict'
2-
require('./check-versions')()
1+
"use strict";
2+
require("./check-versions")();
33

4-
process.env.NODE_ENV = 'production'
4+
process.env.NODE_ENV = "production";
55

6-
const ora = require('ora')
7-
const rm = require('rimraf')
8-
const path = require('path')
9-
const chalk = require('chalk')
10-
const webpack = require('webpack')
11-
const config = require('../config')
12-
const webpackConfig = require('./webpack.prod.conf')
6+
const ora = require("ora");
7+
const rm = require("rimraf");
8+
const path = require("path");
9+
const chalk = require("chalk");
10+
const webpack = require("webpack");
11+
const config = require("../config");
12+
const webpackConfig = require("./webpack.prod.conf");
1313

14-
const spinner = ora('building for production...')
15-
spinner.start()
14+
const spinner = ora("building for production...");
15+
spinner.start();
1616

17-
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
18-
if (err) throw err
19-
webpack(webpackConfig, (err, stats) => {
20-
spinner.stop()
21-
if (err) throw err
22-
process.stdout.write(stats.toString({
23-
colors: true,
24-
modules: false,
25-
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
26-
chunks: false,
27-
chunkModules: false
28-
}) + '\n\n')
17+
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), (err) => {
18+
if (err) { throw err; }
19+
webpack(webpackConfig, (error, stats) => {
20+
spinner.stop();
21+
if (error) { throw error; }
22+
process.stdout.write(stats.toString({
23+
colors: true,
24+
modules: false,
25+
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
26+
chunks: false,
27+
chunkModules: false
28+
}) + "\n\n");
2929

30-
if (stats.hasErrors()) {
31-
console.log(chalk.red(' Build failed with errors.\n'))
32-
process.exit(1)
33-
}
30+
if (stats.hasErrors()) {
31+
console.log(chalk.red(" Build failed with errors.\n"));
32+
process.exit(1);
33+
}
3434

35-
console.log(chalk.cyan(' Build complete.\n'))
36-
console.log(chalk.yellow(
37-
' Tip: built files are meant to be served over an HTTP server.\n' +
38-
' Opening index.html over file:// won\'t work.\n'
39-
))
40-
})
41-
})
35+
console.log(chalk.cyan(" Build complete.\n"));
36+
console.log(chalk.yellow(
37+
" Tip: built files are meant to be served over an HTTP server.\n" +
38+
" Opening index.html over file:// won't work.\n"
39+
));
40+
});
41+
});

build/check-versions.js

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,54 @@
1-
'use strict'
2-
const chalk = require('chalk')
3-
const semver = require('semver')
4-
const packageConfig = require('../package.json')
5-
const shell = require('shelljs')
1+
"use strict";
2+
const chalk = require("chalk");
3+
const semver = require("semver");
4+
const packageConfig = require("../package.json");
5+
const shell = require("shelljs");
66

77
function exec (cmd) {
8-
return require('child_process').execSync(cmd).toString().trim()
8+
return require("child_process").execSync(cmd).toString().trim();
99
}
1010

1111
const versionRequirements = [
12-
{
13-
name: 'node',
14-
currentVersion: semver.clean(process.version),
15-
versionRequirement: packageConfig.engines.node
16-
}
17-
]
18-
19-
if (shell.which('npm')) {
20-
versionRequirements.push({
21-
name: 'npm',
22-
currentVersion: exec('npm --version'),
23-
versionRequirement: packageConfig.engines.npm
24-
})
12+
{
13+
name: "node",
14+
currentVersion: semver.clean(process.version),
15+
versionRequirement: packageConfig.engines.node
16+
}
17+
];
18+
19+
if (shell.which("npm")) {
20+
versionRequirements.push({
21+
name: "npm",
22+
currentVersion: exec("npm --version"),
23+
versionRequirement: packageConfig.engines.npm
24+
});
2525
}
2626

2727
module.exports = function () {
28-
const warnings = []
28+
const warnings = [];
2929

30-
for (let i = 0; i < versionRequirements.length; i++) {
31-
const mod = versionRequirements[i]
30+
for (let i = 0; i < versionRequirements.length; i++) {
31+
const mod = versionRequirements[i];
3232

33-
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
34-
warnings.push(mod.name + ': ' +
35-
chalk.red(mod.currentVersion) + ' should be ' +
33+
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
34+
warnings.push(mod.name + ": " +
35+
chalk.red(mod.currentVersion) + " should be " +
3636
chalk.green(mod.versionRequirement)
37-
)
37+
);
38+
}
3839
}
39-
}
4040

41-
if (warnings.length) {
42-
console.log('')
43-
console.log(chalk.yellow('To use this template, you must update following to modules:'))
44-
console.log()
41+
if (warnings.length) {
42+
console.log("");
43+
console.log(chalk.yellow("To use this template, you must update following to modules:"));
44+
console.log();
4545

46-
for (let i = 0; i < warnings.length; i++) {
47-
const warning = warnings[i]
48-
console.log(' ' + warning)
49-
}
46+
for (let i = 0; i < warnings.length; i++) {
47+
const warning = warnings[i];
48+
console.log(" " + warning);
49+
}
5050

51-
console.log()
52-
process.exit(1)
53-
}
54-
}
51+
console.log();
52+
process.exit(1);
53+
}
54+
};

0 commit comments

Comments
 (0)