Skip to content

Commit 4128e9c

Browse files
authored
Merge pull request #98 from github/rename-app-config
Rename app config
2 parents 5711f95 + a9f54ea commit 4128e9c

File tree

8 files changed

+47
-45
lines changed

8 files changed

+47
-45
lines changed

bin/eslint-github-init.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ const questions = [
4747
}
4848
]
4949

50-
inquirer.prompt(questions).then(answers => {
50+
;(async function() {
51+
const answers = await inquirer.prompt(questions)
5152
const eslintrc = {extends: ['plugin:github/es6']}
5253

5354
if (answers.project === 'app') {
@@ -83,4 +84,4 @@ inquirer.prompt(questions).then(answers => {
8384
prettierConfig.push('')
8485

8586
fs.writeFileSync(path.resolve(process.cwd(), 'prettier.config.js'), prettierConfig.join('\n'), 'utf8')
86-
})
87+
})()

bin/github-lint.js

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -18,47 +18,49 @@ function execFile(command, args) {
1818
}
1919

2020
;(async function() {
21-
let runs = 0
22-
const codes = []
23-
const commands = []
21+
try {
22+
let runs = 0
23+
const codes = []
24+
const commands = []
2425

25-
let eslintOptions = ['--report-unused-disable-directives', '.']
26+
let eslintOptions = ['--report-unused-disable-directives', '.']
2627

27-
if (hasBasicColorSupport) {
28-
eslintOptions = eslintOptions.concat(['--color'])
29-
}
28+
if (hasBasicColorSupport) {
29+
eslintOptions = eslintOptions.concat(['--color'])
30+
}
3031

31-
const isTypeScriptProject = fs.existsSync('tsconfig.json')
32+
const isTypeScriptProject = fs.existsSync('tsconfig.json')
3233

33-
if (isTypeScriptProject) {
34-
eslintOptions = eslintOptions.concat(['--ext', '.js,.ts,.tsx'])
35-
}
34+
if (isTypeScriptProject) {
35+
eslintOptions = eslintOptions.concat(['--ext', '.js,.ts,.tsx'])
36+
}
3637

37-
commands.push(['eslint', eslintOptions])
38+
commands.push(['eslint', eslintOptions])
3839

39-
if (isTypeScriptProject) {
40-
commands.push(['tsc', ['--noEmit']])
41-
}
40+
if (isTypeScriptProject) {
41+
commands.push(['tsc', ['--noEmit']])
42+
}
4243

43-
for (const [command, args] of commands) {
44-
if (runs > 0) process.stderr.write('\n')
45-
process.stderr.write(`> ${command} ${args.join(' ')}\n`)
44+
for (const [command, args] of commands) {
45+
if (runs > 0) process.stderr.write('\n')
46+
process.stderr.write(`> ${command} ${args.join(' ')}\n`)
4647

47-
const {code, stdout, stderr} = await execFile(command, args)
48-
codes.push(code)
49-
if (stderr) process.stderr.write(stderr)
50-
if (stdout) process.stdout.write(stdout)
48+
const {code, stdout, stderr} = await execFile(command, args)
49+
codes.push(code)
50+
if (stderr) process.stderr.write(stderr)
51+
if (stdout) process.stdout.write(stdout)
5152

52-
runs++
53-
}
53+
runs++
54+
}
5455

55-
const nonzero = codes.find(code => code !== 0)
56-
if (nonzero) {
57-
process.stderr.write(`\nCommand failed: ${nonzero}\n`)
58-
process.exit(nonzero)
56+
const nonzero = codes.find(code => code !== 0)
57+
if (nonzero) {
58+
process.stderr.write(`\nCommand failed: ${nonzero}\n`)
59+
process.exit(nonzero)
60+
}
61+
} catch (error) {
62+
setTimeout(() => {
63+
throw error
64+
})
5965
}
60-
})().catch(error => {
61-
setTimeout(() => {
62-
throw error
63-
})
64-
})
66+
})()

bin/npm-check-github-package-requirements.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@ function run() {
1212
process.stdout.write(`1..${checks.length}\n`)
1313
for (const [count, name, callback] of checks) {
1414
Promise.resolve()
15+
// eslint-disable-next-line github/no-then
1516
.then(callback)
17+
// eslint-disable-next-line github/no-then
1618
.then(() => {
1719
process.stdout.write(`ok ${count} - ${name}\n`)
1820
})
21+
// eslint-disable-next-line github/no-then
1922
.catch(error => {
2023
process.stdout.write(`not ok ${count} - ${name}\n ${error}\n`)
2124
})

docs/configs.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ $ node_modules/.bin/eslint-github-init
2222

2323
A base layer of configuration recommended for any JS project. The [Prettier](https://prettier.io/) formatter is used to format code.
2424

25-
### `plugin:github/es6`
25+
### `plugin:github/internal`
2626

27-
Recommended rules when using Babel to transpile features from ES2015+.
28-
29-
### `plugin:github/app`
30-
31-
Recommended rules when writing a browser application.
27+
Recommended rules when writing a internal GitHub app.

lib/configs/browser.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module.exports = {
88
'github/async-preventdefault': 'error',
99
'github/get-attribute': 'error',
1010
'github/no-blur': 'error',
11+
'github/no-dataset': 'error',
1112
'github/no-innerText': 'error',
1213
'github/unescaped-html-literal': 'error'
1314
},

lib/configs/app.js renamed to lib/configs/internal.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ module.exports = {
33
rules: {
44
'github/authenticity-token': 'error',
55
'github/js-class-name': 'error',
6-
'github/no-d-none': 'error',
7-
'github/no-dataset': 'error',
8-
'github/no-then': 'error'
6+
'github/no-d-none': 'error'
97
},
108
extends: [require.resolve('./recommended'), require.resolve('./browser')]
119
}

lib/configs/recommended.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ module.exports = {
2121
'func-style': ['error', 'declaration', {allowArrowFunctions: true}],
2222
'github/array-foreach': 'error',
2323
'github/no-implicit-buggy-globals': 'error',
24+
'github/no-then': 'error',
2425
'import/default': 'error',
2526
'import/export': 'error',
2627
'import/first': 'error',

lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = {
1515
'unescaped-html-literal': require('./rules/unescaped-html-literal')
1616
},
1717
configs: {
18-
app: require('./configs/app'),
18+
internal: require('./configs/internal'),
1919
browser: require('./configs/browser'),
2020
recommended: require('./configs/recommended'),
2121
typescript: require('./configs/typescript')

0 commit comments

Comments
 (0)