Skip to content

Commit

Permalink
style(lint): fix updated rules
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieMason committed Dec 16, 2018
1 parent b765eae commit c910bbb
Show file tree
Hide file tree
Showing 106 changed files with 1,391 additions and 553 deletions.
10 changes: 5 additions & 5 deletions examples/jasmine-cli/src/sum.spec.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
describe('sum(a, b)', function () {
beforeEach(function () {
describe('sum(a, b)', function() {
beforeEach(function() {
this.sum = require('./sum');
});
it('is a function', function () {
it('is a function', function() {
expect(this.sum).toBeFunction();
});
it('returns a number', function () {
it('returns a number', function() {
expect(this.sum(1, 2)).toBeNumber();
});
it('add numbers correctly', function () {
it('add numbers correctly', function() {
expect(this.sum(1, 2)).toEqual(3);
});
});
10 changes: 5 additions & 5 deletions examples/jest/src/sum.spec.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
describe('sum(a, b)', function () {
beforeEach(function () {
describe('sum(a, b)', function() {
beforeEach(function() {
this.sum = require('./sum');
});
it('is a function', function () {
it('is a function', function() {
expect(this.sum).toBeFunction();
});
it('returns a number', function () {
it('returns a number', function() {
expect(this.sum(1, 2)).toBeNumber();
});
it('add numbers correctly', function () {
it('add numbers correctly', function() {
expect(this.sum(1, 2)).toEqual(3);
});
});
20 changes: 5 additions & 15 deletions examples/karma/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
module.exports = function (config) {
module.exports = function(config) {
config.set({
autoWatch: false,
basePath: '',
browsers: [
'Chrome'
],
browsers: ['Chrome'],
colors: true,
concurrency: Infinity,
exclude: [],
files: [
'src/**/*.js',
'src/**/*.spec.js'
],
frameworks: [
'jasmine',
'jasmine-matchers'
],
files: ['src/**/*.js', 'src/**/*.spec.js'],
frameworks: ['jasmine', 'jasmine-matchers'],
logLevel: config.LOG_INFO,
plugins: [
'karma-chrome-launcher',
Expand All @@ -24,9 +16,7 @@ module.exports = function (config) {
],
port: 9876,
preprocessors: {},
reporters: [
'progress'
],
reporters: ['progress'],
singleRun: true
});
};
2 changes: 1 addition & 1 deletion examples/karma/src/sum.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
window.sum = function (a, b) {
window.sum = function(a, b) {
return a + b;
};
8 changes: 4 additions & 4 deletions examples/karma/src/sum.spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
describe('sum(a, b)', function () {
it('is a function', function () {
describe('sum(a, b)', function() {
it('is a function', function() {
expect(window.sum).toBeFunction();
});
it('returns a number', function () {
it('returns a number', function() {
expect(window.sum(1, 2)).toBeNumber();
});
it('add numbers correctly', function () {
it('add numbers correctly', function() {
expect(window.sum(1, 2)).toEqual(3);
});
});
5 changes: 1 addition & 4 deletions examples/protractor/conf.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: [
'node_modules/jasmine-expect/index.js',
'src/**/*.e2e.spec.js'
]
specs: ['node_modules/jasmine-expect/index.js', 'src/**/*.e2e.spec.js']
};
12 changes: 6 additions & 6 deletions examples/protractor/src/calculator.e2e.spec.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
describe('Protractor Example', function () {
describe('Protractor', function () {
it('should be configured correctly', function () {
describe('Protractor Example', function() {
describe('Protractor', function() {
it('should be configured correctly', function() {
browser.get('http://juliemr.github.io/protractor-demo/');
expect(browser.getTitle()).toEqual('Super Calculator');
});
});
describe('Jasmine Matchers', function () {
it('should be configured correctly', function () {
expect(function () {}).toBeFunction();
describe('Jasmine Matchers', function() {
it('should be configured correctly', function() {
expect(function() {}).toBeFunction();
expect(666).toBeNumber();
});
});
Expand Down
64 changes: 36 additions & 28 deletions karma/base.conf.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = function (config) {
module.exports = function(config) {
config.set({
autoWatch: false,
basePath: '..',
Expand All @@ -11,33 +11,41 @@ module.exports = function (config) {
noCompact: true
}
},
reporters: [{
type: 'html',
subdir: 'report-html'
}, {
type: 'lcov',
subdir: 'report-lcov'
}, {
type: 'cobertura',
subdir: '.',
file: 'cobertura.txt'
}, {
type: 'lcovonly',
subdir: '.',
file: 'report-lcovonly.txt'
}, {
type: 'teamcity',
subdir: '.',
file: 'teamcity.txt'
}, {
type: 'text',
subdir: '.',
file: 'text.txt'
}, {
type: 'text-summary',
subdir: '.',
file: 'text-summary.txt'
}]
reporters: [
{
type: 'html',
subdir: 'report-html'
},
{
type: 'lcov',
subdir: 'report-lcov'
},
{
type: 'cobertura',
subdir: '.',
file: 'cobertura.txt'
},
{
type: 'lcovonly',
subdir: '.',
file: 'report-lcovonly.txt'
},
{
type: 'teamcity',
subdir: '.',
file: 'teamcity.txt'
},
{
type: 'text',
subdir: '.',
file: 'text.txt'
},
{
type: 'text-summary',
subdir: '.',
file: 'text-summary.txt'
}
]
},
files: ['dist/jasmine-matchers.js', 'dist/jasmine-matchers.spec.js'],
frameworks: ['jasmine'],
Expand Down
8 changes: 2 additions & 6 deletions karma/browserstack-android.conf.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
const baseConfig = require('./browserstack.conf');

module.exports = function (config) {
module.exports = function(config) {
baseConfig({
set(base) {
base.browsers = [
'android-7.0',
'android-7.1',
'android-8.0'
];
base.browsers = ['android-7.0', 'android-7.1', 'android-8.0'];
config.set(base);
}
});
Expand Down
8 changes: 2 additions & 6 deletions karma/browserstack-chrome.conf.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
const baseConfig = require('./browserstack.conf');

module.exports = function (config) {
module.exports = function(config) {
baseConfig({
set(base) {
base.browsers = [
'chrome-61.0',
'chrome-62.0',
'chrome-63.0'
];
base.browsers = ['chrome-61.0', 'chrome-62.0', 'chrome-63.0'];
config.set(base);
}
});
Expand Down
8 changes: 2 additions & 6 deletions karma/browserstack-firefox.conf.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
const baseConfig = require('./browserstack.conf');

module.exports = function (config) {
module.exports = function(config) {
baseConfig({
set(base) {
base.browsers = [
'firefox-55.0',
'firefox-56.0',
'firefox-57.0'
];
base.browsers = ['firefox-55.0', 'firefox-56.0', 'firefox-57.0'];
config.set(base);
}
});
Expand Down
8 changes: 2 additions & 6 deletions karma/browserstack-ie.conf.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
const baseConfig = require('./browserstack.conf');

module.exports = function (config) {
module.exports = function(config) {
baseConfig({
set(base) {
base.browsers = [
'ie-9.0',
'ie-10.0',
'ie-11.0'
];
base.browsers = ['ie-9.0', 'ie-10.0', 'ie-11.0'];
config.set(base);
}
});
Expand Down
6 changes: 2 additions & 4 deletions karma/browserstack-ios.conf.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
const baseConfig = require('./browserstack.conf');

module.exports = function (config) {
module.exports = function(config) {
baseConfig({
set(base) {
base.browsers = [
'iphone-10.3'
];
base.browsers = ['iphone-10.3'];
config.set(base);
}
});
Expand Down
6 changes: 2 additions & 4 deletions karma/browserstack-opera.conf.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
const baseConfig = require('./browserstack.conf');

module.exports = function (config) {
module.exports = function(config) {
baseConfig({
set(base) {
base.browsers = [
'opera-12.16'
];
base.browsers = ['opera-12.16'];
config.set(base);
}
});
Expand Down
8 changes: 2 additions & 6 deletions karma/browserstack-safari.conf.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
const baseConfig = require('./browserstack.conf');

module.exports = function (config) {
module.exports = function(config) {
baseConfig({
set(base) {
base.browsers = [
'safari-9.1',
'safari-10.1',
'safari-11.0'
];
base.browsers = ['safari-9.1', 'safari-10.1', 'safari-11.0'];
config.set(base);
}
});
Expand Down
2 changes: 1 addition & 1 deletion karma/browserstack.conf.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const baseConfig = require('./cloud.conf');
const platforms = require('./browserstack.json');

module.exports = function (config) {
module.exports = function(config) {
baseConfig({
set(base) {
base.browsers = Object.keys(platforms);
Expand Down
24 changes: 18 additions & 6 deletions karma/browserstack.update.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,22 @@ const childProcess = require('child_process');
const fs = require('fs');
const path = require('path');

const res = childProcess.execSync('curl -u "' + process.env.BROWSERSTACK_USERNAME + ':' + process.env.BROWSERSTACK_ACCESS_KEY + '" https://www.browserstack.com/automate/browsers.json', {
encoding: 'utf8'
});
const res = childProcess.execSync(
'curl -u "' +
process.env.BROWSERSTACK_USERNAME +
':' +
process.env.BROWSERSTACK_ACCESS_KEY +
'" https://www.browserstack.com/automate/browsers.json',
{
encoding: 'utf8'
}
);
const browsers = JSON.parse(res);
const location = path.join(__dirname, 'browserstack.json');
const config = browsers.sort(sortBy('browser_version')).sort(sortBy('browser')).reduce(addBrowser, {});
const config = browsers
.sort(sortBy('browser_version'))
.sort(sortBy('browser'))
.reduce(addBrowser, {});
const json = JSON.stringify(config, null, 2);
fs.writeFileSync(location, json, 'utf8');

Expand All @@ -24,14 +34,16 @@ function addBrowser(memo, browser) {
}

function getBrowserName(browser) {
return browser.browser + '-' + (browser.browser_version || browser.os_version);
return (
browser.browser + '-' + (browser.browser_version || browser.os_version)
);
}

function sortBy(key, reverse) {
const moveSmaller = reverse ? 1 : -1;
const moveLarger = reverse ? -1 : 1;

return function (a, b) {
return function(a, b) {
if (a[key] < b[key]) {
return moveSmaller;
}
Expand Down
2 changes: 1 addition & 1 deletion karma/cloud.conf.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const baseConfig = require('./base.conf');

module.exports = function (config) {
module.exports = function(config) {
baseConfig({
set(base) {
base.browserDisconnectTimeout = 10000; // Default 2000
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"build:readme": "node ./scripts/generate-readme.js",
"build:snippets": "node scripts/generate-snippets.js",
"clean": "rimraf dist ./test/dist ./scripts/es5-snippets ./scripts/es6-snippets",
"format": "prettier --write '**/*.md' './src/**/*.ts' './test/**/*.ts'",
"format": "prettier --write './+(examples|karma|scripts|src)/**/*.+(js|ts)'",
"lint": "tslint --fix --project ./tsconfig.json",
"prebuild": "npm run clean",
"prebuild:snippets": "mkdir -p ./scripts/es5-snippets && mkdir -p ./scripts/es6-snippets",
Expand Down
Loading

0 comments on commit c910bbb

Please sign in to comment.