Skip to content

Commit 50a1c5f

Browse files
authored
Merge pull request #129 from ember-learn/update-eslint
Update eslint and prettier
2 parents dc1ab55 + f34d86a commit 50a1c5f

31 files changed

+1705
-619
lines changed

.eslintrc.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,23 @@ module.exports = {
33
es6: true,
44
node: true,
55
},
6-
extends: 'eslint:recommended',
6+
extends: ['eslint:recommended', 'plugin:prettier/recommended', 'plugin:n/recommended'],
77
parserOptions: {
8-
ecmaVersion: 2018,
8+
ecmaVersion: 2020,
99
sourceType: 'module',
1010
},
1111
rules: {
12-
indent: ['error', 'tab'],
13-
'linebreak-style': ['error', 'unix'],
14-
quotes: ['error', 'single'],
15-
semi: ['error', 'never'],
16-
'no-console': ['off'],
17-
},
18-
globals: {
19-
describe: true,
20-
it: true,
21-
beforeEach: true,
22-
afterEach: true,
12+
'n/no-process-exit': 0,
2313
},
14+
overrides: [
15+
{
16+
files: 'test/**/*',
17+
env: {
18+
mocha: true,
19+
},
20+
rules: {
21+
'n/no-unpublished-import': 0,
22+
},
23+
},
24+
],
2425
}

.prettierrc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
"singleQuote": true,
33
"semi": false,
44
"printWidth": 100,
5-
"useTabs": true,
6-
"trailingComma": "es5"
5+
"arrowParens": "avoid"
76
}

generate-local.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import execa from 'execa'
44
import { copyFileSync, ensureFileSync, existsSync, removeSync } from 'fs-extra'
55
import minimist from 'minimist'
66
import path from 'path'
7-
import 'hard-rejection/register'
87

98
const docsPath = '../ember-api-docs-data'
109

@@ -17,7 +16,7 @@ const exit = function exit() {
1716
process.exit(1)
1817
}
1918

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

@@ -30,11 +29,11 @@ async function runCmd (cmd, path, args = []) {
3029
console.log(executedCmd.stdout + '\n')
3130
}
3231

33-
(async () => {
32+
;(async () => {
3433
if (!project || !version) {
3534
exit(
3635
chalk.red('Both project and version args are required.\n'),
37-
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'),
3837
)
3938
}
4039

@@ -66,13 +65,15 @@ async function runCmd (cmd, path, args = []) {
6665
await runCmd('corepack', projDirPath, ['pnpm', 'install'])
6766
}
6867

69-
7068
if (install) {
7169
await runCmd(project === 'ember' ? 'yarn' : 'pnpm install', projDirPath)
7270
console.log('\n\n')
7371
}
7472

75-
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+
)
7677

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

8384
const yuiDocFile = path.join(
8485
projDirPath,
85-
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',
8687
)
8788
copyFileSync(yuiDocFile, projYuiDocFile)
8889
}
@@ -102,6 +103,6 @@ async function runCmd (cmd, path, args = []) {
102103
project,
103104
'--version',
104105
version,
105-
'--no-sync'
106+
'--no-sync',
106107
]).stdout.pipe(process.stdout)
107108
})()

index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// eslint-disable-next-line
22
require = require('esm')(module /*, options*/)
3-
require('hard-rejection')()
43

54
const argv = require('minimist')(process.argv.slice(2))
65

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/create-classes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import saveDoc from './save-document'
1+
import saveDoc from './save-document.js'
22

33
export default async function (document, projectName, projectVersion) {
44
let things = document.data

lib/create-project-versions.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
// eslint-disable-next-line n/no-missing-import
12
import tojsonapi from 'yuidoc-to-jsonapi/lib/converter'
2-
import saveDoc from './save-document'
3-
import updateIDs from './update-with-versions-and-project'
3+
import saveDoc from './save-document.js'
4+
import updateIDs from './update-with-versions-and-project.js'
45

56
export default async function createProjectVersions(versions, projectName) {
67
const results = []

lib/fix-borked-yuidoc-files.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import fs from 'fs-extra'
22
import semverCompare from 'semver-compare'
3-
import { normalizeYuiDocClassItem } from './yuidoc-fixer/normalize-yui-doc-class-item'
4-
import { yuiDocClassItemKeys } from './yuidoc-fixer/yui-doc-class-item-keys'
5-
import { normalizeYuiDocClass } from './yuidoc-fixer/normalize-yui-doc-class'
3+
import { normalizeYuiDocClassItem } from './yuidoc-fixer/normalize-yui-doc-class-item.js'
4+
import { yuiDocClassItemKeys } from './yuidoc-fixer/yui-doc-class-item-keys.js'
5+
import { normalizeYuiDocClass } from './yuidoc-fixer/normalize-yui-doc-class.js'
66

77
/**
88
* In ember 3.10 and above we introduced decorators.

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/get-version-index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { byType } from './filter-jsonapi-doc'
1+
import { byType } from './filter-jsonapi-doc.js'
22

33
export default function getVersionIndex(doc, projectName) {
44
return {

0 commit comments

Comments
 (0)