Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 9360aa2

Browse files
committed
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
1 parent 42a0061 commit 9360aa2

File tree

172 files changed

+2119
-2111
lines changed

Some content is hidden

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

172 files changed

+2119
-2111
lines changed

.eslintrc-base.json

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
"no-spaced-func": "error",
105105
"no-trailing-spaces": "error",
106106
"no-unneeded-ternary": "error",
107+
"quotes": ["error", "single"],
107108
"semi-spacing": "error",
108109
"semi": "error",
109110
"space-before-blocks": ["error", "always"],

.eslintrc-todo.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"key-spacing": ["error", { "beforeColon": false, "afterColon": true, "mode": "minimum" }],
2121
"object-curly-spacing": ["error", "never"],
2222
"object-property-newline": ["error", { "allowMultiplePropertiesPerLine": true }],
23-
"operator-linebreak": ["error", "after", { "overrides": { "?": "before", ":": "before" }}],
24-
"quotes": ["error", "single"]
23+
"operator-linebreak": ["error", "after", { "overrides": { "?": "before", ":": "before" }}]
2524
}
2625
}

Gruntfile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ module.exports = function(grunt) {
205205
dest: 'build/angular-parse-ext.js',
206206
src: util.wrap(files['angularModules']['ngParseExt'], 'module')
207207
},
208-
"promises-aplus-adapter": {
208+
'promises-aplus-adapter': {
209209
dest:'tmp/promises-aplus-adapter++.js',
210210
src:['src/ng/q.js', 'lib/promises-aplus/promises-aplus-test-adapter.js']
211211
}

angularFiles.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ var angularFiles = {
209209
'build/docs/docs-scenario.js'
210210
],
211211

212-
"karmaModules": [
212+
'karmaModules': [
213213
'build/angular.js',
214214
'@angularSrcModules',
215215
'test/modules/no_bootstrap.js',

benchmarks/ng-options-bp/app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"use strict";
1+
'use strict';
22

33
/* globals angular, benchmarkSteps */
44

benchmarks/orderby-bp/bp.conf.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ module.exports = function(config) {
66
config.set({
77
scripts: [
88
{
9-
"id": "jquery",
10-
"src": "jquery-noop.js"
9+
'id': 'jquery',
10+
'src': 'jquery-noop.js'
1111
}, {
1212
id: 'angular',
1313
src: '/build/angular.js'

benchmarks/select-ng-value-bp/app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"use strict";
1+
'use strict';
22

33
/* globals angular, benchmarkSteps */
44

changelog.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ var writeChangelog = function(stream, commits, version) {
160160
if (commit.breaking) {
161161
sections.breaks[component] = sections.breaks[component] || [];
162162
sections.breaks[component].push({
163-
subject: util.format("due to %s,\n %s", linkToCommit(commit.hash), commit.breaking),
163+
subject: util.format('due to %s,\n %s', linkToCommit(commit.hash), commit.breaking),
164164
hash: commit.hash,
165165
closes: []
166166
});

docs/app/e2e/api-docs/api-pages.scenario.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
'use strict';
22

3-
describe("doc.angularjs.org", function() {
3+
describe('doc.angularjs.org', function() {
44

5-
describe("API pages", function() {
5+
describe('API pages', function() {
66

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

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

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

4444
var codeBlocks = element.all(by.css('pre > code.lang-js'));

docs/app/e2e/api-docs/provider-pages.scenario.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict';
22

3-
describe("provider pages", function() {
3+
describe('provider pages', function() {
44

5-
it("should show the related service", function() {
5+
it('should show the related service', function() {
66
browser.get('build/docs/index.html#!/api/ng/provider/$compileProvider');
77
var serviceLink = element.all(by.css('ol.api-profile-header-structure li a')).first();
88
expect(serviceLink.getText()).toEqual('- $compile');

docs/app/e2e/api-docs/service-pages.scenario.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict';
22

3-
describe("service pages", function() {
3+
describe('service pages', function() {
44

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

17-
it("should show parameter defaults", function() {
17+
it('should show parameter defaults', function() {
1818
browser.get('build/docs/index.html#!/api/ng/service/$timeout');
1919
expect(element.all(by.css('.input-arguments p em')).first().getText()).toContain('(default: 0)');
2020
});

docs/app/e2e/app.scenario.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ describe('docs.angularjs.org', function() {
7373

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

79-
it("should display an error if the page does not exist", function() {
79+
it('should display an error if the page does not exist', function() {
8080
browser.get('build/docs/index-production.html#!/api/does/not/exist');
8181
expect(element(by.css('h1')).getText()).toBe('Oops!');
8282
});

docs/app/src/docs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ angular.module('DocsController', [])
5454
***********************************/
5555

5656
$scope.versionNumber = angular.version.full;
57-
$scope.version = angular.version.full + " " + angular.version.codeName;
57+
$scope.version = angular.version.full + ' ' + angular.version.codeName;
5858
$scope.loading = 0;
5959

6060

docs/app/src/examples.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ angular.module('examples', [])
138138
var newWindow = clickEvent.ctrlKey || clickEvent.metaKey;
139139

140140
var postData = {
141-
'tags[0]': "angularjs",
142-
'tags[1]': "example",
141+
'tags[0]': 'angularjs',
142+
'tags[1]': 'example',
143143
'private': true
144144
};
145145

@@ -183,8 +183,8 @@ angular.module('examples', [])
183183

184184
// The manifests provide the production index file but Plunkr wants
185185
// a straight index.html
186-
if (filename === "index-production.html") {
187-
filename = "index.html";
186+
if (filename === 'index-production.html') {
187+
filename = 'index.html';
188188
}
189189

190190
return {

docs/app/test/directivesSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
describe("code", function() {
3+
describe('code', function() {
44
var prettyPrintOne, oldPP;
55
var compile, scope;
66

docs/app/test/docsSpec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
describe("DocsController", function() {
3+
describe('DocsController', function() {
44
var $scope;
55

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

1818

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

2727

28-
it("should update the Google Analytics with $location.path if currentPage is missing", inject(function($window, $location) {
28+
it('should update the Google Analytics with $location.path if currentPage is missing', inject(function($window, $location) {
2929
$window._gaq = [];
3030
spyOn($location, 'path').and.returnValue('x/y/z');
3131
$scope.$broadcast('$includeContentLoaded');

docs/config/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"use strict";
1+
'use strict';
22

33
var path = require('canonical-path');
44
var packagePath = __dirname;

docs/config/processors/index-page.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"use strict";
1+
'use strict';
22

33
var _ = require('lodash');
44

docs/config/processors/keywords.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"use strict";
1+
'use strict';
22

33
var _ = require('lodash');
44
var fs = require('fs');

docs/config/processors/versions-data.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"use strict";
1+
'use strict';
22

33
var _ = require('lodash');
44

docs/config/services/deployments/debug.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"use strict";
1+
'use strict';
22

33
module.exports = function debugDeployment(getVersion) {
44
return {

docs/config/services/deployments/default.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"use strict";
1+
'use strict';
22

33
module.exports = function defaultDeployment(getVersion) {
44
return {

docs/config/services/deployments/jquery.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"use strict";
1+
'use strict';
22

33
module.exports = function jqueryDeployment(getVersion) {
44
return {

docs/config/services/deployments/production.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
"use strict";
1+
'use strict';
22

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

66
module.exports = function productionDeployment(getVersion) {
77
return {

docs/config/services/errorNamespaceMap.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"use strict";
1+
'use strict';
22
var StringMap = require('stringmap');
33

44
/**

docs/config/services/getMinerrInfo.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"use strict";
1+
'use strict';
22

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

docs/config/services/getVersion.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"use strict";
1+
'use strict';
22
var path = require('canonical-path');
33

44
/**

docs/content/guide/$location.ngdoc

+6-6
Original file line numberDiff line numberDiff line change
@@ -409,9 +409,9 @@ In these examples we use `<base href="/base/index.html" />`. The inputs represen
409409
.constant('baseHref', '/base/index.html')
410410
.value('$sniffer', { history: true })
411411

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

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

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

620620
input.on('keypress keyup keydown', function(event) {
621621
delay = (!delay ? $timeout(fireUrlChange, 250) : null);

docs/content/guide/concepts.ngdoc

+3-3
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ different currencies and also pay the invoice.
121121
return amount * this.usdToForeignRates[outCurr] / this.usdToForeignRates[inCurr];
122122
};
123123
this.pay = function pay() {
124-
window.alert("Thanks!");
124+
window.alert('Thanks!');
125125
};
126126
});
127127
</file>
@@ -221,7 +221,7 @@ Let's refactor our example and move the currency conversion into a service in an
221221
return currencyConverter.convert(this.qty * this.cost, this.inCurr, outCurr);
222222
};
223223
this.pay = function pay() {
224-
window.alert("Thanks!");
224+
window.alert('Thanks!');
225225
};
226226
}]);
227227
</file>
@@ -313,7 +313,7 @@ The following example shows how this is done with Angular:
313313
return currencyConverter.convert(this.qty * this.cost, this.inCurr, outCurr);
314314
};
315315
this.pay = function pay() {
316-
window.alert("Thanks!");
316+
window.alert('Thanks!');
317317
};
318318
}]);
319319
</file>

docs/content/guide/controller.ngdoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ previous example.
186186
var myApp = angular.module('spicyApp2', []);
187187

188188
myApp.controller('SpicyController', ['$scope', function($scope) {
189-
$scope.customSpice = "wasabi";
189+
$scope.customSpice = 'wasabi';
190190
$scope.spice = 'very';
191191

192192
$scope.spicy = function(spice) {

docs/content/guide/filter.ngdoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ text upper-case.
139139
.filter('reverse', function() {
140140
return function(input, uppercase) {
141141
input = input || '';
142-
var out = "";
142+
var out = '';
143143
for (var i = 0; i < input.length; i++) {
144144
out = input.charAt(i) + out;
145145
}

docs/content/guide/i18n.ngdoc

+4-4
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,11 @@ You may find it helpful to play with the following example as you read the expla
226226

227227
angular.module('messageFormatExample', ['ngMessageFormat'])
228228
.controller('ckCtrl', function($scope, $injector, $parse) {
229-
var people = [new Person("Alice", "female"),
230-
new Person("Bob", "male"),
231-
new Person("Charlie", "male")];
229+
var people = [new Person('Alice', 'female'),
230+
new Person('Bob', 'male'),
231+
new Person('Charlie', 'male')];
232232

233-
$scope.sender = new Person("Harry Potter", "male");
233+
$scope.sender = new Person('Harry Potter', 'male');
234234
$scope.recipients = people.slice();
235235

236236
$scope.setNumRecipients = function(n) {

docs/content/guide/services.ngdoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ subsystem takes care of the rest.
5353
return function(msg) {
5454
msgs.push(msg);
5555
if (msgs.length === 3) {
56-
win.alert(msgs.join("\n"));
56+
win.alert(msgs.join('\n'));
5757
msgs = [];
5858
}
5959
};

docs/gulpfile.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,16 @@ var getMergedEslintConfig = function(filepath) {
3939
// While alerts would be bad to have in the library or test code,
4040
// they're perfectly fine in examples.
4141
'no-alert': 'off',
42+
43+
// The following rules have to be disabled or tweaked because dgeni template wrappers
44+
// don't follow them and we have no way to validate only the parts taken
45+
// from ngdoc.
46+
4247
// some dgeni-packages templates generate whitespace-only lines
43-
'no-trailing-spaces': ['error', { 'skipBlankLines': true }]
48+
'no-trailing-spaces': ['error', { 'skipBlankLines': true }],
49+
50+
// dgeni templates use double quotes as string delimiters
51+
quotes: 'off'
4452
},
4553
ignore: false,
4654
useEslintrc: false

0 commit comments

Comments
 (0)