Constnium/node_modules/eslint-plugin-import/lib/rules/unambiguous.js

36 lines
3.4 KiB
JavaScript
Raw Normal View History

2022-06-23 02:27:43 +02: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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy91bmFtYmlndW91cy5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIiwibWV0YSIsInR5cGUiLCJkb2NzIiwidXJsIiwic2NoZW1hIiwiY3JlYXRlIiwiY29udGV4dCIsInBhcnNlck9wdGlvbnMiLCJzb3VyY2VUeXBlIiwiUHJvZ3JhbSIsImFzdCIsInJlcG9ydCIsIm5vZGUiLCJtZXNzYWdlIl0sIm1hcHBpbmdzIjoiOzs7OztBQUtBO0FBQ0EscUMsaUpBTkE7Ozt5TEFRQUEsT0FBT0MsT0FBUCxHQUFpQixFQUNmQyxNQUFNO0FBQ0pDLFVBQU0sWUFERjtBQUVKQyxVQUFNO0FBQ0pDLFdBQUssMEJBQVEsYUFBUixDQURELEVBRkY7O0FBS0pDLFlBQVEsRUFMSixFQURTOzs7QUFTZkMsUUFUZSwrQkFTUkMsT0FUUSxFQVNDO0FBQ2Q7QUFDQSxVQUFJQSxRQUFRQyxhQUFSLENBQXNCQyxV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