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,42 +0,0 @@
|
|
1
|
-
# import/no-nodejs-modules
|
2
|
-
|
3
|
-
<!-- end auto-generated rule header -->
|
4
|
-
|
5
|
-
Forbid the use of Node.js builtin modules. Can be useful for client-side web projects that do not have access to those modules.
|
6
|
-
|
7
|
-
## Options
|
8
|
-
|
9
|
-
This rule supports the following options:
|
10
|
-
|
11
|
-
- `allow`: Array of names of allowed modules. Defaults to an empty array.
|
12
|
-
|
13
|
-
## Rule Details
|
14
|
-
|
15
|
-
### Fail
|
16
|
-
|
17
|
-
```js
|
18
|
-
import fs from 'fs';
|
19
|
-
import path from 'path';
|
20
|
-
|
21
|
-
var fs = require('fs');
|
22
|
-
var path = require('path');
|
23
|
-
```
|
24
|
-
|
25
|
-
### Pass
|
26
|
-
|
27
|
-
```js
|
28
|
-
import _ from 'lodash';
|
29
|
-
import foo from 'foo';
|
30
|
-
import foo from './foo';
|
31
|
-
|
32
|
-
var _ = require('lodash');
|
33
|
-
var foo = require('foo');
|
34
|
-
var foo = require('./foo');
|
35
|
-
|
36
|
-
/* eslint import/no-nodejs-modules: ["error", {"allow": ["path"]}] */
|
37
|
-
import path from 'path';
|
38
|
-
```
|
39
|
-
|
40
|
-
## When Not To Use It
|
41
|
-
|
42
|
-
If you have a project that is run mainly or partially using Node.js.
|
@@ -1,70 +0,0 @@
|
|
1
|
-
# import/no-relative-packages
|
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 importing packages through relative paths.
|
8
|
-
|
9
|
-
It's useful in Yarn/Lerna workspaces, were it's possible to import a sibling
|
10
|
-
package using `../package` relative path, while direct `package` is the correct one.
|
11
|
-
|
12
|
-
## Examples
|
13
|
-
|
14
|
-
Given the following folder structure:
|
15
|
-
|
16
|
-
```pt
|
17
|
-
my-project
|
18
|
-
├── packages
|
19
|
-
│ ├── foo
|
20
|
-
│ │ ├── index.js
|
21
|
-
│ │ └── package.json
|
22
|
-
│ └── bar
|
23
|
-
│ ├── index.js
|
24
|
-
│ └── package.json
|
25
|
-
└── entry.js
|
26
|
-
```
|
27
|
-
|
28
|
-
And the .eslintrc file:
|
29
|
-
|
30
|
-
```json
|
31
|
-
{
|
32
|
-
...
|
33
|
-
"rules": {
|
34
|
-
"import/no-relative-packages": "error"
|
35
|
-
}
|
36
|
-
}
|
37
|
-
```
|
38
|
-
|
39
|
-
The following patterns are considered problems:
|
40
|
-
|
41
|
-
```js
|
42
|
-
/**
|
43
|
-
* in my-project/packages/foo.js
|
44
|
-
*/
|
45
|
-
|
46
|
-
import bar from '../bar'; // Import sibling package using relative path
|
47
|
-
import entry from '../../entry.js'; // Import from parent package using relative path
|
48
|
-
|
49
|
-
/**
|
50
|
-
* in my-project/entry.js
|
51
|
-
*/
|
52
|
-
|
53
|
-
import bar from './packages/bar'; // Import child package using relative path
|
54
|
-
```
|
55
|
-
|
56
|
-
The following patterns are NOT considered problems:
|
57
|
-
|
58
|
-
```js
|
59
|
-
/**
|
60
|
-
* in my-project/packages/foo.js
|
61
|
-
*/
|
62
|
-
|
63
|
-
import bar from 'bar'; // Import sibling package using package name
|
64
|
-
|
65
|
-
/**
|
66
|
-
* in my-project/entry.js
|
67
|
-
*/
|
68
|
-
|
69
|
-
import bar from 'bar'; // Import sibling package using package name
|
70
|
-
```
|
@@ -1,123 +0,0 @@
|
|
1
|
-
# import/no-relative-parent-imports
|
2
|
-
|
3
|
-
<!-- end auto-generated rule header -->
|
4
|
-
|
5
|
-
Use this rule to prevent imports to folders in relative parent paths.
|
6
|
-
|
7
|
-
This rule is useful for enforcing tree-like folder structures instead of complex graph-like folder structures. While this restriction might be a departure from Node's default resolution style, it can lead large, complex codebases to be easier to maintain. If you've ever had debates over "where to put files" this rule is for you.
|
8
|
-
|
9
|
-
To fix violations of this rule there are three general strategies. Given this example:
|
10
|
-
|
11
|
-
```pt
|
12
|
-
numbers
|
13
|
-
└── three.js
|
14
|
-
add.js
|
15
|
-
```
|
16
|
-
|
17
|
-
```js
|
18
|
-
// ./add.js
|
19
|
-
export default function (numbers) {
|
20
|
-
return numbers.reduce((sum, n) => sum + n, 0);
|
21
|
-
}
|
22
|
-
|
23
|
-
// ./numbers/three.js
|
24
|
-
import add from '../add'; // violates import/no-relative-parent-imports
|
25
|
-
|
26
|
-
export default function three() {
|
27
|
-
return add([1, 2]);
|
28
|
-
}
|
29
|
-
```
|
30
|
-
|
31
|
-
You can,
|
32
|
-
|
33
|
-
1. Move the file to be in a sibling folder (or higher) of the dependency.
|
34
|
-
|
35
|
-
`three.js` could be be in the same folder as `add.js`:
|
36
|
-
|
37
|
-
```pt
|
38
|
-
three.js
|
39
|
-
add.js
|
40
|
-
```
|
41
|
-
|
42
|
-
or since `add` doesn't have any imports, it could be in it's own directory (namespace):
|
43
|
-
|
44
|
-
```pt
|
45
|
-
math
|
46
|
-
└── add.js
|
47
|
-
three.js
|
48
|
-
```
|
49
|
-
|
50
|
-
2. Pass the dependency as an argument at runtime (dependency injection)
|
51
|
-
|
52
|
-
```js
|
53
|
-
// three.js
|
54
|
-
export default function three(add) {
|
55
|
-
return add([1, 2]);
|
56
|
-
}
|
57
|
-
|
58
|
-
// somewhere else when you use `three.js`:
|
59
|
-
import add from './add';
|
60
|
-
import three from './numbers/three';
|
61
|
-
console.log(three(add));
|
62
|
-
```
|
63
|
-
|
64
|
-
3. Make the dependency a package so it's globally available to all files in your project:
|
65
|
-
|
66
|
-
```js
|
67
|
-
import add from 'add'; // from https://www.npmjs.com/package/add
|
68
|
-
export default function three() {
|
69
|
-
return add([1,2]);
|
70
|
-
}
|
71
|
-
```
|
72
|
-
|
73
|
-
These are (respectively) static, dynamic & global solutions to graph-like dependency resolution.
|
74
|
-
|
75
|
-
## Examples
|
76
|
-
|
77
|
-
Given the following folder structure:
|
78
|
-
|
79
|
-
```pt
|
80
|
-
my-project
|
81
|
-
├── lib
|
82
|
-
│ ├── a.js
|
83
|
-
│ └── b.js
|
84
|
-
└── main.js
|
85
|
-
```
|
86
|
-
|
87
|
-
And the .eslintrc file:
|
88
|
-
|
89
|
-
```json
|
90
|
-
{
|
91
|
-
...
|
92
|
-
"rules": {
|
93
|
-
"import/no-relative-parent-imports": "error"
|
94
|
-
}
|
95
|
-
}
|
96
|
-
```
|
97
|
-
|
98
|
-
The following patterns are considered problems:
|
99
|
-
|
100
|
-
```js
|
101
|
-
/**
|
102
|
-
* in my-project/lib/a.js
|
103
|
-
*/
|
104
|
-
|
105
|
-
import bar from '../main'; // Import parent file using a relative path
|
106
|
-
```
|
107
|
-
|
108
|
-
The following patterns are NOT considered problems:
|
109
|
-
|
110
|
-
```js
|
111
|
-
/**
|
112
|
-
* in my-project/main.js
|
113
|
-
*/
|
114
|
-
|
115
|
-
import foo from 'foo'; // Import package using module path
|
116
|
-
import a from './lib/a'; // Import child file using relative path
|
117
|
-
|
118
|
-
/**
|
119
|
-
* in my-project/lib/a.js
|
120
|
-
*/
|
121
|
-
|
122
|
-
import b from './b'; // Import sibling file using relative path
|
123
|
-
```
|
@@ -1,198 +0,0 @@
|
|
1
|
-
# import/no-restricted-paths
|
2
|
-
|
3
|
-
<!-- end auto-generated rule header -->
|
4
|
-
|
5
|
-
Some projects contain files which are not always meant to be executed in the same environment.
|
6
|
-
For example consider a web application that contains specific code for the server and some specific code for the browser/client. In this case you don’t want to import server-only files in your client code.
|
7
|
-
|
8
|
-
In order to prevent such scenarios this rule allows you to define restricted zones where you can forbid files from imported if they match a specific path.
|
9
|
-
|
10
|
-
## Rule Details
|
11
|
-
|
12
|
-
This rule has one option. The option is an object containing the definition of all restricted `zones` and the optional `basePath` which is used to resolve relative paths within.
|
13
|
-
The default value for `basePath` is the current working directory.
|
14
|
-
|
15
|
-
Each zone consists of the `target` paths, a `from` paths, and an optional `except` and `message` attribute.
|
16
|
-
|
17
|
-
- `target` contains the paths where the restricted imports should be applied. It can be expressed by
|
18
|
-
- directory string path that matches all its containing files
|
19
|
-
- glob pattern matching all the targeted files
|
20
|
-
- an array of multiple of the two types above
|
21
|
-
- `from` paths define the folders that are not allowed to be used in an import. It can be expressed by
|
22
|
-
- directory string path that matches all its containing files
|
23
|
-
- glob pattern matching all the files restricted to be imported
|
24
|
-
- an array of multiple directory string path
|
25
|
-
- an array of multiple glob patterns
|
26
|
-
- `except` may be defined for a zone, allowing exception paths that would otherwise violate the related `from`. Note that it does not alter the behaviour of `target` in any way.
|
27
|
-
- in case `from` contains only glob patterns, `except` must be an array of glob patterns as well
|
28
|
-
- in case `from` contains only directory path, `except` is relative to `from` and cannot backtrack to a parent directory
|
29
|
-
- `message` - will be displayed in case of the rule violation.
|
30
|
-
|
31
|
-
### Examples
|
32
|
-
|
33
|
-
Given the following folder structure:
|
34
|
-
|
35
|
-
```pt
|
36
|
-
my-project
|
37
|
-
├── client
|
38
|
-
│ └── foo.js
|
39
|
-
│ └── baz.js
|
40
|
-
└── server
|
41
|
-
└── bar.js
|
42
|
-
```
|
43
|
-
|
44
|
-
and the current file being linted is `my-project/client/foo.js`.
|
45
|
-
|
46
|
-
The following patterns are considered problems when configuration set to `{ "zones": [ { "target": "./client", "from": "./server" } ] }`:
|
47
|
-
|
48
|
-
```js
|
49
|
-
import bar from '../server/bar';
|
50
|
-
```
|
51
|
-
|
52
|
-
The following patterns are not considered problems when configuration set to `{ "zones": [ { "target": "./client", "from": "./server" } ] }`:
|
53
|
-
|
54
|
-
```js
|
55
|
-
import baz from '../client/baz';
|
56
|
-
```
|
57
|
-
|
58
|
-
---------------
|
59
|
-
|
60
|
-
Given the following folder structure:
|
61
|
-
|
62
|
-
```pt
|
63
|
-
my-project
|
64
|
-
├── client
|
65
|
-
│ └── foo.js
|
66
|
-
│ └── baz.js
|
67
|
-
└── server
|
68
|
-
├── one
|
69
|
-
│ └── a.js
|
70
|
-
│ └── b.js
|
71
|
-
└── two
|
72
|
-
```
|
73
|
-
|
74
|
-
and the current file being linted is `my-project/server/one/a.js`.
|
75
|
-
|
76
|
-
and the current configuration is set to:
|
77
|
-
|
78
|
-
```json
|
79
|
-
{ "zones": [ {
|
80
|
-
"target": "./tests/files/restricted-paths/server/one",
|
81
|
-
"from": "./tests/files/restricted-paths/server",
|
82
|
-
"except": ["./one"]
|
83
|
-
} ] }
|
84
|
-
```
|
85
|
-
|
86
|
-
The following pattern is considered a problem:
|
87
|
-
|
88
|
-
```js
|
89
|
-
import a from '../two/a'
|
90
|
-
```
|
91
|
-
|
92
|
-
The following pattern is not considered a problem:
|
93
|
-
|
94
|
-
```js
|
95
|
-
import b from './b'
|
96
|
-
|
97
|
-
```
|
98
|
-
|
99
|
-
---------------
|
100
|
-
|
101
|
-
Given the following folder structure:
|
102
|
-
|
103
|
-
```pt
|
104
|
-
my-project
|
105
|
-
├── client
|
106
|
-
└── foo.js
|
107
|
-
└── sub-module
|
108
|
-
└── bar.js
|
109
|
-
└── baz.js
|
110
|
-
|
111
|
-
```
|
112
|
-
|
113
|
-
and the current configuration is set to:
|
114
|
-
|
115
|
-
```json
|
116
|
-
{ "zones": [ {
|
117
|
-
"target": "./tests/files/restricted-paths/client/!(sub-module)/**/*",
|
118
|
-
"from": "./tests/files/restricted-paths/client/sub-module/**/*",
|
119
|
-
} ] }
|
120
|
-
```
|
121
|
-
|
122
|
-
The following import is considered a problem in `my-project/client/foo.js`:
|
123
|
-
|
124
|
-
```js
|
125
|
-
import a from './sub-module/baz'
|
126
|
-
```
|
127
|
-
|
128
|
-
The following import is not considered a problem in `my-project/client/sub-module/bar.js`:
|
129
|
-
|
130
|
-
```js
|
131
|
-
import b from './baz'
|
132
|
-
```
|
133
|
-
|
134
|
-
---------------
|
135
|
-
|
136
|
-
Given the following folder structure:
|
137
|
-
|
138
|
-
```pt
|
139
|
-
my-project
|
140
|
-
└── one
|
141
|
-
└── a.js
|
142
|
-
└── b.js
|
143
|
-
└── two
|
144
|
-
└── a.js
|
145
|
-
└── b.js
|
146
|
-
└── three
|
147
|
-
└── a.js
|
148
|
-
└── b.js
|
149
|
-
```
|
150
|
-
|
151
|
-
and the current configuration is set to:
|
152
|
-
|
153
|
-
```json
|
154
|
-
{
|
155
|
-
"zones": [
|
156
|
-
{
|
157
|
-
"target": ["./tests/files/restricted-paths/two/*", "./tests/files/restricted-paths/three/*"],
|
158
|
-
"from": ["./tests/files/restricted-paths/one", "./tests/files/restricted-paths/three"],
|
159
|
-
}
|
160
|
-
]
|
161
|
-
}
|
162
|
-
```
|
163
|
-
|
164
|
-
The following patterns are not considered a problem in `my-project/one/b.js`:
|
165
|
-
|
166
|
-
```js
|
167
|
-
import a from '../three/a'
|
168
|
-
```
|
169
|
-
|
170
|
-
```js
|
171
|
-
import a from './a'
|
172
|
-
```
|
173
|
-
|
174
|
-
The following pattern is not considered a problem in `my-project/two/b.js`:
|
175
|
-
|
176
|
-
```js
|
177
|
-
import a from './a'
|
178
|
-
```
|
179
|
-
|
180
|
-
The following patterns are considered a problem in `my-project/two/a.js`:
|
181
|
-
|
182
|
-
```js
|
183
|
-
import a from '../one/a'
|
184
|
-
```
|
185
|
-
|
186
|
-
```js
|
187
|
-
import a from '../three/a'
|
188
|
-
```
|
189
|
-
|
190
|
-
The following patterns are considered a problem in `my-project/three/b.js`:
|
191
|
-
|
192
|
-
```js
|
193
|
-
import a from '../one/a'
|
194
|
-
```
|
195
|
-
|
196
|
-
```js
|
197
|
-
import a from './a'
|
198
|
-
```
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# import/no-self-import
|
2
|
-
|
3
|
-
<!-- end auto-generated rule header -->
|
4
|
-
|
5
|
-
Forbid a module from importing itself. This can sometimes happen during refactoring.
|
6
|
-
|
7
|
-
## Rule Details
|
8
|
-
|
9
|
-
### Fail
|
10
|
-
|
11
|
-
```js
|
12
|
-
// foo.js
|
13
|
-
import foo from './foo';
|
14
|
-
|
15
|
-
const foo = require('./foo');
|
16
|
-
```
|
17
|
-
|
18
|
-
```js
|
19
|
-
// index.js
|
20
|
-
import index from '.';
|
21
|
-
|
22
|
-
const index = require('.');
|
23
|
-
```
|
24
|
-
|
25
|
-
### Pass
|
26
|
-
|
27
|
-
```js
|
28
|
-
// foo.js
|
29
|
-
import bar from './bar';
|
30
|
-
|
31
|
-
const bar = require('./bar');
|
32
|
-
```
|
@@ -1,60 +0,0 @@
|
|
1
|
-
# import/no-unassigned-import
|
2
|
-
|
3
|
-
<!-- end auto-generated rule header -->
|
4
|
-
|
5
|
-
With both CommonJS' `require` and the ES6 modules' `import` syntax, it is possible to import a module but not to use its result. This can be done explicitly by not assigning the module to as variable. Doing so can mean either of the following things:
|
6
|
-
|
7
|
-
- The module is imported but not used
|
8
|
-
- The module has side-effects (like [`should`](https://www.npmjs.com/package/should)). Having side-effects, makes it hard to know whether the module is actually used or can be removed. It can also make it harder to test or mock parts of your application.
|
9
|
-
|
10
|
-
This rule aims to remove modules with side-effects by reporting when a module is imported but not assigned.
|
11
|
-
|
12
|
-
## Options
|
13
|
-
|
14
|
-
This rule supports the following option:
|
15
|
-
|
16
|
-
`allow`: An Array of globs. The files that match any of these patterns would be ignored/allowed by the linter. This can be useful for some build environments (e.g. css-loader in webpack).
|
17
|
-
|
18
|
-
Note that the globs start from the where the linter is executed (usually project root), but not from each file that includes the source. Learn more in both the pass and fail examples below.
|
19
|
-
|
20
|
-
## Fail
|
21
|
-
|
22
|
-
```js
|
23
|
-
import 'should'
|
24
|
-
require('should')
|
25
|
-
|
26
|
-
// In <PROJECT_ROOT>/src/app.js
|
27
|
-
import '../styles/app.css'
|
28
|
-
// {"allow": ["styles/*.css"]}
|
29
|
-
```
|
30
|
-
|
31
|
-
## Pass
|
32
|
-
|
33
|
-
```js
|
34
|
-
import _ from 'foo'
|
35
|
-
import _, {foo} from 'foo'
|
36
|
-
import _, {foo as bar} from 'foo'
|
37
|
-
import {foo as bar} from 'foo'
|
38
|
-
import * as _ from 'foo'
|
39
|
-
|
40
|
-
const _ = require('foo')
|
41
|
-
const {foo} = require('foo')
|
42
|
-
const {foo: bar} = require('foo')
|
43
|
-
const [a, b] = require('foo')
|
44
|
-
const _ = require('foo')
|
45
|
-
|
46
|
-
// Module is not assigned, but it is used
|
47
|
-
bar(require('foo'))
|
48
|
-
require('foo').bar
|
49
|
-
require('foo').bar()
|
50
|
-
require('foo')()
|
51
|
-
|
52
|
-
// With allow option set
|
53
|
-
import './style.css' // {"allow": ["**/*.css"]}
|
54
|
-
import 'babel-register' // {"allow": ["babel-register"]}
|
55
|
-
|
56
|
-
// In <PROJECT_ROOT>/src/app.js
|
57
|
-
import './styles/app.css'
|
58
|
-
import '../scripts/register.js'
|
59
|
-
// {"allow": ["src/styles/**", "**/scripts/*.js"]}
|
60
|
-
```
|
@@ -1,110 +0,0 @@
|
|
1
|
-
# import/no-unresolved
|
2
|
-
|
3
|
-
💼 This rule is enabled in the following configs: ❗ `errors`, ☑️ `recommended`.
|
4
|
-
|
5
|
-
<!-- end auto-generated rule header -->
|
6
|
-
|
7
|
-
Ensures an imported module can be resolved to a module on the local filesystem,
|
8
|
-
as defined by standard Node `require.resolve` behavior.
|
9
|
-
|
10
|
-
See [settings](../../README.md#settings) for customization options for the resolution (i.e.
|
11
|
-
additional filetypes, `NODE_PATH`, etc.)
|
12
|
-
|
13
|
-
This rule can also optionally report on unresolved modules in CommonJS `require('./foo')` calls and AMD `require(['./foo'], function (foo) {...})` and `define(['./foo'], function (foo) {...})`.
|
14
|
-
|
15
|
-
To enable this, send `{ commonjs: true/false, amd: true/false }` as a rule option.
|
16
|
-
Both are disabled by default.
|
17
|
-
|
18
|
-
If you are using Webpack, see the section on [resolvers](../../README.md#resolvers).
|
19
|
-
|
20
|
-
## Rule Details
|
21
|
-
|
22
|
-
### Options
|
23
|
-
|
24
|
-
By default, only ES6 imports will be resolved:
|
25
|
-
|
26
|
-
```js
|
27
|
-
/*eslint import/no-unresolved: 2*/
|
28
|
-
import x from './foo' // reports if './foo' cannot be resolved on the filesystem
|
29
|
-
```
|
30
|
-
|
31
|
-
If `{commonjs: true}` is provided, single-argument `require` calls will be resolved:
|
32
|
-
|
33
|
-
```js
|
34
|
-
/*eslint import/no-unresolved: [2, { commonjs: true }]*/
|
35
|
-
const { default: x } = require('./foo') // reported if './foo' is not found
|
36
|
-
|
37
|
-
require(0) // ignored
|
38
|
-
require(['x', 'y'], function (x, y) { /*...*/ }) // ignored
|
39
|
-
```
|
40
|
-
|
41
|
-
Similarly, if `{ amd: true }` is provided, dependency paths for `define` and `require`
|
42
|
-
calls will be resolved:
|
43
|
-
|
44
|
-
```js
|
45
|
-
/*eslint import/no-unresolved: [2, { amd: true }]*/
|
46
|
-
define(['./foo'], function (foo) { /*...*/ }) // reported if './foo' is not found
|
47
|
-
require(['./foo'], function (foo) { /*...*/ }) // reported if './foo' is not found
|
48
|
-
|
49
|
-
const { default: x } = require('./foo') // ignored
|
50
|
-
```
|
51
|
-
|
52
|
-
Both may be provided, too:
|
53
|
-
|
54
|
-
```js
|
55
|
-
/*eslint import/no-unresolved: [2, { commonjs: true, amd: true }]*/
|
56
|
-
const { default: x } = require('./foo') // reported if './foo' is not found
|
57
|
-
define(['./foo'], function (foo) { /*...*/ }) // reported if './foo' is not found
|
58
|
-
require(['./foo'], function (foo) { /*...*/ }) // reported if './foo' is not found
|
59
|
-
```
|
60
|
-
|
61
|
-
#### `ignore`
|
62
|
-
|
63
|
-
This rule has its own ignore list, separate from [`import/ignore`]. This is because you may want to know whether a module can be located, regardless of whether it can be parsed for exports: `node_modules`, CoffeeScript files, etc. are all good to resolve properly, but will not be parsed if configured as such via [`import/ignore`].
|
64
|
-
|
65
|
-
To suppress errors from files that may not be properly resolved by your [resolver settings](../../README.md#resolver-plugins), you may add an `ignore` key with an array of `RegExp` pattern strings:
|
66
|
-
|
67
|
-
```js
|
68
|
-
/*eslint import/no-unresolved: [2, { ignore: ['\\.img$'] }]*/
|
69
|
-
|
70
|
-
import { x } from './mod' // may be reported, if not resolved to a module
|
71
|
-
|
72
|
-
import coolImg from '../../img/coolImg.img' // will not be reported, even if not found
|
73
|
-
```
|
74
|
-
|
75
|
-
#### `caseSensitive`
|
76
|
-
|
77
|
-
By default, this rule will report paths whose case do not match the underlying filesystem path, if the FS is not case-sensitive. To disable this behavior, set the `caseSensitive` option to `false`.
|
78
|
-
|
79
|
-
```js
|
80
|
-
/*eslint import/no-unresolved: [2, { caseSensitive: true (default) | false }]*/
|
81
|
-
const { default: x } = require('./foo') // reported if './foo' is actually './Foo' and caseSensitive: true
|
82
|
-
```
|
83
|
-
|
84
|
-
#### `caseSensitiveStrict`
|
85
|
-
|
86
|
-
The `caseSensitive` option does not detect case for the current working directory. The `caseSensitiveStrict` option allows checking `cwd` in resolved path. By default, the option is disabled.
|
87
|
-
|
88
|
-
```js
|
89
|
-
/*eslint import/no-unresolved: [2, { caseSensitiveStrict: true }]*/
|
90
|
-
|
91
|
-
// Absolute paths
|
92
|
-
import Foo from `/Users/fOo/bar/file.js` // reported, /Users/foo/bar/file.js
|
93
|
-
import Foo from `d:/fOo/bar/file.js` // reported, d:/foo/bar/file.js
|
94
|
-
|
95
|
-
// Relative paths, cwd is Users/foo/
|
96
|
-
import Foo from `./../fOo/bar/file.js` // reported
|
97
|
-
```
|
98
|
-
|
99
|
-
## When Not To Use It
|
100
|
-
|
101
|
-
If you're using a module bundler other than Node or Webpack, you may end up with a lot of false positive reports of missing dependencies.
|
102
|
-
|
103
|
-
## Further Reading
|
104
|
-
|
105
|
-
- [Resolver plugins](../../README.md#resolvers)
|
106
|
-
- [Node resolver](https://npmjs.com/package/eslint-import-resolver-node) (default)
|
107
|
-
- [Webpack resolver](https://npmjs.com/package/eslint-import-resolver-webpack)
|
108
|
-
- [`import/ignore`] global setting
|
109
|
-
|
110
|
-
[`import/ignore`]: ../../README.md#importignore
|