|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1023 bytes
|
| 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 | function hasTests(node) {
|
|---|
| 11 | return /^\s*[xf]?(test|it|describe)(\.\w+|\[['"]\w+['"]\])?\s*\(/mu.test(node.value);
|
|---|
| 12 | }
|
|---|
| 13 |
|
|---|
| 14 | var _default = (0, _utils.createRule)({
|
|---|
| 15 | name: __filename,
|
|---|
| 16 | meta: {
|
|---|
| 17 | docs: {
|
|---|
| 18 | category: 'Best Practices',
|
|---|
| 19 | description: 'Disallow commented out tests',
|
|---|
| 20 | recommended: 'warn'
|
|---|
| 21 | },
|
|---|
| 22 | messages: {
|
|---|
| 23 | commentedTests: 'Some tests seem to be commented'
|
|---|
| 24 | },
|
|---|
| 25 | schema: [],
|
|---|
| 26 | type: 'suggestion'
|
|---|
| 27 | },
|
|---|
| 28 | defaultOptions: [],
|
|---|
| 29 |
|
|---|
| 30 | create(context) {
|
|---|
| 31 | const sourceCode = context.getSourceCode();
|
|---|
| 32 |
|
|---|
| 33 | function checkNode(node) {
|
|---|
| 34 | if (!hasTests(node)) {
|
|---|
| 35 | return;
|
|---|
| 36 | }
|
|---|
| 37 |
|
|---|
| 38 | context.report({
|
|---|
| 39 | messageId: 'commentedTests',
|
|---|
| 40 | node
|
|---|
| 41 | });
|
|---|
| 42 | }
|
|---|
| 43 |
|
|---|
| 44 | return {
|
|---|
| 45 | Program() {
|
|---|
| 46 | const comments = sourceCode.getAllComments();
|
|---|
| 47 | comments.forEach(checkNode);
|
|---|
| 48 | }
|
|---|
| 49 |
|
|---|
| 50 | };
|
|---|
| 51 | }
|
|---|
| 52 |
|
|---|
| 53 | });
|
|---|
| 54 |
|
|---|
| 55 | exports.default = _default; |
|---|
Note:
See
TracBrowser
for help on using the repository browser.