|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 4 | value: true
|
|---|
| 5 | });
|
|---|
| 6 | exports.default = void 0;
|
|---|
| 7 |
|
|---|
| 8 | var _utils = require("./utils");
|
|---|
| 9 |
|
|---|
| 10 | var _default = (0, _utils.createRule)({
|
|---|
| 11 | name: __filename,
|
|---|
| 12 | meta: {
|
|---|
| 13 | docs: {
|
|---|
| 14 | category: 'Best Practices',
|
|---|
| 15 | description: 'Suggest having hooks before any test cases',
|
|---|
| 16 | recommended: false
|
|---|
| 17 | },
|
|---|
| 18 | messages: {
|
|---|
| 19 | noHookOnTop: 'Hooks should come before test cases'
|
|---|
| 20 | },
|
|---|
| 21 | schema: [],
|
|---|
| 22 | type: 'suggestion'
|
|---|
| 23 | },
|
|---|
| 24 | defaultOptions: [],
|
|---|
| 25 |
|
|---|
| 26 | create(context) {
|
|---|
| 27 | const hooksContext = [false];
|
|---|
| 28 | return {
|
|---|
| 29 | CallExpression(node) {
|
|---|
| 30 | if (!(0, _utils.isHook)(node) && (0, _utils.isTestCaseCall)(node)) {
|
|---|
| 31 | hooksContext[hooksContext.length - 1] = true;
|
|---|
| 32 | }
|
|---|
| 33 |
|
|---|
| 34 | if (hooksContext[hooksContext.length - 1] && (0, _utils.isHook)(node)) {
|
|---|
| 35 | context.report({
|
|---|
| 36 | messageId: 'noHookOnTop',
|
|---|
| 37 | node
|
|---|
| 38 | });
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|
| 41 | hooksContext.push(false);
|
|---|
| 42 | },
|
|---|
| 43 |
|
|---|
| 44 | 'CallExpression:exit'() {
|
|---|
| 45 | hooksContext.pop();
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | };
|
|---|
| 49 | }
|
|---|
| 50 |
|
|---|
| 51 | });
|
|---|
| 52 |
|
|---|
| 53 | exports.default = _default; |
|---|
Note:
See
TracBrowser
for help on using the repository browser.