Skip to content

Commit bc4bb18

Browse files
committed
run lint:fix
1 parent 27a0abc commit bc4bb18

18 files changed

+71
-75
lines changed

generate-local.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const exit = function exit() {
1616
process.exit(1)
1717
}
1818

19-
async function runCmd (cmd, path, args = []) {
19+
async function runCmd(cmd, path, args = []) {
2020
console.log(chalk.underline(`Running '${chalk.green(cmd)}' in ${path}`))
2121
const executedCmd = await execa(cmd, args, { cwd: path, shell: true, stdio: 'inherit' })
2222

@@ -33,7 +33,7 @@ async function runCmd (cmd, path, args = []) {
3333
if (!project || !version) {
3434
exit(
3535
chalk.red('Both project and version args are required.\n'),
36-
chalk.yellow(' e.g., yarn gen --project ember --version 3.10.1')
36+
chalk.yellow(' e.g., yarn gen --project ember --version 3.10.1'),
3737
)
3838
}
3939

@@ -65,13 +65,15 @@ async function runCmd (cmd, path, args = []) {
6565
await runCmd('corepack', projDirPath, ['pnpm', 'install'])
6666
}
6767

68-
6968
if (install) {
7069
await runCmd(project === 'ember' ? 'yarn' : 'pnpm install', projDirPath)
7170
console.log('\n\n')
7271
}
7372

74-
await runCmd(project === 'ember' ? 'volta run yarn docs' : 'corepack pnpm run build:docs', projDirPath)
73+
await runCmd(
74+
project === 'ember' ? 'volta run yarn docs' : 'corepack pnpm run build:docs',
75+
projDirPath,
76+
)
7577

7678
let destination = `${docsPath}/s3-docs/v${version}/${project}-docs.json`
7779
ensureFileSync(destination)
@@ -81,7 +83,7 @@ async function runCmd (cmd, path, args = []) {
8183

8284
const yuiDocFile = path.join(
8385
projDirPath,
84-
project === 'ember' ? 'docs/data.json' : 'packages/-ember-data/dist/docs/data.json'
86+
project === 'ember' ? 'docs/data.json' : 'packages/-ember-data/dist/docs/data.json',
8587
)
8688
copyFileSync(yuiDocFile, projYuiDocFile)
8789
}
@@ -101,6 +103,6 @@ async function runCmd (cmd, path, args = []) {
101103
project,
102104
'--version',
103105
version,
104-
'--no-sync'
106+
'--no-sync',
105107
]).stdout.pipe(process.stdout)
106108
})()

lib/add-since-tags.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function sortVersionIndex(versionIndex) {
5050
let keys = Object.keys(versionIndex)
5151

5252
keys.forEach(key =>
53-
Object.keys(versionIndex[key]).forEach(item => versionIndex[key][item].sort())
53+
Object.keys(versionIndex[key]).forEach(item => versionIndex[key][item].sort()),
5454
)
5555
}
5656

@@ -63,5 +63,5 @@ const createMethodEntry = (versionIndex, method, itemType, version) => {
6363
const classItemsWithItemType = versions =>
6464
versions.reduce(
6565
(memo, { data }) => memo.concat(data.classitems.filter(({ itemtype }) => itemtype)),
66-
[]
66+
[],
6767
)

lib/get-latest-patch-versions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import semverUtils from 'semver-utils'
55
export function getLatestPatchVersions(versions) {
66
let groupedVersions = groupBy(
77
versions.sort(semverCompare).map(semverUtils.parse),
8-
v => `${v.major}.${v.minor}`
8+
v => `${v.major}.${v.minor}`,
99
)
1010
return Object.values(groupedVersions).map(verGroup => verGroup.pop().version)
1111
}

lib/markup.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function replaceDescriptionFor(items) {
4949

5050
function highlight(description) {
5151
if (description) {
52-
description = description.replace(/&#(\d+);/g, function(match, dec) {
52+
description = description.replace(/&#(\d+);/g, function (match, dec) {
5353
return String.fromCharCode(dec)
5454
})
5555
}
@@ -109,15 +109,15 @@ function highlight(description) {
109109
function determineLanguage(maybeFileName) {
110110
const lang = maybeFileName.split('.').pop()
111111
switch (lang) {
112-
case 'js':
113-
case 'javascript':
114-
return 'javascript'
115-
case 'ts':
116-
return 'typescript'
117-
case 'hbs':
118-
return 'handlebars'
119-
default:
120-
return lang
112+
case 'js':
113+
case 'javascript':
114+
return 'javascript'
115+
case 'ts':
116+
return 'typescript'
117+
case 'hbs':
118+
return 'handlebars'
119+
default:
120+
return lang
121121
}
122122
}
123123

lib/modules-transform.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function isStaticMethod(item) {
3434
}
3535

3636
function separateByClassName(result, value) {
37-
(result[value.class] || (result[value.class] = [])).push(value)
37+
;(result[value.class] || (result[value.class] = [])).push(value)
3838
return result
3939
}
4040

lib/normalize-ids.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ async function normalizeIDs(pVersions, projectName) {
6161

6262
let namespaces = classes.filter(({ attributes }) => attributes.static === 1)
6363
classes = classes.filter(
64-
({ attributes }) => attributes.static !== 1 && _.has(attributes, 'file')
64+
({ attributes }) => attributes.static !== 1 && _.has(attributes, 'file'),
6565
)
6666

6767
namespaces.forEach(ns => (ns.type = 'namespace'))

lib/read-docs.js

+10-11
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ import { getLatestPatchVersions } from './get-latest-patch-versions.js'
66

77
const docsPath = '../ember-api-docs-data'
88

9-
export default function readDocs(
10-
projects,
11-
specificVersion = '',
12-
runClean = false
13-
) {
9+
export default function readDocs(projects, specificVersion = '', runClean = false) {
1410
return projects.reduce(async (prevPromise, projectName) => {
1511
let prevValue = await prevPromise
1612
let prevIndexedVersions = []
@@ -23,23 +19,26 @@ export default function readDocs(
2319
projectFile = await fs.readJson(projectFile)
2420

2521
prevIndexedVersions = deepGet(projectFile, 'data.relationships.project-versions.data').map(
26-
({ id }) => id.replace(`${projectName}-`, '')
22+
({ id }) => id.replace(`${projectName}-`, ''),
2723
)
2824
}
2925

30-
let folders = glob.sync(`${docsPath}/s3-docs/v${specificVersion}*/${dasherize(projectName)}-docs.json`)
26+
let folders = glob.sync(
27+
`${docsPath}/s3-docs/v${specificVersion}*/${dasherize(projectName)}-docs.json`,
28+
)
3129

3230
let availableSourceVersions = folders.map(x =>
33-
x.replace(`${docsPath}/s3-docs/v`, '').replace(`/${projectName}-docs.json`, '')
31+
x.replace(`${docsPath}/s3-docs/v`, '').replace(`/${projectName}-docs.json`, ''),
3432
)
3533

3634
if (!runClean) {
37-
3835
folders = folders.filter(f => {
3936
if (!prevIndexedVersions.includes(f)) {
4037
return f
4138
} else {
42-
let version = f.replace(`${docsPath}/s3-docs/v`, '').replace(`/${projectName}-docs.json`, '')
39+
let version = f
40+
.replace(`${docsPath}/s3-docs/v`, '')
41+
.replace(`/${projectName}-docs.json`, '')
4342
console.log(`${projectName}-${version} has already been indexed in json-docs`)
4443
}
4544
})
@@ -59,7 +58,7 @@ export default function readDocs(
5958
console.error(e.stack)
6059
process.exit(1)
6160
}
62-
})
61+
}),
6362
)
6463

6564
return { ...prevValue, [projectName]: docs }

lib/rev-docs.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ function revProjVersionFiles(project, ver) {
1515
fs.mkdirpSync(revIndexFolder)
1616
const destination = `${revIndexFolder}/${project}-${ver}.json`
1717

18-
fs.copySync(
19-
`${projDocsDir}/${ver}/project-versions/${project}-${ver}.json`,
20-
destination
21-
)
18+
fs.copySync(`${projDocsDir}/${ver}/project-versions/${project}-${ver}.json`, destination)
2219

2320
opProgress.text = `Revving ${project}:${ver}`
2421

@@ -52,9 +49,10 @@ function revProjVersionFiles(project, ver) {
5249
let fileShortName = f.replace(`${projVerDir}/`, '').replace('.json', '')
5350
let [fileObjType, entityName] = fileShortName.split('/')
5451

55-
projVerRevContent.meta[singularize(fileObjType)][entityName] = getFileName(
56-
f
57-
).replace('.json', '')
52+
projVerRevContent.meta[singularize(fileObjType)][entityName] = getFileName(f).replace(
53+
'.json',
54+
'',
55+
)
5856
})
5957

6058
fs.writeJsonSync(projVerRevFile, projVerRevContent)

lib/update-with-versions-and-project.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import _ from 'lodash'
33
function generateID(type, projectName, version, id) {
44
if (!projectName) {
55
throw new Error(
6-
`no project ! type: ${type} project name: ${projectName} version: ${version}, id: ${id}`
6+
`no project ! type: ${type} project name: ${projectName} version: ${version}, id: ${id}`,
77
)
88
}
99
return `${projectName}-${version}-${id}`
@@ -29,7 +29,7 @@ function updateDocument(doc, projectName, version) {
2929
relationship.data.type,
3030
projectName,
3131
version,
32-
relationship.data.id
32+
relationship.data.id,
3333
)
3434
}
3535
}

lib/yuidoc-fixer/normalize-yui-doc-class-item.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const normalizeYuiDocClassItem = item => {
3939

4040
if (emberKnownEntityNames.map(toLower).includes(key)) {
4141
transformedKey = emberKnownEntityNames.find(
42-
name => name.toLowerCase() === key.toLowerCase()
42+
name => name.toLowerCase() === key.toLowerCase(),
4343
)
4444
}
4545

lib/yuidoc-fixer/yui-doc-class-item-keys.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,5 @@ const keywordsInOurProjects = ['readonly']
8989

9090
export const yuiDocClassItemKeys = without(
9191
[...additionalDocumentationKeywords, ...originalYuiDocClassItemKeys],
92-
...keywordsInOurProjects
92+
...keywordsInOurProjects,
9393
)

main.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,18 @@ export async function apiDocsProcessor(projects, specificDocsVersion, runClean)
9393
projects.map(project => {
9494
const projRevFile = `${docsPath}/rev-index/${project}.json`
9595
let projRevFileContent = fs.readJsonSync(
96-
`${docsPath}/json-docs/${project}/projects/${project}.json`
96+
`${docsPath}/json-docs/${project}/projects/${project}.json`,
9797
)
9898
const availableVersions = []
9999
projRevFileContent.meta = {
100100
availableVersions,
101101
}
102102
projRevFileContent.data.relationships['project-versions'].data.forEach(({ id }) =>
103-
availableVersions.push(id.replace(`${project}-`, ''))
103+
availableVersions.push(id.replace(`${project}-`, '')),
104104
)
105105
console.log({ project, availableVersions })
106106
fs.writeJsonSync(projRevFile, projRevFileContent, { spaces: 2 })
107-
})
107+
}),
108108
)
109109
.then(() => {
110110
console.log('\n\n\n')

test/add-since-tag-test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { assert } from 'chai'
33
import _ from 'lodash'
44

55
describe('addSinceTags', () => {
6-
beforeEach(function() {
6+
beforeEach(function () {
77
this.yuiDocSets = _.range(3).map(i => {
88
return {
99
version: `v1.0.${i}`,
@@ -26,7 +26,7 @@ describe('addSinceTags', () => {
2626
addSinceTags(this.yuiDocSets)
2727
})
2828

29-
it('adds a since tag to classitems', function() {
29+
it('adds a since tag to classitems', function () {
3030
this.yuiDocSets.forEach(({ data }) => {
3131
data.classitems.forEach(({ since }) => assert.equal(since, '1.0.0'))
3232
})

test/filter-jsonapi-doc-test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { classWithIncluded } from '../lib/filter-jsonapi-doc.js'
44

55
describe('filter json api docs', () => {
66
describe('#classWithIncluded', () => {
7-
beforeEach(function() {
7+
beforeEach(function () {
88
this.document = {
99
data: [
1010
{
@@ -35,7 +35,7 @@ describe('filter json api docs', () => {
3535
this.response = classWithIncluded(this.document, 'Ember.Butt')
3636
})
3737

38-
it('returns the class in the result', function() {
38+
it('returns the class in the result', function () {
3939
assert.typeOf(this.response.data, 'object')
4040
assert.deepEqual(this.response.data, {
4141
id: 'Ember.Butt',
@@ -46,7 +46,7 @@ describe('filter json api docs', () => {
4646
})
4747
})
4848

49-
it('returns associated methods', function() {
49+
it('returns associated methods', function () {
5050
assert.deepEqual(this.response.included, [
5151
{
5252
id: 'Ember.Butt#foo',
@@ -60,7 +60,7 @@ describe('filter json api docs', () => {
6060
])
6161
})
6262

63-
it('does not return unassociated models', function() {
63+
it('does not return unassociated models', function () {
6464
let unassociated = _.filter(this.response.included, ['type', 'yoloswag'])
6565
assert.equal(unassociated.length, 0)
6666
})

test/markup-test.js

+8-11
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,14 @@ function desc(path) {
1010
description: fs.readFileSync(join(__dirname, `./mocks/description/${path}.md`), 'utf-8'),
1111
methods: [],
1212
properties: [],
13-
events: []
14-
}
13+
events: [],
14+
},
1515
}
1616
}
1717

1818
function mark(path) {
19-
let data = [
20-
desc(path)
21-
]
22-
let result = markup({data})
19+
let data = [desc(path)]
20+
let result = markup({ data })
2321
let content = result.data[0].attributes.description
2422
maybeWrite(content, path)
2523
return content
@@ -38,24 +36,23 @@ function snapshot(path) {
3836
return fs.readFileSync(fsPath, 'utf8')
3937
}
4038

41-
4239
describe('markup', () => {
43-
it('render correct syntax for handlebars with title', function() {
40+
it('render correct syntax for handlebars with title', function () {
4441
const caseName = 'handlebars-title'
4542
assert.equal(mark(caseName), snapshot(caseName))
4643
})
4744

48-
it('render correct syntax for handlebars without title', function() {
45+
it('render correct syntax for handlebars without title', function () {
4946
const caseName = 'handlebars'
5047
assert.equal(mark(caseName), snapshot(caseName))
5148
})
5249

53-
it('render correct syntax for javascript with title', function() {
50+
it('render correct syntax for javascript with title', function () {
5451
const caseName = 'javascript-title'
5552
assert.equal(mark(caseName), snapshot(caseName))
5653
})
5754

58-
it('render correct syntax for javascript without title', function() {
55+
it('render correct syntax for javascript without title', function () {
5956
const caseName = 'javascript'
6057
assert.equal(mark(caseName), snapshot(caseName))
6158
})

test/modules-transform-test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { assert } from 'chai'
33
import _ from 'lodash'
44

55
describe('transformModules', () => {
6-
beforeEach(function() {
6+
beforeEach(function () {
77
this.yuiDocSets = _.range(3).map(i => {
88
return {
99
version: `v1.0.${i}`,
@@ -72,7 +72,7 @@ describe('transformModules', () => {
7272
transformModules(this.yuiDocSets)
7373
})
7474

75-
it('adds a parent attribute to sub modules', function() {
75+
it('adds a parent attribute to sub modules', function () {
7676
this.yuiDocSets.forEach(({ data }) => {
7777
let subModules = _.filter(data.modules, ({ is_submodule }) => is_submodule)
7878
subModules.forEach(({ parent }) => {
@@ -81,7 +81,7 @@ describe('transformModules', () => {
8181
})
8282
})
8383

84-
it('publicclasses/privateclasses attributes are set correctly', function() {
84+
it('publicclasses/privateclasses attributes are set correctly', function () {
8585
this.yuiDocSets.forEach(({ data }) => {
8686
let modules = data.modules
8787
assert.deepEqual(modules[0].publicclasses, [

0 commit comments

Comments
 (0)