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,75 +0,0 @@
|
|
1
|
-
# import/first
|
2
|
-
|
3
|
-
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
4
|
-
|
5
|
-
<!-- end auto-generated rule header -->
|
6
|
-
|
7
|
-
This rule reports any imports that come after non-import
|
8
|
-
statements.
|
9
|
-
|
10
|
-
## Rule Details
|
11
|
-
|
12
|
-
```js
|
13
|
-
import foo from './foo'
|
14
|
-
|
15
|
-
// some module-level initializer
|
16
|
-
initWith(foo)
|
17
|
-
|
18
|
-
import bar from './bar' // <- reported
|
19
|
-
```
|
20
|
-
|
21
|
-
Providing `absolute-first` as an option will report any absolute imports (i.e.
|
22
|
-
packages) that come after any relative imports:
|
23
|
-
|
24
|
-
```js
|
25
|
-
import foo from 'foo'
|
26
|
-
import bar from './bar'
|
27
|
-
|
28
|
-
import * as _ from 'lodash' // <- reported
|
29
|
-
```
|
30
|
-
|
31
|
-
If you really want import type ordering, check out [`import/order`].
|
32
|
-
|
33
|
-
Notably, `import`s are hoisted, which means the imported modules will be evaluated
|
34
|
-
before any of the statements interspersed between them. Keeping all `import`s together
|
35
|
-
at the top of the file may prevent surprises resulting from this part of the spec.
|
36
|
-
|
37
|
-
### On directives
|
38
|
-
|
39
|
-
Directives are allowed as long as they occur strictly before any `import` declarations,
|
40
|
-
as follows:
|
41
|
-
|
42
|
-
```js
|
43
|
-
'use super-mega-strict'
|
44
|
-
|
45
|
-
import { suchFoo } from 'lame-fake-module-name' // no report here
|
46
|
-
```
|
47
|
-
|
48
|
-
A directive in this case is assumed to be a single statement that contains only
|
49
|
-
a literal string-valued expression.
|
50
|
-
|
51
|
-
`'use strict'` would be a good example, except that [modules are always in strict
|
52
|
-
mode](https://262.ecma-international.org/6.0/#sec-strict-mode-code) so it would be surprising to see a `'use strict'` sharing a file with `import`s and
|
53
|
-
`export`s.
|
54
|
-
|
55
|
-
Given that, see [#255] for the reasoning.
|
56
|
-
|
57
|
-
### With Fixer
|
58
|
-
|
59
|
-
This rule contains a fixer to reorder in-body import to top, the following criteria applied:
|
60
|
-
|
61
|
-
1. Never re-order relative to each other, even if `absolute-first` is set.
|
62
|
-
2. If an import creates an identifier, and that identifier is referenced at module level *before* the import itself, that won't be re-ordered.
|
63
|
-
|
64
|
-
## When Not To Use It
|
65
|
-
|
66
|
-
If you don't mind imports being sprinkled throughout, you may not want to
|
67
|
-
enable this rule.
|
68
|
-
|
69
|
-
## Further Reading
|
70
|
-
|
71
|
-
- [`import/order`]: a major step up from `absolute-first`
|
72
|
-
- Issue [#255]
|
73
|
-
|
74
|
-
[`import/order`]: ./order.md
|
75
|
-
[#255]: https://github.com/import-js/eslint-plugin-import/issues/255
|
@@ -1,118 +0,0 @@
|
|
1
|
-
# import/group-exports
|
2
|
-
|
3
|
-
<!-- end auto-generated rule header -->
|
4
|
-
|
5
|
-
Reports when named exports are not grouped together in a single `export` declaration or when multiple assignments to CommonJS `module.exports` or `exports` object are present in a single file.
|
6
|
-
|
7
|
-
**Rationale:** An `export` declaration or `module.exports` assignment can appear anywhere in the code. By requiring a single export declaration all your exports will remain at one place, making it easier to see what exports a module provides.
|
8
|
-
|
9
|
-
## Rule Details
|
10
|
-
|
11
|
-
This rule warns whenever a single file contains multiple named export declarations or multiple assignments to `module.exports` (or `exports`).
|
12
|
-
|
13
|
-
### Valid
|
14
|
-
|
15
|
-
```js
|
16
|
-
// A single named export declaration -> ok
|
17
|
-
export const valid = true
|
18
|
-
```
|
19
|
-
|
20
|
-
```js
|
21
|
-
const first = true
|
22
|
-
const second = true
|
23
|
-
|
24
|
-
// A single named export declaration -> ok
|
25
|
-
export {
|
26
|
-
first,
|
27
|
-
second,
|
28
|
-
}
|
29
|
-
```
|
30
|
-
|
31
|
-
```js
|
32
|
-
// Aggregating exports -> ok
|
33
|
-
export { default as module1 } from 'module-1'
|
34
|
-
export { default as module2 } from 'module-2'
|
35
|
-
```
|
36
|
-
|
37
|
-
```js
|
38
|
-
// A single exports assignment -> ok
|
39
|
-
module.exports = {
|
40
|
-
first: true,
|
41
|
-
second: true
|
42
|
-
}
|
43
|
-
```
|
44
|
-
|
45
|
-
```js
|
46
|
-
const first = true
|
47
|
-
const second = true
|
48
|
-
|
49
|
-
// A single exports assignment -> ok
|
50
|
-
module.exports = {
|
51
|
-
first,
|
52
|
-
second,
|
53
|
-
}
|
54
|
-
```
|
55
|
-
|
56
|
-
```js
|
57
|
-
function test() {}
|
58
|
-
test.property = true
|
59
|
-
test.another = true
|
60
|
-
|
61
|
-
// A single exports assignment -> ok
|
62
|
-
module.exports = test
|
63
|
-
```
|
64
|
-
|
65
|
-
```ts
|
66
|
-
const first = true;
|
67
|
-
type firstType = boolean
|
68
|
-
|
69
|
-
// A single named export declaration (type exports handled separately) -> ok
|
70
|
-
export {first}
|
71
|
-
export type {firstType}
|
72
|
-
```
|
73
|
-
|
74
|
-
### Invalid
|
75
|
-
|
76
|
-
```js
|
77
|
-
// Multiple named export statements -> not ok!
|
78
|
-
export const first = true
|
79
|
-
export const second = true
|
80
|
-
```
|
81
|
-
|
82
|
-
```js
|
83
|
-
// Aggregating exports from the same module -> not ok!
|
84
|
-
export { module1 } from 'module-1'
|
85
|
-
export { module2 } from 'module-1'
|
86
|
-
```
|
87
|
-
|
88
|
-
```js
|
89
|
-
// Multiple exports assignments -> not ok!
|
90
|
-
exports.first = true
|
91
|
-
exports.second = true
|
92
|
-
```
|
93
|
-
|
94
|
-
```js
|
95
|
-
// Multiple exports assignments -> not ok!
|
96
|
-
module.exports = {}
|
97
|
-
module.exports.first = true
|
98
|
-
```
|
99
|
-
|
100
|
-
```js
|
101
|
-
// Multiple exports assignments -> not ok!
|
102
|
-
module.exports = () => {}
|
103
|
-
module.exports.first = true
|
104
|
-
module.exports.second = true
|
105
|
-
```
|
106
|
-
|
107
|
-
```ts
|
108
|
-
type firstType = boolean
|
109
|
-
type secondType = any
|
110
|
-
|
111
|
-
// Multiple named type export statements -> not ok!
|
112
|
-
export type {firstType}
|
113
|
-
export type {secondType}
|
114
|
-
```
|
115
|
-
|
116
|
-
## When Not To Use It
|
117
|
-
|
118
|
-
If you do not mind having your exports spread across the file, you can safely turn this rule off.
|
@@ -1,9 +0,0 @@
|
|
1
|
-
# import/imports-first
|
2
|
-
|
3
|
-
❌ This rule is deprecated.
|
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
|
-
This rule was **deprecated** in eslint-plugin-import v2.0.0. Please use the corresponding rule [`first`](https://github.com/import-js/eslint-plugin-import/blob/HEAD/docs/rules/first.md).
|
@@ -1,70 +0,0 @@
|
|
1
|
-
# import/max-dependencies
|
2
|
-
|
3
|
-
<!-- end auto-generated rule header -->
|
4
|
-
|
5
|
-
Forbid modules to have too many dependencies (`import` or `require` statements).
|
6
|
-
|
7
|
-
This is a useful rule because a module with too many dependencies is a code smell, and usually indicates the module is doing too much and/or should be broken up into smaller modules.
|
8
|
-
|
9
|
-
Importing multiple named exports from a single module will only count once (e.g. `import {x, y, z} from './foo'` will only count as a single dependency).
|
10
|
-
|
11
|
-
## Options
|
12
|
-
|
13
|
-
This rule has the following options, with these defaults:
|
14
|
-
|
15
|
-
```js
|
16
|
-
"import/max-dependencies": ["error", {
|
17
|
-
"max": 10,
|
18
|
-
"ignoreTypeImports": false,
|
19
|
-
}]
|
20
|
-
```
|
21
|
-
|
22
|
-
### `max`
|
23
|
-
|
24
|
-
This option sets the maximum number of dependencies allowed. Anything over will trigger the rule. **Default is 10** if the rule is enabled and no `max` is specified.
|
25
|
-
|
26
|
-
Given a max value of `{"max": 2}`:
|
27
|
-
|
28
|
-
### Fail
|
29
|
-
|
30
|
-
```js
|
31
|
-
import a from './a'; // 1
|
32
|
-
const b = require('./b'); // 2
|
33
|
-
import c from './c'; // 3 - exceeds max!
|
34
|
-
```
|
35
|
-
|
36
|
-
### Pass
|
37
|
-
|
38
|
-
```js
|
39
|
-
import a from './a'; // 1
|
40
|
-
const anotherA = require('./a'); // still 1
|
41
|
-
import {x, y, z} from './foo'; // 2
|
42
|
-
```
|
43
|
-
|
44
|
-
### `ignoreTypeImports`
|
45
|
-
|
46
|
-
Ignores `type` imports. Type imports are a feature released in TypeScript 3.8, you can [read more here](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export). Defaults to `false`.
|
47
|
-
|
48
|
-
Given `{"max": 2, "ignoreTypeImports": true}`:
|
49
|
-
|
50
|
-
<!-- markdownlint-disable-next-line MD024 -- duplicate header -->
|
51
|
-
### Fail
|
52
|
-
|
53
|
-
```ts
|
54
|
-
import a from './a';
|
55
|
-
import b from './b';
|
56
|
-
import c from './c';
|
57
|
-
```
|
58
|
-
|
59
|
-
<!-- markdownlint-disable-next-line MD024 -- duplicate header -->
|
60
|
-
### Pass
|
61
|
-
|
62
|
-
```ts
|
63
|
-
import a from './a';
|
64
|
-
import b from './b';
|
65
|
-
import type c from './c'; // Doesn't count against max
|
66
|
-
```
|
67
|
-
|
68
|
-
## When Not To Use It
|
69
|
-
|
70
|
-
If you don't care how many dependencies a module has.
|
@@ -1,102 +0,0 @@
|
|
1
|
-
# import/named
|
2
|
-
|
3
|
-
💼🚫 This rule is enabled in the following configs: ❗ `errors`, ☑️ `recommended`. This rule is _disabled_ in the ⌨️ `typescript` config.
|
4
|
-
|
5
|
-
<!-- end auto-generated rule header -->
|
6
|
-
|
7
|
-
Verifies that all named imports are part of the set of named exports in the referenced module.
|
8
|
-
|
9
|
-
For `export`, verifies that all named exports exist in the referenced module.
|
10
|
-
|
11
|
-
Note: for packages, the plugin will find exported names
|
12
|
-
from [`jsnext:main`] (deprecated) or `module`, if present in `package.json`.
|
13
|
-
Redux's npm module includes this key, and thereby is lintable, for example.
|
14
|
-
|
15
|
-
A module path that is [ignored] or not [unambiguously an ES module] will not be reported when imported. Note that type imports and exports, as used by [Flow], are always ignored.
|
16
|
-
|
17
|
-
[ignored]: ../../README.md#importignore
|
18
|
-
[unambiguously an ES module]: https://github.com/bmeck/UnambiguousJavaScriptGrammar
|
19
|
-
[Flow]: https://flow.org/
|
20
|
-
|
21
|
-
## Rule Details
|
22
|
-
|
23
|
-
Given:
|
24
|
-
|
25
|
-
```js
|
26
|
-
// ./foo.js
|
27
|
-
export const foo = "I'm so foo"
|
28
|
-
```
|
29
|
-
|
30
|
-
The following is considered valid:
|
31
|
-
|
32
|
-
```js
|
33
|
-
// ./bar.js
|
34
|
-
import { foo } from './foo'
|
35
|
-
|
36
|
-
// ES7 proposal
|
37
|
-
export { foo as bar } from './foo'
|
38
|
-
|
39
|
-
// node_modules without jsnext:main are not analyzed by default
|
40
|
-
// (import/ignore setting)
|
41
|
-
import { SomeNonsenseThatDoesntExist } from 'react'
|
42
|
-
```
|
43
|
-
|
44
|
-
...and the following are reported:
|
45
|
-
|
46
|
-
```js
|
47
|
-
// ./baz.js
|
48
|
-
import { notFoo } from './foo'
|
49
|
-
|
50
|
-
// ES7 proposal
|
51
|
-
export { notFoo as defNotBar } from './foo'
|
52
|
-
|
53
|
-
// will follow 'jsnext:main', if available
|
54
|
-
import { dontCreateStore } from 'redux'
|
55
|
-
```
|
56
|
-
|
57
|
-
### Settings
|
58
|
-
|
59
|
-
[`import/ignore`] can be provided as a setting to ignore certain modules (node_modules,
|
60
|
-
CoffeeScript, CSS if using Webpack, etc.).
|
61
|
-
|
62
|
-
Given:
|
63
|
-
|
64
|
-
```yaml
|
65
|
-
# .eslintrc (YAML)
|
66
|
-
---
|
67
|
-
settings:
|
68
|
-
import/ignore:
|
69
|
-
- node_modules # included by default, but replaced if explicitly configured
|
70
|
-
- *.coffee$ # can't parse CoffeeScript (unless a custom polyglot parser was configured)
|
71
|
-
```
|
72
|
-
|
73
|
-
and
|
74
|
-
|
75
|
-
```coffeescript
|
76
|
-
# ./whatever.coffee
|
77
|
-
exports.whatever = (foo) -> console.log foo
|
78
|
-
```
|
79
|
-
|
80
|
-
then the following is not reported:
|
81
|
-
|
82
|
-
```js
|
83
|
-
// ./foo.js
|
84
|
-
|
85
|
-
// can't be analyzed, and ignored, so not reported
|
86
|
-
import { notWhatever } from './whatever'
|
87
|
-
```
|
88
|
-
|
89
|
-
## When Not To Use It
|
90
|
-
|
91
|
-
If you are using CommonJS and/or modifying the exported namespace of any module at
|
92
|
-
runtime, you will likely see false positives with this rule.
|
93
|
-
|
94
|
-
## Further Reading
|
95
|
-
|
96
|
-
- [`import/ignore`] setting
|
97
|
-
- [`jsnext:main`] deprecation
|
98
|
-
- [`pkg.module`] (Rollup)
|
99
|
-
|
100
|
-
[`jsnext:main`]: https://github.com/jsforum/jsforum/issues/5
|
101
|
-
[`pkg.module`]: https://github.com/rollup/rollup/wiki/pkg.module
|
102
|
-
[`import/ignore`]: ../../README.md#importignore
|
@@ -1,106 +0,0 @@
|
|
1
|
-
# import/namespace
|
2
|
-
|
3
|
-
💼 This rule is enabled in the following configs: ❗ `errors`, ☑️ `recommended`.
|
4
|
-
|
5
|
-
<!-- end auto-generated rule header -->
|
6
|
-
|
7
|
-
Enforces names exist at the time they are dereferenced, when imported as a full namespace (i.e. `import * as foo from './foo'; foo.bar();` will report if `bar` is not exported by `./foo`.).
|
8
|
-
|
9
|
-
Will report at the import declaration if there are _no_ exported names found.
|
10
|
-
|
11
|
-
Also, will report for computed references (i.e. `foo["bar"]()`).
|
12
|
-
|
13
|
-
Reports on assignment to a member of an imported namespace.
|
14
|
-
|
15
|
-
Note: for packages, the plugin will find exported names
|
16
|
-
from [`jsnext:main`], if present in `package.json`.
|
17
|
-
Redux's npm module includes this key, and thereby is lintable, for example.
|
18
|
-
|
19
|
-
A module path that is [ignored] or not [unambiguously an ES module] will not be reported when imported.
|
20
|
-
|
21
|
-
[ignored]: ../README.md#importignore
|
22
|
-
[unambiguously an ES module]: https://github.com/bmeck/UnambiguousJavaScriptGrammar
|
23
|
-
|
24
|
-
## Rule Details
|
25
|
-
|
26
|
-
Currently, this rule does not check for possible
|
27
|
-
redefinition of the namespace in an intermediate scope. Adherence to the ESLint
|
28
|
-
`no-shadow` rule for namespaces will prevent this from being a problem.
|
29
|
-
|
30
|
-
For [ES7], reports if an exported namespace would be empty (no names exported from the referenced module.)
|
31
|
-
|
32
|
-
Given:
|
33
|
-
|
34
|
-
```js
|
35
|
-
// @module ./named-exports
|
36
|
-
export const a = 1
|
37
|
-
const b = 2
|
38
|
-
export { b }
|
39
|
-
|
40
|
-
const c = 3
|
41
|
-
export { c as d }
|
42
|
-
|
43
|
-
export class ExportedClass { }
|
44
|
-
|
45
|
-
// ES7
|
46
|
-
export * as deep from './deep'
|
47
|
-
```
|
48
|
-
|
49
|
-
and:
|
50
|
-
|
51
|
-
```js
|
52
|
-
// @module ./deep
|
53
|
-
export const e = "MC2"
|
54
|
-
```
|
55
|
-
|
56
|
-
See what is valid and reported:
|
57
|
-
|
58
|
-
```js
|
59
|
-
// @module ./foo
|
60
|
-
import * as names from './named-exports'
|
61
|
-
|
62
|
-
function great() {
|
63
|
-
return names.a + names.b // so great https://youtu.be/ei7mb8UxEl8
|
64
|
-
}
|
65
|
-
|
66
|
-
function notGreat() {
|
67
|
-
doSomethingWith(names.c) // Reported: 'c' not found in imported namespace 'names'.
|
68
|
-
|
69
|
-
const { a, b, c } = names // also reported, only for 'c'
|
70
|
-
}
|
71
|
-
|
72
|
-
// also tunnels through re-exported namespaces!
|
73
|
-
function deepTrouble() {
|
74
|
-
doSomethingWith(names.deep.e) // fine
|
75
|
-
doSomethingWith(names.deep.f) // Reported: 'f' not found in deeply imported namespace 'names.deep'.
|
76
|
-
}
|
77
|
-
|
78
|
-
```
|
79
|
-
|
80
|
-
### Options
|
81
|
-
|
82
|
-
#### `allowComputed`
|
83
|
-
|
84
|
-
Defaults to `false`. When false, will report the following:
|
85
|
-
|
86
|
-
```js
|
87
|
-
/*eslint import/namespace: [2, { allowComputed: false }]*/
|
88
|
-
import * as a from './a'
|
89
|
-
|
90
|
-
function f(x) {
|
91
|
-
return a[x] // Unable to validate computed reference to imported namespace 'a'.
|
92
|
-
}
|
93
|
-
```
|
94
|
-
|
95
|
-
When set to `true`, the above computed namespace member reference is allowed, but
|
96
|
-
still can't be statically analyzed any further.
|
97
|
-
|
98
|
-
## Further Reading
|
99
|
-
|
100
|
-
- Lee Byron's [ES7] export proposal
|
101
|
-
- [`import/ignore`] setting
|
102
|
-
- [`jsnext:main`](Rollup)
|
103
|
-
|
104
|
-
[ES7]: https://github.com/leebyron/ecmascript-more-export-from
|
105
|
-
[`import/ignore`]: ../../README.md#importignore
|
106
|
-
[`jsnext:main`]: https://github.com/rollup/rollup/wiki/jsnext:main
|
@@ -1,167 +0,0 @@
|
|
1
|
-
# import/newline-after-import
|
2
|
-
|
3
|
-
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
4
|
-
|
5
|
-
<!-- end auto-generated rule header -->
|
6
|
-
|
7
|
-
Enforces having one or more empty lines after the last top-level import statement or require call.
|
8
|
-
|
9
|
-
## Rule Details
|
10
|
-
|
11
|
-
This rule supports the following options:
|
12
|
-
|
13
|
-
- `count` which sets the number of newlines that are enforced after the last top-level import statement or require call. This option defaults to `1`.
|
14
|
-
|
15
|
-
- `exactCount` which enforce the exact numbers of newlines that is mentioned in `count`. This option defaults to `false`.
|
16
|
-
|
17
|
-
- `considerComments` which enforces the rule on comments after the last import-statement as well when set to true. This option defaults to `false`.
|
18
|
-
|
19
|
-
Valid:
|
20
|
-
|
21
|
-
```js
|
22
|
-
import defaultExport from './foo';
|
23
|
-
|
24
|
-
const FOO = 'BAR';
|
25
|
-
```
|
26
|
-
|
27
|
-
```js
|
28
|
-
import defaultExport from './foo';
|
29
|
-
import { bar } from 'bar-lib';
|
30
|
-
|
31
|
-
const FOO = 'BAR';
|
32
|
-
```
|
33
|
-
|
34
|
-
```js
|
35
|
-
const FOO = require('./foo');
|
36
|
-
const BAR = require('./bar');
|
37
|
-
|
38
|
-
const BAZ = 1;
|
39
|
-
```
|
40
|
-
|
41
|
-
Invalid:
|
42
|
-
|
43
|
-
```js
|
44
|
-
import * as foo from 'foo'
|
45
|
-
const FOO = 'BAR';
|
46
|
-
```
|
47
|
-
|
48
|
-
```js
|
49
|
-
import * as foo from 'foo';
|
50
|
-
const FOO = 'BAR';
|
51
|
-
|
52
|
-
import { bar } from 'bar-lib';
|
53
|
-
```
|
54
|
-
|
55
|
-
```js
|
56
|
-
const FOO = require('./foo');
|
57
|
-
const BAZ = 1;
|
58
|
-
const BAR = require('./bar');
|
59
|
-
```
|
60
|
-
|
61
|
-
With `count` set to `2` this will be considered valid:
|
62
|
-
|
63
|
-
```js
|
64
|
-
import defaultExport from './foo';
|
65
|
-
|
66
|
-
|
67
|
-
const FOO = 'BAR';
|
68
|
-
```
|
69
|
-
|
70
|
-
```js
|
71
|
-
import defaultExport from './foo';
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
const FOO = 'BAR';
|
76
|
-
```
|
77
|
-
|
78
|
-
With `count` set to `2` these will be considered invalid:
|
79
|
-
|
80
|
-
```js
|
81
|
-
import defaultExport from './foo';
|
82
|
-
const FOO = 'BAR';
|
83
|
-
```
|
84
|
-
|
85
|
-
```js
|
86
|
-
import defaultExport from './foo';
|
87
|
-
|
88
|
-
const FOO = 'BAR';
|
89
|
-
```
|
90
|
-
|
91
|
-
With `count` set to `2` and `exactCount` set to `true` this will be considered valid:
|
92
|
-
|
93
|
-
```js
|
94
|
-
import defaultExport from './foo';
|
95
|
-
|
96
|
-
|
97
|
-
const FOO = 'BAR';
|
98
|
-
```
|
99
|
-
|
100
|
-
With `count` set to `2` and `exactCount` set to `true` these will be considered invalid:
|
101
|
-
|
102
|
-
```js
|
103
|
-
import defaultExport from './foo';
|
104
|
-
const FOO = 'BAR';
|
105
|
-
```
|
106
|
-
|
107
|
-
```js
|
108
|
-
import defaultExport from './foo';
|
109
|
-
|
110
|
-
const FOO = 'BAR';
|
111
|
-
```
|
112
|
-
|
113
|
-
```js
|
114
|
-
import defaultExport from './foo';
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
const FOO = 'BAR';
|
119
|
-
```
|
120
|
-
|
121
|
-
```js
|
122
|
-
import defaultExport from './foo';
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
const FOO = 'BAR';
|
128
|
-
```
|
129
|
-
|
130
|
-
With `considerComments` set to `false` this will be considered valid:
|
131
|
-
|
132
|
-
```js
|
133
|
-
import defaultExport from './foo'
|
134
|
-
// some comment here.
|
135
|
-
const FOO = 'BAR'
|
136
|
-
```
|
137
|
-
|
138
|
-
With `considerComments` set to `true` this will be considered valid:
|
139
|
-
|
140
|
-
```js
|
141
|
-
import defaultExport from './foo'
|
142
|
-
|
143
|
-
// some comment here.
|
144
|
-
const FOO = 'BAR'
|
145
|
-
```
|
146
|
-
|
147
|
-
With `considerComments` set to `true` this will be considered invalid:
|
148
|
-
|
149
|
-
```js
|
150
|
-
import defaultExport from './foo'
|
151
|
-
// some comment here.
|
152
|
-
const FOO = 'BAR'
|
153
|
-
```
|
154
|
-
|
155
|
-
## Example options usage
|
156
|
-
|
157
|
-
```json
|
158
|
-
{
|
159
|
-
"rules": {
|
160
|
-
"import/newline-after-import": ["error", { "count": 2 }]
|
161
|
-
}
|
162
|
-
}
|
163
|
-
```
|
164
|
-
|
165
|
-
## When Not To Use It
|
166
|
-
|
167
|
-
If you like to visually group module imports with its usage, you don't want to use this rule.
|
@@ -1,54 +0,0 @@
|
|
1
|
-
# import/no-absolute-path
|
2
|
-
|
3
|
-
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
4
|
-
|
5
|
-
<!-- end auto-generated rule header -->
|
6
|
-
|
7
|
-
Node.js allows the import of modules using an absolute path such as `/home/xyz/file.js`. That is a bad practice as it ties the code using it to your computer, and therefore makes it unusable in packages distributed on `npm` for instance.
|
8
|
-
|
9
|
-
This rule forbids the import of modules using absolute paths.
|
10
|
-
|
11
|
-
## Rule Details
|
12
|
-
|
13
|
-
### Fail
|
14
|
-
|
15
|
-
```js
|
16
|
-
import f from '/foo';
|
17
|
-
import f from '/some/path';
|
18
|
-
|
19
|
-
var f = require('/foo');
|
20
|
-
var f = require('/some/path');
|
21
|
-
```
|
22
|
-
|
23
|
-
### Pass
|
24
|
-
|
25
|
-
```js
|
26
|
-
import _ from 'lodash';
|
27
|
-
import foo from 'foo';
|
28
|
-
import foo from './foo';
|
29
|
-
|
30
|
-
var _ = require('lodash');
|
31
|
-
var foo = require('foo');
|
32
|
-
var foo = require('./foo');
|
33
|
-
```
|
34
|
-
|
35
|
-
### Options
|
36
|
-
|
37
|
-
By default, only ES6 imports and CommonJS `require` calls will have this rule enforced.
|
38
|
-
|
39
|
-
You may provide an options object providing true/false for any of
|
40
|
-
|
41
|
-
- `esmodule`: defaults to `true`
|
42
|
-
- `commonjs`: defaults to `true`
|
43
|
-
- `amd`: defaults to `false`
|
44
|
-
|
45
|
-
If `{ amd: true }` is provided, dependency paths for AMD-style `define` and `require`
|
46
|
-
calls will be resolved:
|
47
|
-
|
48
|
-
```js
|
49
|
-
/*eslint import/no-absolute-path: [2, { commonjs: false, amd: true }]*/
|
50
|
-
define(['/foo'], function (foo) { /*...*/ }) // reported
|
51
|
-
require(['/foo'], function (foo) { /*...*/ }) // reported
|
52
|
-
|
53
|
-
const foo = require('/foo') // ignored because of explicit `commonjs: false`
|
54
|
-
```
|