12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- 'use strict';
- var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
- module.exports = {
- meta: {
- type: 'suggestion',
- docs: {
- url: (0, _docsUrl2.default)('no-amd') },
- schema: [] },
- create: function (context) {
- return {
- 'CallExpression': function (node) {
- if (context.getScope().type !== 'module') return;
- if (node.callee.type !== 'Identifier') return;
- if (node.callee.name !== 'require' &&
- node.callee.name !== 'define') return;
-
- if (node.arguments.length !== 2) return;
- const modules = node.arguments[0];
- if (modules.type !== 'ArrayExpression') return;
-
- context.report(node, `Expected imports instead of AMD ${node.callee.name}().`);
- } };
- } };
|