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,125 +0,0 @@
|
|
1
|
-
# import/no-unused-modules
|
2
|
-
|
3
|
-
<!-- end auto-generated rule header -->
|
4
|
-
|
5
|
-
Reports:
|
6
|
-
|
7
|
-
- modules without any exports
|
8
|
-
- individual exports not being statically `import`ed or `require`ed from other modules in the same project
|
9
|
-
- dynamic imports are supported if argument is a literal string
|
10
|
-
|
11
|
-
## Rule Details
|
12
|
-
|
13
|
-
### Usage
|
14
|
-
|
15
|
-
In order for this plugin to work, at least one of the options `missingExports` or `unusedExports` must be enabled (see "Options" section below). In the future, these options will be enabled by default (see <https://github.com/import-js/eslint-plugin-import/issues/1324>)
|
16
|
-
|
17
|
-
Example:
|
18
|
-
|
19
|
-
```json
|
20
|
-
"rules: {
|
21
|
-
...otherRules,
|
22
|
-
"import/no-unused-modules": [1, {"unusedExports": true}]
|
23
|
-
}
|
24
|
-
```
|
25
|
-
|
26
|
-
### Options
|
27
|
-
|
28
|
-
This rule takes the following option:
|
29
|
-
|
30
|
-
- **`missingExports`**: if `true`, files without any exports are reported (defaults to `false`)
|
31
|
-
- **`unusedExports`**: if `true`, exports without any static usage within other modules are reported (defaults to `false`)
|
32
|
-
- `src`: an array with files/paths to be analyzed. It only applies to unused exports. Defaults to `process.cwd()`, if not provided
|
33
|
-
- `ignoreExports`: an array with files/paths for which unused exports will not be reported (e.g module entry points in a published package)
|
34
|
-
|
35
|
-
### Example for missing exports
|
36
|
-
|
37
|
-
#### The following will be reported
|
38
|
-
|
39
|
-
```js
|
40
|
-
const class MyClass { /*...*/ }
|
41
|
-
|
42
|
-
function makeClass() { return new MyClass(...arguments) }
|
43
|
-
```
|
44
|
-
|
45
|
-
#### The following will not be reported
|
46
|
-
|
47
|
-
```js
|
48
|
-
export default function () { /*...*/ }
|
49
|
-
```
|
50
|
-
|
51
|
-
```js
|
52
|
-
export const foo = function () { /*...*/ }
|
53
|
-
```
|
54
|
-
|
55
|
-
```js
|
56
|
-
export { foo, bar }
|
57
|
-
```
|
58
|
-
|
59
|
-
```js
|
60
|
-
export { foo as bar }
|
61
|
-
```
|
62
|
-
|
63
|
-
### Example for unused exports
|
64
|
-
|
65
|
-
given file-f:
|
66
|
-
|
67
|
-
```js
|
68
|
-
import { e } from 'file-a'
|
69
|
-
import { f } from 'file-b'
|
70
|
-
import * as fileC from 'file-c'
|
71
|
-
export { default, i0 } from 'file-d' // both will be reported
|
72
|
-
|
73
|
-
export const j = 99 // will be reported
|
74
|
-
```
|
75
|
-
|
76
|
-
and file-d:
|
77
|
-
|
78
|
-
```js
|
79
|
-
export const i0 = 9 // will not be reported
|
80
|
-
export const i1 = 9 // will be reported
|
81
|
-
export default () => {} // will not be reported
|
82
|
-
```
|
83
|
-
|
84
|
-
and file-c:
|
85
|
-
|
86
|
-
```js
|
87
|
-
export const h = 8 // will not be reported
|
88
|
-
export default () => {} // will be reported, as export * only considers named exports and ignores default exports
|
89
|
-
```
|
90
|
-
|
91
|
-
and file-b:
|
92
|
-
|
93
|
-
```js
|
94
|
-
import two, { b, c, doAnything } from 'file-a'
|
95
|
-
|
96
|
-
export const f = 6 // will not be reported
|
97
|
-
```
|
98
|
-
|
99
|
-
and file-a:
|
100
|
-
|
101
|
-
```js
|
102
|
-
const b = 2
|
103
|
-
const c = 3
|
104
|
-
const d = 4
|
105
|
-
|
106
|
-
export const a = 1 // will be reported
|
107
|
-
|
108
|
-
export { b, c } // will not be reported
|
109
|
-
|
110
|
-
export { d as e } // will not be reported
|
111
|
-
|
112
|
-
export function doAnything() {
|
113
|
-
// some code
|
114
|
-
} // will not be reported
|
115
|
-
|
116
|
-
export default 5 // will not be reported
|
117
|
-
```
|
118
|
-
|
119
|
-
#### Important Note
|
120
|
-
|
121
|
-
Exports from files listed as a main file (`main`, `browser`, or `bin` fields in `package.json`) will be ignored by default. This only applies if the `package.json` is not set to `private: true`
|
122
|
-
|
123
|
-
## When not to use
|
124
|
-
|
125
|
-
If you don't mind having unused files or dead code within your codebase, you can disable this rule
|
@@ -1,85 +0,0 @@
|
|
1
|
-
# import/no-useless-path-segments
|
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
|
-
Use this rule to prevent unnecessary path segments in import and require statements.
|
8
|
-
|
9
|
-
## Rule Details
|
10
|
-
|
11
|
-
Given the following folder structure:
|
12
|
-
|
13
|
-
```pt
|
14
|
-
my-project
|
15
|
-
├── app.js
|
16
|
-
├── footer.js
|
17
|
-
├── header.js
|
18
|
-
└── helpers.js
|
19
|
-
└── helpers
|
20
|
-
└── index.js
|
21
|
-
├── index.js
|
22
|
-
└── pages
|
23
|
-
├── about.js
|
24
|
-
├── contact.js
|
25
|
-
└── index.js
|
26
|
-
```
|
27
|
-
|
28
|
-
The following patterns are considered problems:
|
29
|
-
|
30
|
-
```js
|
31
|
-
/**
|
32
|
-
* in my-project/app.js
|
33
|
-
*/
|
34
|
-
|
35
|
-
import "./../my-project/pages/about.js"; // should be "./pages/about.js"
|
36
|
-
import "./../my-project/pages/about"; // should be "./pages/about"
|
37
|
-
import "../my-project/pages/about.js"; // should be "./pages/about.js"
|
38
|
-
import "../my-project/pages/about"; // should be "./pages/about"
|
39
|
-
import "./pages//about"; // should be "./pages/about"
|
40
|
-
import "./pages/"; // should be "./pages"
|
41
|
-
import "./pages/index"; // should be "./pages" (except if there is a ./pages.js file)
|
42
|
-
import "./pages/index.js"; // should be "./pages" (except if there is a ./pages.js file)
|
43
|
-
```
|
44
|
-
|
45
|
-
The following patterns are NOT considered problems:
|
46
|
-
|
47
|
-
```js
|
48
|
-
/**
|
49
|
-
* in my-project/app.js
|
50
|
-
*/
|
51
|
-
|
52
|
-
import "./header.js";
|
53
|
-
import "./pages";
|
54
|
-
import "./pages/about";
|
55
|
-
import ".";
|
56
|
-
import "..";
|
57
|
-
import fs from "fs";
|
58
|
-
```
|
59
|
-
|
60
|
-
## Options
|
61
|
-
|
62
|
-
### noUselessIndex
|
63
|
-
|
64
|
-
If you want to detect unnecessary `/index` or `/index.js` (depending on the specified file extensions, see below) imports in your paths, you can enable the option `noUselessIndex`. By default it is set to `false`:
|
65
|
-
|
66
|
-
```js
|
67
|
-
"import/no-useless-path-segments": ["error", {
|
68
|
-
noUselessIndex: true,
|
69
|
-
}]
|
70
|
-
```
|
71
|
-
|
72
|
-
Additionally to the patterns described above, the following imports are considered problems if `noUselessIndex` is enabled:
|
73
|
-
|
74
|
-
```js
|
75
|
-
// in my-project/app.js
|
76
|
-
import "./helpers/index"; // should be "./helpers/" (not auto-fixable to `./helpers` because this would lead to an ambiguous import of `./helpers.js` and `./helpers/index.js`)
|
77
|
-
import "./pages/index"; // should be "./pages" (auto-fixable)
|
78
|
-
import "./pages/index.js"; // should be "./pages" (auto-fixable)
|
79
|
-
```
|
80
|
-
|
81
|
-
Note: `noUselessIndex` only avoids ambiguous imports for `.js` files if you haven't specified other resolved file extensions. See [Settings: import/extensions](https://github.com/import-js/eslint-plugin-import#importextensions) for details.
|
82
|
-
|
83
|
-
### commonjs
|
84
|
-
|
85
|
-
When set to `true`, this rule checks CommonJS imports. Default to `false`.
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# import/no-webpack-loader-syntax
|
2
|
-
|
3
|
-
<!-- end auto-generated rule header -->
|
4
|
-
|
5
|
-
Forbid Webpack loader syntax in imports.
|
6
|
-
|
7
|
-
[Webpack](https://webpack.js.org) allows specifying the [loaders](https://webpack.js.org/concepts/loaders/) to use in the import source string using a special syntax like this:
|
8
|
-
|
9
|
-
```js
|
10
|
-
var moduleWithOneLoader = require("my-loader!./my-awesome-module");
|
11
|
-
```
|
12
|
-
|
13
|
-
This syntax is non-standard, so it couples the code to Webpack. The recommended way to specify Webpack loader configuration is in a [Webpack configuration file](https://webpack.js.org/concepts/loaders/#configuration).
|
14
|
-
|
15
|
-
## Rule Details
|
16
|
-
|
17
|
-
### Fail
|
18
|
-
|
19
|
-
```js
|
20
|
-
import myModule from 'my-loader!my-module';
|
21
|
-
import theme from 'style!css!./theme.css';
|
22
|
-
|
23
|
-
var myModule = require('my-loader!./my-module');
|
24
|
-
var theme = require('style!css!./theme.css');
|
25
|
-
```
|
26
|
-
|
27
|
-
### Pass
|
28
|
-
|
29
|
-
```js
|
30
|
-
import myModule from 'my-module';
|
31
|
-
import theme from './theme.css';
|
32
|
-
|
33
|
-
var myModule = require('my-module');
|
34
|
-
var theme = require('./theme.css');
|
35
|
-
```
|
36
|
-
|
37
|
-
## When Not To Use It
|
38
|
-
|
39
|
-
If you have a project that doesn't use Webpack you can safely disable this rule.
|
@@ -1,365 +0,0 @@
|
|
1
|
-
# import/order
|
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
|
-
Enforce a convention in the order of `require()` / `import` statements.
|
8
|
-
|
9
|
-
With the [`groups`](#groups-array) option set to `["builtin", "external", "internal", "parent", "sibling", "index", "object", "type"]` the order is as shown in the following example:
|
10
|
-
|
11
|
-
```ts
|
12
|
-
// 1. node "builtin" modules
|
13
|
-
import fs from 'fs';
|
14
|
-
import path from 'path';
|
15
|
-
// 2. "external" modules
|
16
|
-
import _ from 'lodash';
|
17
|
-
import chalk from 'chalk';
|
18
|
-
// 3. "internal" modules
|
19
|
-
// (if you have configured your path or webpack to handle your internal paths differently)
|
20
|
-
import foo from 'src/foo';
|
21
|
-
// 4. modules from a "parent" directory
|
22
|
-
import foo from '../foo';
|
23
|
-
import qux from '../../foo/qux';
|
24
|
-
// 5. "sibling" modules from the same or a sibling's directory
|
25
|
-
import bar from './bar';
|
26
|
-
import baz from './bar/baz';
|
27
|
-
// 6. "index" of the current directory
|
28
|
-
import main from './';
|
29
|
-
// 7. "object"-imports (only available in TypeScript)
|
30
|
-
import log = console.log;
|
31
|
-
// 8. "type" imports (only available in Flow and TypeScript)
|
32
|
-
import type { Foo } from 'foo';
|
33
|
-
```
|
34
|
-
|
35
|
-
Unassigned imports are ignored, as the order they are imported in may be important.
|
36
|
-
|
37
|
-
Statements using the ES6 `import` syntax must appear before any `require()` statements.
|
38
|
-
|
39
|
-
## Fail
|
40
|
-
|
41
|
-
```ts
|
42
|
-
import _ from 'lodash';
|
43
|
-
import path from 'path'; // `path` import should occur before import of `lodash`
|
44
|
-
|
45
|
-
// -----
|
46
|
-
|
47
|
-
var _ = require('lodash');
|
48
|
-
var path = require('path'); // `path` import should occur before import of `lodash`
|
49
|
-
|
50
|
-
// -----
|
51
|
-
|
52
|
-
var path = require('path');
|
53
|
-
import foo from './foo'; // `import` statements must be before `require` statement
|
54
|
-
```
|
55
|
-
|
56
|
-
## Pass
|
57
|
-
|
58
|
-
```ts
|
59
|
-
import path from 'path';
|
60
|
-
import _ from 'lodash';
|
61
|
-
|
62
|
-
// -----
|
63
|
-
|
64
|
-
var path = require('path');
|
65
|
-
var _ = require('lodash');
|
66
|
-
|
67
|
-
// -----
|
68
|
-
|
69
|
-
// Allowed as ̀`babel-register` is not assigned.
|
70
|
-
require('babel-register');
|
71
|
-
var path = require('path');
|
72
|
-
|
73
|
-
// -----
|
74
|
-
|
75
|
-
// Allowed as `import` must be before `require`
|
76
|
-
import foo from './foo';
|
77
|
-
var path = require('path');
|
78
|
-
```
|
79
|
-
|
80
|
-
## Options
|
81
|
-
|
82
|
-
This rule supports the following options:
|
83
|
-
|
84
|
-
### `groups: [array]`
|
85
|
-
|
86
|
-
How groups are defined, and the order to respect. `groups` must be an array of `string` or [`string`]. The only allowed `string`s are:
|
87
|
-
`"builtin"`, `"external"`, `"internal"`, `"unknown"`, `"parent"`, `"sibling"`, `"index"`, `"object"`, `"type"`.
|
88
|
-
The enforced order is the same as the order of each element in a group. Omitted types are implicitly grouped together as the last element. Example:
|
89
|
-
|
90
|
-
```ts
|
91
|
-
[
|
92
|
-
'builtin', // Built-in types are first
|
93
|
-
['sibling', 'parent'], // Then sibling and parent types. They can be mingled together
|
94
|
-
'index', // Then the index file
|
95
|
-
'object',
|
96
|
-
// Then the rest: internal and external type
|
97
|
-
]
|
98
|
-
```
|
99
|
-
|
100
|
-
The default value is `["builtin", "external", "parent", "sibling", "index"]`.
|
101
|
-
|
102
|
-
You can set the options like this:
|
103
|
-
|
104
|
-
```ts
|
105
|
-
"import/order": [
|
106
|
-
"error",
|
107
|
-
{
|
108
|
-
"groups": [
|
109
|
-
"index",
|
110
|
-
"sibling",
|
111
|
-
"parent",
|
112
|
-
"internal",
|
113
|
-
"external",
|
114
|
-
"builtin",
|
115
|
-
"object",
|
116
|
-
"type"
|
117
|
-
]
|
118
|
-
}
|
119
|
-
]
|
120
|
-
```
|
121
|
-
|
122
|
-
### `pathGroups: [array of objects]`
|
123
|
-
|
124
|
-
To be able to group by paths mostly needed with aliases pathGroups can be defined.
|
125
|
-
|
126
|
-
Properties of the objects
|
127
|
-
|
128
|
-
| property | required | type | description |
|
129
|
-
|----------------|:--------:|--------|---------------|
|
130
|
-
| pattern | x | string | minimatch pattern for the paths to be in this group (will not be used for builtins or externals) |
|
131
|
-
| patternOptions | | object | options for minimatch, default: { nocomment: true } |
|
132
|
-
| group | x | string | one of the allowed groups, the pathGroup will be positioned relative to this group |
|
133
|
-
| position | | string | defines where around the group the pathGroup will be positioned, can be 'after' or 'before', if not provided pathGroup will be positioned like the group |
|
134
|
-
|
135
|
-
```json
|
136
|
-
{
|
137
|
-
"import/order": ["error", {
|
138
|
-
"pathGroups": [
|
139
|
-
{
|
140
|
-
"pattern": "~/**",
|
141
|
-
"group": "external"
|
142
|
-
}
|
143
|
-
]
|
144
|
-
}]
|
145
|
-
}
|
146
|
-
```
|
147
|
-
|
148
|
-
### `distinctGroup: [boolean]`
|
149
|
-
|
150
|
-
This changes how `pathGroups[].position` affects grouping. The property is most useful when `newlines-between` is set to `always` and at least 1 `pathGroups` entry has a `position` property set.
|
151
|
-
|
152
|
-
By default, in the context of a particular `pathGroup` entry, when setting `position`, a new "group" will silently be created. That is, even if the `group` is specified, a newline will still separate imports that match that `pattern` with the rest of the group (assuming `newlines-between` is `always`). This is undesirable if your intentions are to use `position` to position _within_ the group (and not create a new one). Override this behavior by setting `distinctGroup` to `false`; this will keep imports within the same group as intended.
|
153
|
-
|
154
|
-
Note that currently, `distinctGroup` defaults to `true`. However, in a later update, the default will change to `false`
|
155
|
-
|
156
|
-
Example:
|
157
|
-
|
158
|
-
```json
|
159
|
-
{
|
160
|
-
"import/order": ["error", {
|
161
|
-
"newlines-between": "always",
|
162
|
-
"pathGroups": [
|
163
|
-
{
|
164
|
-
"pattern": "@app/**",
|
165
|
-
"group": "external",
|
166
|
-
"position": "after"
|
167
|
-
}
|
168
|
-
],
|
169
|
-
"distinctGroup": false
|
170
|
-
}]
|
171
|
-
}
|
172
|
-
```
|
173
|
-
|
174
|
-
### `pathGroupsExcludedImportTypes: [array]`
|
175
|
-
|
176
|
-
This defines import types that are not handled by configured pathGroups.
|
177
|
-
This is mostly needed when you want to handle path groups that look like external imports.
|
178
|
-
|
179
|
-
Example:
|
180
|
-
|
181
|
-
```json
|
182
|
-
{
|
183
|
-
"import/order": ["error", {
|
184
|
-
"pathGroups": [
|
185
|
-
{
|
186
|
-
"pattern": "@app/**",
|
187
|
-
"group": "external",
|
188
|
-
"position": "after"
|
189
|
-
}
|
190
|
-
],
|
191
|
-
"pathGroupsExcludedImportTypes": ["builtin"]
|
192
|
-
}]
|
193
|
-
}
|
194
|
-
```
|
195
|
-
|
196
|
-
You can also use `patterns`(e.g., `react`, `react-router-dom`, etc).
|
197
|
-
|
198
|
-
Example:
|
199
|
-
|
200
|
-
```json
|
201
|
-
{
|
202
|
-
"import/order": [
|
203
|
-
"error",
|
204
|
-
{
|
205
|
-
"pathGroups": [
|
206
|
-
{
|
207
|
-
"pattern": "react",
|
208
|
-
"group": "builtin",
|
209
|
-
"position": "before"
|
210
|
-
}
|
211
|
-
],
|
212
|
-
"pathGroupsExcludedImportTypes": ["react"]
|
213
|
-
}
|
214
|
-
]
|
215
|
-
}
|
216
|
-
```
|
217
|
-
|
218
|
-
The default value is `["builtin", "external", "object"]`.
|
219
|
-
|
220
|
-
### `newlines-between: [ignore|always|always-and-inside-groups|never]`
|
221
|
-
|
222
|
-
Enforces or forbids new lines between import groups:
|
223
|
-
|
224
|
-
- If set to `ignore`, no errors related to new lines between import groups will be reported.
|
225
|
-
- If set to `always`, at least one new line between each group will be enforced, and new lines inside a group will be forbidden. To prevent multiple lines between imports, core `no-multiple-empty-lines` rule can be used.
|
226
|
-
- If set to `always-and-inside-groups`, it will act like `always` except newlines are allowed inside import groups.
|
227
|
-
- If set to `never`, no new lines are allowed in the entire import section.
|
228
|
-
|
229
|
-
The default value is `"ignore"`.
|
230
|
-
|
231
|
-
With the default group setting, the following will be invalid:
|
232
|
-
|
233
|
-
```ts
|
234
|
-
/* eslint import/order: ["error", {"newlines-between": "always"}] */
|
235
|
-
import fs from 'fs';
|
236
|
-
import path from 'path';
|
237
|
-
import index from './';
|
238
|
-
import sibling from './foo';
|
239
|
-
```
|
240
|
-
|
241
|
-
```ts
|
242
|
-
/* eslint import/order: ["error", {"newlines-between": "always-and-inside-groups"}] */
|
243
|
-
import fs from 'fs';
|
244
|
-
|
245
|
-
import path from 'path';
|
246
|
-
import index from './';
|
247
|
-
import sibling from './foo';
|
248
|
-
```
|
249
|
-
|
250
|
-
```ts
|
251
|
-
/* eslint import/order: ["error", {"newlines-between": "never"}] */
|
252
|
-
import fs from 'fs';
|
253
|
-
import path from 'path';
|
254
|
-
|
255
|
-
import index from './';
|
256
|
-
|
257
|
-
import sibling from './foo';
|
258
|
-
```
|
259
|
-
|
260
|
-
while those will be valid:
|
261
|
-
|
262
|
-
```ts
|
263
|
-
/* eslint import/order: ["error", {"newlines-between": "always"}] */
|
264
|
-
import fs from 'fs';
|
265
|
-
import path from 'path';
|
266
|
-
|
267
|
-
import index from './';
|
268
|
-
|
269
|
-
import sibling from './foo';
|
270
|
-
```
|
271
|
-
|
272
|
-
```ts
|
273
|
-
/* eslint import/order: ["error", {"newlines-between": "always-and-inside-groups"}] */
|
274
|
-
import fs from 'fs';
|
275
|
-
|
276
|
-
import path from 'path';
|
277
|
-
|
278
|
-
import index from './';
|
279
|
-
|
280
|
-
import sibling from './foo';
|
281
|
-
```
|
282
|
-
|
283
|
-
```ts
|
284
|
-
/* eslint import/order: ["error", {"newlines-between": "never"}] */
|
285
|
-
import fs from 'fs';
|
286
|
-
import path from 'path';
|
287
|
-
import index from './';
|
288
|
-
import sibling from './foo';
|
289
|
-
```
|
290
|
-
|
291
|
-
### `alphabetize: {order: asc|desc|ignore, orderImportKind: asc|desc|ignore, caseInsensitive: true|false}`
|
292
|
-
|
293
|
-
Sort the order within each group in alphabetical manner based on **import path**:
|
294
|
-
|
295
|
-
- `order`: use `asc` to sort in ascending order, and `desc` to sort in descending order (default: `ignore`).
|
296
|
-
- `orderImportKind`: use `asc` to sort in ascending order various import kinds, e.g. imports prefixed with `type` or `typeof`, with same import path. Use `desc` to sort in descending order (default: `ignore`).
|
297
|
-
- `caseInsensitive`: use `true` to ignore case, and `false` to consider case (default: `false`).
|
298
|
-
|
299
|
-
Example setting:
|
300
|
-
|
301
|
-
```ts
|
302
|
-
alphabetize: {
|
303
|
-
order: 'asc', /* sort in ascending order. Options: ['ignore', 'asc', 'desc'] */
|
304
|
-
caseInsensitive: true /* ignore case. Options: [true, false] */
|
305
|
-
}
|
306
|
-
```
|
307
|
-
|
308
|
-
This will fail the rule check:
|
309
|
-
|
310
|
-
```ts
|
311
|
-
/* eslint import/order: ["error", {"alphabetize": {"order": "asc", "caseInsensitive": true}}] */
|
312
|
-
import React, { PureComponent } from 'react';
|
313
|
-
import aTypes from 'prop-types';
|
314
|
-
import { compose, apply } from 'xcompose';
|
315
|
-
import * as classnames from 'classnames';
|
316
|
-
import blist from 'BList';
|
317
|
-
```
|
318
|
-
|
319
|
-
While this will pass:
|
320
|
-
|
321
|
-
```ts
|
322
|
-
/* eslint import/order: ["error", {"alphabetize": {"order": "asc", "caseInsensitive": true}}] */
|
323
|
-
import blist from 'BList';
|
324
|
-
import * as classnames from 'classnames';
|
325
|
-
import aTypes from 'prop-types';
|
326
|
-
import React, { PureComponent } from 'react';
|
327
|
-
import { compose, apply } from 'xcompose';
|
328
|
-
```
|
329
|
-
|
330
|
-
### `warnOnUnassignedImports: true|false`
|
331
|
-
|
332
|
-
- default: `false`
|
333
|
-
|
334
|
-
Warns when unassigned imports are out of order. These warning will not be fixed
|
335
|
-
with `--fix` because unassigned imports are used for side-effects and changing the
|
336
|
-
import of order of modules with side effects can not be done automatically in a
|
337
|
-
way that is safe.
|
338
|
-
|
339
|
-
This will fail the rule check:
|
340
|
-
|
341
|
-
```ts
|
342
|
-
/* eslint import/order: ["error", {"warnOnUnassignedImports": true}] */
|
343
|
-
import fs from 'fs';
|
344
|
-
import './styles.css';
|
345
|
-
import path from 'path';
|
346
|
-
```
|
347
|
-
|
348
|
-
While this will pass:
|
349
|
-
|
350
|
-
```ts
|
351
|
-
/* eslint import/order: ["error", {"warnOnUnassignedImports": true}] */
|
352
|
-
import fs from 'fs';
|
353
|
-
import path from 'path';
|
354
|
-
import './styles.css';
|
355
|
-
```
|
356
|
-
|
357
|
-
## Related
|
358
|
-
|
359
|
-
- [`import/external-module-folders`] setting
|
360
|
-
|
361
|
-
- [`import/internal-regex`] setting
|
362
|
-
|
363
|
-
[`import/external-module-folders`]: ../../README.md#importexternal-module-folders
|
364
|
-
|
365
|
-
[`import/internal-regex`]: ../../README.md#importinternal-regex
|