mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-29 03:45:15 +00:00
42 lines
4.4 KiB
JavaScript
42 lines
4.4 KiB
JavaScript
|
'use strict';var _importType = require('../core/importType');var _importType2 = _interopRequireDefault(_importType);
|
||
|
var _moduleVisitor = require('eslint-module-utils/moduleVisitor');var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor);
|
||
|
var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
|
||
|
|
||
|
function reportIfMissing(context, node, allowed, name) {
|
||
|
if (allowed.indexOf(name) === -1 && (0, _importType2['default'])(name, context) === 'builtin') {
|
||
|
context.report(node, 'Do not import Node.js builtin module "' + name + '"');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = {
|
||
|
meta: {
|
||
|
type: 'suggestion',
|
||
|
docs: {
|
||
|
url: (0, _docsUrl2['default'])('no-nodejs-modules') },
|
||
|
|
||
|
schema: [
|
||
|
{
|
||
|
type: 'object',
|
||
|
properties: {
|
||
|
allow: {
|
||
|
type: 'array',
|
||
|
uniqueItems: true,
|
||
|
items: {
|
||
|
type: 'string' } } },
|
||
|
|
||
|
|
||
|
|
||
|
additionalProperties: false }] },
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
create: function () {function create(context) {
|
||
|
var options = context.options[0] || {};
|
||
|
var allowed = options.allow || [];
|
||
|
|
||
|
return (0, _moduleVisitor2['default'])(function (source, node) {
|
||
|
reportIfMissing(context, node, allowed, source.value);
|
||
|
}, { commonjs: true });
|
||
|
}return create;}() };
|
||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1ub2RlanMtbW9kdWxlcy5qcyJdLCJuYW1lcyI6WyJyZXBvcnRJZk1pc3NpbmciLCJjb250ZXh0Iiwibm9kZSIsImFsbG93ZWQiLC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