|
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:
992 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 | var _default = (0, _utils.createRule)({
|
|---|
| 11 | name: __filename,
|
|---|
| 12 | meta: {
|
|---|
| 13 | type: 'problem',
|
|---|
| 14 | docs: {
|
|---|
| 15 | description: 'Disallow importing Jest',
|
|---|
| 16 | category: 'Best Practices',
|
|---|
| 17 | recommended: 'error'
|
|---|
| 18 | },
|
|---|
| 19 | messages: {
|
|---|
| 20 | unexpectedImport: `Jest is automatically in scope. Do not import "jest", as Jest doesn't export anything.`
|
|---|
| 21 | },
|
|---|
| 22 | schema: []
|
|---|
| 23 | },
|
|---|
| 24 | defaultOptions: [],
|
|---|
| 25 |
|
|---|
| 26 | create(context) {
|
|---|
| 27 | return {
|
|---|
| 28 | 'ImportDeclaration[source.value="jest"]'(node) {
|
|---|
| 29 | context.report({
|
|---|
| 30 | node,
|
|---|
| 31 | messageId: 'unexpectedImport'
|
|---|
| 32 | });
|
|---|
| 33 | },
|
|---|
| 34 |
|
|---|
| 35 | 'CallExpression[callee.name="require"][arguments.0.value="jest"]'(node) {
|
|---|
| 36 | context.report({
|
|---|
| 37 | loc: node.arguments[0].loc,
|
|---|
| 38 | messageId: 'unexpectedImport',
|
|---|
| 39 | node
|
|---|
| 40 | });
|
|---|
| 41 | }
|
|---|
| 42 |
|
|---|
| 43 | };
|
|---|
| 44 | }
|
|---|
| 45 |
|
|---|
| 46 | });
|
|---|
| 47 |
|
|---|
| 48 | exports.default = _default; |
|---|
Note:
See
TracBrowser
for help on using the repository browser.