GoScrobble/web/node_modules/eslint-plugin-import/lib/rules/unambiguous.js

36 lines
3.5 KiB
JavaScript
Raw Permalink Normal View History

2022-04-25 02:47:15 +00:00
'use strict';
var _unambiguous = require('eslint-module-utils/unambiguous');
var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} /**
* @fileOverview Report modules that could parse incorrectly as scripts.
* @author Ben Mosher
*/module.exports = { meta: {
type: 'suggestion',
docs: {
url: (0, _docsUrl2['default'])('unambiguous') },
schema: [] },
create: function () {function create(context) {
// ignore non-modules
if (context.parserOptions.sourceType !== 'module') {
return {};
}
return {
Program: function () {function Program(ast) {
if (!(0, _unambiguous.isModule)(ast)) {
context.report({
node: ast,
message: 'This module could be parsed as a valid script.' });
}
}return Program;}() };
}return create;}() };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy91bmFtYmlndW91cy5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIiwibWV0YSIsInR5cGUiLCJkb2NzIiwidXJsIiwic2NoZW1hIiwiY3JlYXRlIiwiY29udGV4dCIsInBhcnNlck9wdGlvbnMiLCJzb3VyY2VUeXBlIiwiUHJvZ3JhbSIsImFzdCIsInJlcG9ydCIsIm5vZGUiLCJtZXNzYWdlIl0sIm1hcHBpbmdzIjoiOzs7OztBQUtBO0FBQ0EscUMsaUpBTkE7Ozt5TEFRQUEsT0FBT0MsT0FBUCxHQUFpQixFQUNmQyxNQUFNO0FBQ0pDLFVBQU0sWUFERjtBQUVKQyxVQUFNO0FBQ0pDLFdBQUssMEJBQVEsYUFBUixDQURELEVBRkY7O0FBS0pDLFlBQVEsRUFMSixFQURTOzs7QUFTZkMsdUJBQVEsZ0JBQVVDLE9BQVYsRUFBbUI7QUFDekI7QUFDQSxVQUFJQSxRQUFRQyxhQUFSL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