From ec2dc7914404a23e5bde2ed2bed7c3055afa2c6c Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Thu, 21 Jan 2021 13:32:08 +0100 Subject: [PATCH] Add `vue/next-tick-style` rule (#1400) * Add rule docs * Add rule tests * Initial implementation: detect nextTick calls * Finish rule implementation * Add fixer for promise style * Add new rule to rule collections * Improve short description * Use `output: null` instead of copying the unchanged code * Update documentation with update tool * Simplify rule fix code * Drop unused `recommended` property * Fix require path * Update docs * Fix docs * Prevent false positives for `foo.then(nextTick)` * Update rule type * Add `foo.then(nextTick, catchHandler)` test case --- docs/rules/README.md | 1 + docs/rules/next-tick-style.md | 103 ++++++++++ lib/index.js | 1 + lib/rules/next-tick-style.js | 146 ++++++++++++++ tests/lib/rules/next-tick-style.js | 304 +++++++++++++++++++++++++++++ 5 files changed, 555 insertions(+) create mode 100644 docs/rules/next-tick-style.md create mode 100644 lib/rules/next-tick-style.js create mode 100644 tests/lib/rules/next-tick-style.js diff --git a/docs/rules/README.md b/docs/rules/README.md index c96f44a00..92674e1f5 100644 --- a/docs/rules/README.md +++ b/docs/rules/README.md @@ -294,6 +294,7 @@ For example: | [vue/html-comment-indent](./html-comment-indent.md) | enforce consistent indentation in HTML comments | :wrench: | | [vue/match-component-file-name](./match-component-file-name.md) | require component name property to match its file name | | | [vue/new-line-between-multi-line-property](./new-line-between-multi-line-property.md) | enforce new lines between multi-line properties in Vue components | :wrench: | +| [vue/next-tick-style](./next-tick-style.md) | enforce Promise or callback style in `nextTick` | :wrench: | | [vue/no-bare-strings-in-template](./no-bare-strings-in-template.md) | disallow the use of bare strings in `