Skip to content

Commit 7ba8b39

Browse files
feat(formatting): adding editor config, adding eslint and tslint config.
1 parent 6fa059b commit 7ba8b39

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1918
-1955
lines changed

.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# http://editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
indent_style = space
8+
indent_size = 2
9+
end_of_line = lf
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true
12+
13+
[*.md]
14+
insert_final_newline = false
15+
trim_trailing_whitespace = false

.eslintrc

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"ecmaFeatures": {
3+
"modules": true,
4+
"module": true
5+
},
6+
"env": {
7+
"mocha": true,
8+
"node": true,
9+
"es6": true
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
module.exports = {
22
description: '',
3-
3+
44
// ******************************************************
55
// ******************************************************
66
// LEAVE THIS HERE
77
// Must override install to prevent ember's component tests
88
// ******************************************************
99
// ******************************************************
10-
11-
install: function(options){}
10+
11+
install: function () {
12+
}
1213
};

addon/ng2/blueprints/component/index.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
1-
var stringUtils = require('ember-cli/lib/utilities/string');
21
var dynamicPathParser = require('../../utilities/dynamic-path-parser');
32

43
module.exports = {
54
description: '',
65

7-
normalizeEntityName: function(entityName) {
6+
normalizeEntityName: function (entityName) {
87
var parsedPath = dynamicPathParser(this.project, entityName);
9-
8+
109
this.dynamicPath = parsedPath;
1110
return parsedPath.name;
1211
},
1312

14-
locals: function(options) {
13+
locals: function () {
1514
return {
1615
dynamicPath: this.dynamicPath.dir
1716
};
1817
},
1918

20-
fileMapTokens: function(options) {
19+
fileMapTokens: function () {
2120
// Return custom template variables here.
2221
return {
23-
__name__: (options) => {
22+
__name__: () => {
2423
return this.dynamicPath.name;
2524
},
26-
__path__: (options) => {
25+
__path__: () => {
2726
return this.dynamicPath.dir;
2827
}
2928
};

addon/ng2/blueprints/directive/index.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
1-
var stringUtils = require('ember-cli/lib/utilities/string');
21
var dynamicPathParser = require('../../utilities/dynamic-path-parser');
32

43
module.exports = {
54
description: '',
65

7-
normalizeEntityName: function(entityName) {
6+
normalizeEntityName: function (entityName) {
87
var parsedPath = dynamicPathParser(this.project, entityName);
9-
8+
109
this.dynamicPath = parsedPath;
1110
return parsedPath.name;
1211
},
1312

14-
locals: function(options) {
13+
locals: function () {
1514
return {
1615
dynamicPath: this.dynamicPath.dir
1716
};
1817
},
1918

20-
fileMapTokens: function(options) {
19+
fileMapTokens: function () {
2120
// Return custom template variables here.
2221
return {
23-
__name__: (options) => {
22+
__name__: () => {
2423
return this.dynamicPath.name;
2524
},
26-
__path__: (options) => {
25+
__path__: () => {
2726
return this.dynamicPath.dir;
2827
}
2928
};

addon/ng2/blueprints/ng2/files/karma-test-shim.js

+14-12
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
/*global jasmine, __karma__, window*/
12
Error.stackTraceLimit = Infinity;
23

34
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;
45

5-
__karma__.loaded = function() {};
6+
__karma__.loaded = function () {
7+
};
68

79
System.config({
810
packages: {
@@ -11,30 +13,30 @@ System.config({
1113
format: 'register',
1214
map: Object.keys(window.__karma__.files)
1315
.filter(onlyAppFiles)
14-
.reduce(function(pathsMapping, appPath) {
16+
.reduce(function (pathsMapping, appPath) {
1517
var moduleName = appPath.replace(/^\/base\/dist\/app\//, './').replace(/\.js$/, '');
16-
pathsMapping[moduleName] = appPath + '?' + window.__karma__.files[appPath]
17-
return pathsMapping;
18-
}, {})
18+
pathsMapping[moduleName] = appPath + '?' + window.__karma__.files[appPath];
19+
return pathsMapping;
20+
}, {})
1921
}
2022
}
2123
});
2224

23-
System.import('angular2/testing').then(function(testing) {
24-
return System.import('angular2/platform/testing/browser').then(function(providers) {
25+
System.import('angular2/testing').then(function (testing) {
26+
return System.import('angular2/platform/testing/browser').then(function (providers) {
2527
testing.setBaseTestProviders(providers.TEST_BROWSER_PLATFORM_PROVIDERS,
26-
providers.TEST_BROWSER_APPLICATION_PROVIDERS);
28+
providers.TEST_BROWSER_APPLICATION_PROVIDERS);
2729
});
28-
}).then(function() {
30+
}).then(function () {
2931
return Promise.all(
3032
Object.keys(window.__karma__.files)
3133
.filter(onlySpecFiles)
32-
.map(function(moduleName) {
34+
.map(function (moduleName) {
3335
return System.import(moduleName);
3436
}));
35-
}).then(function() {
37+
}).then(function () {
3638
__karma__.start();
37-
}, function(error) {
39+
}, function (error) {
3840
__karma__.error(error.stack || error);
3941
});
4042

addon/ng2/blueprints/ng2/files/karma.conf.js

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = function(config) {
1+
module.exports = function (config) {
22
config.set({
33
basePath: '',
44
frameworks: ['jasmine'],
@@ -9,39 +9,39 @@ module.exports = function(config) {
99
customLaunchers: {
1010
// chrome setup for travis CI using chromium
1111
Chrome_travis_ci: {
12-
base: 'Chrome',
13-
flags: ['--no-sandbox']
14-
},
12+
base: 'Chrome',
13+
flags: ['--no-sandbox']
14+
}
1515
},
1616
files: [
17-
{pattern: 'node_modules/systemjs/dist/system-polyfills.js', included: true, watched: true},
18-
{pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: true},
19-
{pattern: 'node_modules/es6-shim/es6-shim.js', included: true, watched: true},
20-
{pattern: 'node_modules/angular2/bundles/angular2-polyfills.js', included: true, watched: true},
21-
{pattern: 'node_modules/rxjs/bundles/Rx.js', included: true, watched: true},
22-
{pattern: 'node_modules/angular2/bundles/angular2.js', included: true, watched: true},
23-
{pattern: 'node_modules/angular2/bundles/http.dev.js', included: true, watched: true},
24-
{pattern: 'node_modules/angular2/bundles/router.dev.js', included: true, watched: true},
25-
{pattern: 'node_modules/angular2/bundles/testing.dev.js', included: true, watched: true},
17+
{ pattern: 'node_modules/systemjs/dist/system-polyfills.js', included: true, watched: true },
18+
{ pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: true },
19+
{ pattern: 'node_modules/es6-shim/es6-shim.js', included: true, watched: true },
20+
{ pattern: 'node_modules/angular2/bundles/angular2-polyfills.js', included: true, watched: true },
21+
{ pattern: 'node_modules/rxjs/bundles/Rx.js', included: true, watched: true },
22+
{ pattern: 'node_modules/angular2/bundles/angular2.js', included: true, watched: true },
23+
{ pattern: 'node_modules/angular2/bundles/http.dev.js', included: true, watched: true },
24+
{ pattern: 'node_modules/angular2/bundles/router.dev.js', included: true, watched: true },
25+
{ pattern: 'node_modules/angular2/bundles/testing.dev.js', included: true, watched: true },
2626

2727

28-
{pattern: 'karma-test-shim.js', included: true, watched: true},
28+
{ pattern: 'karma-test-shim.js', included: true, watched: true },
2929

3030
// paths loaded via module imports
31-
{pattern: 'dist/**/*.js', included: false, watched: true},
31+
{ pattern: 'dist/**/*.js', included: false, watched: true },
3232

3333
// paths loaded via Angular's component compiler
3434
// (these paths need to be rewritten, see proxies section)
35-
{pattern: 'dist/**/*.html', included: false, watched: true},
36-
{pattern: 'dist/**/*.css', included: false, watched: true},
35+
{ pattern: 'dist/**/*.html', included: false, watched: true },
36+
{ pattern: 'dist/**/*.css', included: false, watched: true },
3737

3838
// paths to support debugging with source maps in dev tools
39-
{pattern: 'dist/**/*.ts', included: false, watched: false},
40-
{pattern: 'dist/**/*.js.map', included: false, watched: false}
39+
{ pattern: 'dist/**/*.ts', included: false, watched: false },
40+
{ pattern: 'dist/**/*.js.map', included: false, watched: false }
4141
],
4242
proxies: {
4343
// required for component assets fetched by Angular's compiler
44-
"/app/": "/base/dist/app/"
44+
'/app/': '/base/dist/app/'
4545
},
4646
exclude: [],
4747
preprocessors: {},

addon/ng2/blueprints/ng2/files/protractor.conf.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/*global jasmine */
12
var SpecReporter = require('jasmine-spec-reporter');
23

34
exports.config = {
@@ -24,5 +25,5 @@ exports.config = {
2425
},
2526
onPrepare: function() {
2627
jasmine.getEnv().addReporter(new SpecReporter());
27-
},
28+
}
2829
};

addon/ng2/blueprints/ng2/index.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ module.exports = {
44
description: '',
55

66
locals: function(options) {
7-
// Return custom template variables here.
8-
return {
9-
htmlComponentName: stringUtils.dasherize(options.entity.name),
10-
jsComponentName: stringUtils.classify(options.entity.name)
11-
};
7+
// Return custom template variables here.
8+
return {
9+
htmlComponentName: stringUtils.dasherize(options.entity.name),
10+
jsComponentName: stringUtils.classify(options.entity.name)
11+
};
1212
}
1313

1414
// afterInstall: function(options) {

addon/ng2/blueprints/pipe/index.js

+7-10
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
1-
var stringUtils = require('ember-cli/lib/utilities/string');
21
var dynamicPathParser = require('../../utilities/dynamic-path-parser');
32

43
module.exports = {
54
description: '',
65

7-
normalizeEntityName: function(entityName) {
6+
normalizeEntityName: function (entityName) {
87
var parsedPath = dynamicPathParser(this.project, entityName);
9-
8+
109
this.dynamicPath = parsedPath;
1110
return parsedPath.name;
1211
},
1312

14-
locals: function(options) {
15-
return {
16-
dynamicPath: this.dynamicPath.dir
17-
};
13+
locals: function () {
14+
return { dynamicPath: this.dynamicPath.dir };
1815
},
1916

20-
fileMapTokens: function(options) {
17+
fileMapTokens: function () {
2118
// Return custom template variables here.
2219
return {
23-
__name__: (options) => {
20+
__name__: () => {
2421
return this.dynamicPath.name;
2522
},
26-
__path__: (options) => {
23+
__path__: () => {
2724
return this.dynamicPath.dir;
2825
}
2926
};

addon/ng2/blueprints/route-config/index.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module.exports = {
1515
try {
1616
fs.unlinkSync(routeConfigPath);
1717
} catch (e) {
18+
// doing nothing here
1819
}
1920
}
2021
};
@@ -23,17 +24,16 @@ function generateLocals(options) {
2324
var ngCliConfigPath = path.join(options.project.root, 'angular-cli.json');
2425
var ngCliConfig = JSON.parse(fs.readFileSync(ngCliConfigPath, 'utf-8'));
2526

26-
imports = ngCliConfig.routes.map(route =>
27-
`import {${route.component}} from '${route.componentPath}';`)
28-
.join('\n');
27+
imports =
28+
ngCliConfig.routes.map(route => `import {${route.component}} from '${route.componentPath}';`)
29+
.join('\n');
2930

30-
routeDefinitions = ngCliConfig.routes.map(route =>
31-
`{path: '${route.routePath}', name: '${route.component}', component: ${route.component}},`
32-
)
33-
.join('\n');
31+
routeDefinitions =
32+
ngCliConfig.routes
33+
.map(
34+
route =>
35+
`{path: '${route.routePath}', name: '${route.component}', component: ${route.component}},`)
36+
.join('\n');
3437

35-
return {
36-
imports,
37-
routeDefinitions
38-
}
39-
}
38+
return { imports, routeDefinitions }
39+
}
+4-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
var stringUtils = require('ember-cli/lib/utilities/string');
2-
31
module.exports = {
42
description: '',
5-
3+
64
// ******************************************************
75
// ******************************************************
86
// LEAVE THIS HERE
97
// Must override install to prevent ember's route tests
108
// ******************************************************
119
// ******************************************************
12-
13-
install: function(options){}
10+
11+
install: function () {
12+
}
1413
};

0 commit comments

Comments
 (0)