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

Lines changed: 8 additions & 6 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 10 additions & 10 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 10 additions & 11 deletions
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

Lines changed: 5 additions & 7 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

0 commit comments

Comments
 (0)