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,237 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
var _staticRequire = require('../core/staticRequire');var _staticRequire2 = _interopRequireDefault(_staticRequire);
|
7
|
-
var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);
|
8
|
-
|
9
|
-
var _debug = require('debug');var _debug2 = _interopRequireDefault(_debug);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
|
10
|
-
var log = (0, _debug2['default'])('eslint-plugin-import:rules:newline-after-import');
|
11
|
-
|
12
|
-
//------------------------------------------------------------------------------
|
13
|
-
// Rule Definition
|
14
|
-
//------------------------------------------------------------------------------
|
15
|
-
/**
|
16
|
-
* @fileoverview Rule to enforce new line after import not followed by another import.
|
17
|
-
* @author Radek Benkel
|
18
|
-
*/function containsNodeOrEqual(outerNode, innerNode) {return outerNode.range[0] <= innerNode.range[0] && outerNode.range[1] >= innerNode.range[1];}
|
19
|
-
|
20
|
-
function getScopeBody(scope) {
|
21
|
-
if (scope.block.type === 'SwitchStatement') {
|
22
|
-
log('SwitchStatement scopes not supported');
|
23
|
-
return null;
|
24
|
-
}var
|
25
|
-
|
26
|
-
body = scope.block.body;
|
27
|
-
if (body && body.type === 'BlockStatement') {
|
28
|
-
return body.body;
|
29
|
-
}
|
30
|
-
|
31
|
-
return body;
|
32
|
-
}
|
33
|
-
|
34
|
-
function findNodeIndexInScopeBody(body, nodeToFind) {
|
35
|
-
return body.findIndex(function (node) {return containsNodeOrEqual(node, nodeToFind);});
|
36
|
-
}
|
37
|
-
|
38
|
-
function getLineDifference(node, nextNode) {
|
39
|
-
return nextNode.loc.start.line - node.loc.end.line;
|
40
|
-
}
|
41
|
-
|
42
|
-
function isClassWithDecorator(node) {
|
43
|
-
return node.type === 'ClassDeclaration' && node.decorators && node.decorators.length;
|
44
|
-
}
|
45
|
-
|
46
|
-
function isExportDefaultClass(node) {
|
47
|
-
return node.type === 'ExportDefaultDeclaration' && node.declaration.type === 'ClassDeclaration';
|
48
|
-
}
|
49
|
-
|
50
|
-
function isExportNameClass(node) {
|
51
|
-
|
52
|
-
return node.type === 'ExportNamedDeclaration' && node.declaration && node.declaration.type === 'ClassDeclaration';
|
53
|
-
}
|
54
|
-
|
55
|
-
module.exports = {
|
56
|
-
meta: {
|
57
|
-
type: 'layout',
|
58
|
-
docs: {
|
59
|
-
category: 'Style guide',
|
60
|
-
description: 'Enforce a newline after import statements.',
|
61
|
-
url: (0, _docsUrl2['default'])('newline-after-import') },
|
62
|
-
|
63
|
-
fixable: 'whitespace',
|
64
|
-
schema: [
|
65
|
-
{
|
66
|
-
type: 'object',
|
67
|
-
properties: {
|
68
|
-
count: {
|
69
|
-
type: 'integer',
|
70
|
-
minimum: 1 },
|
71
|
-
|
72
|
-
exactCount: { type: 'boolean' },
|
73
|
-
considerComments: { type: 'boolean' } },
|
74
|
-
|
75
|
-
additionalProperties: false }] },
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
create: function () {function create(context) {
|
80
|
-
var level = 0;
|
81
|
-
var requireCalls = [];
|
82
|
-
var options = Object.assign({
|
83
|
-
count: 1,
|
84
|
-
exactCount: false,
|
85
|
-
considerComments: false },
|
86
|
-
context.options[0]);
|
87
|
-
|
88
|
-
|
89
|
-
function checkForNewLine(node, nextNode, type) {
|
90
|
-
if (isExportDefaultClass(nextNode) || isExportNameClass(nextNode)) {
|
91
|
-
var classNode = nextNode.declaration;
|
92
|
-
|
93
|
-
if (isClassWithDecorator(classNode)) {
|
94
|
-
nextNode = classNode.decorators[0];
|
95
|
-
}
|
96
|
-
} else if (isClassWithDecorator(nextNode)) {
|
97
|
-
nextNode = nextNode.decorators[0];
|
98
|
-
}
|
99
|
-
|
100
|
-
var lineDifference = getLineDifference(node, nextNode);
|
101
|
-
var EXPECTED_LINE_DIFFERENCE = options.count + 1;
|
102
|
-
|
103
|
-
if (
|
104
|
-
lineDifference < EXPECTED_LINE_DIFFERENCE ||
|
105
|
-
options.exactCount && lineDifference !== EXPECTED_LINE_DIFFERENCE)
|
106
|
-
{
|
107
|
-
var column = node.loc.start.column;
|
108
|
-
|
109
|
-
if (node.loc.start.line !== node.loc.end.line) {
|
110
|
-
column = 0;
|
111
|
-
}
|
112
|
-
|
113
|
-
context.report({
|
114
|
-
loc: {
|
115
|
-
line: node.loc.end.line,
|
116
|
-
column: column },
|
117
|
-
|
118
|
-
message: 'Expected ' + String(options.count) + ' empty line' + (options.count > 1 ? 's' : '') + ' after ' + String(type) + ' statement not followed by another ' + String(type) + '.',
|
119
|
-
fix: options.exactCount && EXPECTED_LINE_DIFFERENCE < lineDifference ? undefined : function (fixer) {return fixer.insertTextAfter(
|
120
|
-
node,
|
121
|
-
'\n'.repeat(EXPECTED_LINE_DIFFERENCE - lineDifference));} });
|
122
|
-
|
123
|
-
|
124
|
-
}
|
125
|
-
}
|
126
|
-
|
127
|
-
function commentAfterImport(node, nextComment) {
|
128
|
-
var lineDifference = getLineDifference(node, nextComment);
|
129
|
-
var EXPECTED_LINE_DIFFERENCE = options.count + 1;
|
130
|
-
|
131
|
-
if (lineDifference < EXPECTED_LINE_DIFFERENCE) {
|
132
|
-
var column = node.loc.start.column;
|
133
|
-
|
134
|
-
if (node.loc.start.line !== node.loc.end.line) {
|
135
|
-
column = 0;
|
136
|
-
}
|
137
|
-
|
138
|
-
context.report({
|
139
|
-
loc: {
|
140
|
-
line: node.loc.end.line,
|
141
|
-
column: column },
|
142
|
-
|
143
|
-
message: 'Expected ' + String(options.count) + ' empty line' + (options.count > 1 ? 's' : '') + ' after import statement not followed by another import.',
|
144
|
-
fix: options.exactCount && EXPECTED_LINE_DIFFERENCE < lineDifference ? undefined : function (fixer) {return fixer.insertTextAfter(
|
145
|
-
node,
|
146
|
-
'\n'.repeat(EXPECTED_LINE_DIFFERENCE - lineDifference));} });
|
147
|
-
|
148
|
-
|
149
|
-
}
|
150
|
-
}
|
151
|
-
|
152
|
-
function incrementLevel() {
|
153
|
-
level++;
|
154
|
-
}
|
155
|
-
function decrementLevel() {
|
156
|
-
level--;
|
157
|
-
}
|
158
|
-
|
159
|
-
function checkImport(node) {var
|
160
|
-
parent = node.parent;
|
161
|
-
|
162
|
-
if (!parent || !parent.body) {
|
163
|
-
return;
|
164
|
-
}
|
165
|
-
|
166
|
-
var nodePosition = parent.body.indexOf(node);
|
167
|
-
var nextNode = parent.body[nodePosition + 1];
|
168
|
-
var endLine = node.loc.end.line;
|
169
|
-
var nextComment = void 0;
|
170
|
-
|
171
|
-
if (typeof parent.comments !== 'undefined' && options.considerComments) {
|
172
|
-
nextComment = parent.comments.find(function (o) {return o.loc.start.line >= endLine && o.loc.start.line <= endLine + options.count + 1;});
|
173
|
-
}
|
174
|
-
|
175
|
-
// skip "export import"s
|
176
|
-
if (node.type === 'TSImportEqualsDeclaration' && node.isExport) {
|
177
|
-
return;
|
178
|
-
}
|
179
|
-
|
180
|
-
if (nextComment && typeof nextComment !== 'undefined') {
|
181
|
-
commentAfterImport(node, nextComment);
|
182
|
-
} else if (nextNode && nextNode.type !== 'ImportDeclaration' && (nextNode.type !== 'TSImportEqualsDeclaration' || nextNode.isExport)) {
|
183
|
-
checkForNewLine(node, nextNode, 'import');
|
184
|
-
}
|
185
|
-
}
|
186
|
-
|
187
|
-
return {
|
188
|
-
ImportDeclaration: checkImport,
|
189
|
-
TSImportEqualsDeclaration: checkImport,
|
190
|
-
CallExpression: function () {function CallExpression(node) {
|
191
|
-
if ((0, _staticRequire2['default'])(node) && level === 0) {
|
192
|
-
requireCalls.push(node);
|
193
|
-
}
|
194
|
-
}return CallExpression;}(),
|
195
|
-
'Program:exit': function () {function ProgramExit() {
|
196
|
-
log('exit processing for', context.getPhysicalFilename ? context.getPhysicalFilename() : context.getFilename());
|
197
|
-
var scopeBody = getScopeBody(context.getScope());
|
198
|
-
log('got scope:', scopeBody);
|
199
|
-
|
200
|
-
requireCalls.forEach(function (node, index) {
|
201
|
-
var nodePosition = findNodeIndexInScopeBody(scopeBody, node);
|
202
|
-
log('node position in scope:', nodePosition);
|
203
|
-
|
204
|
-
var statementWithRequireCall = scopeBody[nodePosition];
|
205
|
-
var nextStatement = scopeBody[nodePosition + 1];
|
206
|
-
var nextRequireCall = requireCalls[index + 1];
|
207
|
-
|
208
|
-
if (nextRequireCall && containsNodeOrEqual(statementWithRequireCall, nextRequireCall)) {
|
209
|
-
return;
|
210
|
-
}
|
211
|
-
|
212
|
-
if (
|
213
|
-
nextStatement && (
|
214
|
-
!nextRequireCall ||
|
215
|
-
!containsNodeOrEqual(nextStatement, nextRequireCall)))
|
216
|
-
|
217
|
-
{
|
218
|
-
|
219
|
-
checkForNewLine(statementWithRequireCall, nextStatement, 'require');
|
220
|
-
}
|
221
|
-
});
|
222
|
-
}return ProgramExit;}(),
|
223
|
-
FunctionDeclaration: incrementLevel,
|
224
|
-
FunctionExpression: incrementLevel,
|
225
|
-
ArrowFunctionExpression: incrementLevel,
|
226
|
-
BlockStatement: incrementLevel,
|
227
|
-
ObjectExpression: incrementLevel,
|
228
|
-
Decorator: incrementLevel,
|
229
|
-
'FunctionDeclaration:exit': decrementLevel,
|
230
|
-
'FunctionExpression:exit': decrementLevel,
|
231
|
-
'ArrowFunctionExpression:exit': decrementLevel,
|
232
|
-
'BlockStatement:exit': decrementLevel,
|
233
|
-
'ObjectExpression:exit': decrementLevel,
|
234
|
-
'Decorator:exit': decrementLevel };
|
235
|
-
|
236
|
-
}return create;}() };
|
237
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uZXdsaW5lLWFmdGVyLWltcG9ydC5qcyJdLCJuYW1lcyI6WyJsb2ciLCJjb250YWluc05vZGVPckVxdWFsIiwib3V0ZXJOb2RlIiwiaW5uZXJOb2RlIiwicmFuZ2UiLCJnZXRTY29wZUJvZHkiLCJzY29wZSIsImJsb2NrIiwidHlwZSIsImJvZHkiLCJmaW5kTm9kZUluZGV4SW5TY29wZUJvZHkiLCJub2RlVG9GaW5kIiwiZmluZEluZGV4Iiwibm9kZSIsImdldExpbmVEaWZmZXJlbmNlIiwibmV4dE5vZGUiLCJsb2MiLCJzdGFydCIsImxpbmUiLCJlbmQiLCJpc0NsYXNzV2l0aERlY29yYXRvciIsImRlY29yYXRvcnMiLCJsZW5ndGgiLCJpc0V4cG9ydERlZmF1bHRDbGFzcyIsImRlY2xhcmF0aW9uIiwiaXNFeHBvcnROYW1l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DRSA9IG9wdGlvbnMuY291bnQgKyAxO1xuXG4gICAgICBpZiAoXG4gICAgICAgIGxpbmVEaWZmZXJlbmNlIDwgRVhQRUNURURfTElORV9ESUZGRVJFTkNFXG4gICAgICAgIHx8IG9wdGlvbnMuZXhhY3RDb3VudCAmJiBsaW5lRGlmZmVyZW5jZSAhPT0gRVhQRUNURURfTElORV9ESUZGRVJFTkNFXG4gICAgICApIHtcbiAgICAgICAgbGV0IGNvbHVtbiA9IG5vZGUubG9jLnN0YXJ0LmNvbHVtbjtcblxuICAgICAgICBpZiAobm9kZS5sb2Muc3RhcnQubGluZSAhPT0gbm9kZS5sb2MuZW5kLmxpbmUpIHtcbiAgICAgICAgICBjb2x1bW4gPSAwO1xuICAgICAgICB9XG5cbiAgICAgICAgY29udGV4dC5yZXBvcnQoe1xuICAgICAgICAgIGxvYzoge1xuICAgICAgICAgICAgbGluZTogbm9kZS5sb2MuZW5kLmxpbmUsXG4gICAgICAgICAgICBjb2x1bW4sXG4gICAgICAgICAgfSxcbiAgICAgICAgICBtZXNzYWdlOiBgRXhwZWN0ZWQgJHtvcHRpb25zLmNvdW50fSBlbXB0eSBsaW5lJHtvcHRpb25zLmNvdW50ID4gMSA/ICdzJyA6ICcnfSBhZnRlciAke3R5cGV9IHN0YXRlbWVudCBub3QgZm9sbG93ZWQgYnkgYW5vdGhlciAke3R5cGV9LmAsXG4gICAgICAgICAgZml4OiBvcHRpb25zLmV4YWN0Q291bnQgJiYgRVhQRUNURURfTElORV9ESUZGRVJFTkNFIDwgbGluZURpZmZlcmVuY2UgPyB1bmRlZmluZWQgOiAoZml4ZXIpID0+IGZpeGVyLmluc2VydFRleHRBZnRlcihcbiAgICAgICAgICAgIG5vZGUsXG4gICAgICAgICAgICAnXFxuJy5yZXBlYXQoRVhQRUNURURfTElORV9ESUZGRVJFTkNFIC0gbGluZURpZmZlcmVuY2UpLFxuICAgICAgICAgICksXG4gICAgICAgIH0pO1xuICAgICAgfVxuICAgIH1cblxuICAgIG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5jcmVtZW50TGV2ZWwsXG4gICAgICBGdW5jdGlvbkV4cHJlc3Npb246IGluY3JlbWVudExldmVsLFxuICAgICAgQXJyb3dGdW5jdGlvbkV4cHJlc3Npb246IGluY3JlbWVudExldmVsLFxuICAgICAgQmxvY2tTdGF0ZW1lbnQ6IGluY3JlbWVudExldmVsLFxuICAgICAgT2JqZWN0RXhwcmVzc2lvbjogaW5jcmVtZW50TGV2ZWwsXG4gICAgICBEZWNvcmF0b3I6IGluY3JlbWVudExldmVsLFxuICAgICAgJ0Z1bmN0aW9uRGVjbGFyYXRpb246ZXhpdCc6IGRlY3JlbWVudExldmVsLFxuICAgICAgJ0Z1bmN0aW9uRXhwcmVzc2lvbjpleGl0JzogZGVjcmVtZW50TGV2ZWwsXG4gICAgICAnQXJyb3dGdW5jdGlvbkV4cHJlc3Npb246ZXhpdCc6IGRlY3JlbWVudExldmVsLFxuICAgICAgJ0Jsb2NrU3RhdGVtZW50OmV4aXQnOiBkZWNyZW1lbnRMZXZlbCxcbiAgICAgICdPYmplY3RFeHByZXNzaW9uOmV4aXQnOiBkZWNyZW1lbnRMZXZlbCxcbiAgICAgICdEZWNvcmF0b3I6ZXhpdCc6IGRlY3JlbWVudExldmVsLFxuICAgIH07XG4gIH0sXG59O1xuIl19
|
@@ -1,40 +0,0 @@
|
|
1
|
-
'use strict';var _path = require('path');var _path2 = _interopRequireDefault(_path);
|
2
|
-
var _moduleVisitor = require('eslint-module-utils/moduleVisitor');var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor);
|
3
|
-
var _importType = require('../core/importType');
|
4
|
-
var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
|
5
|
-
|
6
|
-
module.exports = {
|
7
|
-
meta: {
|
8
|
-
type: 'suggestion',
|
9
|
-
docs: {
|
10
|
-
category: 'Static analysis',
|
11
|
-
description: 'Forbid import of modules using absolute paths.',
|
12
|
-
url: (0, _docsUrl2['default'])('no-absolute-path') },
|
13
|
-
|
14
|
-
fixable: 'code',
|
15
|
-
schema: [(0, _moduleVisitor.makeOptionsSchema)()] },
|
16
|
-
|
17
|
-
|
18
|
-
create: function () {function create(context) {
|
19
|
-
function reportIfAbsolute(source) {
|
20
|
-
if ((0, _importType.isAbsolute)(source.value)) {
|
21
|
-
context.report({
|
22
|
-
node: source,
|
23
|
-
message: 'Do not import modules using an absolute path',
|
24
|
-
fix: function () {function fix(fixer) {
|
25
|
-
var resolvedContext = context.getPhysicalFilename ? context.getPhysicalFilename() : context.getFilename();
|
26
|
-
// node.js and web imports work with posix style paths ("/")
|
27
|
-
var relativePath = _path2['default'].posix.relative(_path2['default'].dirname(resolvedContext), source.value);
|
28
|
-
if (!relativePath.startsWith('.')) {
|
29
|
-
relativePath = './' + String(relativePath);
|
30
|
-
}
|
31
|
-
return fixer.replaceText(source, JSON.stringify(relativePath));
|
32
|
-
}return fix;}() });
|
33
|
-
|
34
|
-
}
|
35
|
-
}
|
36
|
-
|
37
|
-
var options = Object.assign({ esmodule: true, commonjs: true }, context.options[0]);
|
38
|
-
return (0, _moduleVisitor2['default'])(reportIfAbsolute, options);
|
39
|
-
}return create;}() };
|
40
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1hYnNvbHV0ZS1wYXRoLmpzIl0sIm5hbWVzIjpbIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwidHlwZSIsImRvY3MiLCJjYXRlZ29yeSIsImRlc2NyaXB0aW9uIiwidXJsIiwiZml4YWJsZSIsInNjaGVtYSIsImNyZWF0ZSIsImNvbnRleHQiLCJyZXBvcnRJZkFic29sdXRlIiwic291cmNlIiwidmFsdWUiLCJyZXBvcnQiLCJub2RlIiwibWVzc2FnZSIsImZpeCIsImZpeGVyIiwicmVzb2x2ZWRDb250ZXh0IiwiZ2V0UGh5c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c3Qgb3B0aW9ucyA9IHsgZXNtb2R1bGU6IHRydWUsIGNvbW1vbmpzOiB0cnVlLCAuLi5jb250ZXh0Lm9wdGlvbnNbMF0gfTtcbiAgICByZXR1cm4gbW9kdWxlVmlzaXRvcihyZXBvcnRJZkFic29sdXRlLCBvcHRpb25zKTtcbiAgfSxcbn07XG4iXX0=
|
@@ -1,47 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
|
7
|
-
|
8
|
-
//------------------------------------------------------------------------------
|
9
|
-
// Rule Definition
|
10
|
-
//------------------------------------------------------------------------------
|
11
|
-
|
12
|
-
module.exports = {
|
13
|
-
meta: {
|
14
|
-
type: 'suggestion',
|
15
|
-
docs: {
|
16
|
-
category: 'Module systems',
|
17
|
-
description: 'Forbid AMD `require` and `define` calls.',
|
18
|
-
url: (0, _docsUrl2['default'])('no-amd') },
|
19
|
-
|
20
|
-
schema: [] },
|
21
|
-
|
22
|
-
|
23
|
-
create: function () {function create(context) {
|
24
|
-
return {
|
25
|
-
CallExpression: function () {function CallExpression(node) {
|
26
|
-
if (context.getScope().type !== 'module') {return;}
|
27
|
-
|
28
|
-
if (node.callee.type !== 'Identifier') {return;}
|
29
|
-
if (node.callee.name !== 'require' && node.callee.name !== 'define') {return;}
|
30
|
-
|
31
|
-
// todo: capture define((require, module, exports) => {}) form?
|
32
|
-
if (node.arguments.length !== 2) {return;}
|
33
|
-
|
34
|
-
var modules = node.arguments[0];
|
35
|
-
if (modules.type !== 'ArrayExpression') {return;}
|
36
|
-
|
37
|
-
// todo: check second arg type? (identifier or callback)
|
38
|
-
|
39
|
-
context.report(node, 'Expected imports instead of AMD ' + String(node.callee.name) + '().');
|
40
|
-
}return CallExpression;}() };
|
41
|
-
|
42
|
-
|
43
|
-
}return create;}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@ -1,103 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
var _hasown = require('hasown');var _hasown2 = _interopRequireDefault(_hasown);
|
7
|
-
var _object = require('object.values');var _object2 = _interopRequireDefault(_object);
|
8
|
-
var _object3 = require('object.fromentries');var _object4 = _interopRequireDefault(_object3);
|
9
|
-
|
10
|
-
var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} /**
|
11
|
-
* @fileoverview Rule to disallow anonymous default exports.
|
12
|
-
* @author Duncan Beevers
|
13
|
-
*/var defs = { ArrayExpression: {
|
14
|
-
option: 'allowArray',
|
15
|
-
description: 'If `false`, will report default export of an array',
|
16
|
-
message: 'Assign array to a variable before exporting as module default' },
|
17
|
-
|
18
|
-
ArrowFunctionExpression: {
|
19
|
-
option: 'allowArrowFunction',
|
20
|
-
description: 'If `false`, will report default export of an arrow function',
|
21
|
-
message: 'Assign arrow function to a variable before exporting as module default' },
|
22
|
-
|
23
|
-
CallExpression: {
|
24
|
-
option: 'allowCallExpression',
|
25
|
-
description: 'If `false`, will report default export of a function call',
|
26
|
-
message: 'Assign call result to a variable before exporting as module default',
|
27
|
-
'default': true },
|
28
|
-
|
29
|
-
ClassDeclaration: {
|
30
|
-
option: 'allowAnonymousClass',
|
31
|
-
description: 'If `false`, will report default export of an anonymous class',
|
32
|
-
message: 'Unexpected default export of anonymous class',
|
33
|
-
forbid: function () {function forbid(node) {return !node.declaration.id;}return forbid;}() },
|
34
|
-
|
35
|
-
FunctionDeclaration: {
|
36
|
-
option: 'allowAnonymousFunction',
|
37
|
-
description: 'If `false`, will report default export of an anonymous function',
|
38
|
-
message: 'Unexpected default export of anonymous function',
|
39
|
-
forbid: function () {function forbid(node) {return !node.declaration.id;}return forbid;}() },
|
40
|
-
|
41
|
-
Literal: {
|
42
|
-
option: 'allowLiteral',
|
43
|
-
description: 'If `false`, will report default export of a literal',
|
44
|
-
message: 'Assign literal to a variable before exporting as module default' },
|
45
|
-
|
46
|
-
ObjectExpression: {
|
47
|
-
option: 'allowObject',
|
48
|
-
description: 'If `false`, will report default export of an object expression',
|
49
|
-
message: 'Assign object to a variable before exporting as module default' },
|
50
|
-
|
51
|
-
TemplateLiteral: {
|
52
|
-
option: 'allowLiteral',
|
53
|
-
description: 'If `false`, will report default export of a literal',
|
54
|
-
message: 'Assign literal to a variable before exporting as module default' },
|
55
|
-
|
56
|
-
NewExpression: {
|
57
|
-
option: 'allowNew',
|
58
|
-
description: 'If `false`, will report default export of a class instantiation',
|
59
|
-
message: 'Assign instance to a variable before exporting as module default' } };
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
var schemaProperties = (0, _object4['default'])((0, _object2['default'])(defs).map(function (def) {return [def.option, {
|
64
|
-
description: def.description,
|
65
|
-
type: 'boolean' }];}));
|
66
|
-
|
67
|
-
|
68
|
-
var defaults = (0, _object4['default'])((0, _object2['default'])(defs).map(function (def) {return [def.option, (0, _hasown2['default'])(def, 'default') ? def['default'] : false];}));
|
69
|
-
|
70
|
-
module.exports = {
|
71
|
-
meta: {
|
72
|
-
type: 'suggestion',
|
73
|
-
docs: {
|
74
|
-
category: 'Style guide',
|
75
|
-
description: 'Forbid anonymous values as default exports.',
|
76
|
-
url: (0, _docsUrl2['default'])('no-anonymous-default-export') },
|
77
|
-
|
78
|
-
|
79
|
-
schema: [
|
80
|
-
{
|
81
|
-
type: 'object',
|
82
|
-
properties: schemaProperties,
|
83
|
-
additionalProperties: false }] },
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
create: function () {function create(context) {
|
89
|
-
var options = Object.assign({}, defaults, context.options[0]);
|
90
|
-
|
91
|
-
return {
|
92
|
-
ExportDefaultDeclaration: function () {function ExportDefaultDeclaration(node) {
|
93
|
-
var def = defs[node.declaration.type];
|
94
|
-
|
95
|
-
// Recognized node type and allowed by configuration,
|
96
|
-
// and has no forbid check, or forbid check return value is truthy
|
97
|
-
if (def && !options[def.option] && (!def.forbid || def.forbid(node))) {
|
98
|
-
context.report({ node: node, message: def.message });
|
99
|
-
}
|
100
|
-
}return ExportDefaultDeclaration;}() };
|
101
|
-
|
102
|
-
}return create;}() };
|
103
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1hbm9ueW1vdXMtZGVmYXVsdC1leHBvcnQuanMiXSwibmFtZXMiOlsiZGVmcyIsIkFycmF5RXhwcmVzc2lvbiIsIm9wdGlvbiIsImRlc2NyaXB0aW9uIiwibWVzc2FnZSIsIkFycm93RnVuY3Rpb25FeHByZXNzaW9uIiwiQ2FsbEV4cHJlc3Npb24iLCJDbGFzc0RlY2xhcmF0aW9uIiwiZm9yYmlkIiwibm9kZSIsImRlY2xhcmF0aW9uIiwiaWQiLCJGdW5jdGlvbkRlY2xhcmF0aW9uIiwiTGl0ZXJhbCIsIk9iamVjdEV4cHJlc3Npb24iLCJUZW1wbGF0ZUxpdGVyYWwiLCJOZXdFeHByZXNzaW9uIiwic2NoZW1hUHJvcGVydGllcyIsIm1hcCIsImRlZiIsInR5cGUiLCJkZWZhdWx0cyIsIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwiZG9jcyIsImNhdGVnb3J5IiwidXJsIiwic2NoZW1hIiwicHJvcGVydGllcyIsImFkZGl0aW9uYWxQcm9wZXJ0aWVzIiwiY3JlYXRlIiwiY29udGV4dCIsIm9wdGlvbnMiLCJFeHBvcnREZWZhdWx0RGVjbGFyYXRpb24iLCJyZXBvcnQiXSwibWFwcGluZ3MiOiI7Ozs7O0FBS0EsZ0M7QUFDQSx1QztBQUNBLDZDOztBQUVBLHFDLGlKQVRBOzs7eUxBV0EsSUFBTUEsT0FBTyxFQUNYQyxpQkFBaUI7QUFDZkMsWUFBUSxZQURPO0FBRWZDLGlCQUFhLG9EQUZ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G4gIH0sXG5cbiAgY3JlYXRlKGNvbnRleHQpIHtcbiAgICBjb25zdCBvcHRpb25zID0geyAuLi5kZWZhdWx0cywgLi4uY29udGV4dC5vcHRpb25zWzBdIH07XG5cbiAgICByZXR1cm4ge1xuICAgICAgRXhwb3J0RGVmYXVsdERlY2xhcmF0aW9uKG5vZGUpIHtcbiAgICAgICAgY29uc3QgZGVmID0gZGVmc1tub2RlLmRlY2xhcmF0aW9uLnR5cGVdO1xuXG4gICAgICAgIC8vIFJlY29nbml6ZWQgbm9kZSB0eXBlIGFuZCBhbGxvd2VkIGJ5IGNvbmZpZ3VyYXRpb24sXG4gICAgICAgIC8vICAgYW5kIGhhcyBubyBmb3JiaWQgY2hlY2ssIG9yIGZvcmJpZCBjaGVjayByZXR1cm4gdmFsdWUgaXMgdHJ1dGh5XG4gICAgICAgIGlmIChkZWYgJiYgIW9wdGlvbnNbZGVmLm9wdGlvbl0gJiYgKCFkZWYuZm9yYmlkIHx8IGRlZi5mb3JiaWQobm9kZSkpKSB7XG4gICAgICAgICAgY29udGV4dC5yZXBvcnQoeyBub2RlLCBtZXNzYWdlOiBkZWYubWVzc2FnZSB9KTtcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICB9O1xuICB9LFxufTtcbiJdfQ==
|
@@ -1,141 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
|
7
|
-
|
8
|
-
var EXPORT_MESSAGE = 'Expected "export" or "export default"'; /**
|
9
|
-
* @fileoverview Rule to prefer ES6 to CJS
|
10
|
-
* @author Jamund Ferguson
|
11
|
-
*/var IMPORT_MESSAGE = 'Expected "import" instead of "require()"';function normalizeLegacyOptions(options) {
|
12
|
-
if (options.indexOf('allow-primitive-modules') >= 0) {
|
13
|
-
return { allowPrimitiveModules: true };
|
14
|
-
}
|
15
|
-
return options[0] || {};
|
16
|
-
}
|
17
|
-
|
18
|
-
function allowPrimitive(node, options) {
|
19
|
-
if (!options.allowPrimitiveModules) {return false;}
|
20
|
-
if (node.parent.type !== 'AssignmentExpression') {return false;}
|
21
|
-
return node.parent.right.type !== 'ObjectExpression';
|
22
|
-
}
|
23
|
-
|
24
|
-
function allowRequire(node, options) {
|
25
|
-
return options.allowRequire;
|
26
|
-
}
|
27
|
-
|
28
|
-
function allowConditionalRequire(node, options) {
|
29
|
-
return options.allowConditionalRequire !== false;
|
30
|
-
}
|
31
|
-
|
32
|
-
function validateScope(scope) {
|
33
|
-
return scope.variableScope.type === 'module';
|
34
|
-
}
|
35
|
-
|
36
|
-
// https://github.com/estree/estree/blob/HEAD/es5.md
|
37
|
-
function isConditional(node) {
|
38
|
-
if (
|
39
|
-
node.type === 'IfStatement' ||
|
40
|
-
node.type === 'TryStatement' ||
|
41
|
-
node.type === 'LogicalExpression' ||
|
42
|
-
node.type === 'ConditionalExpression')
|
43
|
-
{
|
44
|
-
return true;
|
45
|
-
}
|
46
|
-
if (node.parent) {return isConditional(node.parent);}
|
47
|
-
return false;
|
48
|
-
}
|
49
|
-
|
50
|
-
function isLiteralString(node) {
|
51
|
-
return node.type === 'Literal' && typeof node.value === 'string' ||
|
52
|
-
node.type === 'TemplateLiteral' && node.expressions.length === 0;
|
53
|
-
}
|
54
|
-
|
55
|
-
//------------------------------------------------------------------------------
|
56
|
-
// Rule Definition
|
57
|
-
//------------------------------------------------------------------------------
|
58
|
-
|
59
|
-
var schemaString = { 'enum': ['allow-primitive-modules'] };
|
60
|
-
var schemaObject = {
|
61
|
-
type: 'object',
|
62
|
-
properties: {
|
63
|
-
allowPrimitiveModules: { type: 'boolean' },
|
64
|
-
allowRequire: { type: 'boolean' },
|
65
|
-
allowConditionalRequire: { type: 'boolean' } },
|
66
|
-
|
67
|
-
additionalProperties: false };
|
68
|
-
|
69
|
-
|
70
|
-
module.exports = {
|
71
|
-
meta: {
|
72
|
-
type: 'suggestion',
|
73
|
-
docs: {
|
74
|
-
category: 'Module systems',
|
75
|
-
description: 'Forbid CommonJS `require` calls and `module.exports` or `exports.*`.',
|
76
|
-
url: (0, _docsUrl2['default'])('no-commonjs') },
|
77
|
-
|
78
|
-
|
79
|
-
schema: {
|
80
|
-
anyOf: [
|
81
|
-
{
|
82
|
-
type: 'array',
|
83
|
-
items: [schemaString],
|
84
|
-
additionalItems: false },
|
85
|
-
|
86
|
-
{
|
87
|
-
type: 'array',
|
88
|
-
items: [schemaObject],
|
89
|
-
additionalItems: false }] } },
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
create: function () {function create(context) {
|
96
|
-
var options = normalizeLegacyOptions(context.options);
|
97
|
-
|
98
|
-
return {
|
99
|
-
|
100
|
-
MemberExpression: function () {function MemberExpression(node) {
|
101
|
-
|
102
|
-
// module.exports
|
103
|
-
if (node.object.name === 'module' && node.property.name === 'exports') {
|
104
|
-
if (allowPrimitive(node, options)) {return;}
|
105
|
-
context.report({ node: node, message: EXPORT_MESSAGE });
|
106
|
-
}
|
107
|
-
|
108
|
-
// exports.
|
109
|
-
if (node.object.name === 'exports') {
|
110
|
-
var isInScope = context.getScope().
|
111
|
-
variables.
|
112
|
-
some(function (variable) {return variable.name === 'exports';});
|
113
|
-
if (!isInScope) {
|
114
|
-
context.report({ node: node, message: EXPORT_MESSAGE });
|
115
|
-
}
|
116
|
-
}
|
117
|
-
|
118
|
-
}return MemberExpression;}(),
|
119
|
-
CallExpression: function () {function CallExpression(call) {
|
120
|
-
if (!validateScope(context.getScope())) {return;}
|
121
|
-
|
122
|
-
if (call.callee.type !== 'Identifier') {return;}
|
123
|
-
if (call.callee.name !== 'require') {return;}
|
124
|
-
|
125
|
-
if (call.arguments.length !== 1) {return;}
|
126
|
-
if (!isLiteralString(call.arguments[0])) {return;}
|
127
|
-
|
128
|
-
if (allowRequire(call, options)) {return;}
|
129
|
-
|
130
|
-
if (allowConditionalRequire(call, options) && isConditional(call.parent)) {return;}
|
131
|
-
|
132
|
-
// keeping it simple: all 1-string-arg `require` calls are reported
|
133
|
-
context.report({
|
134
|
-
node: call.callee,
|
135
|
-
message: IMPORT_MESSAGE });
|
136
|
-
|
137
|
-
}return CallExpression;}() };
|
138
|
-
|
139
|
-
|
140
|
-
}return create;}() };
|
141
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1jb21tb25qcy5qcyJdLCJuYW1lcyI6WyJFWFBPUlRfTUVTU0FHRSIsIklNUE9SVF9NRVNTQUdFIiwibm9ybWFsaXplTGVnYWN5T3B0aW9ucyIsIm9wdGlvbnMiLCJpbmRleE9mIiwiYWxsb3dQcmltaXRpdmVNb2R1bGVzIiwiYWxsb3dQcmltaXRpdmUiLCJub2RlIiwicGFyZW50IiwidHlwZSIsInJpZ2h0IiwiYWxsb3dSZXF1aXJlIiwiYWxsb3dDb25kaXRpb25hbFJlcXVpcmUiLCJ2YWxpZGF0ZVNjb3BlIiwic2NvcGUiLCJ2YXJpYWJsZVNjb3BlIiwiaXNDb25kaXRpb25hbCIsImlzTGl0ZXJhbFN0cmluZyIsInZhbHVlIiwiZXhwcmVzc2lvbnMiLCJsZW5ndGgiLCJzY2hlbWFTdHJpbmciLCJzY2hlbWFPYmplY3QiLCJwcm9wZXJ0aWVzIiwiYWRkaXRpb25hbFByb3BlcnRpZXMiLCJtb2R1bGUiLCJleHBvcnRzIiwibWV0YSIsImRvY3MiLCJjYXRlZ29yeSIsImRlc2NyaXB0aW9uIiwidXJsIiwic2NoZW1hIiwiYW55T2YiLCJpdGVtcyIsImFkZGl0aW9uYWxJdGVtcyIsImNyZWF0ZSIsImNvbnRleHQiLCJNZW1iZXJFeHByZXNzaW9uIiwib2JqZWN0IiwibmFtZSIsInByb3BlcnR5IiwicmVwb3J0IiwibWVzc2FnZSIsImlzSW5TY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