immosquare-cleaner 0.1.34 → 0.1.35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/immosquare-cleaner/version.rb +1 -1
- data/lib/immosquare-cleaner.rb +2 -2
- data/linters/eslint.config.mjs +30 -0
- data/linters/rubocop-3.2.2.yml +2 -0
- data/node_modules/function-bind/README.md +27 -25
- data/node_modules/function-bind/implementation.js +12 -44
- data/node_modules/function-bind/package.json +14 -38
- data/node_modules/is-core-module/CHANGELOG.md +0 -7
- data/node_modules/is-core-module/index.js +2 -2
- data/node_modules/is-core-module/package.json +4 -4
- data/package.json +2 -4
- metadata +3 -180
- data/linters/eslintrc.json +0 -57
- data/node_modules/.bin/rimraf +0 -1
- data/node_modules/eslint-config-airbnb-base/CHANGELOG.md +0 -374
- data/node_modules/eslint-config-airbnb-base/LICENSE.md +0 -21
- data/node_modules/eslint-config-airbnb-base/README.md +0 -112
- data/node_modules/eslint-config-airbnb-base/index.js +0 -17
- data/node_modules/eslint-config-airbnb-base/legacy.js +0 -34
- data/node_modules/eslint-config-airbnb-base/node_modules/semver/LICENSE +0 -15
- data/node_modules/eslint-config-airbnb-base/node_modules/semver/README.md +0 -443
- data/node_modules/eslint-config-airbnb-base/node_modules/semver/bin/semver.js +0 -174
- data/node_modules/eslint-config-airbnb-base/node_modules/semver/package.json +0 -38
- data/node_modules/eslint-config-airbnb-base/node_modules/semver/range.bnf +0 -16
- data/node_modules/eslint-config-airbnb-base/node_modules/semver/semver.js +0 -1643
- data/node_modules/eslint-config-airbnb-base/package.json +0 -95
- data/node_modules/eslint-config-airbnb-base/rules/best-practices.js +0 -408
- data/node_modules/eslint-config-airbnb-base/rules/errors.js +0 -179
- data/node_modules/eslint-config-airbnb-base/rules/es6.js +0 -185
- data/node_modules/eslint-config-airbnb-base/rules/imports.js +0 -273
- data/node_modules/eslint-config-airbnb-base/rules/node.js +0 -43
- data/node_modules/eslint-config-airbnb-base/rules/strict.js +0 -6
- data/node_modules/eslint-config-airbnb-base/rules/style.js +0 -529
- data/node_modules/eslint-config-airbnb-base/rules/variables.js +0 -56
- data/node_modules/eslint-config-airbnb-base/test/requires.js +0 -13
- data/node_modules/eslint-config-airbnb-base/test/test-base.js +0 -32
- data/node_modules/eslint-config-airbnb-base/whitespace-async.js +0 -96
- data/node_modules/eslint-config-airbnb-base/whitespace.js +0 -102
- data/node_modules/eslint-plugin-import/CHANGELOG.md +0 -1925
- data/node_modules/eslint-plugin-import/CONTRIBUTING.md +0 -84
- data/node_modules/eslint-plugin-import/LICENSE +0 -22
- data/node_modules/eslint-plugin-import/README.md +0 -500
- data/node_modules/eslint-plugin-import/RELEASE.md +0 -54
- data/node_modules/eslint-plugin-import/SECURITY.md +0 -11
- data/node_modules/eslint-plugin-import/config/electron.js +0 -8
- data/node_modules/eslint-plugin-import/config/errors.js +0 -14
- data/node_modules/eslint-plugin-import/config/react-native.js +0 -13
- data/node_modules/eslint-plugin-import/config/react.js +0 -18
- data/node_modules/eslint-plugin-import/config/recommended.js +0 -28
- data/node_modules/eslint-plugin-import/config/stage-0.js +0 -12
- data/node_modules/eslint-plugin-import/config/typescript.js +0 -34
- data/node_modules/eslint-plugin-import/config/warnings.js +0 -12
- data/node_modules/eslint-plugin-import/docs/rules/consistent-type-specifier-style.md +0 -91
- data/node_modules/eslint-plugin-import/docs/rules/default.md +0 -72
- data/node_modules/eslint-plugin-import/docs/rules/dynamic-import-chunkname.md +0 -92
- data/node_modules/eslint-plugin-import/docs/rules/export.md +0 -37
- data/node_modules/eslint-plugin-import/docs/rules/exports-last.md +0 -51
- data/node_modules/eslint-plugin-import/docs/rules/extensions.md +0 -174
- data/node_modules/eslint-plugin-import/docs/rules/first.md +0 -75
- data/node_modules/eslint-plugin-import/docs/rules/group-exports.md +0 -118
- data/node_modules/eslint-plugin-import/docs/rules/imports-first.md +0 -9
- data/node_modules/eslint-plugin-import/docs/rules/max-dependencies.md +0 -70
- data/node_modules/eslint-plugin-import/docs/rules/named.md +0 -102
- data/node_modules/eslint-plugin-import/docs/rules/namespace.md +0 -106
- data/node_modules/eslint-plugin-import/docs/rules/newline-after-import.md +0 -167
- data/node_modules/eslint-plugin-import/docs/rules/no-absolute-path.md +0 -54
- data/node_modules/eslint-plugin-import/docs/rules/no-amd.md +0 -37
- data/node_modules/eslint-plugin-import/docs/rules/no-anonymous-default-export.md +0 -83
- data/node_modules/eslint-plugin-import/docs/rules/no-commonjs.md +0 -96
- data/node_modules/eslint-plugin-import/docs/rules/no-cycle.md +0 -111
- data/node_modules/eslint-plugin-import/docs/rules/no-default-export.md +0 -65
- data/node_modules/eslint-plugin-import/docs/rules/no-deprecated.md +0 -62
- data/node_modules/eslint-plugin-import/docs/rules/no-duplicates.md +0 -109
- data/node_modules/eslint-plugin-import/docs/rules/no-dynamic-require.md +0 -25
- data/node_modules/eslint-plugin-import/docs/rules/no-empty-named-blocks.md +0 -49
- data/node_modules/eslint-plugin-import/docs/rules/no-extraneous-dependencies.md +0 -139
- data/node_modules/eslint-plugin-import/docs/rules/no-import-module-exports.md +0 -81
- data/node_modules/eslint-plugin-import/docs/rules/no-internal-modules.md +0 -136
- data/node_modules/eslint-plugin-import/docs/rules/no-mutable-exports.md +0 -54
- data/node_modules/eslint-plugin-import/docs/rules/no-named-as-default-member.md +0 -52
- data/node_modules/eslint-plugin-import/docs/rules/no-named-as-default.md +0 -53
- data/node_modules/eslint-plugin-import/docs/rules/no-named-default.md +0 -36
- data/node_modules/eslint-plugin-import/docs/rules/no-named-export.md +0 -79
- data/node_modules/eslint-plugin-import/docs/rules/no-namespace.md +0 -44
- data/node_modules/eslint-plugin-import/docs/rules/no-nodejs-modules.md +0 -42
- data/node_modules/eslint-plugin-import/docs/rules/no-relative-packages.md +0 -70
- data/node_modules/eslint-plugin-import/docs/rules/no-relative-parent-imports.md +0 -123
- data/node_modules/eslint-plugin-import/docs/rules/no-restricted-paths.md +0 -198
- data/node_modules/eslint-plugin-import/docs/rules/no-self-import.md +0 -32
- data/node_modules/eslint-plugin-import/docs/rules/no-unassigned-import.md +0 -60
- data/node_modules/eslint-plugin-import/docs/rules/no-unresolved.md +0 -110
- data/node_modules/eslint-plugin-import/docs/rules/no-unused-modules.md +0 -125
- data/node_modules/eslint-plugin-import/docs/rules/no-useless-path-segments.md +0 -85
- data/node_modules/eslint-plugin-import/docs/rules/no-webpack-loader-syntax.md +0 -39
- data/node_modules/eslint-plugin-import/docs/rules/order.md +0 -365
- data/node_modules/eslint-plugin-import/docs/rules/prefer-default-export.md +0 -185
- data/node_modules/eslint-plugin-import/docs/rules/unambiguous.md +0 -57
- data/node_modules/eslint-plugin-import/lib/ExportMap.js +0 -856
- data/node_modules/eslint-plugin-import/lib/core/importType.js +0 -129
- data/node_modules/eslint-plugin-import/lib/core/packagePath.js +0 -22
- data/node_modules/eslint-plugin-import/lib/core/staticRequire.js +0 -11
- data/node_modules/eslint-plugin-import/lib/docsUrl.js +0 -8
- data/node_modules/eslint-plugin-import/lib/importDeclaration.js +0 -5
- data/node_modules/eslint-plugin-import/lib/index.js +0 -71
- data/node_modules/eslint-plugin-import/lib/rules/consistent-type-specifier-style.js +0 -221
- data/node_modules/eslint-plugin-import/lib/rules/default.js +0 -40
- data/node_modules/eslint-plugin-import/lib/rules/dynamic-import-chunkname.js +0 -120
- data/node_modules/eslint-plugin-import/lib/rules/export.js +0 -250
- data/node_modules/eslint-plugin-import/lib/rules/exports-last.js +0 -40
- data/node_modules/eslint-plugin-import/lib/rules/extensions.js +0 -193
- data/node_modules/eslint-plugin-import/lib/rules/first.js +0 -144
- data/node_modules/eslint-plugin-import/lib/rules/group-exports.js +0 -155
- data/node_modules/eslint-plugin-import/lib/rules/imports-first.js +0 -16
- data/node_modules/eslint-plugin-import/lib/rules/max-dependencies.js +0 -60
- data/node_modules/eslint-plugin-import/lib/rules/named.js +0 -143
- data/node_modules/eslint-plugin-import/lib/rules/namespace.js +0 -218
- data/node_modules/eslint-plugin-import/lib/rules/newline-after-import.js +0 -237
- data/node_modules/eslint-plugin-import/lib/rules/no-absolute-path.js +0 -40
- data/node_modules/eslint-plugin-import/lib/rules/no-amd.js +0 -47
- data/node_modules/eslint-plugin-import/lib/rules/no-anonymous-default-export.js +0 -103
- data/node_modules/eslint-plugin-import/lib/rules/no-commonjs.js +0 -141
- data/node_modules/eslint-plugin-import/lib/rules/no-cycle.js +0 -158
- data/node_modules/eslint-plugin-import/lib/rules/no-default-export.js +0 -43
- data/node_modules/eslint-plugin-import/lib/rules/no-deprecated.js +0 -138
- data/node_modules/eslint-plugin-import/lib/rules/no-duplicates.js +0 -354
- data/node_modules/eslint-plugin-import/lib/rules/no-dynamic-require.js +0 -77
- data/node_modules/eslint-plugin-import/lib/rules/no-empty-named-blocks.js +0 -105
- data/node_modules/eslint-plugin-import/lib/rules/no-extraneous-dependencies.js +0 -301
- data/node_modules/eslint-plugin-import/lib/rules/no-import-module-exports.js +0 -85
- data/node_modules/eslint-plugin-import/lib/rules/no-internal-modules.js +0 -144
- data/node_modules/eslint-plugin-import/lib/rules/no-mutable-exports.js +0 -59
- data/node_modules/eslint-plugin-import/lib/rules/no-named-as-default-member.js +0 -96
- data/node_modules/eslint-plugin-import/lib/rules/no-named-as-default.js +0 -45
- data/node_modules/eslint-plugin-import/lib/rules/no-named-default.js +0 -31
- data/node_modules/eslint-plugin-import/lib/rules/no-named-export.js +0 -39
- data/node_modules/eslint-plugin-import/lib/rules/no-namespace.js +0 -175
- data/node_modules/eslint-plugin-import/lib/rules/no-nodejs-modules.js +0 -44
- data/node_modules/eslint-plugin-import/lib/rules/no-relative-packages.js +0 -71
- data/node_modules/eslint-plugin-import/lib/rules/no-relative-parent-imports.js +0 -48
- data/node_modules/eslint-plugin-import/lib/rules/no-restricted-paths.js +0 -245
- data/node_modules/eslint-plugin-import/lib/rules/no-self-import.js +0 -39
- data/node_modules/eslint-plugin-import/lib/rules/no-unassigned-import.js +0 -79
- data/node_modules/eslint-plugin-import/lib/rules/no-unresolved.js +0 -60
- data/node_modules/eslint-plugin-import/lib/rules/no-unused-modules.js +0 -945
- data/node_modules/eslint-plugin-import/lib/rules/no-useless-path-segments.js +0 -147
- data/node_modules/eslint-plugin-import/lib/rules/no-webpack-loader-syntax.js +0 -26
- data/node_modules/eslint-plugin-import/lib/rules/order.js +0 -785
- data/node_modules/eslint-plugin-import/lib/rules/prefer-default-export.js +0 -116
- data/node_modules/eslint-plugin-import/lib/rules/unambiguous.js +0 -38
- data/node_modules/eslint-plugin-import/memo-parser/LICENSE +0 -22
- data/node_modules/eslint-plugin-import/memo-parser/README.md +0 -21
- data/node_modules/eslint-plugin-import/memo-parser/index.js +0 -41
- data/node_modules/eslint-plugin-import/node_modules/debug/CHANGELOG.md +0 -395
- data/node_modules/eslint-plugin-import/node_modules/debug/LICENSE +0 -19
- data/node_modules/eslint-plugin-import/node_modules/debug/README.md +0 -437
- data/node_modules/eslint-plugin-import/node_modules/debug/node.js +0 -1
- data/node_modules/eslint-plugin-import/node_modules/debug/node_modules/ms/index.js +0 -162
- data/node_modules/eslint-plugin-import/node_modules/debug/node_modules/ms/license.md +0 -21
- data/node_modules/eslint-plugin-import/node_modules/debug/node_modules/ms/package.json +0 -38
- data/node_modules/eslint-plugin-import/node_modules/debug/node_modules/ms/readme.md +0 -59
- data/node_modules/eslint-plugin-import/node_modules/debug/package.json +0 -51
- data/node_modules/eslint-plugin-import/node_modules/debug/src/browser.js +0 -180
- data/node_modules/eslint-plugin-import/node_modules/debug/src/common.js +0 -249
- data/node_modules/eslint-plugin-import/node_modules/debug/src/index.js +0 -12
- data/node_modules/eslint-plugin-import/node_modules/debug/src/node.js +0 -177
- data/node_modules/eslint-plugin-import/node_modules/doctrine/CHANGELOG.md +0 -94
- data/node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE +0 -177
- data/node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.closure-compiler +0 -202
- data/node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.esprima +0 -19
- data/node_modules/eslint-plugin-import/node_modules/doctrine/README.md +0 -165
- data/node_modules/eslint-plugin-import/node_modules/doctrine/lib/doctrine.js +0 -899
- data/node_modules/eslint-plugin-import/node_modules/doctrine/lib/typed.js +0 -1305
- data/node_modules/eslint-plugin-import/node_modules/doctrine/lib/utility.js +0 -35
- data/node_modules/eslint-plugin-import/node_modules/doctrine/package.json +0 -57
- data/node_modules/eslint-plugin-import/node_modules/minimatch/LICENSE +0 -15
- data/node_modules/eslint-plugin-import/node_modules/minimatch/README.md +0 -230
- data/node_modules/eslint-plugin-import/node_modules/minimatch/minimatch.js +0 -947
- data/node_modules/eslint-plugin-import/node_modules/minimatch/node_modules/brace-expansion/LICENSE +0 -21
- data/node_modules/eslint-plugin-import/node_modules/minimatch/node_modules/brace-expansion/README.md +0 -129
- data/node_modules/eslint-plugin-import/node_modules/minimatch/node_modules/brace-expansion/index.js +0 -201
- data/node_modules/eslint-plugin-import/node_modules/minimatch/node_modules/brace-expansion/package.json +0 -47
- data/node_modules/eslint-plugin-import/node_modules/minimatch/package.json +0 -33
- data/node_modules/eslint-plugin-import/node_modules/semver/LICENSE +0 -15
- data/node_modules/eslint-plugin-import/node_modules/semver/README.md +0 -443
- data/node_modules/eslint-plugin-import/node_modules/semver/bin/semver.js +0 -174
- data/node_modules/eslint-plugin-import/node_modules/semver/package.json +0 -38
- data/node_modules/eslint-plugin-import/node_modules/semver/range.bnf +0 -16
- data/node_modules/eslint-plugin-import/node_modules/semver/semver.js +0 -1643
- data/node_modules/eslint-plugin-import/package.json +0 -124
- data/node_modules/function-bind/CHANGELOG.md +0 -136
@@ -1,120 +0,0 @@
|
|
1
|
-
'use strict';var _vm = require('vm');var _vm2 = _interopRequireDefault(_vm);
|
2
|
-
var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
|
3
|
-
|
4
|
-
module.exports = {
|
5
|
-
meta: {
|
6
|
-
type: 'suggestion',
|
7
|
-
docs: {
|
8
|
-
category: 'Style guide',
|
9
|
-
description: 'Enforce a leading comment with the webpackChunkName for dynamic imports.',
|
10
|
-
url: (0, _docsUrl2['default'])('dynamic-import-chunkname') },
|
11
|
-
|
12
|
-
schema: [{
|
13
|
-
type: 'object',
|
14
|
-
properties: {
|
15
|
-
importFunctions: {
|
16
|
-
type: 'array',
|
17
|
-
uniqueItems: true,
|
18
|
-
items: {
|
19
|
-
type: 'string' } },
|
20
|
-
|
21
|
-
|
22
|
-
webpackChunknameFormat: {
|
23
|
-
type: 'string' } } }] },
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
create: function () {function create(context) {
|
30
|
-
var config = context.options[0];var _ref =
|
31
|
-
config || {},_ref$importFunctions = _ref.importFunctions,importFunctions = _ref$importFunctions === undefined ? [] : _ref$importFunctions;var _ref2 =
|
32
|
-
config || {},_ref2$webpackChunknam = _ref2.webpackChunknameFormat,webpackChunknameFormat = _ref2$webpackChunknam === undefined ? '([0-9a-zA-Z-_/.]|\\[(request|index)\\])+' : _ref2$webpackChunknam;
|
33
|
-
|
34
|
-
var paddedCommentRegex = /^ (\S[\s\S]+\S) $/;
|
35
|
-
var commentStyleRegex = /^( ((webpackChunkName: .+)|((webpackPrefetch|webpackPreload): (true|false|-?[0-9]+))|(webpackIgnore: (true|false))|((webpackInclude|webpackExclude): \/.*\/)|(webpackMode: ["'](lazy|lazy-once|eager|weak)["'])|(webpackExports: (['"]\w+['"]|\[(['"]\w+['"], *)+(['"]\w+['"]*)\]))),?)+ $/;
|
36
|
-
var chunkSubstrFormat = ' webpackChunkName: ["\']' + String(webpackChunknameFormat) + '["\'],? ';
|
37
|
-
var chunkSubstrRegex = new RegExp(chunkSubstrFormat);
|
38
|
-
|
39
|
-
function run(node, arg) {
|
40
|
-
var sourceCode = context.getSourceCode();
|
41
|
-
var leadingComments = sourceCode.getCommentsBefore ?
|
42
|
-
sourceCode.getCommentsBefore(arg) // This method is available in ESLint >= 4.
|
43
|
-
: sourceCode.getComments(arg).leading; // This method is deprecated in ESLint 7.
|
44
|
-
|
45
|
-
if (!leadingComments || leadingComments.length === 0) {
|
46
|
-
context.report({
|
47
|
-
node: node,
|
48
|
-
message: 'dynamic imports require a leading comment with the webpack chunkname' });
|
49
|
-
|
50
|
-
return;
|
51
|
-
}
|
52
|
-
|
53
|
-
var isChunknamePresent = false;var _iteratorNormalCompletion = true;var _didIteratorError = false;var _iteratorError = undefined;try {
|
54
|
-
|
55
|
-
for (var _iterator = leadingComments[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {var comment = _step.value;
|
56
|
-
if (comment.type !== 'Block') {
|
57
|
-
context.report({
|
58
|
-
node: node,
|
59
|
-
message: 'dynamic imports require a /* foo */ style comment, not a // foo comment' });
|
60
|
-
|
61
|
-
return;
|
62
|
-
}
|
63
|
-
|
64
|
-
if (!paddedCommentRegex.test(comment.value)) {
|
65
|
-
context.report({
|
66
|
-
node: node,
|
67
|
-
message: 'dynamic imports require a block comment padded with spaces - /* foo */' });
|
68
|
-
|
69
|
-
return;
|
70
|
-
}
|
71
|
-
|
72
|
-
try {
|
73
|
-
// just like webpack itself does
|
74
|
-
_vm2['default'].runInNewContext('(function() {return {' + String(comment.value) + '}})()');
|
75
|
-
} catch (error) {
|
76
|
-
context.report({
|
77
|
-
node: node,
|
78
|
-
message: 'dynamic imports require a "webpack" comment with valid syntax' });
|
79
|
-
|
80
|
-
return;
|
81
|
-
}
|
82
|
-
|
83
|
-
if (!commentStyleRegex.test(comment.value)) {
|
84
|
-
context.report({
|
85
|
-
node: node,
|
86
|
-
message: 'dynamic imports require a "webpack" comment with valid syntax' });
|
87
|
-
|
88
|
-
|
89
|
-
return;
|
90
|
-
}
|
91
|
-
|
92
|
-
if (chunkSubstrRegex.test(comment.value)) {
|
93
|
-
isChunknamePresent = true;
|
94
|
-
}
|
95
|
-
}} catch (err) {_didIteratorError = true;_iteratorError = err;} finally {try {if (!_iteratorNormalCompletion && _iterator['return']) {_iterator['return']();}} finally {if (_didIteratorError) {throw _iteratorError;}}}
|
96
|
-
|
97
|
-
if (!isChunknamePresent) {
|
98
|
-
context.report({
|
99
|
-
node: node,
|
100
|
-
message: 'dynamic imports require a leading comment in the form /*' +
|
101
|
-
chunkSubstrFormat + '*/' });
|
102
|
-
|
103
|
-
}
|
104
|
-
}
|
105
|
-
|
106
|
-
return {
|
107
|
-
ImportExpression: function () {function ImportExpression(node) {
|
108
|
-
run(node, node.source);
|
109
|
-
}return ImportExpression;}(),
|
110
|
-
|
111
|
-
CallExpression: function () {function CallExpression(node) {
|
112
|
-
if (node.callee.type !== 'Import' && importFunctions.indexOf(node.callee.name) < 0) {
|
113
|
-
return;
|
114
|
-
}
|
115
|
-
|
116
|
-
run(node, node.arguments[0]);
|
117
|
-
}return CallExpression;}() };
|
118
|
-
|
119
|
-
}return create;}() };
|
120
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9keW5hbWljLWltcG9ydC1jaHVua25hbWUuanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJ0eXBlIiwiZG9jcyIsImNhdGVnb3J5IiwiZGVzY3JpcHRpb24iLCJ1cmwiLCJzY2hlbWEiLCJwcm9wZXJ0aWVzIiwiaW1wb3J0RnVuY3Rpb25zIiwidW5pcXVlSXRlbXMiLCJpdGVtcyIsIndlYnBhY2tDaHVua25hbWVGb3JtYXQiLCJjcmVhdGUiLCJjb250ZXh0IiwiY29uZmlnIiwib3B0aW9ucyIsInBhZGRlZENvbW1lbnRSZWdleCIsImNvbW1lbnRTdHlsZVJlZ2V4IiwiY2h1bmtTdWJzdHJGb3JtYXQiLCJjaHVua1N1YnN0clJlZ2V4IiwiUmVnRXhwIiwicnVuIiwibm9kZSIsImFyZyIsInNvdXJjZUNvZGUiLCJnZXRTb3VyY2VDb2RlIiwibGVhZGluZ0NvbW1lbnRzIiwi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iAgICAgICAgICAgIG1lc3NhZ2U6IGBkeW5hbWljIGltcG9ydHMgcmVxdWlyZSBhIGJsb2NrIGNvbW1lbnQgcGFkZGVkIHdpdGggc3BhY2VzIC0gLyogZm9vICovYCxcbiAgICAgICAgICB9KTtcbiAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICB0cnkge1xuICAgICAgICAgIC8vIGp1c3QgbGlrZSB3ZWJwYWNrIGl0c2VsZiBkb2VzXG4gICAgICAgICAgdm0ucnVuSW5OZXdDb250ZXh0KGAoZnVuY3Rpb24oKSB7cmV0dXJuIHske2NvbW1lbnQudmFsdWV9fX0pKClgKTtcbiAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgICBjb250ZXh0LnJlcG9ydCh7XG4gICAgICAgICAgICBub2RlLFxuICAgICAgICAgICAgbWVzc2FnZTogYGR5bmFtaWMgaW1wb3J0cyByZXF1aXJlIGEgXCJ3ZWJwYWNrXCIgY29tbWVudCB3aXRoIHZhbGlkIHN5bnRheGAsXG4gICAgICAgICAgfSk7XG4gICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKCFjb21tZW50U3R5bGVSZWdleC50ZXN0KGNvbW1lbnQudmFsdWUpKSB7XG4gICAgICAgICAgY29udGV4dC5yZXBvcnQoe1xuICAgICAgICAgICAgbm9kZSxcbiAgICAgICAgICAgIG1lc3NhZ2U6XG4gICAgICAgICAgICAgIGBkeW5hbWljIGltcG9ydHMgcmVxdWlyZSBhIFwid2VicGFja1wiIGNvbW1lbnQgd2l0aCB2YWxpZCBzeW50YXhgLFxuICAgICAgICAgIH0pO1xuICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChjaHVua1N1YnN0clJlZ2V4LnRlc3QoY29tbWVudC52YWx1ZSkpIHtcbiAgICAgICAgICBpc0NodW5rbmFtZVByZXNlbnQgPSB0cnVlO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIGlmICghaXNDaHVua25hbWVQcmVzZW50KSB7XG4gICAgICAgIGNvbnRleHQucmVwb3J0KHtcbiAgICAgICAgICBub2RlLFxuICAgICAgICAgIG1lc3NhZ2U6XG4gICAgICAgICAgICBgZHluYW1pYyBpbXBvcnRzIHJlcXVpcmUgYSBsZWFkaW5nIGNvbW1lbnQgaW4gdGhlIGZvcm0gLyoke2NodW5rU3Vic3RyRm9ybWF0fSovYCxcbiAgICAgICAgfSk7XG4gICAgICB9XG4gICAgfVxuXG4gICAgcmV0dXJuIHtcbiAgICAgIEltcG9ydEV4cHJlc3Npb24obm9kZSkge1xuICAgICAgICBydW4obm9kZSwgbm9kZS5zb3VyY2UpO1xuICAgICAgfSxcblxuICAgICAgQ2FsbEV4cHJlc3Npb24obm9kZSkge1xuICAgICAgICBpZiAobm9kZS5jYWxsZWUudHlwZSAhPT0gJ0ltcG9ydCcgJiYgaW1wb3J0RnVuY3Rpb25zLmluZGV4T2Yobm9kZS5jYWxsZWUubmFtZSkgPCAwKSB7XG4gICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG5cbiAgICAgICAgcnVuKG5vZGUsIG5vZGUuYXJndW1lbnRzWzBdKTtcbiAgICAgIH0sXG4gICAgfTtcbiAgfSxcbn07XG4iXX0=
|
@@ -1,250 +0,0 @@
|
|
1
|
-
'use strict';var _slicedToArray = function () {function sliceIterator(arr, i) {var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"]) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}return function (arr, i) {if (Array.isArray(arr)) {return arr;} else if (Symbol.iterator in Object(arr)) {return sliceIterator(arr, i);} else {throw new TypeError("Invalid attempt to destructure non-iterable instance");}};}();var _ExportMap = require('../ExportMap');var _ExportMap2 = _interopRequireDefault(_ExportMap);
|
2
|
-
var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);
|
3
|
-
var _arrayIncludes = require('array-includes');var _arrayIncludes2 = _interopRequireDefault(_arrayIncludes);
|
4
|
-
var _arrayPrototype = require('array.prototype.flatmap');var _arrayPrototype2 = _interopRequireDefault(_arrayPrototype);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
|
5
|
-
|
6
|
-
/*
|
7
|
-
Notes on TypeScript namespaces aka TSModuleDeclaration:
|
8
|
-
|
9
|
-
There are two forms:
|
10
|
-
- active namespaces: namespace Foo {} / module Foo {}
|
11
|
-
- ambient modules; declare module "eslint-plugin-import" {}
|
12
|
-
|
13
|
-
active namespaces:
|
14
|
-
- cannot contain a default export
|
15
|
-
- cannot contain an export all
|
16
|
-
- cannot contain a multi name export (export { a, b })
|
17
|
-
- can have active namespaces nested within them
|
18
|
-
|
19
|
-
ambient namespaces:
|
20
|
-
- can only be defined in .d.ts files
|
21
|
-
- cannot be nested within active namespaces
|
22
|
-
- have no other restrictions
|
23
|
-
*/
|
24
|
-
|
25
|
-
var rootProgram = 'root';
|
26
|
-
var tsTypePrefix = 'type:';
|
27
|
-
|
28
|
-
/**
|
29
|
-
* Detect function overloads like:
|
30
|
-
* ```ts
|
31
|
-
* export function foo(a: number);
|
32
|
-
* export function foo(a: string);
|
33
|
-
* export function foo(a: number|string) { return a; }
|
34
|
-
* ```
|
35
|
-
* @param {Set<Object>} nodes
|
36
|
-
* @returns {boolean}
|
37
|
-
*/
|
38
|
-
function isTypescriptFunctionOverloads(nodes) {
|
39
|
-
var nodesArr = Array.from(nodes);
|
40
|
-
|
41
|
-
var idents = (0, _arrayPrototype2['default'])(
|
42
|
-
nodesArr,
|
43
|
-
function (node) {return node.declaration && (
|
44
|
-
node.declaration.type === 'TSDeclareFunction' // eslint 6+
|
45
|
-
|| node.declaration.type === 'TSEmptyBodyFunctionDeclaration' // eslint 4-5
|
46
|
-
) ?
|
47
|
-
node.declaration.id.name :
|
48
|
-
[];});
|
49
|
-
|
50
|
-
if (new Set(idents).size !== idents.length) {
|
51
|
-
return true;
|
52
|
-
}
|
53
|
-
|
54
|
-
var types = new Set(nodesArr.map(function (node) {return node.parent.type;}));
|
55
|
-
if (!types.has('TSDeclareFunction')) {
|
56
|
-
return false;
|
57
|
-
}
|
58
|
-
if (types.size === 1) {
|
59
|
-
return true;
|
60
|
-
}
|
61
|
-
if (types.size === 2 && types.has('FunctionDeclaration')) {
|
62
|
-
return true;
|
63
|
-
}
|
64
|
-
return false;
|
65
|
-
}
|
66
|
-
|
67
|
-
/**
|
68
|
-
* Detect merging Namespaces with Classes, Functions, or Enums like:
|
69
|
-
* ```ts
|
70
|
-
* export class Foo { }
|
71
|
-
* export namespace Foo { }
|
72
|
-
* ```
|
73
|
-
* @param {Set<Object>} nodes
|
74
|
-
* @returns {boolean}
|
75
|
-
*/
|
76
|
-
function isTypescriptNamespaceMerging(nodes) {
|
77
|
-
var types = new Set(Array.from(nodes, function (node) {return node.parent.type;}));
|
78
|
-
var noNamespaceNodes = Array.from(nodes).filter(function (node) {return node.parent.type !== 'TSModuleDeclaration';});
|
79
|
-
|
80
|
-
return types.has('TSModuleDeclaration') && (
|
81
|
-
|
82
|
-
types.size === 1
|
83
|
-
// Merging with functions
|
84
|
-
|| types.size === 2 && (types.has('FunctionDeclaration') || types.has('TSDeclareFunction')) ||
|
85
|
-
types.size === 3 && types.has('FunctionDeclaration') && types.has('TSDeclareFunction')
|
86
|
-
// Merging with classes or enums
|
87
|
-
|| types.size === 2 && (types.has('ClassDeclaration') || types.has('TSEnumDeclaration')) && noNamespaceNodes.length === 1);
|
88
|
-
|
89
|
-
}
|
90
|
-
|
91
|
-
/**
|
92
|
-
* Detect if a typescript namespace node should be reported as multiple export:
|
93
|
-
* ```ts
|
94
|
-
* export class Foo { }
|
95
|
-
* export function Foo();
|
96
|
-
* export namespace Foo { }
|
97
|
-
* ```
|
98
|
-
* @param {Object} node
|
99
|
-
* @param {Set<Object>} nodes
|
100
|
-
* @returns {boolean}
|
101
|
-
*/
|
102
|
-
function shouldSkipTypescriptNamespace(node, nodes) {
|
103
|
-
var types = new Set(Array.from(nodes, function (node) {return node.parent.type;}));
|
104
|
-
|
105
|
-
return !isTypescriptNamespaceMerging(nodes) &&
|
106
|
-
node.parent.type === 'TSModuleDeclaration' && (
|
107
|
-
|
108
|
-
types.has('TSEnumDeclaration') ||
|
109
|
-
types.has('ClassDeclaration') ||
|
110
|
-
types.has('FunctionDeclaration') ||
|
111
|
-
types.has('TSDeclareFunction'));
|
112
|
-
|
113
|
-
}
|
114
|
-
|
115
|
-
module.exports = {
|
116
|
-
meta: {
|
117
|
-
type: 'problem',
|
118
|
-
docs: {
|
119
|
-
category: 'Helpful warnings',
|
120
|
-
description: 'Forbid any invalid exports, i.e. re-export of the same name.',
|
121
|
-
url: (0, _docsUrl2['default'])('export') },
|
122
|
-
|
123
|
-
schema: [] },
|
124
|
-
|
125
|
-
|
126
|
-
create: function () {function create(context) {
|
127
|
-
var namespace = new Map([[rootProgram, new Map()]]);
|
128
|
-
|
129
|
-
function addNamed(name, node, parent, isType) {
|
130
|
-
if (!namespace.has(parent)) {
|
131
|
-
namespace.set(parent, new Map());
|
132
|
-
}
|
133
|
-
var named = namespace.get(parent);
|
134
|
-
|
135
|
-
var key = isType ? '' + tsTypePrefix + String(name) : name;
|
136
|
-
var nodes = named.get(key);
|
137
|
-
|
138
|
-
if (nodes == null) {
|
139
|
-
nodes = new Set();
|
140
|
-
named.set(key, nodes);
|
141
|
-
}
|
142
|
-
|
143
|
-
nodes.add(node);
|
144
|
-
}
|
145
|
-
|
146
|
-
function getParent(node) {
|
147
|
-
if (node.parent && node.parent.type === 'TSModuleBlock') {
|
148
|
-
return node.parent.parent;
|
149
|
-
}
|
150
|
-
|
151
|
-
// just in case somehow a non-ts namespace export declaration isn't directly
|
152
|
-
// parented to the root Program node
|
153
|
-
return rootProgram;
|
154
|
-
}
|
155
|
-
|
156
|
-
return {
|
157
|
-
ExportDefaultDeclaration: function () {function ExportDefaultDeclaration(node) {
|
158
|
-
addNamed('default', node, getParent(node));
|
159
|
-
}return ExportDefaultDeclaration;}(),
|
160
|
-
|
161
|
-
ExportSpecifier: function () {function ExportSpecifier(node) {
|
162
|
-
addNamed(
|
163
|
-
node.exported.name || node.exported.value,
|
164
|
-
node.exported,
|
165
|
-
getParent(node.parent));
|
166
|
-
|
167
|
-
}return ExportSpecifier;}(),
|
168
|
-
|
169
|
-
ExportNamedDeclaration: function () {function ExportNamedDeclaration(node) {
|
170
|
-
if (node.declaration == null) {return;}
|
171
|
-
|
172
|
-
var parent = getParent(node);
|
173
|
-
// support for old TypeScript versions
|
174
|
-
var isTypeVariableDecl = node.declaration.kind === 'type';
|
175
|
-
|
176
|
-
if (node.declaration.id != null) {
|
177
|
-
if ((0, _arrayIncludes2['default'])([
|
178
|
-
'TSTypeAliasDeclaration',
|
179
|
-
'TSInterfaceDeclaration'],
|
180
|
-
node.declaration.type)) {
|
181
|
-
addNamed(node.declaration.id.name, node.declaration.id, parent, true);
|
182
|
-
} else {
|
183
|
-
addNamed(node.declaration.id.name, node.declaration.id, parent, isTypeVariableDecl);
|
184
|
-
}
|
185
|
-
}
|
186
|
-
|
187
|
-
if (node.declaration.declarations != null) {var _iteratorNormalCompletion = true;var _didIteratorError = false;var _iteratorError = undefined;try {
|
188
|
-
for (var _iterator = node.declaration.declarations[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {var declaration = _step.value;
|
189
|
-
(0, _ExportMap.recursivePatternCapture)(declaration.id, function (v) {addNamed(v.name, v, parent, isTypeVariableDecl);});
|
190
|
-
}} catch (err) {_didIteratorError = true;_iteratorError = err;} finally {try {if (!_iteratorNormalCompletion && _iterator['return']) {_iterator['return']();}} finally {if (_didIteratorError) {throw _iteratorError;}}}
|
191
|
-
}
|
192
|
-
}return ExportNamedDeclaration;}(),
|
193
|
-
|
194
|
-
ExportAllDeclaration: function () {function ExportAllDeclaration(node) {
|
195
|
-
if (node.source == null) {return;} // not sure if this is ever true
|
196
|
-
|
197
|
-
// `export * as X from 'path'` does not conflict
|
198
|
-
if (node.exported && node.exported.name) {return;}
|
199
|
-
|
200
|
-
var remoteExports = _ExportMap2['default'].get(node.source.value, context);
|
201
|
-
if (remoteExports == null) {return;}
|
202
|
-
|
203
|
-
if (remoteExports.errors.length) {
|
204
|
-
remoteExports.reportErrors(context, node);
|
205
|
-
return;
|
206
|
-
}
|
207
|
-
|
208
|
-
var parent = getParent(node);
|
209
|
-
|
210
|
-
var any = false;
|
211
|
-
remoteExports.forEach(function (v, name) {
|
212
|
-
if (name !== 'default') {
|
213
|
-
any = true; // poor man's filter
|
214
|
-
addNamed(name, node, parent);
|
215
|
-
}
|
216
|
-
});
|
217
|
-
|
218
|
-
if (!any) {
|
219
|
-
context.report(
|
220
|
-
node.source, 'No named exports found in module \'' + String(
|
221
|
-
node.source.value) + '\'.');
|
222
|
-
|
223
|
-
}
|
224
|
-
}return ExportAllDeclaration;}(),
|
225
|
-
|
226
|
-
'Program:exit': function () {function ProgramExit() {var _iteratorNormalCompletion2 = true;var _didIteratorError2 = false;var _iteratorError2 = undefined;try {
|
227
|
-
for (var _iterator2 = namespace[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {var _ref = _step2.value;var _ref2 = _slicedToArray(_ref, 2);var named = _ref2[1];var _iteratorNormalCompletion3 = true;var _didIteratorError3 = false;var _iteratorError3 = undefined;try {
|
228
|
-
for (var _iterator3 = named[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {var _ref3 = _step3.value;var _ref4 = _slicedToArray(_ref3, 2);var name = _ref4[0];var nodes = _ref4[1];
|
229
|
-
if (nodes.size <= 1) {continue;}
|
230
|
-
|
231
|
-
if (isTypescriptFunctionOverloads(nodes) || isTypescriptNamespaceMerging(nodes)) {continue;}var _iteratorNormalCompletion4 = true;var _didIteratorError4 = false;var _iteratorError4 = undefined;try {
|
232
|
-
|
233
|
-
for (var _iterator4 = nodes[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {var node = _step4.value;
|
234
|
-
if (shouldSkipTypescriptNamespace(node, nodes)) {continue;}
|
235
|
-
|
236
|
-
if (name === 'default') {
|
237
|
-
context.report(node, 'Multiple default exports.');
|
238
|
-
} else {
|
239
|
-
context.report(
|
240
|
-
node, 'Multiple exports of name \'' + String(
|
241
|
-
name.replace(tsTypePrefix, '')) + '\'.');
|
242
|
-
|
243
|
-
}
|
244
|
-
}} catch (err) {_didIteratorError4 = true;_iteratorError4 = err;} finally {try {if (!_iteratorNormalCompletion4 && _iterator4['return']) {_iterator4['return']();}} finally {if (_didIteratorError4) {throw _iteratorError4;}}}
|
245
|
-
}} catch (err) {_didIteratorError3 = true;_iteratorError3 = err;} finally {try {if (!_iteratorNormalCompletion3 && _iterator3['return']) {_iterator3['return']();}} finally {if (_didIteratorError3) {throw _iteratorError3;}}}
|
246
|
-
}} catch (err) {_didIteratorError2 = true;_iteratorError2 = err;} finally {try {if (!_iteratorNormalCompletion2 && _iterator2['return']) {_iterator2['return']();}} finally {if (_didIteratorError2) {throw _iteratorError2;}}}
|
247
|
-
}return ProgramExit;}() };
|
248
|
-
|
249
|
-
}return create;}() };
|
250
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9leHBvcnQuanMiXSwibmFtZXMiOlsicm9vdFByb2dyYW0iLCJ0c1R5cGVQcmVmaXgiLCJpc1R5cGVzY3JpcHRGdW5jdGlvbk92ZXJsb2FkcyIsIm5vZGVzIiwibm9kZXNBcnIiLCJBcnJheSIsImZyb20iLCJpZGVudHMiLCJub2RlIiwiZGVjbGFyYXRpb24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NvbnRleHQpO1xuICAgICAgICBpZiAocmVtb3RlRXhwb3J0cyA9PSBudWxsKSB7IHJldHVybjsgfVxuXG4gICAgICAgIGlmIChyZW1vdGVFeHBvcnRzLmVycm9ycy5sZW5ndGgpIHtcbiAgICAgICAgICByZW1vdGVFeHBvcnRzLnJlcG9ydEVycm9ycyhjb250ZXh0LCBub2RlKTtcbiAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICBjb25zdCBwYXJlbnQgPSBnZXRQYXJlbnQobm9kZSk7XG5cbiAgICAgICAgbGV0IGFueSA9IGZhbHNlO1xuICAgICAgICByZW1vdGVFeHBvcnRzLmZvckVhY2goKHYsIG5hbWUpID0+IHtcbiAgICAgICAgICBpZiAobmFtZSAhPT0gJ2RlZmF1bHQnKSB7XG4gICAgICAgICAgICBhbnkgPSB0cnVlOyAvLyBwb29yIG1hbidzIGZpbHRlclxuICAgICAgICAgICAgYWRkTmFtZWQobmFtZSwgbm9kZSwgcGFyZW50KTtcbiAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIGlmICghYW55KSB7XG4gICAgICAgICAgY29udGV4dC5yZXBvcnQoXG4gICAgICAgICAgICBub2RlLnNvdXJjZSxcbiAgICAgICAgICAgIGBObyBuYW1lZCBleHBvcnRzIGZvdW5kIGluIG1vZHVsZSAnJHtub2RlLnNvdXJjZS52YWx1ZX0nLmAsXG4gICAgICAgICAgKTtcbiAgICAgICAgfVxuICAgICAgfSxcblxuICAgICAgJ1Byb2dyYW06ZXhpdCcoKSB7XG4gICAgICAgIGZvciAoY29uc3QgWywgbmFtZWRdIG9mIG5hbWVzcGFjZSkge1xuICAgICAgICAgIGZvciAoY29uc3QgW25hbWUsIG5vZGVzXSBvZiBuYW1lZCkge1xuICAgICAgICAgICAgaWYgKG5vZGVzLnNpemUgPD0gMSkgeyBjb250aW51ZTsgfVxuXG4gICAgICAgICAgICBpZiAoaXNUeXBlc2NyaXB0RnVuY3Rpb25PdmVybG9hZHMobm9kZXMpIHx8IGlzVHlwZXNjcmlwdE5hbWVzcGFjZU1lcmdpbmcobm9kZXMpKSB7IGNvbnRpbnVlOyB9XG5cbiAgICAgICAgICAgIGZvciAoY29uc3Qgbm9kZSBvZiBub2Rlcykge1xuICAgICAgICAgICAgICBpZiAoc2hvdWxkU2tpcFR5cGVzY3JpcHROYW1lc3BhY2Uobm9kZSwgbm9kZXMpKSB7IGNvbnRpbnVlOyB9XG5cbiAgICAgICAgICAgICAgaWYgKG5hbWUgPT09ICdkZWZhdWx0Jykge1xuICAgICAgICAgICAgICAgIGNvbnRleHQucmVwb3J0KG5vZGUsICdNdWx0aXBsZSBkZWZhdWx0IGV4cG9ydHMuJyk7XG4gICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgY29udGV4dC5yZXBvcnQoXG4gICAgICAgICAgICAgICAgICBub2RlLFxuICAgICAgICAgICAgICAgICAgYE11bHRpcGxlIGV4cG9ydHMgb2YgbmFtZSAnJHtuYW1lLnJlcGxhY2UodHNUeXBlUHJlZml4LCAnJyl9Jy5gLFxuICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgfTtcbiAgfSxcbn07XG4iXX0=
|
@@ -1,40 +0,0 @@
|
|
1
|
-
'use strict';var _arrayPrototype = require('array.prototype.findlastindex');var _arrayPrototype2 = _interopRequireDefault(_arrayPrototype);
|
2
|
-
|
3
|
-
var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
|
4
|
-
|
5
|
-
function isNonExportStatement(_ref) {var type = _ref.type;
|
6
|
-
return type !== 'ExportDefaultDeclaration' &&
|
7
|
-
type !== 'ExportNamedDeclaration' &&
|
8
|
-
type !== 'ExportAllDeclaration';
|
9
|
-
}
|
10
|
-
|
11
|
-
module.exports = {
|
12
|
-
meta: {
|
13
|
-
type: 'suggestion',
|
14
|
-
docs: {
|
15
|
-
category: 'Style guide',
|
16
|
-
description: 'Ensure all exports appear after other statements.',
|
17
|
-
url: (0, _docsUrl2['default'])('exports-last') },
|
18
|
-
|
19
|
-
schema: [] },
|
20
|
-
|
21
|
-
|
22
|
-
create: function () {function create(context) {
|
23
|
-
return {
|
24
|
-
Program: function () {function Program(_ref2) {var body = _ref2.body;
|
25
|
-
var lastNonExportStatementIndex = (0, _arrayPrototype2['default'])(body, isNonExportStatement);
|
26
|
-
|
27
|
-
if (lastNonExportStatementIndex !== -1) {
|
28
|
-
body.slice(0, lastNonExportStatementIndex).forEach(function (node) {
|
29
|
-
if (!isNonExportStatement(node)) {
|
30
|
-
context.report({
|
31
|
-
node: node,
|
32
|
-
message: 'Export statements should appear at the end of the file' });
|
33
|
-
|
34
|
-
}
|
35
|
-
});
|
36
|
-
}
|
37
|
-
}return Program;}() };
|
38
|
-
|
39
|
-
}return create;}() };
|
40
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9leHBvcnRzLWxhc3QuanMiXSwibmFtZXMiOlsiaXNOb25FeHBvcnRTdGF0ZW1lbnQiLCJ0eXBlIiwibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJkb2NzIiwiY2F0ZWdvcnkiLCJkZXNjcmlwdGlvbiIsInVybCIsInNjaGVtYSIsImNyZWF0ZSIsImNvbnRleHQiLCJQcm9ncmFtIiwiYm9keSIsImxhc3ROb25FeHBvcnRTdGF0ZW1lbnRJbmRleCIsInNsaWNlIiwiZm9yRWFjaCIsIm5vZGUiLCJyZXBvcnQiLCJtZXNzYWdlIl0sIm1hcHBpbmdzIjoiYUFBQSwrRDs7QUFFQSxxQzs7QUFFQSxTQUFTQSxvQkFBVCxPQUF3QyxLQUFSQyxJQUFRLFFBQVJBLElBQVE7QUFD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