mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-24 13:01:24 +01:00
merge completed... now to fix all the bugs...
This commit is contained in:
commit
87c4d80fbc
3472 changed files with 466748 additions and 6517 deletions
79
node_modules/eslint-plugin-import/docs/rules/no-useless-path-segments.md
generated
vendored
Normal file
79
node_modules/eslint-plugin-import/docs/rules/no-useless-path-segments.md
generated
vendored
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
# import/no-useless-path-segments
|
||||
|
||||
Use this rule to prevent unnecessary path segments in import and require statements.
|
||||
|
||||
## Rule Details
|
||||
|
||||
Given the following folder structure:
|
||||
|
||||
```
|
||||
my-project
|
||||
├── app.js
|
||||
├── footer.js
|
||||
├── header.js
|
||||
└── helpers.js
|
||||
└── helpers
|
||||
└── index.js
|
||||
└── pages
|
||||
├── about.js
|
||||
├── contact.js
|
||||
└── index.js
|
||||
```
|
||||
|
||||
The following patterns are considered problems:
|
||||
|
||||
```js
|
||||
/**
|
||||
* in my-project/app.js
|
||||
*/
|
||||
|
||||
import "./../pages/about.js"; // should be "./pages/about.js"
|
||||
import "./../pages/about"; // should be "./pages/about"
|
||||
import "../pages/about.js"; // should be "./pages/about.js"
|
||||
import "../pages/about"; // should be "./pages/about"
|
||||
import "./pages//about"; // should be "./pages/about"
|
||||
import "./pages/"; // should be "./pages"
|
||||
import "./pages/index"; // should be "./pages" (except if there is a ./pages.js file)
|
||||
import "./pages/index.js"; // should be "./pages" (except if there is a ./pages.js file)
|
||||
```
|
||||
|
||||
The following patterns are NOT considered problems:
|
||||
|
||||
```js
|
||||
/**
|
||||
* in my-project/app.js
|
||||
*/
|
||||
|
||||
import "./header.js";
|
||||
import "./pages";
|
||||
import "./pages/about";
|
||||
import ".";
|
||||
import "..";
|
||||
import fs from "fs";
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### noUselessIndex
|
||||
|
||||
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`:
|
||||
```js
|
||||
"import/no-useless-path-segments": ["error", {
|
||||
noUselessIndex: true,
|
||||
}]
|
||||
```
|
||||
|
||||
Additionally to the patterns described above, the following imports are considered problems if `noUselessIndex` is enabled:
|
||||
|
||||
```js
|
||||
// in my-project/app.js
|
||||
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`)
|
||||
import "./pages/index"; // should be "./pages" (auto-fixable)
|
||||
import "./pages/index.js"; // should be "./pages" (auto-fixable)
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
### commonjs
|
||||
|
||||
When set to `true`, this rule checks CommonJS imports. Default to `false`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue