Skip to content

Commit 1f6d584

Browse files
Just Use Prettier™
1 parent 44b73c3 commit 1f6d584

39 files changed

+7335
-5180
lines changed

karma.conf.js

+10-15
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Karma configuration file
2-
var karma = require("karma");
2+
var karma = require('karma');
33
var ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
4-
var DEFAULT_NG_VERSION = "1.6";
4+
var DEFAULT_NG_VERSION = '1.6';
55

66
/**
77
* This returns a Karma 'files configuration'.
@@ -24,7 +24,7 @@ function karmaServedFiles(ngVersion) {
2424
];
2525
}
2626

27-
var angularFiles = angular(ngVersion).map(function (pattern) {
27+
var angularFiles = angular(ngVersion).map(function(pattern) {
2828
return { watched: false, included: true, nocache: true, pattern: pattern };
2929
});
3030

@@ -41,7 +41,7 @@ module.exports = function(config) {
4141

4242
// level of logging
4343
// possible values: LOG_DISABLE, LOG_ERROR, LOG_WARN, LOG_INFO, LOG_DEBUG
44-
logLevel: "warn",
44+
logLevel: 'warn',
4545

4646
reporters: ['super-dots', 'mocha'],
4747
colors: true,
@@ -58,7 +58,7 @@ module.exports = function(config) {
5858
// Chrome, ChromeCanary, Firefox, Opera, Safari, PhantomJS
5959
browsers: ['ChromeHeadlessNoSandbox'],
6060
customLaunchers: {
61-
ChromeHeadlessNoSandbox: { base: 'ChromeHeadless', flags: ['--no-sandbox'] }
61+
ChromeHeadlessNoSandbox: { base: 'ChromeHeadless', flags: ['--no-sandbox'] },
6262
},
6363

6464
frameworks: ['jasmine'],
@@ -69,29 +69,25 @@ module.exports = function(config) {
6969
require('karma-super-dots-reporter'),
7070
require('karma-mocha-reporter'),
7171
require('karma-jasmine'),
72-
require('karma-chrome-launcher')
72+
require('karma-chrome-launcher'),
7373
],
7474

7575
webpack: {
7676
mode: 'development',
7777
resolve: {
7878
modules: ['node_modules'],
79-
extensions: ['.js', '.jsx', '.ts', '.tsx']
79+
extensions: ['.js', '.jsx', '.ts', '.tsx'],
8080
},
8181

8282
devtool: 'inline-source-map',
8383

8484
module: {
85-
rules: [
86-
{ test: /\.tsx?$/, loader: 'ts-loader', options: { transpileOnly: true } }
87-
]
85+
rules: [{ test: /\.tsx?$/, loader: 'ts-loader', options: { transpileOnly: true } }],
8886
},
8987

90-
plugins: [
91-
new ForkTsCheckerWebpackPlugin(),
92-
],
88+
plugins: [new ForkTsCheckerWebpackPlugin()],
9389

94-
externals: [ 'angular' ]
90+
externals: ['angular'],
9591
},
9692

9793
webpackMiddleware: {
@@ -105,6 +101,5 @@ module.exports = function(config) {
105101
'test/index.js': ['webpack', 'sourcemap'],
106102
'../src/ng1': ['webpack', 'sourcemap'],
107103
},
108-
109104
});
110105
};

rollup.config.js

+57-46
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,17 @@ const EVENTS = process.env.EVENTS;
99
const RESOLVE = process.env.RESOLVE;
1010

1111
const pkg = require('./package.json');
12-
let banner =
13-
`/**
12+
let banner = `/**
1413
* ${pkg.description}`;
1514
if (ROUTER && MONOLITHIC) {
1615
banner += `
1716
* NOTICE: This monolithic bundle also bundles the @uirouter/core code.
1817
* This causes it to be incompatible with plugins that depend on @uirouter/core.
1918
* We recommend switching to the ui-router-core.js and ui-router-angularjs.js bundles instead.
20-
* For more information, see https://ui-router.github.io/blog/uirouter-for-angularjs-umd-bundles`
19+
* For more information, see https://ui-router.github.io/blog/uirouter-for-angularjs-umd-bundles`;
2120
} else if (ROUTER) {
2221
banner += `
23-
* This bundle requires the ui-router-core.js bundle from the @uirouter/core package.`
22+
* This bundle requires the ui-router-core.js bundle from the @uirouter/core package.`;
2423
}
2524
banner += `
2625
* @version v${pkg.version}
@@ -30,25 +29,21 @@ banner += `
3029

3130
const uglifyOpts = { output: {} };
3231
// retain multiline comment with @license
33-
uglifyOpts.output.comments = (node, comment) =>
34-
comment.type === 'comment2' && /@license/i.test(comment.value);
32+
uglifyOpts.output.comments = (node, comment) => comment.type === 'comment2' && /@license/i.test(comment.value);
3533

36-
const onwarn = (warning) => {
34+
const onwarn = warning => {
3735
// Suppress this error message... https://github.com/rollup/rollup/wiki/Troubleshooting#this-is-undefined
3836
const ignores = ['THIS_IS_UNDEFINED'];
3937
if (!ignores.some(code => code === warning.code)) {
4038
console.error(warning.message);
4139
}
4240
};
4341

44-
const plugins = [
45-
nodeResolve({jsnext: true}),
46-
sourcemaps(),
47-
];
42+
const plugins = [nodeResolve({ jsnext: true }), sourcemaps()];
4843

4944
if (MINIFY) plugins.push(uglify(uglifyOpts));
5045

51-
const extension = MINIFY ? ".min.js" : ".js";
46+
const extension = MINIFY ? '.min.js' : '.js';
5247

5348
const BASE_CONFIG = {
5449
onwarn: onwarn,
@@ -60,53 +55,69 @@ const BASE_OUTPUT = {
6055
exports: 'named',
6156
format: 'umd',
6257
sourcemap: true,
63-
}
58+
};
6459

65-
const ROUTER_CONFIG = Object.assign({
66-
input: 'lib-esm/index.js',
67-
external: ['angular', '@uirouter/core'],
68-
output: Object.assign({
69-
file: 'release/ui-router-angularjs' + extension,
70-
name: '@uirouter/angularjs',
71-
globals: { angular: 'angular', '@uirouter/core': '@uirouter/core' },
72-
}, BASE_OUTPUT),
73-
}, BASE_CONFIG);
60+
const ROUTER_CONFIG = Object.assign(
61+
{
62+
input: 'lib-esm/index.js',
63+
external: ['angular', '@uirouter/core'],
64+
output: Object.assign(
65+
{
66+
file: 'release/ui-router-angularjs' + extension,
67+
name: '@uirouter/angularjs',
68+
globals: { angular: 'angular', '@uirouter/core': '@uirouter/core' },
69+
},
70+
BASE_OUTPUT,
71+
),
72+
},
73+
BASE_CONFIG,
74+
);
7475

7576
// Also bundles the code from @uirouter/core into the same bundle
76-
const MONOLITHIC_ROUTER_CONFIG = Object.assign({
77-
input: 'lib-esm/index.js',
78-
external: 'angular',
79-
output: Object.assign({
80-
file: 'release/angular-ui-router' + extension,
81-
name: '@uirouter/angularjs',
82-
globals: { angular: 'angular' },
83-
}, BASE_OUTPUT),
84-
}, BASE_CONFIG);
77+
const MONOLITHIC_ROUTER_CONFIG = Object.assign(
78+
{
79+
input: 'lib-esm/index.js',
80+
external: 'angular',
81+
output: Object.assign(
82+
{
83+
file: 'release/angular-ui-router' + extension,
84+
name: '@uirouter/angularjs',
85+
globals: { angular: 'angular' },
86+
},
87+
BASE_OUTPUT,
88+
),
89+
},
90+
BASE_CONFIG,
91+
);
8592

8693
const EVENTS_CONFIG = Object.assign({}, BASE_CONFIG, {
8794
input: 'lib-esm/legacy/stateEvents.js',
8895
external: ['angular', '@uirouter/core'],
89-
output: Object.assign({
90-
file: 'release/stateEvents' + extension,
91-
name: '@uirouter/angularjs-state-events',
92-
globals: { angular: 'angular', '@uirouter/core': '@uirouter/core' },
93-
}, BASE_OUTPUT),
96+
output: Object.assign(
97+
{
98+
file: 'release/stateEvents' + extension,
99+
name: '@uirouter/angularjs-state-events',
100+
globals: { angular: 'angular', '@uirouter/core': '@uirouter/core' },
101+
},
102+
BASE_OUTPUT,
103+
),
94104
});
95105

96106
const RESOLVE_CONFIG = Object.assign({}, BASE_CONFIG, {
97107
input: 'lib-esm/legacy/resolveService.js',
98108
external: ['angular', '@uirouter/core'],
99-
output: Object.assign({
100-
file: 'release/resolveService' + extension,
101-
name: '@uirouter/angularjs-resolve-service',
102-
globals: { angular: 'angular', '@uirouter/core': '@uirouter/core' },
103-
}, BASE_OUTPUT),
109+
output: Object.assign(
110+
{
111+
file: 'release/resolveService' + extension,
112+
name: '@uirouter/angularjs-resolve-service',
113+
globals: { angular: 'angular', '@uirouter/core': '@uirouter/core' },
114+
},
115+
BASE_OUTPUT,
116+
),
104117
});
105118

106-
const CONFIG =
107-
RESOLVE ? RESOLVE_CONFIG :
108-
EVENTS ? EVENTS_CONFIG :
109-
MONOLITHIC ? MONOLITHIC_ROUTER_CONFIG :
110-
ROUTER ? ROUTER_CONFIG : ROUTER_CONFIG;
119+
const CONFIG = RESOLVE
120+
? RESOLVE_CONFIG
121+
: EVENTS ? EVENTS_CONFIG : MONOLITHIC ? MONOLITHIC_ROUTER_CONFIG : ROUTER ? ROUTER_CONFIG : ROUTER_CONFIG;
111122

112123
export default CONFIG;

src/angular.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ declare var angular;
66
import * as ng_from_import from 'angular';
77
const ng_from_global = angular;
88

9-
export const ng = (ng_from_import && ng_from_import.module) ? ng_from_import : ng_from_global;
9+
export const ng = ng_from_import && ng_from_import.module ? ng_from_import : ng_from_global;

0 commit comments

Comments
 (0)