Skip to content

Commit e720baa

Browse files
Replace custom ESLint rule with builtin (#1546)
1 parent 252e737 commit e720baa

File tree

4 files changed

+9
-25
lines changed

4 files changed

+9
-25
lines changed

.eslintrc.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,4 +360,10 @@ overrides:
360360
- files: "*"
361361
excludedFiles: "**/__tests__/**"
362362
rules:
363-
no-async: error
363+
no-restricted-syntax:
364+
- error
365+
- selector: 'FunctionDeclaration[async=true]'
366+
message: >
367+
async functions are not allowed outside of the test suite because
368+
older versions of NodeJS do not support them without additional
369+
runtime dependencies. Instead, use explicit Promises.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"testonly": "mocha --require @babel/register --require @babel/polyfill --check-leaks --full-trace --timeout 15000 src/**/__tests__/**/*-test.js",
3030
"testonly:cover": "nyc --reporter html --reporter text-summary -- npm run testonly",
3131
"testonly:coveralls": "nyc --silent -- npm run testonly && nyc report --reporter text-lcov | coveralls",
32-
"lint": "eslint --report-unused-disable-directives --rulesdir ./resources/lint src || (printf '\\033[33mTry: \\033[7m npm run lint -- --fix \\033[0m\\n' && exit 1)",
32+
"lint": "eslint --report-unused-disable-directives src || (printf '\\033[33mTry: \\033[7m npm run lint -- --fix \\033[0m\\n' && exit 1)",
3333
"benchmark": "node ./resources/benchmark.js",
3434
"prettier": "prettier --write 'src/**/*.js'",
3535
"check": "flow check",

resources/lint/no-async.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

resources/watch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ function lintFiles(filepaths) {
145145
return filepaths.reduce((prev, filepath) => prev.then(prevSuccess => {
146146
if (isJS(filepath)) {
147147
process.stdout.write(' ' + filepath + ' ...');
148-
return exec('eslint', ['--rulesdir', './resources/lint', srcPath(filepath)])
148+
return exec('eslint', [srcPath(filepath)])
149149
.catch(() => false)
150150
.then(success => {
151151
console.log(CLEARLINE + ' ' + (success ? CHECK : X)

0 commit comments

Comments
 (0)