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,37 +0,0 @@
|
|
1
|
-
# import/no-amd
|
2
|
-
|
3
|
-
<!-- end auto-generated rule header -->
|
4
|
-
|
5
|
-
Reports `require([array], ...)` and `define([array], ...)` function calls at the
|
6
|
-
module scope. Will not report if !=2 arguments, or first argument is not a literal array.
|
7
|
-
|
8
|
-
Intended for temporary use when migrating to pure ES6 modules.
|
9
|
-
|
10
|
-
## Rule Details
|
11
|
-
|
12
|
-
This will be reported:
|
13
|
-
|
14
|
-
```js
|
15
|
-
define(["a", "b"], function (a, b) { /* ... */ })
|
16
|
-
|
17
|
-
require(["b", "c"], function (b, c) { /* ... */ })
|
18
|
-
```
|
19
|
-
|
20
|
-
CommonJS `require` is still valid.
|
21
|
-
|
22
|
-
## When Not To Use It
|
23
|
-
|
24
|
-
If you don't mind mixing module systems (sometimes this is useful), you probably
|
25
|
-
don't want this rule.
|
26
|
-
|
27
|
-
It is also fairly noisy if you have a larger codebase that is being transitioned
|
28
|
-
from AMD to ES6 modules.
|
29
|
-
|
30
|
-
## Contributors
|
31
|
-
|
32
|
-
Special thanks to @xjamundx for donating his no-define rule as a start to this.
|
33
|
-
|
34
|
-
## Further Reading
|
35
|
-
|
36
|
-
- [`no-commonjs`](./no-commonjs.md): report CommonJS `require` and `exports`
|
37
|
-
- Source: <https://github.com/xjamundx/eslint-plugin-modules>
|
@@ -1,83 +0,0 @@
|
|
1
|
-
# import/no-anonymous-default-export
|
2
|
-
|
3
|
-
<!-- end auto-generated rule header -->
|
4
|
-
|
5
|
-
Reports if a module's default export is unnamed. This includes several types of unnamed data types; literals, object expressions, arrays, anonymous functions, arrow functions, and anonymous class declarations.
|
6
|
-
|
7
|
-
Ensuring that default exports are named helps improve the grepability of the codebase by encouraging the re-use of the same identifier for the module's default export at its declaration site and at its import sites.
|
8
|
-
|
9
|
-
## Options
|
10
|
-
|
11
|
-
By default, all types of anonymous default exports are forbidden, but any types can be selectively allowed by toggling them on in the options.
|
12
|
-
|
13
|
-
The complete default configuration looks like this.
|
14
|
-
|
15
|
-
```js
|
16
|
-
"import/no-anonymous-default-export": ["error", {
|
17
|
-
"allowArray": false,
|
18
|
-
"allowArrowFunction": false,
|
19
|
-
"allowAnonymousClass": false,
|
20
|
-
"allowAnonymousFunction": false,
|
21
|
-
"allowCallExpression": true, // The true value here is for backward compatibility
|
22
|
-
"allowNew": false,
|
23
|
-
"allowLiteral": false,
|
24
|
-
"allowObject": false
|
25
|
-
}]
|
26
|
-
```
|
27
|
-
|
28
|
-
## Rule Details
|
29
|
-
|
30
|
-
### Fail
|
31
|
-
|
32
|
-
```js
|
33
|
-
export default []
|
34
|
-
|
35
|
-
export default () => {}
|
36
|
-
|
37
|
-
export default class {}
|
38
|
-
|
39
|
-
export default function () {}
|
40
|
-
|
41
|
-
/* eslint import/no-anonymous-default-export: [2, {"allowCallExpression": false}] */
|
42
|
-
export default foo(bar)
|
43
|
-
|
44
|
-
export default 123
|
45
|
-
|
46
|
-
export default {}
|
47
|
-
|
48
|
-
export default new Foo()
|
49
|
-
```
|
50
|
-
|
51
|
-
### Pass
|
52
|
-
|
53
|
-
```js
|
54
|
-
const foo = 123
|
55
|
-
export default foo
|
56
|
-
|
57
|
-
export default class MyClass() {}
|
58
|
-
|
59
|
-
export default function foo() {}
|
60
|
-
|
61
|
-
/* eslint import/no-anonymous-default-export: [2, {"allowArray": true}] */
|
62
|
-
export default []
|
63
|
-
|
64
|
-
/* eslint import/no-anonymous-default-export: [2, {"allowArrowFunction": true}] */
|
65
|
-
export default () => {}
|
66
|
-
|
67
|
-
/* eslint import/no-anonymous-default-export: [2, {"allowAnonymousClass": true}] */
|
68
|
-
export default class {}
|
69
|
-
|
70
|
-
/* eslint import/no-anonymous-default-export: [2, {"allowAnonymousFunction": true}] */
|
71
|
-
export default function () {}
|
72
|
-
|
73
|
-
export default foo(bar)
|
74
|
-
|
75
|
-
/* eslint import/no-anonymous-default-export: [2, {"allowLiteral": true}] */
|
76
|
-
export default 123
|
77
|
-
|
78
|
-
/* eslint import/no-anonymous-default-export: [2, {"allowObject": true}] */
|
79
|
-
export default {}
|
80
|
-
|
81
|
-
/* eslint import/no-anonymous-default-export: [2, {"allowNew": true}] */
|
82
|
-
export default new Foo()
|
83
|
-
```
|
@@ -1,96 +0,0 @@
|
|
1
|
-
# import/no-commonjs
|
2
|
-
|
3
|
-
<!-- end auto-generated rule header -->
|
4
|
-
|
5
|
-
Reports `require([string])` function calls. Will not report if >1 argument,
|
6
|
-
or single argument is not a literal string.
|
7
|
-
|
8
|
-
Reports `module.exports` or `exports.*`, also.
|
9
|
-
|
10
|
-
Intended for temporary use when migrating to pure ES6 modules.
|
11
|
-
|
12
|
-
## Rule Details
|
13
|
-
|
14
|
-
This will be reported:
|
15
|
-
|
16
|
-
```js
|
17
|
-
var mod = require('./mod')
|
18
|
-
, common = require('./common')
|
19
|
-
, fs = require('fs')
|
20
|
-
, whateverModule = require('./not-found')
|
21
|
-
|
22
|
-
module.exports = { a: "b" }
|
23
|
-
exports.c = "d"
|
24
|
-
```
|
25
|
-
|
26
|
-
### Allow require
|
27
|
-
|
28
|
-
If `allowRequire` option is set to `true`, `require` calls are valid:
|
29
|
-
|
30
|
-
```js
|
31
|
-
/*eslint no-commonjs: [2, { allowRequire: true }]*/
|
32
|
-
var mod = require('./mod');
|
33
|
-
```
|
34
|
-
|
35
|
-
but `module.exports` is reported as usual.
|
36
|
-
|
37
|
-
### Allow conditional require
|
38
|
-
|
39
|
-
By default, conditional requires are allowed:
|
40
|
-
|
41
|
-
```js
|
42
|
-
var a = b && require("c")
|
43
|
-
|
44
|
-
if (typeof window !== "undefined") {
|
45
|
-
require('that-ugly-thing');
|
46
|
-
}
|
47
|
-
|
48
|
-
var fs = null;
|
49
|
-
try {
|
50
|
-
fs = require("fs")
|
51
|
-
} catch (error) {}
|
52
|
-
```
|
53
|
-
|
54
|
-
If the `allowConditionalRequire` option is set to `false`, they will be reported.
|
55
|
-
|
56
|
-
If you don't rely on synchronous module loading, check out [dynamic import](https://github.com/airbnb/babel-plugin-dynamic-import-node).
|
57
|
-
|
58
|
-
### Allow primitive modules
|
59
|
-
|
60
|
-
If `allowPrimitiveModules` option is set to `true`, the following is valid:
|
61
|
-
|
62
|
-
```js
|
63
|
-
/*eslint no-commonjs: [2, { allowPrimitiveModules: true }]*/
|
64
|
-
|
65
|
-
module.exports = "foo"
|
66
|
-
module.exports = function rule(context) { return { /* ... */ } }
|
67
|
-
```
|
68
|
-
|
69
|
-
but this is still reported:
|
70
|
-
|
71
|
-
```js
|
72
|
-
/*eslint no-commonjs: [2, { allowPrimitiveModules: true }]*/
|
73
|
-
|
74
|
-
module.exports = { x: "y" }
|
75
|
-
exports.z = function boop() { /* ... */ }
|
76
|
-
```
|
77
|
-
|
78
|
-
This is useful for things like ESLint rule modules, which must export a function as
|
79
|
-
the module.
|
80
|
-
|
81
|
-
## When Not To Use It
|
82
|
-
|
83
|
-
If you don't mind mixing module systems (sometimes this is useful), you probably
|
84
|
-
don't want this rule.
|
85
|
-
|
86
|
-
It is also fairly noisy if you have a larger codebase that is being transitioned
|
87
|
-
from CommonJS to ES6 modules.
|
88
|
-
|
89
|
-
## Contributors
|
90
|
-
|
91
|
-
Special thanks to @xjamundx for donating the module.exports and exports.* bits.
|
92
|
-
|
93
|
-
## Further Reading
|
94
|
-
|
95
|
-
- [`no-amd`](./no-amd.md): report on AMD `require`, `define`
|
96
|
-
- Source: <https://github.com/xjamundx/eslint-plugin-modules>
|
@@ -1,111 +0,0 @@
|
|
1
|
-
# import/no-cycle
|
2
|
-
|
3
|
-
<!-- end auto-generated rule header -->
|
4
|
-
|
5
|
-
Ensures that there is no resolvable path back to this module via its dependencies.
|
6
|
-
|
7
|
-
This includes cycles of depth 1 (imported module imports me) to `"∞"` (or `Infinity`), if the
|
8
|
-
[`maxDepth`](#maxdepth) option is not set.
|
9
|
-
|
10
|
-
```js
|
11
|
-
// dep-b.js
|
12
|
-
import './dep-a.js'
|
13
|
-
|
14
|
-
export function b() { /* ... */ }
|
15
|
-
```
|
16
|
-
|
17
|
-
```js
|
18
|
-
// dep-a.js
|
19
|
-
import { b } from './dep-b.js' // reported: Dependency cycle detected.
|
20
|
-
```
|
21
|
-
|
22
|
-
This rule does _not_ detect imports that resolve directly to the linted module;
|
23
|
-
for that, see [`no-self-import`].
|
24
|
-
|
25
|
-
This rule ignores type-only imports in Flow and TypeScript syntax (`import type` and `import typeof`), which have no runtime effect.
|
26
|
-
|
27
|
-
## Rule Details
|
28
|
-
|
29
|
-
### Options
|
30
|
-
|
31
|
-
By default, this rule only detects cycles for ES6 imports, but see the [`no-unresolved` options](./no-unresolved.md#options) as this rule also supports the same `commonjs` and `amd` flags. However, these flags only impact which import types are _linted_; the
|
32
|
-
import/export infrastructure only registers `import` statements in dependencies, so
|
33
|
-
cycles created by `require` within imported modules may not be detected.
|
34
|
-
|
35
|
-
#### `maxDepth`
|
36
|
-
|
37
|
-
There is a `maxDepth` option available to prevent full expansion of very deep dependency trees:
|
38
|
-
|
39
|
-
```js
|
40
|
-
/*eslint import/no-cycle: [2, { maxDepth: 1 }]*/
|
41
|
-
|
42
|
-
// dep-c.js
|
43
|
-
import './dep-a.js'
|
44
|
-
```
|
45
|
-
|
46
|
-
```js
|
47
|
-
// dep-b.js
|
48
|
-
import './dep-c.js'
|
49
|
-
|
50
|
-
export function b() { /* ... */ }
|
51
|
-
```
|
52
|
-
|
53
|
-
```js
|
54
|
-
// dep-a.js
|
55
|
-
import { b } from './dep-b.js' // not reported as the cycle is at depth 2
|
56
|
-
```
|
57
|
-
|
58
|
-
This is not necessarily recommended, but available as a cost/benefit tradeoff mechanism
|
59
|
-
for reducing total project lint time, if needed.
|
60
|
-
|
61
|
-
#### `ignoreExternal`
|
62
|
-
|
63
|
-
An `ignoreExternal` option is available to prevent the cycle detection to expand to external modules:
|
64
|
-
|
65
|
-
```js
|
66
|
-
/*eslint import/no-cycle: [2, { ignoreExternal: true }]*/
|
67
|
-
|
68
|
-
// dep-a.js
|
69
|
-
import 'module-b/dep-b.js'
|
70
|
-
|
71
|
-
export function a() { /* ... */ }
|
72
|
-
```
|
73
|
-
|
74
|
-
```js
|
75
|
-
// node_modules/module-b/dep-b.js
|
76
|
-
import { a } from './dep-a.js' // not reported as this module is external
|
77
|
-
```
|
78
|
-
|
79
|
-
Its value is `false` by default, but can be set to `true` for reducing total project lint time, if needed.
|
80
|
-
|
81
|
-
#### `allowUnsafeDynamicCyclicDependency`
|
82
|
-
|
83
|
-
This option disable reporting of errors if a cycle is detected with at least one dynamic import.
|
84
|
-
|
85
|
-
```js
|
86
|
-
// bar.js
|
87
|
-
import { foo } from './foo';
|
88
|
-
export const bar = foo;
|
89
|
-
|
90
|
-
// foo.js
|
91
|
-
export const foo = 'Foo';
|
92
|
-
export function getBar() { return import('./bar'); }
|
93
|
-
```
|
94
|
-
|
95
|
-
> Cyclic dependency are **always** a dangerous anti-pattern as discussed extensively in [#2265](https://github.com/import-js/eslint-plugin-import/issues/2265). Please be extra careful about using this option.
|
96
|
-
|
97
|
-
## When Not To Use It
|
98
|
-
|
99
|
-
This rule is comparatively computationally expensive. If you are pressed for lint
|
100
|
-
time, or don't think you have an issue with dependency cycles, you may not want
|
101
|
-
this rule enabled.
|
102
|
-
|
103
|
-
## Further Reading
|
104
|
-
|
105
|
-
- [Original inspiring issue](https://github.com/import-js/eslint-plugin-import/issues/941)
|
106
|
-
- Rule to detect that module imports itself: [`no-self-import`]
|
107
|
-
- [`import/external-module-folders`] setting
|
108
|
-
|
109
|
-
[`no-self-import`]: ./no-self-import.md
|
110
|
-
|
111
|
-
[`import/external-module-folders`]: ../../README.md#importexternal-module-folders
|
@@ -1,65 +0,0 @@
|
|
1
|
-
# import/no-default-export
|
2
|
-
|
3
|
-
<!-- end auto-generated rule header -->
|
4
|
-
|
5
|
-
Prohibit default exports. Mostly an inverse of [`prefer-default-export`].
|
6
|
-
|
7
|
-
[`prefer-default-export`]: ./prefer-default-export.md
|
8
|
-
|
9
|
-
## Rule Details
|
10
|
-
|
11
|
-
The following patterns are considered warnings:
|
12
|
-
|
13
|
-
```javascript
|
14
|
-
// bad1.js
|
15
|
-
|
16
|
-
// There is a default export.
|
17
|
-
export const foo = 'foo';
|
18
|
-
const bar = 'bar';
|
19
|
-
export default 'bar';
|
20
|
-
```
|
21
|
-
|
22
|
-
```javascript
|
23
|
-
// bad2.js
|
24
|
-
|
25
|
-
// There is a default export.
|
26
|
-
const foo = 'foo';
|
27
|
-
export { foo as default }
|
28
|
-
```
|
29
|
-
|
30
|
-
The following patterns are not warnings:
|
31
|
-
|
32
|
-
```javascript
|
33
|
-
// good1.js
|
34
|
-
|
35
|
-
// There is only a single module export and it's a named export.
|
36
|
-
export const foo = 'foo';
|
37
|
-
```
|
38
|
-
|
39
|
-
```javascript
|
40
|
-
// good2.js
|
41
|
-
|
42
|
-
// There is more than one named export in the module.
|
43
|
-
export const foo = 'foo';
|
44
|
-
export const bar = 'bar';
|
45
|
-
```
|
46
|
-
|
47
|
-
```javascript
|
48
|
-
// good3.js
|
49
|
-
|
50
|
-
// There is more than one named export in the module
|
51
|
-
const foo = 'foo';
|
52
|
-
const bar = 'bar';
|
53
|
-
export { foo, bar }
|
54
|
-
```
|
55
|
-
|
56
|
-
```javascript
|
57
|
-
// export-star.js
|
58
|
-
|
59
|
-
// Any batch export will disable this rule. The remote module is not inspected.
|
60
|
-
export * from './other-module'
|
61
|
-
```
|
62
|
-
|
63
|
-
## When Not To Use It
|
64
|
-
|
65
|
-
If you don't care if default imports are used, or if you prefer default imports over named imports.
|
@@ -1,62 +0,0 @@
|
|
1
|
-
# import/no-deprecated
|
2
|
-
|
3
|
-
<!-- end auto-generated rule header -->
|
4
|
-
|
5
|
-
Reports use of a deprecated name, as indicated by a JSDoc block with a `@deprecated`
|
6
|
-
tag or TomDoc `Deprecated:` comment.
|
7
|
-
|
8
|
-
using a JSDoc `@deprecated` tag:
|
9
|
-
|
10
|
-
```js
|
11
|
-
// @file: ./answer.js
|
12
|
-
|
13
|
-
/**
|
14
|
-
* this is what you get when you trust a mouse talk show
|
15
|
-
* @deprecated need to restart the experiment
|
16
|
-
* @returns {Number} nonsense
|
17
|
-
*/
|
18
|
-
export function multiply(six, nine) {
|
19
|
-
return 42
|
20
|
-
}
|
21
|
-
```
|
22
|
-
|
23
|
-
will report as such:
|
24
|
-
|
25
|
-
```js
|
26
|
-
import { multiply } from './answer' // Deprecated: need to restart the experiment
|
27
|
-
|
28
|
-
function whatever(y, z) {
|
29
|
-
return multiply(y, z) // Deprecated: need to restart the experiment
|
30
|
-
}
|
31
|
-
```
|
32
|
-
|
33
|
-
or using the TomDoc equivalent:
|
34
|
-
|
35
|
-
```js
|
36
|
-
// Deprecated: This is what you get when you trust a mouse talk show, need to
|
37
|
-
// restart the experiment.
|
38
|
-
//
|
39
|
-
// Returns a Number nonsense
|
40
|
-
export function multiply(six, nine) {
|
41
|
-
return 42
|
42
|
-
}
|
43
|
-
```
|
44
|
-
|
45
|
-
Only JSDoc is enabled by default. Other documentation styles can be enabled with
|
46
|
-
the `import/docstyle` setting.
|
47
|
-
|
48
|
-
```yaml
|
49
|
-
# .eslintrc.yml
|
50
|
-
settings:
|
51
|
-
import/docstyle: ['jsdoc', 'tomdoc']
|
52
|
-
```
|
53
|
-
|
54
|
-
## Worklist
|
55
|
-
|
56
|
-
- [x] report explicit imports on the import node
|
57
|
-
- [x] support namespaces
|
58
|
-
- [x] should bubble up through deep namespaces (#157)
|
59
|
-
- [x] report explicit imports at reference time (at the identifier) similar to namespace
|
60
|
-
- [x] mark module deprecated if file JSDoc has a @deprecated tag?
|
61
|
-
- [ ] don't flag redeclaration of imported, deprecated names
|
62
|
-
- [ ] flag destructuring
|
@@ -1,109 +0,0 @@
|
|
1
|
-
# import/no-duplicates
|
2
|
-
|
3
|
-
⚠️ This rule _warns_ in the following configs: ☑️ `recommended`, 🚸 `warnings`.
|
4
|
-
|
5
|
-
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
6
|
-
|
7
|
-
<!-- end auto-generated rule header -->
|
8
|
-
|
9
|
-
Reports if a resolved path is imported more than once.
|
10
|
-
|
11
|
-
ESLint core has a similar rule ([`no-duplicate-imports`](https://eslint.org/docs/rules/no-duplicate-imports)), but this version
|
12
|
-
is different in two key ways:
|
13
|
-
|
14
|
-
1. the paths in the source code don't have to exactly match, they just have to point to the same module on the filesystem. (i.e. `./foo` and `./foo.js`)
|
15
|
-
2. this version distinguishes Flow `type` imports from standard imports. ([#334](https://github.com/import-js/eslint-plugin-import/pull/334))
|
16
|
-
|
17
|
-
## Rule Details
|
18
|
-
|
19
|
-
Valid:
|
20
|
-
|
21
|
-
```js
|
22
|
-
import SomeDefaultClass, * as names from './mod'
|
23
|
-
// Flow `type` import from same module is fine
|
24
|
-
import type SomeType from './mod'
|
25
|
-
```
|
26
|
-
|
27
|
-
...whereas here, both `./mod` imports will be reported:
|
28
|
-
|
29
|
-
```js
|
30
|
-
import SomeDefaultClass from './mod'
|
31
|
-
|
32
|
-
// oops, some other import separated these lines
|
33
|
-
import foo from './some-other-mod'
|
34
|
-
|
35
|
-
import * as names from './mod'
|
36
|
-
|
37
|
-
// will catch this too, assuming it is the same target module
|
38
|
-
import { something } from './mod.js'
|
39
|
-
```
|
40
|
-
|
41
|
-
The motivation is that this is likely a result of two developers importing different
|
42
|
-
names from the same module at different times (and potentially largely different
|
43
|
-
locations in the file.) This rule brings both (or n-many) to attention.
|
44
|
-
|
45
|
-
### Query Strings
|
46
|
-
|
47
|
-
By default, this rule ignores query strings (i.e. paths followed by a question mark), and thus imports from `./mod?a` and `./mod?b` will be considered as duplicates. However you can use the option `considerQueryString` to handle them as different (primarily because browsers will resolve those imports differently).
|
48
|
-
|
49
|
-
Config:
|
50
|
-
|
51
|
-
```json
|
52
|
-
"import/no-duplicates": ["error", {"considerQueryString": true}]
|
53
|
-
```
|
54
|
-
|
55
|
-
And then the following code becomes valid:
|
56
|
-
|
57
|
-
```js
|
58
|
-
import minifiedMod from './mod?minify'
|
59
|
-
import noCommentsMod from './mod?comments=0'
|
60
|
-
import originalMod from './mod'
|
61
|
-
```
|
62
|
-
|
63
|
-
It will still catch duplicates when using the same module and the exact same query string:
|
64
|
-
|
65
|
-
```js
|
66
|
-
import SomeDefaultClass from './mod?minify'
|
67
|
-
|
68
|
-
// This is invalid, assuming `./mod` and `./mod.js` are the same target:
|
69
|
-
import * from './mod.js?minify'
|
70
|
-
```
|
71
|
-
|
72
|
-
### Inline Type imports
|
73
|
-
|
74
|
-
TypeScript 4.5 introduced a new [feature](https://devblogs.microsoft.com/typescript/announcing-typescript-4-5/#type-on-import-names) that allows mixing of named value and type imports. In order to support fixing to an inline type import when duplicate imports are detected, `prefer-inline` can be set to true.
|
75
|
-
|
76
|
-
Config:
|
77
|
-
|
78
|
-
```json
|
79
|
-
"import/no-duplicates": ["error", {"prefer-inline": true}]
|
80
|
-
```
|
81
|
-
|
82
|
-
<!--tabs-->
|
83
|
-
|
84
|
-
❌ Invalid `["error", {"prefer-inline": true}]`
|
85
|
-
|
86
|
-
```js
|
87
|
-
import { AValue, type AType } from './mama-mia'
|
88
|
-
import type { BType } from './mama-mia'
|
89
|
-
|
90
|
-
import { CValue } from './papa-mia'
|
91
|
-
import type { CType } from './papa-mia'
|
92
|
-
```
|
93
|
-
|
94
|
-
✅ Valid with `["error", {"prefer-inline": true}]`
|
95
|
-
|
96
|
-
```js
|
97
|
-
import { AValue, type AType, type BType } from './mama-mia'
|
98
|
-
|
99
|
-
import { CValue, type CType } from './papa-mia'
|
100
|
-
```
|
101
|
-
|
102
|
-
<!--tabs-->
|
103
|
-
|
104
|
-
## When Not To Use It
|
105
|
-
|
106
|
-
If the core ESLint version is good enough (i.e. you're _not_ using Flow and you _are_ using [`import/extensions`](./extensions.md)), keep it and don't use this.
|
107
|
-
|
108
|
-
If you like to split up imports across lines or may need to import a default and a namespace,
|
109
|
-
you may not want to enable this rule.
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# import/no-dynamic-require
|
2
|
-
|
3
|
-
<!-- end auto-generated rule header -->
|
4
|
-
|
5
|
-
The `require` method from CommonJS is used to import modules from different files. Unlike the ES6 `import` syntax, it can be given expressions that will be resolved at runtime. While this is sometimes necessary and useful, in most cases it isn't. Using expressions (for instance, concatenating a path and variable) as the argument makes it harder for tools to do static code analysis, or to find where in the codebase a module is used.
|
6
|
-
|
7
|
-
This rule forbids every call to `require()` that uses expressions for the module name argument.
|
8
|
-
|
9
|
-
## Rule Details
|
10
|
-
|
11
|
-
### Fail
|
12
|
-
|
13
|
-
```js
|
14
|
-
require(name);
|
15
|
-
require('../' + name);
|
16
|
-
require(`../${name}`);
|
17
|
-
require(name());
|
18
|
-
```
|
19
|
-
|
20
|
-
### Pass
|
21
|
-
|
22
|
-
```js
|
23
|
-
require('../name');
|
24
|
-
require(`../name`);
|
25
|
-
```
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# import/no-empty-named-blocks
|
2
|
-
|
3
|
-
🔧💡 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) and manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
|
4
|
-
|
5
|
-
<!-- end auto-generated rule header -->
|
6
|
-
|
7
|
-
Reports the use of empty named import blocks.
|
8
|
-
|
9
|
-
## Rule Details
|
10
|
-
|
11
|
-
### Valid
|
12
|
-
|
13
|
-
```js
|
14
|
-
import { mod } from 'mod'
|
15
|
-
import Default, { mod } from 'mod'
|
16
|
-
```
|
17
|
-
|
18
|
-
When using typescript
|
19
|
-
|
20
|
-
```js
|
21
|
-
import type { mod } from 'mod'
|
22
|
-
```
|
23
|
-
|
24
|
-
When using flow
|
25
|
-
|
26
|
-
```js
|
27
|
-
import typeof { mod } from 'mod'
|
28
|
-
```
|
29
|
-
|
30
|
-
### Invalid
|
31
|
-
|
32
|
-
```js
|
33
|
-
import {} from 'mod'
|
34
|
-
import Default, {} from 'mod'
|
35
|
-
```
|
36
|
-
|
37
|
-
When using typescript
|
38
|
-
|
39
|
-
```js
|
40
|
-
import type Default, {} from 'mod'
|
41
|
-
import type {} from 'mod'
|
42
|
-
```
|
43
|
-
|
44
|
-
When using flow
|
45
|
-
|
46
|
-
```js
|
47
|
-
import typeof {} from 'mod'
|
48
|
-
import typeof Default, {} from 'mod'
|
49
|
-
```
|