diff --git a/aio/package.json b/aio/package.json index adb3060d36..189325fe6a 100644 --- a/aio/package.json +++ b/aio/package.json @@ -9,8 +9,8 @@ "ng": "yarn check-env && ng", "start": "yarn check-env && ng serve", "build": "yarn check-env && yarn docs && ng build -prod -sm", + "lint": "yarn check-env && yarn docs-lint && ng lint", "test": "yarn check-env && ng test --sourcemap=false", - "lint": "yarn check-env && ng lint", "pree2e": "yarn ~~update-webdriver", "e2e": "yarn check-env && ng e2e --no-webdriver-update", "deploy-preview": "scripts/deploy-preview.sh", @@ -18,6 +18,7 @@ "check-env": "node ../tools/check-environment.js", "predocs": "rimraf src/content", "docs": "dgeni ./transforms/angular.io-package", + "docs-lint": "eslint --ignore-path=\"transforms/.eslintignore\" transforms", "docs-test": "node ../dist/tools/cjs-jasmine/index-tools ../../transforms/**/*.spec.js", "~~update-webdriver": "webdriver-manager update --standalone false --gecko false", "pre~~deploy": "yarn build", @@ -53,6 +54,8 @@ "dgeni": "^0.4.7", "dgeni-packages": "0.17.0", "entities": "^1.1.1", + "eslint": "^3.19.0", + "eslint-plugin-jasmine": "^2.2.0", "firebase-tools": "^3.2.1", "fs-extra": "^2.1.1", "globby": "^6.1.0", diff --git a/aio/transforms/.eslintignore b/aio/transforms/.eslintignore new file mode 100644 index 0000000000..4f9e159136 --- /dev/null +++ b/aio/transforms/.eslintignore @@ -0,0 +1 @@ +**/*.template.js diff --git a/aio/transforms/.eslintrc.js b/aio/transforms/.eslintrc.js new file mode 100644 index 0000000000..f82f5d54c0 --- /dev/null +++ b/aio/transforms/.eslintrc.js @@ -0,0 +1,20 @@ +module.exports = { + 'env': { + 'es6': true, + 'jasmine': true, + 'node': true + }, + 'extends': [ + 'eslint:recommended', + 'plugin:jasmine/recommended' + ], + 'plugins': [ + 'jasmine' + ], + 'rules': { + 'indent': ['error', 2], + 'linebreak-style': ['error', 'unix'], + 'quotes': ['error', 'single'], + 'semi': ['error', 'always'] + } +}; diff --git a/aio/transforms/angular.io-package/index.js b/aio/transforms/angular.io-package/index.js index 707c22de94..c3ac899919 100644 --- a/aio/transforms/angular.io-package/index.js +++ b/aio/transforms/angular.io-package/index.js @@ -29,8 +29,7 @@ const DOCS_OUTPUT_PATH = path.resolve(OUTPUT_PATH, 'docs'); module.exports = new Package( - 'angular.io', - [ + 'angular.io', [ jsdocPackage, nunjucksPackage, typescriptPackage, linksPackage, examplesPackage, gitPackage, targetPackage, contentPackage, rhoPackage ]) @@ -59,7 +58,7 @@ module.exports = .factory(require('./readers/json')) .factory(require('./services/copyFolder')) - .config(function(checkAnchorLinksProcessor, log) { + .config(function(checkAnchorLinksProcessor) { // TODO: re-enable checkAnchorLinksProcessor.$enabled = false; }) @@ -257,7 +256,6 @@ module.exports = generateKeywordsProcessor) { const API_SEGMENT = 'api'; - const GUIDE_SEGMENT = 'guide'; const APP_SEGMENT = 'app'; generateApiListDoc.outputFolder = API_SEGMENT; diff --git a/aio/transforms/angular.io-package/inline-tag-defs/anchor.js b/aio/transforms/angular.io-package/inline-tag-defs/anchor.js index 0ab6c7ea67..c975910c48 100644 --- a/aio/transforms/angular.io-package/inline-tag-defs/anchor.js +++ b/aio/transforms/angular.io-package/inline-tag-defs/anchor.js @@ -1,7 +1,7 @@ module.exports = { name: 'a', description: 'A shorthand for creating heading anchors. Usage: `{@a some-id}`', - handler: function(doc, tagName, tagDescription, docs) { + handler: function(doc, tagName, tagDescription) { return ''; } }; diff --git a/aio/transforms/angular.io-package/processors/addNotYetDocumentedProperty.spec.js b/aio/transforms/angular.io-package/processors/addNotYetDocumentedProperty.spec.js index a3ecf30e4a..ab71e43227 100644 --- a/aio/transforms/angular.io-package/processors/addNotYetDocumentedProperty.spec.js +++ b/aio/transforms/angular.io-package/processors/addNotYetDocumentedProperty.spec.js @@ -2,13 +2,12 @@ var testPackage = require('../../helpers/test-package'); var Dgeni = require('dgeni'); describe('addNotYetDocumentedProperty', function() { - var dgeni, injector, processor, log; + var dgeni, injector, processor; beforeEach(function() { dgeni = new Dgeni([testPackage('angular.io-package')]); injector = dgeni.configureInjector(); processor = injector.get('addNotYetDocumentedProperty'); - log = injector.get('log'); }); it('should mark export docs with no description as "not yet documented"', function() { @@ -145,4 +144,4 @@ describe('addNotYetDocumentedProperty', function() { expect(c1.notYetDocumented).toBeTruthy(); expect(c2.notYetDocumented).toBeTruthy(); }); -}); \ No newline at end of file +}); diff --git a/aio/transforms/angular.io-package/processors/checkUnbalancedBackTicks.spec.js b/aio/transforms/angular.io-package/processors/checkUnbalancedBackTicks.spec.js index b96c3929dc..bc9cd4c6fb 100644 --- a/aio/transforms/angular.io-package/processors/checkUnbalancedBackTicks.spec.js +++ b/aio/transforms/angular.io-package/processors/checkUnbalancedBackTicks.spec.js @@ -1,6 +1,5 @@ var testPackage = require('../../helpers/test-package'); var Dgeni = require('dgeni'); -var path = require('canonical-path'); describe('checkUnbalancedBackTicks', function() { var dgeni, injector, processor, log; @@ -27,4 +26,4 @@ describe('checkUnbalancedBackTicks', function() { 'checkUnbalancedBackTicks processor: unbalanced backticks found in rendered content - doc'); expect(docs[0].unbalancedBackTicks).toBe(true); }); -}); \ No newline at end of file +}); diff --git a/aio/transforms/angular.io-package/processors/convertToJson.js b/aio/transforms/angular.io-package/processors/convertToJson.js index 270f0def7d..fd918d8d03 100644 --- a/aio/transforms/angular.io-package/processors/convertToJson.js +++ b/aio/transforms/angular.io-package/processors/convertToJson.js @@ -5,7 +5,7 @@ module.exports = function convertToJsonProcessor() { $runBefore: ['writeFilesProcessor'], docTypes: [], $process: function(docs) { - const docTypes = this.docTypes + const docTypes = this.docTypes; docs.forEach((doc) => { if (docTypes.indexOf(doc.docType) !== -1) { const output = { @@ -17,4 +17,4 @@ module.exports = function convertToJsonProcessor() { }); } }; -}; \ No newline at end of file +}; diff --git a/aio/transforms/angular.io-package/processors/copyContentAssets.spec.js b/aio/transforms/angular.io-package/processors/copyContentAssets.spec.js index 9d6fa25aa3..04ac065527 100644 --- a/aio/transforms/angular.io-package/processors/copyContentAssets.spec.js +++ b/aio/transforms/angular.io-package/processors/copyContentAssets.spec.js @@ -2,7 +2,7 @@ const testPackage = require('../../helpers/test-package'); const Dgeni = require('dgeni'); const factory = require('./copyContentAssets'); -fdescribe('extractDecoratedClasses processor', function() { +describe('extractDecoratedClasses processor', function() { let dgeni, injector, processor; beforeEach(function() { @@ -24,4 +24,4 @@ fdescribe('extractDecoratedClasses processor', function() { expect(mockCopyFolder).toHaveBeenCalledWith('a/b/c', 'x/y/z'); expect(mockCopyFolder).toHaveBeenCalledWith('1/2/3', '4/5/6'); }); -}); \ No newline at end of file +}); diff --git a/aio/transforms/angular.io-package/processors/filterIgnoredDocs.js b/aio/transforms/angular.io-package/processors/filterIgnoredDocs.js index f0425face5..f1ec0fe177 100644 --- a/aio/transforms/angular.io-package/processors/filterIgnoredDocs.js +++ b/aio/transforms/angular.io-package/processors/filterIgnoredDocs.js @@ -9,5 +9,5 @@ module.exports = function filterIgnoredDocs() { $process: function(docs) { return docs.filter(doc => !this.ignore.some(regexp => regexp.test(doc.id))); } - } + }; }; diff --git a/aio/transforms/angular.io-package/processors/filterIgnoredDocs.spec.js b/aio/transforms/angular.io-package/processors/filterIgnoredDocs.spec.js index 33bce21953..a44a16220b 100644 --- a/aio/transforms/angular.io-package/processors/filterIgnoredDocs.spec.js +++ b/aio/transforms/angular.io-package/processors/filterIgnoredDocs.spec.js @@ -13,7 +13,7 @@ describe('filterIgnoredDocs processor', () => { it('should run before the correct processor', () => { const processor = processorFactory(); - expect(processor.$runBefore).toEqual(['computing-paths']) + expect(processor.$runBefore).toEqual(['computing-paths']); }); it('should run after the correct processor', () => { @@ -35,5 +35,5 @@ describe('filterIgnoredDocs processor', () => { { id: 'public1'}, { id: 'public2'} ]); - }) -}); \ No newline at end of file + }); +}); diff --git a/aio/transforms/angular.io-package/processors/filterMemberDocs.js b/aio/transforms/angular.io-package/processors/filterMemberDocs.js index 906a9c1213..b0fcd6b3ce 100644 --- a/aio/transforms/angular.io-package/processors/filterMemberDocs.js +++ b/aio/transforms/angular.io-package/processors/filterMemberDocs.js @@ -3,5 +3,5 @@ module.exports = function filterMemberDocs() { $runAfter: ['extra-docs-added'], $runBefore: ['computing-paths'], $process: function(docs) { return docs.filter(function(doc) { return doc.docType !== 'member'; }); } - } -}; \ No newline at end of file + }; +}; diff --git a/aio/transforms/angular.io-package/processors/filterPrivateDocs.js b/aio/transforms/angular.io-package/processors/filterPrivateDocs.js index 08289a3a8e..673e38d114 100644 --- a/aio/transforms/angular.io-package/processors/filterPrivateDocs.js +++ b/aio/transforms/angular.io-package/processors/filterPrivateDocs.js @@ -3,7 +3,7 @@ module.exports = function filterPrivateDocs() { $runAfter: ['extra-docs-added'], $runBefore: ['computing-paths'], $process: function(docs) { - return docs.filter(function(doc) { return doc.privateExport !== true }); + return docs.filter(function(doc) { return doc.privateExport !== true; }); } - } -}; \ No newline at end of file + }; +}; diff --git a/aio/transforms/angular.io-package/processors/filterPrivateDocs.spec.js b/aio/transforms/angular.io-package/processors/filterPrivateDocs.spec.js index fd237bf75a..1301118ed6 100644 --- a/aio/transforms/angular.io-package/processors/filterPrivateDocs.spec.js +++ b/aio/transforms/angular.io-package/processors/filterPrivateDocs.spec.js @@ -13,7 +13,7 @@ describe('filterPrivateDocs processor', () => { it('should run before the correct processor', () => { const processor = processorFactory(); - expect(processor.$runBefore).toEqual(['computing-paths']) + expect(processor.$runBefore).toEqual(['computing-paths']); }); it('should run after the correct processor', () => { @@ -36,5 +36,5 @@ describe('filterPrivateDocs processor', () => { { name: 'public2'}, { id: 'other'} ]); - }) -}); \ No newline at end of file + }); +}); diff --git a/aio/transforms/angular.io-package/processors/fixInternalDocumentLinks.spec.js b/aio/transforms/angular.io-package/processors/fixInternalDocumentLinks.spec.js index 32843c2ced..b2d6802466 100644 --- a/aio/transforms/angular.io-package/processors/fixInternalDocumentLinks.spec.js +++ b/aio/transforms/angular.io-package/processors/fixInternalDocumentLinks.spec.js @@ -13,7 +13,7 @@ describe('fixInternalDocumentLinks processor', () => { it('should run before the correct processor', () => { const processor = processorFactory(); - expect(processor.$runBefore).toEqual(['writeFilesProcessor']) + expect(processor.$runBefore).toEqual(['writeFilesProcessor']); }); it('should run after the correct processor', () => { @@ -48,5 +48,5 @@ describe('fixInternalDocumentLinks processor', () => { ` }, ]); - }) -}); \ No newline at end of file + }); +}); diff --git a/aio/transforms/angular.io-package/processors/markBarredODocsAsPrivate.spec.js b/aio/transforms/angular.io-package/processors/markBarredODocsAsPrivate.spec.js index c2a403d1a9..48151df634 100644 --- a/aio/transforms/angular.io-package/processors/markBarredODocsAsPrivate.spec.js +++ b/aio/transforms/angular.io-package/processors/markBarredODocsAsPrivate.spec.js @@ -18,7 +18,7 @@ describe('generateApiListDoc processor', () => { const docs = [ { name: 'ɵPrivate' }, { name: 'public' } - ] + ]; processor.$process(docs); expect(docs[0].privateExport).toBeTruthy(); diff --git a/aio/transforms/angular.io-package/processors/matchUpDirectiveDecorators.js b/aio/transforms/angular.io-package/processors/matchUpDirectiveDecorators.js index b2564749cf..ae093a9653 100644 --- a/aio/transforms/angular.io-package/processors/matchUpDirectiveDecorators.js +++ b/aio/transforms/angular.io-package/processors/matchUpDirectiveDecorators.js @@ -5,7 +5,7 @@ var _ = require('lodash'); * @description * */ -module.exports = function matchUpDirectiveDecoratorsProcessor(aliasMap) { +module.exports = function matchUpDirectiveDecoratorsProcessor() { return { $runAfter: ['ids-computed', 'paths-computed'], @@ -17,7 +17,7 @@ module.exports = function matchUpDirectiveDecoratorsProcessor(aliasMap) { if (doc.docType === 'directive') { doc.selector = doc.directiveOptions.selector; - for (decoratorName in decoratorMappings) { + for (let decoratorName in decoratorMappings) { var propertyName = decoratorMappings[decoratorName]; doc[propertyName] = getDecoratorValues(doc.directiveOptions[propertyName], decoratorName, doc.members); @@ -29,7 +29,6 @@ module.exports = function matchUpDirectiveDecoratorsProcessor(aliasMap) { }; function getDecoratorValues(classDecoratorValues, memberDecoratorName, members) { - var optionMap = {}; var decoratorValues = {}; // Parse the class decorator @@ -59,4 +58,4 @@ function getDecoratorValues(classDecoratorValues, memberDecoratorName, members) if (Object.keys(decoratorValues).length) { return decoratorValues; } -} \ No newline at end of file +} diff --git a/aio/transforms/angular.io-package/processors/mergeDecoratorDocs.js b/aio/transforms/angular.io-package/processors/mergeDecoratorDocs.js index 03e55cfc4a..7fde771509 100644 --- a/aio/transforms/angular.io-package/processors/mergeDecoratorDocs.js +++ b/aio/transforms/angular.io-package/processors/mergeDecoratorDocs.js @@ -1,5 +1,3 @@ -var _ = require('lodash'); - module.exports = function mergeDecoratorDocs(log) { return { $runAfter: ['processing-docs'], @@ -80,4 +78,4 @@ function getMakeDecoratorCall(doc, type) { return initializer; } } -} \ No newline at end of file +} diff --git a/aio/transforms/angular.io-package/processors/processNavigationMap.js b/aio/transforms/angular.io-package/processors/processNavigationMap.js index eb0be5778f..049b1ac4c5 100644 --- a/aio/transforms/angular.io-package/processors/processNavigationMap.js +++ b/aio/transforms/angular.io-package/processors/processNavigationMap.js @@ -19,6 +19,7 @@ module.exports = function processNavigationMap(versionInfo, log) { if (errors.length) { log.error(`Navigation doc: ${navigationDoc.fileInfo.relativePath} contains invalid urls`); + // eslint-disable-next-line no-console console.log(errors); // TODO(petebd): fail if there are errors: throw new Error('processNavigationMap failed'); } @@ -26,7 +27,7 @@ module.exports = function processNavigationMap(versionInfo, log) { // Add in the version data in a "secret" field to be extracted in the docs app navigationDoc.data['__versionInfo'] = versionInfo.currentVersion; } - } + }; }; function walk(node, map, path) { @@ -47,4 +48,4 @@ function walk(node, map, path) { function isRelative(url) { return !/^(https?:)?\/\//.test(url); -} \ No newline at end of file +} diff --git a/aio/transforms/angular.io-package/rendering/indentForMarkdown.js b/aio/transforms/angular.io-package/rendering/indentForMarkdown.js index e0fff8afb6..86210565d7 100644 --- a/aio/transforms/angular.io-package/rendering/indentForMarkdown.js +++ b/aio/transforms/angular.io-package/rendering/indentForMarkdown.js @@ -1,4 +1,4 @@ -module.exports = function(encodeCodeBlock) { +module.exports = function() { // var MIXIN_PATTERN = /\S*\+\S*\(.*/; return { name: 'indentForMarkdown', @@ -57,6 +57,6 @@ module.exports = function(encodeCodeBlock) { str += ' '; } return str; - }; + } -}; \ No newline at end of file +}; diff --git a/aio/transforms/angular.io-package/tag-defs/internal.js b/aio/transforms/angular.io-package/tag-defs/internal.js index 422b6b147a..f981361298 100644 --- a/aio/transforms/angular.io-package/tag-defs/internal.js +++ b/aio/transforms/angular.io-package/tag-defs/internal.js @@ -1,5 +1,5 @@ module.exports = function() { return { name: 'internal', transforms: function() { return true; } - } + }; }; diff --git a/aio/transforms/content-package/index.js b/aio/transforms/content-package/index.js index 8909435500..cbe639697f 100644 --- a/aio/transforms/content-package/index.js +++ b/aio/transforms/content-package/index.js @@ -21,7 +21,7 @@ module.exports = new Package('content', [jsdocPackage, linksPackage]) }) // Configure ids and paths - .config(function(computeIdsProcessor, computePathsProcessor) { + .config(function(computeIdsProcessor) { computeIdsProcessor.idTemplates.push({ docTypes: ['content'], @@ -44,4 +44,4 @@ function requireFolder(folderPath) { return fs.readdirSync(absolutePath) .filter(p => !/[._]spec\.js$/.test(p)) // ignore spec files .map(p => require(path.resolve(absolutePath, p))); -} \ No newline at end of file +} diff --git a/aio/transforms/content-package/readers/content.js b/aio/transforms/content-package/readers/content.js index 8ddd61f377..0a8b539e8f 100644 --- a/aio/transforms/content-package/readers/content.js +++ b/aio/transforms/content-package/readers/content.js @@ -1,5 +1,3 @@ -var path = require('canonical-path'); - /** * @dgService * @description @@ -23,4 +21,4 @@ module.exports = function contentFileReader() { return [{docType: 'content', content: fileInfo.content, startingLine: 1}]; } }; -}; \ No newline at end of file +}; diff --git a/aio/transforms/eslintrc.js b/aio/transforms/eslintrc.js deleted file mode 100644 index a48ebde2a7..0000000000 --- a/aio/transforms/eslintrc.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = { - 'globals': {'describe': true, 'beforeEach': true, 'it': true, 'expect': true}, - 'env': {'node': true}, - 'extends': 'eslint:recommended', - 'rules': { - 'indent': ['error', 2], - 'linebreak-style': ['error', 'unix'], - 'quotes': ['error', 'single'], - 'semi': ['error', 'always'] - } -}; \ No newline at end of file diff --git a/aio/transforms/examples-package/file-readers/example-reader.js b/aio/transforms/examples-package/file-readers/example-reader.js index 536afd7a05..7f06bf33a5 100644 --- a/aio/transforms/examples-package/file-readers/example-reader.js +++ b/aio/transforms/examples-package/file-readers/example-reader.js @@ -4,7 +4,7 @@ * Later on we can extract the regions, via "shredding"; and we can also construct runnable examples * for passing to plunker and the like. */ -module.exports = function exampleFileReader(log) { +module.exports = function exampleFileReader() { return { name: 'exampleFileReader', getDocs: function(fileInfo) { diff --git a/aio/transforms/examples-package/inline-tag-defs/example.js b/aio/transforms/examples-package/inline-tag-defs/example.js index aa3e896f30..5a2093207b 100644 --- a/aio/transforms/examples-package/inline-tag-defs/example.js +++ b/aio/transforms/examples-package/inline-tag-defs/example.js @@ -1,5 +1,3 @@ -var path = require('canonical-path'); -var fs = require('fs'); var entities = require('entities'); /** @@ -28,7 +26,7 @@ module.exports = function exampleInlineTagDef(parseArgString, createDocMessage, if (regionName === '\'\'') regionName = ''; var title = tagArgs.title || (unnamedArgs.length > 2 ? unnamedArgs.slice(2).join(' ') : null); var linenums = tagArgs.linenums; - var stylePattern = tagArgs.stylePattern; // TODO: not yet implemented here + // var stylePattern = tagArgs.stylePattern; // TODO: not yet implemented here const sourceCode = getExampleRegion(doc, relativePath, regionName); diff --git a/aio/transforms/examples-package/inline-tag-defs/exampleTabs.js b/aio/transforms/examples-package/inline-tag-defs/exampleTabs.js index a141b83bcd..1456551815 100644 --- a/aio/transforms/examples-package/inline-tag-defs/exampleTabs.js +++ b/aio/transforms/examples-package/inline-tag-defs/exampleTabs.js @@ -14,8 +14,7 @@ var fs = require('fs'); * -titles="Hello app1, Hello app2" } * @kind function */ -module.exports = function exampleTabsInlineTagDef( - getLinkInfo, parseArgString, createDocMessage, log) { +module.exports = function exampleTabsInlineTagDef(getLinkInfo, parseArgString) { return { name: 'exampleTabs', description: @@ -32,9 +31,10 @@ module.exports = function exampleTabsInlineTagDef( } // TODO: not yet implemented here - var stylePatterns = tagArgs.stylePattern; + // var stylePatterns = tagArgs.stylePattern; var mixinPaths = relativePaths.map(function(relativePath, ix) { + // eslint-disable-next-line no-undef var fragFileName = getApiFragmentFileName(relativePath, regions && regions[ix]); if (!fs.existsSync(fragFileName)) { // TODO: log.warn(createDocMessage('Invalid example (unable to locate fragment file: ' + @@ -43,7 +43,7 @@ module.exports = function exampleTabsInlineTagDef( return path.join('_api', relativePath); }); - var comma = ', ' + var comma = ', '; var pathsArg = quote(mixinPaths.join(',')); var regionsArg = regions ? quote(regions.join(',')) : 'null'; var titlesArg = titles ? quote(titles) : 'null'; diff --git a/aio/transforms/examples-package/processors/collect-examples.js b/aio/transforms/examples-package/processors/collect-examples.js index 069f60b264..c09baee5cc 100644 --- a/aio/transforms/examples-package/processors/collect-examples.js +++ b/aio/transforms/examples-package/processors/collect-examples.js @@ -65,7 +65,7 @@ module.exports = function collectExamples(exampleMap, regionParser, log, createD function createRegionDoc(folder, relativePath, regionName, regionContents) { const path = folder + '/' + relativePath; - const id = path + '#' + regionName + const id = path + '#' + regionName; return { docType: 'example-region', path: path, @@ -74,4 +74,4 @@ function createRegionDoc(folder, relativePath, regionName, regionContents) { aliases: [id], contents: regionContents }; -} \ No newline at end of file +} diff --git a/aio/transforms/examples-package/processors/collect-examples.spec.js b/aio/transforms/examples-package/processors/collect-examples.spec.js index 3ea7facaaf..52480e7760 100644 --- a/aio/transforms/examples-package/processors/collect-examples.spec.js +++ b/aio/transforms/examples-package/processors/collect-examples.spec.js @@ -8,7 +8,7 @@ describe('collectExampleRegions processor', () => { beforeEach(function() { regionParser = jasmine.createSpy('regionParser').and.callFake(function(contents, extension) { - return { contents: 'PARSED:' + contents, regions: {dummy: extension} } + return { contents: 'PARSED:' + contents, regions: {dummy: extension} }; }); const dgeni = @@ -82,7 +82,7 @@ describe('collectExampleRegions processor', () => { createDoc('Other doc 2', 'other/b/c.js', 'content') ]; - const processedDocs = processor.$process(docs); + processor.$process(docs); expect(regionParser).toHaveBeenCalledTimes(3); expect(regionParser).toHaveBeenCalledWith('Example A', 'js'); diff --git a/aio/transforms/examples-package/processors/render-examples.spec.js b/aio/transforms/examples-package/processors/render-examples.spec.js index c7a13413eb..b02580a06f 100644 --- a/aio/transforms/examples-package/processors/render-examples.spec.js +++ b/aio/transforms/examples-package/processors/render-examples.spec.js @@ -1,9 +1,8 @@ var testPackage = require('../../helpers/test-package'); var Dgeni = require('dgeni'); -var path = require('path'); describe('renderExamples processor', () => { - var injector, processor, exampleMap, regionParser, collectExamples, exampleMap; + var injector, processor, exampleMap, collectExamples; beforeEach(function() { const dgeni = new Dgeni([testPackage('examples-package', true)]); @@ -24,7 +23,7 @@ describe('renderExamples processor', () => { }); it('should run before the correct processor', () => { - expect(processor.$runBefore).toEqual(['writing-files']) + expect(processor.$runBefore).toEqual(['writing-files']); }); it('should run after the correct processor', () => { @@ -90,4 +89,4 @@ describe('renderExamples processor', () => { }); }) ); -}); \ No newline at end of file +}); diff --git a/aio/transforms/examples-package/services/parseArgString.js b/aio/transforms/examples-package/services/parseArgString.js index 6bfa79a322..6507ab6c6c 100644 --- a/aio/transforms/examples-package/services/parseArgString.js +++ b/aio/transforms/examples-package/services/parseArgString.js @@ -47,12 +47,12 @@ module.exports = function parseArgString() { key = key.substr(1); } } else { - unnammedArgs.push(arg) + unnammedArgs.push(arg); key = null; } } } } while (match !== null); return args; - } -} \ No newline at end of file + }; +}; diff --git a/aio/transforms/examples-package/services/region-parser.js b/aio/transforms/examples-package/services/region-parser.js index 7372d4fce1..76eb124bea 100644 --- a/aio/transforms/examples-package/services/region-parser.js +++ b/aio/transforms/examples-package/services/region-parser.js @@ -3,7 +3,6 @@ const html = require('./region-matchers/html'); const inlineC = require('./region-matchers/inline-c'); const inlineCOnly = require('./region-matchers/inline-c-only'); const inlineHash = require('./region-matchers/inline-hash'); -const NO_NAME_REGION = ''; const DEFAULT_PLASTER = '. . .'; const {mapObject} = require('../utils'); @@ -140,4 +139,4 @@ function RegionParserError(message, index) { this.stack = (new Error()).stack; } RegionParserError.prototype = Object.create(Error.prototype); -RegionParserError.prototype.constructor = RegionParserError; \ No newline at end of file +RegionParserError.prototype.constructor = RegionParserError; diff --git a/aio/transforms/examples-package/services/region-parser.spec.js b/aio/transforms/examples-package/services/region-parser.spec.js index 925a2c3508..803d47b0ea 100644 --- a/aio/transforms/examples-package/services/region-parser.spec.js +++ b/aio/transforms/examples-package/services/region-parser.spec.js @@ -172,7 +172,7 @@ describe('regionParser service', () => { expect(output.regions['A']).toEqual(t('abc', 'xyz')); expect(output.regions['B']).toEqual(t('abc')); expect(output.regions['C']).toEqual(t('xyz')); - }) + }); }); function t() { diff --git a/aio/transforms/examples-package/utils.js b/aio/transforms/examples-package/utils.js index f4dbb85bec..858263a844 100644 --- a/aio/transforms/examples-package/utils.js +++ b/aio/transforms/examples-package/utils.js @@ -17,7 +17,7 @@ module.exports = { */ parseAttributes(str) { const attrMap = {}; - let index = 0, key, value; + let index = 0; skipSpace(); @@ -64,7 +64,7 @@ module.exports = { function tryQuote() { const quote = str[index]; - if (['"', "'"].indexOf(quote) !== -1) { + if (['"', '\''].indexOf(quote) !== -1) { index++; return quote; } @@ -90,4 +90,4 @@ module.exports = { return attrMap; } -}; \ No newline at end of file +}; diff --git a/aio/transforms/examples-package/utils.spec.js b/aio/transforms/examples-package/utils.spec.js index 0cd0e21730..ce0369b7b7 100644 --- a/aio/transforms/examples-package/utils.spec.js +++ b/aio/transforms/examples-package/utils.spec.js @@ -71,6 +71,6 @@ describe('utils', () => { expect(() => parseAttributes('a="" b="two')).toThrowError( 'Unterminated quoted attribute value in `a="" b="two`. Starting at 8. Expected a " but got "end of string".' ); - }) + }); }); -}); \ No newline at end of file +}); diff --git a/aio/transforms/helpers/test-package.js b/aio/transforms/helpers/test-package.js index 227ab68707..450b5a5c36 100644 --- a/aio/transforms/helpers/test-package.js +++ b/aio/transforms/helpers/test-package.js @@ -19,7 +19,7 @@ module.exports = function testPackage(packageName, mockTemplateEngine) { // overrides base packageInfo and returns the one for the 'angular/angular' repo. const PROJECT_ROOT = path.resolve(__dirname, '../../..'); - pkg.factory('packageInfo', function() { return require(path.resolve(PROJECT_ROOT, 'package.json')); }) + pkg.factory('packageInfo', function() { return require(path.resolve(PROJECT_ROOT, 'package.json')); }); if (mockTemplateEngine) { diff --git a/aio/transforms/links-package/services/getDocFromAlias.js b/aio/transforms/links-package/services/getDocFromAlias.js index 4ae5b6f89b..8860198c3c 100644 --- a/aio/transforms/links-package/services/getDocFromAlias.js +++ b/aio/transforms/links-package/services/getDocFromAlias.js @@ -4,7 +4,7 @@ var _ = require('lodash'); * @dgService getDocFromAlias * @description Get an array of docs that match this alias, relative to the originating doc. */ -module.exports = function getDocFromAlias(aliasMap, log) { +module.exports = function getDocFromAlias(aliasMap) { return function getDocFromAlias(alias, originatingDoc) { var docs = aliasMap.getDocs(alias); @@ -28,4 +28,4 @@ module.exports = function getDocFromAlias(aliasMap, log) { return docs; }; -}; \ No newline at end of file +}; diff --git a/aio/transforms/links-package/services/getLinkInfo.js b/aio/transforms/links-package/services/getLinkInfo.js index cc3aaeaf77..e2cbe2c4d8 100644 --- a/aio/transforms/links-package/services/getLinkInfo.js +++ b/aio/transforms/links-package/services/getLinkInfo.js @@ -73,6 +73,6 @@ module.exports = function getLinkInfo(getDocFromAlias, encodeCodeBlock, log) { } return linkInfo; - }; + } -}; \ No newline at end of file +}; diff --git a/aio/transforms/rho-package/services/renderMarkdown.js b/aio/transforms/rho-package/services/renderMarkdown.js index 1205361f96..f5408cf51c 100644 --- a/aio/transforms/rho-package/services/renderMarkdown.js +++ b/aio/transforms/rho-package/services/renderMarkdown.js @@ -55,7 +55,7 @@ module.exports = function renderMarkdown() { walk.startFrom(endIdx + 2); return true; - }; + } renderMarkdownImpl.unformattedTags = []; @@ -64,5 +64,5 @@ module.exports = function renderMarkdown() { function renderMarkdownImpl(content) { const rawHtml = new rho.BlockCompiler(rho.options).toHtml(content); return prettyPrint(rawHtml, { indent_size: 2, max_char: 0, unformatted: [...defaultUnformattedTags, ...renderMarkdownImpl.unformattedTags]}); - }; + } }; diff --git a/aio/transforms/target-package/services/targetEnvironments.js b/aio/transforms/target-package/services/targetEnvironments.js index 23e1719503..18376561d8 100644 --- a/aio/transforms/target-package/services/targetEnvironments.js +++ b/aio/transforms/target-package/services/targetEnvironments.js @@ -12,7 +12,7 @@ module.exports = function targetEnvironments() { var updateActiveCount = function() { _activeCount = 0; - for (target in _targets) { + for (let target in _targets) { if (_targets[target]) _activeCount++; } }; @@ -48,4 +48,4 @@ module.exports = function targetEnvironments() { return false; } }; -}; \ No newline at end of file +}; diff --git a/aio/yarn.lock b/aio/yarn.lock index 55abc75e99..64c323d71f 100644 --- a/aio/yarn.lock +++ b/aio/yarn.lock @@ -1963,6 +1963,10 @@ escope@^3.6.0: esrecurse "^4.1.0" estraverse "^4.1.1" +eslint-plugin-jasmine@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-jasmine/-/eslint-plugin-jasmine-2.2.0.tgz#7135879383c39a667c721d302b9f20f0389543de" + eslint@^3.19.0: version "3.19.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.19.0.tgz#c8fc6201c7f40dd08941b87c085767386a679acc"