Skip to content
This repository has been archived by the owner on Apr 13, 2022. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
chore(eslint): enable quotes: ["error", "single"]
The quotes rule had to be disabled for e2e tests generated from ngdoc
because dgeni templates use double quotes as string delimiters.

Since we can't have guarantees that dgeni template wrappers will follow
the same JS code style the Angular 1 repo uses, we should find a way
to enforce our ESLint setup only for the parts in this repo, perhaps
via prepending a generated `/* eslint-enable OUR_RULES */` pragma.

Closes #15011
  • Loading branch information
mgol committed Aug 10, 2016
1 parent 42a0061 commit 9360aa2
Show file tree
Hide file tree
Showing 172 changed files with 2,119 additions and 2,111 deletions.
1 change: 1 addition & 0 deletions .eslintrc-base.json
Expand Up @@ -104,6 +104,7 @@
"no-spaced-func": "error",
"no-trailing-spaces": "error",
"no-unneeded-ternary": "error",
"quotes": ["error", "single"],
"semi-spacing": "error",
"semi": "error",
"space-before-blocks": ["error", "always"],
Expand Down
3 changes: 1 addition & 2 deletions .eslintrc-todo.json
Expand Up @@ -20,7 +20,6 @@
"key-spacing": ["error", { "beforeColon": false, "afterColon": true, "mode": "minimum" }],
"object-curly-spacing": ["error", "never"],
"object-property-newline": ["error", { "allowMultiplePropertiesPerLine": true }],
"operator-linebreak": ["error", "after", { "overrides": { "?": "before", ":": "before" }}],
"quotes": ["error", "single"]
"operator-linebreak": ["error", "after", { "overrides": { "?": "before", ":": "before" }}]
}
}
2 changes: 1 addition & 1 deletion Gruntfile.js
Expand Up @@ -205,7 +205,7 @@ module.exports = function(grunt) {
dest: 'build/angular-parse-ext.js',
src: util.wrap(files['angularModules']['ngParseExt'], 'module')
},
"promises-aplus-adapter": {
'promises-aplus-adapter': {
dest:'tmp/promises-aplus-adapter++.js',
src:['src/ng/q.js', 'lib/promises-aplus/promises-aplus-test-adapter.js']
}
Expand Down
2 changes: 1 addition & 1 deletion angularFiles.js
Expand Up @@ -209,7 +209,7 @@ var angularFiles = {
'build/docs/docs-scenario.js'
],

"karmaModules": [
'karmaModules': [
'build/angular.js',
'@angularSrcModules',
'test/modules/no_bootstrap.js',
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/ng-options-bp/app.js
@@ -1,4 +1,4 @@
"use strict";
'use strict';

/* globals angular, benchmarkSteps */

Expand Down
4 changes: 2 additions & 2 deletions benchmarks/orderby-bp/bp.conf.js
Expand Up @@ -6,8 +6,8 @@ module.exports = function(config) {
config.set({
scripts: [
{
"id": "jquery",
"src": "jquery-noop.js"
'id': 'jquery',
'src': 'jquery-noop.js'
}, {
id: 'angular',
src: '/build/angular.js'
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/select-ng-value-bp/app.js
@@ -1,4 +1,4 @@
"use strict";
'use strict';

/* globals angular, benchmarkSteps */

Expand Down
2 changes: 1 addition & 1 deletion changelog.js
Expand Up @@ -160,7 +160,7 @@ var writeChangelog = function(stream, commits, version) {
if (commit.breaking) {
sections.breaks[component] = sections.breaks[component] || [];
sections.breaks[component].push({
subject: util.format("due to %s,\n %s", linkToCommit(commit.hash), commit.breaking),
subject: util.format('due to %s,\n %s', linkToCommit(commit.hash), commit.breaking),
hash: commit.hash,
closes: []
});
Expand Down
8 changes: 4 additions & 4 deletions docs/app/e2e/api-docs/api-pages.scenario.js
@@ -1,10 +1,10 @@
'use strict';

describe("doc.angularjs.org", function() {
describe('doc.angularjs.org', function() {

describe("API pages", function() {
describe('API pages', function() {

it("should display links to code on GitHub", function() {
it('should display links to code on GitHub', function() {
browser.get('build/docs/index.html#!/api/ng/service/$http');
expect(element(by.css('.improve-docs')).getAttribute('href')).toMatch(/https?:\/\/github\.com\/angular\/angular\.js\/edit\/.+\/src\/ng\/http\.js/);

Expand Down Expand Up @@ -38,7 +38,7 @@ describe("doc.angularjs.org", function() {
expect(code.getText()).toContain('guest!!!');
});

it("should trim indentation from code blocks", function() {
it('should trim indentation from code blocks', function() {
browser.get('build/docs/index.html#!/api/ng/type/$rootScope.Scope');

var codeBlocks = element.all(by.css('pre > code.lang-js'));
Expand Down
4 changes: 2 additions & 2 deletions docs/app/e2e/api-docs/provider-pages.scenario.js
@@ -1,8 +1,8 @@
'use strict';

describe("provider pages", function() {
describe('provider pages', function() {

it("should show the related service", function() {
it('should show the related service', function() {
browser.get('build/docs/index.html#!/api/ng/provider/$compileProvider');
var serviceLink = element.all(by.css('ol.api-profile-header-structure li a')).first();
expect(serviceLink.getText()).toEqual('- $compile');
Expand Down
6 changes: 3 additions & 3 deletions docs/app/e2e/api-docs/service-pages.scenario.js
@@ -1,8 +1,8 @@
'use strict';

describe("service pages", function() {
describe('service pages', function() {

it("should show the related provider if there is one", function() {
it('should show the related provider if there is one', function() {
browser.get('build/docs/index.html#!/api/ng/service/$compile');
var providerLink = element.all(by.css('ol.api-profile-header-structure li a')).first();
expect(providerLink.getText()).toEqual('- $compileProvider');
Expand All @@ -14,7 +14,7 @@ describe("service pages", function() {
expect(providerLink.getAttribute('href')).not.toMatch(/api\/ng\/provider\/\$compileProvider/);
});

it("should show parameter defaults", function() {
it('should show parameter defaults', function() {
browser.get('build/docs/index.html#!/api/ng/service/$timeout');
expect(element.all(by.css('.input-arguments p em')).first().getText()).toContain('(default: 0)');
});
Expand Down
4 changes: 2 additions & 2 deletions docs/app/e2e/app.scenario.js
Expand Up @@ -73,10 +73,10 @@ describe('docs.angularjs.org', function() {

it('should display formatted error messages on error doc pages', function() {
browser.get('build/docs/index-production.html#!error/ng/areq?p0=Missing&p1=not%20a%20function,%20got%20undefined');
expect(element(by.css('.minerr-errmsg')).getText()).toEqual("Argument 'Missing' is not a function, got undefined");
expect(element(by.css('.minerr-errmsg')).getText()).toEqual('Argument \'Missing\' is not a function, got undefined');
});

it("should display an error if the page does not exist", function() {
it('should display an error if the page does not exist', function() {
browser.get('build/docs/index-production.html#!/api/does/not/exist');
expect(element(by.css('h1')).getText()).toBe('Oops!');
});
Expand Down
2 changes: 1 addition & 1 deletion docs/app/src/docs.js
Expand Up @@ -54,7 +54,7 @@ angular.module('DocsController', [])
***********************************/

$scope.versionNumber = angular.version.full;
$scope.version = angular.version.full + " " + angular.version.codeName;
$scope.version = angular.version.full + ' ' + angular.version.codeName;
$scope.loading = 0;


Expand Down
8 changes: 4 additions & 4 deletions docs/app/src/examples.js
Expand Up @@ -138,8 +138,8 @@ angular.module('examples', [])
var newWindow = clickEvent.ctrlKey || clickEvent.metaKey;

var postData = {
'tags[0]': "angularjs",
'tags[1]': "example",
'tags[0]': 'angularjs',
'tags[1]': 'example',
'private': true
};

Expand Down Expand Up @@ -183,8 +183,8 @@ angular.module('examples', [])

// The manifests provide the production index file but Plunkr wants
// a straight index.html
if (filename === "index-production.html") {
filename = "index.html";
if (filename === 'index-production.html') {
filename = 'index.html';
}

return {
Expand Down
2 changes: 1 addition & 1 deletion docs/app/test/directivesSpec.js
@@ -1,6 +1,6 @@
'use strict';

describe("code", function() {
describe('code', function() {
var prettyPrintOne, oldPP;
var compile, scope;

Expand Down
6 changes: 3 additions & 3 deletions docs/app/test/docsSpec.js
@@ -1,6 +1,6 @@
'use strict';

describe("DocsController", function() {
describe('DocsController', function() {
var $scope;

angular.module('fake', [])
Expand All @@ -17,15 +17,15 @@ describe("DocsController", function() {


describe('afterPartialLoaded', function() {
it("should update the Google Analytics with currentPage path if currentPage exists", inject(function($window) {
it('should update the Google Analytics with currentPage path if currentPage exists', inject(function($window) {
$window._gaq = [];
$scope.currentPage = { path: 'a/b/c' };
$scope.$broadcast('$includeContentLoaded');
expect($window._gaq.pop()).toEqual(['_trackPageview', 'a/b/c']);
}));


it("should update the Google Analytics with $location.path if currentPage is missing", inject(function($window, $location) {
it('should update the Google Analytics with $location.path if currentPage is missing', inject(function($window, $location) {
$window._gaq = [];
spyOn($location, 'path').and.returnValue('x/y/z');
$scope.$broadcast('$includeContentLoaded');
Expand Down
2 changes: 1 addition & 1 deletion docs/config/index.js
@@ -1,4 +1,4 @@
"use strict";
'use strict';

var path = require('canonical-path');
var packagePath = __dirname;
Expand Down
2 changes: 1 addition & 1 deletion docs/config/processors/index-page.js
@@ -1,4 +1,4 @@
"use strict";
'use strict';

var _ = require('lodash');

Expand Down
2 changes: 1 addition & 1 deletion docs/config/processors/keywords.js
@@ -1,4 +1,4 @@
"use strict";
'use strict';

var _ = require('lodash');
var fs = require('fs');
Expand Down
2 changes: 1 addition & 1 deletion docs/config/processors/versions-data.js
@@ -1,4 +1,4 @@
"use strict";
'use strict';

var _ = require('lodash');

Expand Down
2 changes: 1 addition & 1 deletion docs/config/services/deployments/debug.js
@@ -1,4 +1,4 @@
"use strict";
'use strict';

module.exports = function debugDeployment(getVersion) {
return {
Expand Down
2 changes: 1 addition & 1 deletion docs/config/services/deployments/default.js
@@ -1,4 +1,4 @@
"use strict";
'use strict';

module.exports = function defaultDeployment(getVersion) {
return {
Expand Down
2 changes: 1 addition & 1 deletion docs/config/services/deployments/jquery.js
@@ -1,4 +1,4 @@
"use strict";
'use strict';

module.exports = function jqueryDeployment(getVersion) {
return {
Expand Down
4 changes: 2 additions & 2 deletions docs/config/services/deployments/production.js
@@ -1,7 +1,7 @@
"use strict";
'use strict';

var versionInfo = require('../../../../lib/versions/version-info');
var cdnUrl = "//ajax.googleapis.com/ajax/libs/angularjs/" + versionInfo.cdnVersion;
var cdnUrl = '//ajax.googleapis.com/ajax/libs/angularjs/' + versionInfo.cdnVersion;

module.exports = function productionDeployment(getVersion) {
return {
Expand Down
2 changes: 1 addition & 1 deletion docs/config/services/errorNamespaceMap.js
@@ -1,4 +1,4 @@
"use strict";
'use strict';
var StringMap = require('stringmap');

/**
Expand Down
2 changes: 1 addition & 1 deletion docs/config/services/getMinerrInfo.js
@@ -1,4 +1,4 @@
"use strict";
'use strict';

var path = require('canonical-path');

Expand Down
2 changes: 1 addition & 1 deletion docs/config/services/getVersion.js
@@ -1,4 +1,4 @@
"use strict";
'use strict';
var path = require('canonical-path');

/**
Expand Down
12 changes: 6 additions & 6 deletions docs/content/guide/$location.ngdoc
Expand Up @@ -409,9 +409,9 @@ In these examples we use `<base href="/base/index.html" />`. The inputs represen
.constant('baseHref', '/base/index.html')
.value('$sniffer', { history: true })

.controller("LocationController", function($scope, $location) {
.controller('LocationController', function($scope, $location) {
$scope.$location = {};
angular.forEach("protocol host port path search hash".split(" "), function(method) {
angular.forEach('protocol host port path search hash'.split(' '), function(method) {
$scope.$location[method] = function() {
var result = $location[method]();
return angular.isObject(result) ? angular.toJson(result) : result;
Expand Down Expand Up @@ -461,7 +461,7 @@ In these examples we use `<base href="/base/index.html" />`. The inputs represen
return {
template: 'Address: <input id="addressBar" type="text" style="width: 400px" >',
link: function(scope, element, attrs) {
var input = element.children("input"), delay;
var input = element.children('input'), delay;

input.on('keypress keyup keydown', function(event) {
delay = (!delay ? $timeout(fireUrlChange, 250) : null);
Expand Down Expand Up @@ -563,9 +563,9 @@ In these examples we use `<base href="/base/index.html" />`. The inputs represen
$locationProvider.html5Mode(true).hashPrefix('!');
})

.controller("LocationController", function($scope, $location) {
.controller('LocationController', function($scope, $location) {
$scope.$location = {};
angular.forEach("protocol host port path search hash".split(" "), function(method) {
angular.forEach('protocol host port path search hash'.split(' '), function(method) {
$scope.$location[method] = function() {
var result = $location[method]();
return angular.isObject(result) ? angular.toJson(result) : result;
Expand Down Expand Up @@ -615,7 +615,7 @@ In these examples we use `<base href="/base/index.html" />`. The inputs represen
return {
template: 'Address: <input id="addressBar" type="text" style="width: 400px" >',
link: function(scope, element, attrs) {
var input = element.children("input"), delay;
var input = element.children('input'), delay;

input.on('keypress keyup keydown', function(event) {
delay = (!delay ? $timeout(fireUrlChange, 250) : null);
Expand Down
6 changes: 3 additions & 3 deletions docs/content/guide/concepts.ngdoc
Expand Up @@ -121,7 +121,7 @@ different currencies and also pay the invoice.
return amount * this.usdToForeignRates[outCurr] / this.usdToForeignRates[inCurr];
};
this.pay = function pay() {
window.alert("Thanks!");
window.alert('Thanks!');
};
});
</file>
Expand Down Expand Up @@ -221,7 +221,7 @@ Let's refactor our example and move the currency conversion into a service in an
return currencyConverter.convert(this.qty * this.cost, this.inCurr, outCurr);
};
this.pay = function pay() {
window.alert("Thanks!");
window.alert('Thanks!');
};
}]);
</file>
Expand Down Expand Up @@ -313,7 +313,7 @@ The following example shows how this is done with Angular:
return currencyConverter.convert(this.qty * this.cost, this.inCurr, outCurr);
};
this.pay = function pay() {
window.alert("Thanks!");
window.alert('Thanks!');
};
}]);
</file>
Expand Down
2 changes: 1 addition & 1 deletion docs/content/guide/controller.ngdoc
Expand Up @@ -186,7 +186,7 @@ previous example.
var myApp = angular.module('spicyApp2', []);

myApp.controller('SpicyController', ['$scope', function($scope) {
$scope.customSpice = "wasabi";
$scope.customSpice = 'wasabi';
$scope.spice = 'very';

$scope.spicy = function(spice) {
Expand Down
2 changes: 1 addition & 1 deletion docs/content/guide/filter.ngdoc
Expand Up @@ -139,7 +139,7 @@ text upper-case.
.filter('reverse', function() {
return function(input, uppercase) {
input = input || '';
var out = "";
var out = '';
for (var i = 0; i < input.length; i++) {
out = input.charAt(i) + out;
}
Expand Down
8 changes: 4 additions & 4 deletions docs/content/guide/i18n.ngdoc
Expand Up @@ -226,11 +226,11 @@ You may find it helpful to play with the following example as you read the expla

angular.module('messageFormatExample', ['ngMessageFormat'])
.controller('ckCtrl', function($scope, $injector, $parse) {
var people = [new Person("Alice", "female"),
new Person("Bob", "male"),
new Person("Charlie", "male")];
var people = [new Person('Alice', 'female'),
new Person('Bob', 'male'),
new Person('Charlie', 'male')];

$scope.sender = new Person("Harry Potter", "male");
$scope.sender = new Person('Harry Potter', 'male');
$scope.recipients = people.slice();

$scope.setNumRecipients = function(n) {
Expand Down
2 changes: 1 addition & 1 deletion docs/content/guide/services.ngdoc
Expand Up @@ -53,7 +53,7 @@ subsystem takes care of the rest.
return function(msg) {
msgs.push(msg);
if (msgs.length === 3) {
win.alert(msgs.join("\n"));
win.alert(msgs.join('\n'));
msgs = [];
}
};
Expand Down
10 changes: 9 additions & 1 deletion docs/gulpfile.js
Expand Up @@ -39,8 +39,16 @@ var getMergedEslintConfig = function(filepath) {
// While alerts would be bad to have in the library or test code,
// they're perfectly fine in examples.
'no-alert': 'off',

// The following rules have to be disabled or tweaked because dgeni template wrappers
// don't follow them and we have no way to validate only the parts taken
// from ngdoc.

// some dgeni-packages templates generate whitespace-only lines
'no-trailing-spaces': ['error', { 'skipBlankLines': true }]
'no-trailing-spaces': ['error', { 'skipBlankLines': true }],

// dgeni templates use double quotes as string delimiters
quotes: 'off'
},
ignore: false,
useEslintrc: false
Expand Down

0 comments on commit 9360aa2

Please sign in to comment.