merge completed... now to fix all the bugs...

This commit is contained in:
howlingsails 2021-12-12 23:02:38 -08:00
commit 87c4d80fbc
3472 changed files with 466748 additions and 6517 deletions

1627
node_modules/eslint-plugin-import/CHANGELOG.md generated vendored Normal file

File diff suppressed because it is too large Load diff

116
node_modules/eslint-plugin-import/CONTRIBUTING.md generated vendored Normal file
View file

@ -0,0 +1,116 @@
# Contributing
Thanks for your interest in helping out! Here are a **few** _weird_ tricks to
~~cut your mortgage in half~~ maximize the global net efficiency of your efforts!
## TL;DR: Checklist
When opening an [issue](#issues):
- [ ] search open/closed issues
- [ ] discuss bug/enhancement in new or old issue
[PR](#prs) time:
- [ ] write tests
- [ ] implement feature/fix bug
- [ ] update docs
- [ ] make a note in change log
Remember, you don't need to do it all yourself; any of these are helpful! 😎
## Issues
### Search open + closed issues for similar cases.
You may find an open issue that closely matches what you are thinking. You
may also find a closed issue with discussion that either solves your problem
or explains why we are unlikely to solve it in the near future.
If you find a matching issue that is open, and marked `accepted` and/or `help
wanted`, you might want to [open a PR](#prs).
### Open an issue.
Let's discuss your issue. Could be as simple as unclear documentation or a
wonky config file.
If you're suggesting a feature, it might exist and need better
documentation, or it might be in process. Even given those, some discussion might
be warranted to ensure the enhancement is clear.
You're welcome to jump right to a PR, but without a discussion, can't make any
guarantees about merging.
That said: sometimes seeing the code makes the discussion clearer.😄
This is a helpful contribution all by itself. Thanks!
## PRs
If you would like to implement something, firstly: thanks! Community contributions
are a magical thing. Like Redux or [the flux capacitor](https://youtu.be/SR5BfQ4rEqQ?t=2m25s),
they make open source possible.
**Working on your first Pull Request?**
You can learn how from this _free_ series [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).
Here are some things to keep in mind when working on a PR:
#### Tests
A PR that is just failing test cases for an existing issue is very helpful, as this
can take as much time (if not more) as it takes to implement a new feature or fix
a bug.
If you only have enough time to write tests, fantastic! Submit away. This is a great
jumping-off point for a core contributor or even another PR to continue what you've started.
#### Docs
For enhancements to rules, please update the docs in `docs/rules` matching the rule
filename from `src/rules`.
Also, take a quick look at the rule summary in [README.md] in case it could use tweaking,
or add a line if you've implemented a new rule.
Bugfixes may not warrant docs changes, though it's worth skimming the existing
docs to see if there are any relevant caveats that need to be removed.
#### Changelog
Please add a quick blurb to the [**Unreleased**](./CHANGELOG.md#unreleased) section of the change log. Give yourself
some credit, and please link back to the PR for future reference. This is especially
helpful for resolver changes, as the resolvers are less frequently modified and published.
Note also that the change log can't magically link back to Github entities (i.e. PRs,
issues, users) or rules; there are a handful of footnote URL definitions at the bottom.
You may need to add one or more URL if you've square-bracketed any such items.
## Code of Conduct
This is not so much a set of guidelines as a reference for what I hope may become
a shared perspective on the project. I hope to write a longer essay to this end
in the future. Comments are welcome, I'd like this to be as clear as possible.
### Empathy
People have feelings and perspectives, and people say and believe things for good reasons.
If you find that you summarily disagree with a perspective stated by someone else,
you likely each have histories that have moved you in opposite directions on a continuum
that probably does not have a "wrong" or "right" end. It may be that you simply
are working toward different goals that require different strategies. Every decision
has pros and cons, and could result in some winners and some losers. It's great to
discuss this so that both are well-known, and realize that even with infinite discussion,
cons and losers will likely never go to zero.
Also note that we're not doing brain surgery here, so while it's fine if we spend some time
understanding each other, cordial disagreement should not be expensive in the
long run, and we can accept that we will get some things wrong before we get them right (if ever!).
If we can all get together behind the common goal of embracing empathy, everything else should be able to work itself out.
#### Attribution
Thanks for help from https://mozillascience.github.io/working-open-workshop/contributing/
for inspiration before I wrote this. --ben
[README.md]: ./README.md

22
node_modules/eslint-plugin-import/LICENSE generated vendored Normal file
View file

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015 Ben Mosher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

521
node_modules/eslint-plugin-import/README.md generated vendored Normal file
View file

@ -0,0 +1,521 @@
# eslint-plugin-import
[![github actions][actions-image]][actions-url]
[![travis-ci](https://travis-ci.org/import-js/eslint-plugin-import.svg?branch=main)](https://travis-ci.org/import-js/eslint-plugin-import)
[![coverage][codecov-image]][codecov-url]
[![win32 build status](https://ci.appveyor.com/api/projects/status/3mw2fifalmjlqf56/branch/main?svg=true)](https://ci.appveyor.com/project/import-js/eslint-plugin-import/branch/main)
[![npm](https://img.shields.io/npm/v/eslint-plugin-import.svg)](https://www.npmjs.com/package/eslint-plugin-import)
[![npm downloads](https://img.shields.io/npm/dt/eslint-plugin-import.svg?maxAge=2592000)](https://www.npmtrends.com/eslint-plugin-import)
This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, and prevent issues with misspelling of file paths and import names. All the goodness that the ES2015+ static module syntax intends to provide, marked up in your editor.
**IF YOU ARE USING THIS WITH SUBLIME**: see the [bottom section](#sublimelinter-eslint) for important info.
## Rules
### Static analysis
* Ensure imports point to a file/module that can be resolved. ([`no-unresolved`])
* Ensure named imports correspond to a named export in the remote file. ([`named`])
* Ensure a default export is present, given a default import. ([`default`])
* Ensure imported namespaces contain dereferenced properties as they are dereferenced. ([`namespace`])
* Restrict which files can be imported in a given folder ([`no-restricted-paths`])
* Forbid import of modules using absolute paths ([`no-absolute-path`])
* Forbid `require()` calls with expressions ([`no-dynamic-require`])
* Prevent importing the submodules of other modules ([`no-internal-modules`])
* Forbid webpack loader syntax in imports ([`no-webpack-loader-syntax`])
* Forbid a module from importing itself ([`no-self-import`])
* Forbid a module from importing a module with a dependency path back to itself ([`no-cycle`])
* Prevent unnecessary path segments in import and require statements ([`no-useless-path-segments`])
* Forbid importing modules from parent directories ([`no-relative-parent-imports`])
* Prevent importing packages through relative paths ([`no-relative-packages`])
[`no-unresolved`]: ./docs/rules/no-unresolved.md
[`named`]: ./docs/rules/named.md
[`default`]: ./docs/rules/default.md
[`namespace`]: ./docs/rules/namespace.md
[`no-restricted-paths`]: ./docs/rules/no-restricted-paths.md
[`no-absolute-path`]: ./docs/rules/no-absolute-path.md
[`no-dynamic-require`]: ./docs/rules/no-dynamic-require.md
[`no-internal-modules`]: ./docs/rules/no-internal-modules.md
[`no-webpack-loader-syntax`]: ./docs/rules/no-webpack-loader-syntax.md
[`no-self-import`]: ./docs/rules/no-self-import.md
[`no-cycle`]: ./docs/rules/no-cycle.md
[`no-useless-path-segments`]: ./docs/rules/no-useless-path-segments.md
[`no-relative-parent-imports`]: ./docs/rules/no-relative-parent-imports.md
[`no-relative-packages`]: ./docs/rules/no-relative-packages.md
### Helpful warnings
* Report any invalid exports, i.e. re-export of the same name ([`export`])
* Report use of exported name as identifier of default export ([`no-named-as-default`])
* Report use of exported name as property of default export ([`no-named-as-default-member`])
* Report imported names marked with `@deprecated` documentation tag ([`no-deprecated`])
* Forbid the use of extraneous packages ([`no-extraneous-dependencies`])
* Forbid the use of mutable exports with `var` or `let`. ([`no-mutable-exports`])
* Report modules without exports, or exports without matching import in another module ([`no-unused-modules`])
[`export`]: ./docs/rules/export.md
[`no-named-as-default`]: ./docs/rules/no-named-as-default.md
[`no-named-as-default-member`]: ./docs/rules/no-named-as-default-member.md
[`no-deprecated`]: ./docs/rules/no-deprecated.md
[`no-extraneous-dependencies`]: ./docs/rules/no-extraneous-dependencies.md
[`no-mutable-exports`]: ./docs/rules/no-mutable-exports.md
[`no-unused-modules`]: ./docs/rules/no-unused-modules.md
### Module systems
* Report potentially ambiguous parse goal (`script` vs. `module`) ([`unambiguous`])
* Report CommonJS `require` calls and `module.exports` or `exports.*`. ([`no-commonjs`])
* Report AMD `require` and `define` calls. ([`no-amd`])
* No Node.js builtin modules. ([`no-nodejs-modules`])
* Forbid imports with CommonJS exports ([`no-import-module-exports`])
[`unambiguous`]: ./docs/rules/unambiguous.md
[`no-commonjs`]: ./docs/rules/no-commonjs.md
[`no-amd`]: ./docs/rules/no-amd.md
[`no-nodejs-modules`]: ./docs/rules/no-nodejs-modules.md
[`no-import-module-exports`]: ./docs/rules/no-import-module-exports.md
### Style guide
* Ensure all imports appear before other statements ([`first`])
* Ensure all exports appear after other statements ([`exports-last`])
* Report repeated import of the same module in multiple places ([`no-duplicates`])
* Forbid namespace (a.k.a. "wildcard" `*`) imports ([`no-namespace`])
* Ensure consistent use of file extension within the import path ([`extensions`])
* Enforce a convention in module import order ([`order`])
* Enforce a newline after import statements ([`newline-after-import`])
* Prefer a default export if module exports a single name ([`prefer-default-export`])
* Limit the maximum number of dependencies a module can have ([`max-dependencies`])
* Forbid unassigned imports ([`no-unassigned-import`])
* Forbid named default exports ([`no-named-default`])
* Forbid default exports ([`no-default-export`])
* Forbid named exports ([`no-named-export`])
* Forbid anonymous values as default exports ([`no-anonymous-default-export`])
* Prefer named exports to be grouped together in a single export declaration ([`group-exports`])
* Enforce a leading comment with the webpackChunkName for dynamic imports ([`dynamic-import-chunkname`])
[`first`]: ./docs/rules/first.md
[`exports-last`]: ./docs/rules/exports-last.md
[`no-duplicates`]: ./docs/rules/no-duplicates.md
[`no-namespace`]: ./docs/rules/no-namespace.md
[`extensions`]: ./docs/rules/extensions.md
[`order`]: ./docs/rules/order.md
[`newline-after-import`]: ./docs/rules/newline-after-import.md
[`prefer-default-export`]: ./docs/rules/prefer-default-export.md
[`max-dependencies`]: ./docs/rules/max-dependencies.md
[`no-unassigned-import`]: ./docs/rules/no-unassigned-import.md
[`no-named-default`]: ./docs/rules/no-named-default.md
[`no-anonymous-default-export`]: ./docs/rules/no-anonymous-default-export.md
[`group-exports`]: ./docs/rules/group-exports.md
[`no-default-export`]: ./docs/rules/no-default-export.md
[`no-named-export`]: ./docs/rules/no-named-export.md
[`dynamic-import-chunkname`]: ./docs/rules/dynamic-import-chunkname.md
## `eslint-plugin-import` for enterprise
Available as part of the Tidelift Subscription.
The maintainers of `eslint-plugin-import` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-eslint-plugin-import?utm_source=npm-eslint-plugin-import&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
## Installation
```sh
npm install eslint-plugin-import -g
```
or if you manage ESLint as a dev dependency:
```sh
# inside your project's working tree
npm install eslint-plugin-import --save-dev
```
All rules are off by default. However, you may configure them manually
in your `.eslintrc.(yml|json|js)`, or extend one of the canned configs:
```yaml
---
extends:
- eslint:recommended
- plugin:import/recommended
# alternatively, 'recommended' is the combination of these two rule sets:
- plugin:import/errors
- plugin:import/warnings
# or configure manually:
plugins:
- import
rules:
import/no-unresolved: [2, {commonjs: true, amd: true}]
import/named: 2
import/namespace: 2
import/default: 2
import/export: 2
# etc...
```
# TypeScript
You may use the following shortcut or assemble your own config using the granular settings described below.
Make sure you have installed [`@typescript-eslint/parser`] which is used in the following configuration. Unfortunately NPM does not allow to list optional peer dependencies.
```yaml
extends:
- eslint:recommended
- plugin:import/recommended
- plugin:import/typescript # this line does the trick
```
[`@typescript-eslint/parser`]: https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser
You will also need to install and configure the TypeScript resolver:
[`eslint-import-resolver-typescript`](https://github.com/alexgorbatchev/eslint-import-resolver-typescript).
# Resolvers
With the advent of module bundlers and the current state of modules and module
syntax specs, it's not always obvious where `import x from 'module'` should look
to find the file behind `module`.
Up through v0.10ish, this plugin has directly used substack's [`resolve`] plugin,
which implements Node's import behavior. This works pretty well in most cases.
However, webpack allows a number of things in import module source strings that
Node does not, such as loaders (`import 'file!./whatever'`) and a number of
aliasing schemes, such as [`externals`]: mapping a module id to a global name at
runtime (allowing some modules to be included more traditionally via script tags).
In the interest of supporting both of these, v0.11 introduces resolvers.
Currently [Node] and [webpack] resolution have been implemented, but the
resolvers are just npm packages, so [third party packages are supported](https://github.com/import-js/eslint-plugin-import/wiki/Resolvers) (and encouraged!).
You can reference resolvers in several ways (in order of precedence):
- as a conventional `eslint-import-resolver` name, like `eslint-import-resolver-foo`:
```yaml
# .eslintrc.yml
settings:
# uses 'eslint-import-resolver-foo':
import/resolver: foo
```
```js
// .eslintrc.js
module.exports = {
settings: {
'import/resolver': {
foo: { someConfig: value }
}
}
}
```
- with a full npm module name, like `my-awesome-npm-module`:
```yaml
# .eslintrc.yml
settings:
import/resolver: 'my-awesome-npm-module'
```
```js
// .eslintrc.js
module.exports = {
settings: {
'import/resolver': {
'my-awesome-npm-module': { someConfig: value }
}
}
}
```
- with a filesystem path to resolver, defined in this example as a `computed property` name:
```js
// .eslintrc.js
module.exports = {
settings: {
'import/resolver': {
[path.resolve('../../../my-resolver')]: { someConfig: value }
}
}
}
```
Relative paths will be resolved relative to the source's nearest `package.json` or
the process's current working directory if no `package.json` is found.
If you are interesting in writing a resolver, see the [spec](./resolvers/README.md) for more details.
[`resolve`]: https://www.npmjs.com/package/resolve
[`externals`]: https://webpack.github.io/docs/library-and-externals.html
[Node]: https://www.npmjs.com/package/eslint-import-resolver-node
[webpack]: https://www.npmjs.com/package/eslint-import-resolver-webpack
# Settings
You may set the following settings in your `.eslintrc`:
#### `import/extensions`
A list of file extensions that will be parsed as modules and inspected for
`export`s.
This defaults to `['.js']`, unless you are using the `react` shared config,
in which case it is specified as `['.js', '.jsx']`.
```js
"settings": {
"import/extensions": [
".js",
".jsx"
]
}
```
If you require more granular extension definitions, you can use:
```js
"settings": {
"import/resolver": {
"node": {
"extensions": [
".js",
".jsx"
]
}
}
}
```
Note that this is different from (and likely a subset of) any `import/resolver`
extensions settings, which may include `.json`, `.coffee`, etc. which will still
factor into the `no-unresolved` rule.
Also, the following `import/ignore` patterns will overrule this list.
#### `import/ignore`
A list of regex strings that, if matched by a path, will
not report the matching module if no `export`s are found.
In practice, this means rules other than [`no-unresolved`](./docs/rules/no-unresolved.md#ignore) will not report on any
`import`s with (absolute filesystem) paths matching this pattern.
`no-unresolved` has its own [`ignore`](./docs/rules/no-unresolved.md#ignore) setting.
```yaml
settings:
import/ignore:
- \.coffee$ # fraught with parse errors
- \.(scss|less|css)$ # can't parse unprocessed CSS modules, either
```
#### `import/core-modules`
An array of additional modules to consider as "core" modules--modules that should
be considered resolved but have no path on the filesystem. Your resolver may
already define some of these (for example, the Node resolver knows about `fs` and
`path`), so you need not redefine those.
For example, Electron exposes an `electron` module:
```js
import 'electron' // without extra config, will be flagged as unresolved!
```
that would otherwise be unresolved. To avoid this, you may provide `electron` as a
core module:
```yaml
# .eslintrc.yml
settings:
import/core-modules: [ electron ]
```
In Electron's specific case, there is a shared config named `electron`
that specifies this for you.
Contribution of more such shared configs for other platforms are welcome!
#### `import/external-module-folders`
An array of folders. Resolved modules only from those folders will be considered as "external". By default - `["node_modules"]`. Makes sense if you have configured your path or webpack to handle your internal paths differently and want to consider modules from some folders, for example `bower_components` or `jspm_modules`, as "external".
This option is also useful in a monorepo setup: list here all directories that contain monorepo's packages and they will be treated as external ones no matter which resolver is used.
If you are using `yarn` PnP as your package manager, add the `.yarn` folder and all your installed dependencies will be considered as `external`, instead of `internal`.
Each item in this array is either a folder's name, its subpath, or its absolute prefix path:
- `jspm_modules` will match any file or folder named `jspm_modules` or which has a direct or non-direct parent named `jspm_modules`, e.g. `/home/me/project/jspm_modules` or `/home/me/project/jspm_modules/some-pkg/index.js`.
- `packages/core` will match any path that contains these two segments, for example `/home/me/project/packages/core/src/utils.js`.
- `/home/me/project/packages` will only match files and directories inside this directory, and the directory itself.
Please note that incomplete names are not allowed here so `components` won't match `bower_components` and `packages/ui` won't match `packages/ui-utils` (but will match `packages/ui/utils`).
#### `import/parsers`
A map from parsers to file extension arrays. If a file extension is matched, the
dependency parser will require and use the map key as the parser instead of the
configured ESLint parser. This is useful if you're inter-op-ing with TypeScript
directly using webpack, for example:
```yaml
# .eslintrc.yml
settings:
import/parsers:
@typescript-eslint/parser: [ .ts, .tsx ]
```
In this case, [`@typescript-eslint/parser`](https://www.npmjs.com/package/@typescript-eslint/parser)
must be installed and require-able from the running `eslint` module's location
(i.e., install it as a peer of ESLint).
This is currently only tested with `@typescript-eslint/parser` (and its predecessor,
`typescript-eslint-parser`) but should theoretically work with any moderately
ESTree-compliant parser.
It's difficult to say how well various plugin features will be supported, too,
depending on how far down the rabbit hole goes. Submit an issue if you find strange
behavior beyond here, but steel your heart against the likely outcome of closing
with `wontfix`.
#### `import/resolver`
See [resolvers](#resolvers).
#### `import/cache`
Settings for cache behavior. Memoization is used at various levels to avoid the copious amount of `fs.statSync`/module parse calls required to correctly report errors.
For normal `eslint` console runs, the cache lifetime is irrelevant, as we can strongly assume that files should not be changing during the lifetime of the linter process (and thus, the cache in memory)
For long-lasting processes, like [`eslint_d`] or [`eslint-loader`], however, it's important that there be some notion of staleness.
If you never use [`eslint_d`] or [`eslint-loader`], you may set the cache lifetime to `Infinity` and everything should be fine:
```yaml
# .eslintrc.yml
settings:
import/cache:
lifetime: ∞ # or Infinity
```
Otherwise, set some integer, and cache entries will be evicted after that many seconds have elapsed:
```yaml
# .eslintrc.yml
settings:
import/cache:
lifetime: 5 # 30 is the default
```
[`eslint_d`]: https://www.npmjs.com/package/eslint_d
[`eslint-loader`]: https://www.npmjs.com/package/eslint-loader
#### `import/internal-regex`
A regex for packages should be treated as internal. Useful when you are utilizing a monorepo setup or developing a set of packages that depend on each other.
By default, any package referenced from [`import/external-module-folders`](#importexternal-module-folders) will be considered as "external", including packages in a monorepo like yarn workspace or lerna environment. If you want to mark these packages as "internal" this will be useful.
For example, if your packages in a monorepo are all in `@scope`, you can configure `import/internal-regex` like this
```yaml
# .eslintrc.yml
settings:
import/internal-regex: ^@scope/
```
## SublimeLinter-eslint
SublimeLinter-eslint introduced a change to support `.eslintignore` files
which altered the way file paths are passed to ESLint when linting during editing.
This change sends a relative path instead of the absolute path to the file (as ESLint
normally provides), which can make it impossible for this plugin to resolve dependencies
on the filesystem.
This workaround should no longer be necessary with the release of ESLint 2.0, when
`.eslintignore` will be updated to work more like a `.gitignore`, which should
support proper ignoring of absolute paths via `--stdin-filename`.
In the meantime, see [roadhump/SublimeLinter-eslint#58](https://github.com/roadhump/SublimeLinter-eslint/issues/58)
for more details and discussion, but essentially, you may find you need to add the following
`SublimeLinter` config to your Sublime project file:
```json
{
"folders":
[
{
"path": "code"
}
],
"SublimeLinter":
{
"linters":
{
"eslint":
{
"chdir": "${project}/code"
}
}
}
}
```
Note that `${project}/code` matches the `code` provided at `folders[0].path`.
The purpose of the `chdir` setting, in this case, is to set the working directory
from which ESLint is executed to be the same as the directory on which SublimeLinter-eslint
bases the relative path it provides.
See the SublimeLinter docs on [`chdir`](https://www.sublimelinter.com/en/latest/linter_settings.html#chdir)
for more information, in case this does not work with your project.
If you are not using `.eslintignore`, or don't have a Sublime project file, you can also
do the following via a `.sublimelinterrc` file in some ancestor directory of your
code:
```json
{
"linters": {
"eslint": {
"args": ["--stdin-filename", "@"]
}
}
}
```
I also found that I needed to set `rc_search_limit` to `null`, which removes the file
hierarchy search limit when looking up the directory tree for `.sublimelinterrc`:
In Package Settings / SublimeLinter / User Settings:
```json
{
"user": {
"rc_search_limit": null
}
}
```
I believe this defaults to `3`, so you may not need to alter it depending on your
project folder max depth.
[codecov-image]: https://codecov.io/gh/import-js/eslint-plugin-import/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/import-js/eslint-plugin-import/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/import-js/eslint-plugin-import
[actions-url]: https://github.com/import-js/eslint-plugin-import

54
node_modules/eslint-plugin-import/RELEASE.md generated vendored Normal file
View file

@ -0,0 +1,54 @@
# Release steps
1. create a `release-[x.y.z]` branch from tip of `main` (or whatever release commit)
```bash
git checkout main && git pull && git checkout -b release-2.1.0
```
2. bump `package.json` + update CHANGELOG version links for all releasing packages (i.e., root + any resolvers)
In changelog for core plugin, normally leave [Unreleased] but update its link at the bottom
to be rooted at the new version's tag, and add a link for the new version rooted
at last version's tag.
```markdown
[Unreleased]: https://github.com/import-js/eslint-plugin-import/compare/v2.0.1...HEAD
[2.0.1]: https://github.com/import-js/eslint-plugin-import/compare/v2.0.0...v2.0.1
```
becomes
```markdown
[Unreleased]: https://github.com/import-js/eslint-plugin-import/compare/v2.1.0...HEAD
[2.1.0]: https://github.com/import-js/eslint-plugin-import/compare/v2.0.1...v2.1.0
[2.0.1]: https://github.com/import-js/eslint-plugin-import/compare/v2.0.0...v2.0.1
```
Generally, don't use `npm version` for this because it creates a tag, which I normally
wait until signoff from contributors and actually `npm publish`-ing to snap the tag.
3. create pull request from `release-[x.y.z]` into `release` branch
I like this because it
- lists all commits in the release
- provides a commentary location to discuss the release
- builds in CI and provides test results
4. iterate on feedback
- handle other issues
- merge more PRs
- fix issues in changelog/docs
5. `npm publish` from `release-[x.y.z]` branch
- don't forget resolvers!
6. tag commit (`v[x.y.z]`)
- again, not forgetting resolvers, if needed (`resolvers/[name]/v[t.u.v]`)
7. merge `release-[x.y.z]` into `release` (
- ideally fast-forward, probably with Git CLI instead of Github
8. merge `release` into `main`
Done!

11
node_modules/eslint-plugin-import/SECURITY.md generated vendored Normal file
View file

@ -0,0 +1,11 @@
# Security Policy
## Supported Versions
Latest major/minor version is supported only for security updates.
## Reporting a Vulnerability
To report a security vulnerability, please use the
[Tidelift security contact](https://tidelift.com/security).
Tidelift will coordinate the fix and disclosure.

8
node_modules/eslint-plugin-import/config/electron.js generated vendored Normal file
View file

@ -0,0 +1,8 @@
/**
* Default settings for Electron applications.
*/
module.exports = {
settings: {
'import/core-modules': ['electron'],
},
};

14
node_modules/eslint-plugin-import/config/errors.js generated vendored Normal file
View file

@ -0,0 +1,14 @@
/**
* unopinionated config. just the things that are necessarily runtime errors
* waiting to happen.
* @type {Object}
*/
module.exports = {
plugins: ['import'],
rules: { 'import/no-unresolved': 2,
'import/named': 2,
'import/namespace': 2,
'import/default': 2,
'import/export': 2,
},
};

View file

@ -0,0 +1,13 @@
/**
* - adds platform extensions to Node resolver
*/
module.exports = {
settings: {
'import/resolver': {
node: {
// Note: will not complain if only _one_ of these files exists.
extensions: ['.js', '.web.js', '.ios.js', '.android.js'],
},
},
},
};

18
node_modules/eslint-plugin-import/config/react.js generated vendored Normal file
View file

@ -0,0 +1,18 @@
/**
* Adds `.jsx` as an extension, and enables JSX parsing.
*
* Even if _you_ aren't using JSX (or .jsx) directly, if your dependencies
* define jsnext:main and have JSX internally, you may run into problems
* if you don't enable these settings at the top level.
*/
module.exports = {
settings: {
'import/extensions': ['.js', '.jsx'],
},
parserOptions: {
ecmaFeatures: { jsx: true },
},
};

View file

@ -0,0 +1,28 @@
/**
* The basics.
* @type {Object}
*/
module.exports = {
plugins: ['import'],
rules: {
// analysis/correctness
'import/no-unresolved': 'error',
'import/named': 'error',
'import/namespace': 'error',
'import/default': 'error',
'import/export': 'error',
// red flags (thus, warnings)
'import/no-named-as-default': 'warn',
'import/no-named-as-default-member': 'warn',
'import/no-duplicates': 'warn',
},
// need all these for parsing dependencies (even if _your_ code doesn't need
// all of them)
parserOptions: {
sourceType: 'module',
ecmaVersion: 2018,
},
};

12
node_modules/eslint-plugin-import/config/stage-0.js generated vendored Normal file
View file

@ -0,0 +1,12 @@
/**
* Rules in progress.
*
* Do not expect these to adhere to semver across releases.
* @type {Object}
*/
module.exports = {
plugins: ['import'],
rules: {
'import/no-deprecated': 1,
},
};

31
node_modules/eslint-plugin-import/config/typescript.js generated vendored Normal file
View file

@ -0,0 +1,31 @@
/**
* Adds `.jsx`, `.ts` and `.tsx` as an extension, and enables JSX/TSX parsing.
*/
// Omit `.d.ts` because 1) TypeScript compilation already confirms that
// types are resolved, and 2) it would mask an unresolved
// `.ts`/`.tsx`/`.js`/`.jsx` implementation.
const allExtensions = ['.ts', '.tsx', '.js', '.jsx'];
module.exports = {
settings: {
'import/extensions': allExtensions,
'import/external-module-folders': ['node_modules', 'node_modules/@types'],
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
'node': {
'extensions': allExtensions,
},
},
},
rules: {
// analysis/correctness
// TypeScript compilation already ensures that named imports exist in the referenced module
'import/named': 'off',
},
};

12
node_modules/eslint-plugin-import/config/warnings.js generated vendored Normal file
View file

@ -0,0 +1,12 @@
/**
* more opinionated config.
* @type {Object}
*/
module.exports = {
plugins: ['import'],
rules: {
'import/no-named-as-default': 1,
'import/no-named-as-default-member': 1,
'import/no-duplicates': 1,
},
};

View file

@ -0,0 +1,71 @@
# import/default
If a default import is requested, this rule will report if there is no default
export in the imported module.
For [ES7], reports if a default is named and exported but is not found in the
referenced module.
Note: for packages, the plugin will find exported names
from [`jsnext:main`], if present in `package.json`.
Redux's npm module includes this key, and thereby is lintable, for example.
A module path that is [ignored] or not [unambiguously an ES module] will not be reported when imported.
[ignored]: ../README.md#importignore
[unambiguously an ES module]: https://github.com/bmeck/UnambiguousJavaScriptGrammar
## Rule Details
Given:
```js
// ./foo.js
export default function () { return 42 }
// ./bar.js
export function bar() { return null }
// ./baz.js
module.exports = function () { /* ... */ }
// node_modules/some-module/index.js
exports.sharedFunction = function shared() { /* ... */ }
```
The following is considered valid:
```js
import foo from './foo'
// assuming 'node_modules' are ignored (true by default)
import someModule from 'some-module'
```
...and the following cases are reported:
```js
import bar from './bar' // no default export found in ./bar
import baz from './baz' // no default export found in ./baz
```
## When Not To Use It
If you are using CommonJS and/or modifying the exported namespace of any module at
runtime, you will likely see false positives with this rule.
This rule currently does not interpret `module.exports = ...` as a `default` export,
either, so such a situation will be reported in the importing module.
## Further Reading
- Lee Byron's [ES7] export proposal
- [`import/ignore`] setting
- [`jsnext:main`] (Rollup)
[ES7]: https://github.com/leebyron/ecmascript-more-export-from
[`import/ignore`]: ../../README.md#importignore
[`jsnext:main`]: https://github.com/rollup/rollup/wiki/jsnext:main

View file

@ -0,0 +1,85 @@
# dynamic imports require a leading comment with a webpackChunkName (dynamic-import-chunkname)
This rule reports any dynamic imports without a webpackChunkName specified in a leading block comment in the proper format.
This rule enforces naming of webpack chunks in dynamic imports. When you don't explicitly name chunks, webpack will autogenerate chunk names that are not consistent across builds, which prevents long-term browser caching.
## Rule Details
This rule runs against `import()` by default, but can be configured to also run against an alternative dynamic-import function, e.g. 'dynamicImport.'
You can also configure the regex format you'd like to accept for the webpackChunkName - for example, if we don't want the number 6 to show up in our chunk names:
```javascript
{
"dynamic-import-chunkname": [2, {
importFunctions: ["dynamicImport"],
webpackChunknameFormat: "[a-zA-Z0-57-9-/_]+"
}]
}
```
### invalid
The following patterns are invalid:
```javascript
// no leading comment
import('someModule');
// incorrectly formatted comment
import(
/*webpackChunkName:"someModule"*/
'someModule',
);
import(
/* webpackChunkName : "someModule" */
'someModule',
);
// chunkname contains a 6 (forbidden by rule config)
import(
/* webpackChunkName: "someModule6" */
'someModule',
);
// invalid syntax for webpack comment
import(
/* totally not webpackChunkName: "someModule" */
'someModule',
);
// single-line comment, not a block-style comment
import(
// webpackChunkName: "someModule"
'someModule',
);
```
### valid
The following patterns are valid:
```javascript
import(
/* webpackChunkName: "someModule" */
'someModule',
);
import(
/* webpackChunkName: "someOtherModule12345789" */
'someModule',
);
import(
/* webpackChunkName: "someModule" */
/* webpackPrefetch: true */
'someModule',
);
import(
/* webpackChunkName: "someModule", webpackPrefetch: true */
'someModule',
);
// using single quotes instead of double quotes
import(
/* webpackChunkName: 'someModule' */
'someModule',
);
```
## When Not To Use It
If you don't care that webpack will autogenerate chunk names and may blow up browser caches and bundle size reports.

32
node_modules/eslint-plugin-import/docs/rules/export.md generated vendored Normal file
View file

@ -0,0 +1,32 @@
# import/export
Reports funny business with exports, like repeated exports of names or defaults.
## Rule Details
```js
export default class MyClass { /*...*/ } // Multiple default exports.
function makeClass() { return new MyClass(...arguments) }
export default makeClass // Multiple default exports.
```
or
```js
export const foo = function () { /*...*/ } // Multiple exports of name 'foo'.
function bar() { /*...*/ }
export { bar as foo } // Multiple exports of name 'foo'.
```
In the case of named/default re-export, all `n` re-exports will be reported,
as at least `n-1` of them are clearly mistakes, but it is not clear which one
(if any) is intended. Could be the result of copy/paste, code duplication with
intent to rename, etc.
## Further Reading
- Lee Byron's [ES7] export proposal
[ES7]: https://github.com/leebyron/ecmascript-more-export-from

View file

@ -0,0 +1,50 @@
# import/exports-last
This rule enforces that all exports are declared at the bottom of the file. This rule will report any export declarations that comes before any non-export statements.
## This will be reported
```JS
const bool = true
export default bool
const str = 'foo'
```
```JS
export const bool = true
const str = 'foo'
```
## This will not be reported
```JS
const arr = ['bar']
export const bool = true
export default bool
export function func() {
console.log('Hello World 🌍')
}
export const str = 'foo'
```
## When Not To Use It
If you don't mind exports being sprinkled throughout a file, you may not want to enable this rule.
#### ES6 exports only
The exports-last rule is currently only working on ES6 exports. You may not want to enable this rule if you're using CommonJS exports.
If you need CommonJS support feel free to open an issue or create a PR.

View file

@ -0,0 +1,169 @@
# import/extensions - Ensure consistent use of file extension within the import path
Some file resolve algorithms allow you to omit the file extension within the import source path. For example the `node` resolver can resolve `./foo/bar` to the absolute path `/User/someone/foo/bar.js` because the `.js` extension is resolved automatically by default. Depending on the resolver you can configure more extensions to get resolved automatically.
In order to provide a consistent use of file extensions across your code base, this rule can enforce or disallow the use of certain file extensions.
## Rule Details
This rule either takes one string option, one object option, or a string and an object option. If it is the string `"never"` (the default value), then the rule forbids the use for any extension. If it is the string `"always"`, then the rule enforces the use of extensions for all import statements. If it is the string `"ignorePackages"`, then the rule enforces the use of extensions for all import statements except package imports.
```
"import/extensions": [<severity>, "never" | "always" | "ignorePackages"]
```
By providing an object you can configure each extension separately.
```
"import/extensions": [<severity>, {
<extension>: "never" | "always" | "ignorePackages"
}]
```
For example `{ "js": "always", "json": "never" }` would always enforce the use of the `.js` extension but never allow the use of the `.json` extension.
By providing both a string and an object, the string will set the default setting for all extensions, and the object can be used to set granular overrides for specific extensions.
```
"import/extensions": [
<severity>,
"never" | "always" | "ignorePackages",
{
<extension>: "never" | "always" | "ignorePackages"
}
]
```
For example, `["error", "never", { "svg": "always" }]` would require that all extensions are omitted, except for "svg".
`ignorePackages` can be set as a separate boolean option like this:
```
"import/extensions": [
<severity>,
"never" | "always" | "ignorePackages",
{
ignorePackages: true | false,
pattern: {
<extension>: "never" | "always" | "ignorePackages"
}
}
]
```
In that case, if you still want to specify extensions, you can do so inside the **pattern** property.
Default value of `ignorePackages` is `false`.
### Exception
When disallowing the use of certain extensions this rule makes an exception and allows the use of extension when the file would not be resolvable without extension.
For example, given the following folder structure:
```
├── foo
│   ├── bar.js
│   ├── bar.json
```
and this import statement:
```js
import bar from './foo/bar.json';
```
then the extension cant be omitted because it would then resolve to `./foo/bar.js`.
### Examples
The following patterns are considered problems when configuration set to "never":
```js
import foo from './foo.js';
import bar from './bar.json';
import Component from './Component.jsx';
import express from 'express/index.js';
```
The following patterns are not considered problems when configuration set to "never":
```js
import foo from './foo';
import bar from './bar';
import Component from './Component';
import express from 'express/index';
import * as path from 'path';
```
The following patterns are considered problems when configuration set to "always":
```js
import foo from './foo';
import bar from './bar';
import Component from './Component';
import foo from '@/foo';
```
The following patterns are not considered problems when configuration set to "always":
```js
import foo from './foo.js';
import bar from './bar.json';
import Component from './Component.jsx';
import * as path from 'path';
import foo from '@/foo.js';
```
The following patterns are considered problems when configuration set to "ignorePackages":
```js
import foo from './foo';
import bar from './bar';
import Component from './Component';
```
The following patterns are not considered problems when configuration set to "ignorePackages":
```js
import foo from './foo.js';
import bar from './bar.json';
import Component from './Component.jsx';
import express from 'express';
import foo from '@/foo'
```
The following patterns are not considered problems when configuration set to `['error', 'always', {ignorePackages: true} ]`:
```js
import Component from './Component.jsx';
import baz from 'foo/baz.js';
import express from 'express';
import foo from '@/foo';
```
## When Not To Use It
If you are not concerned about a consistent usage of file extension.

70
node_modules/eslint-plugin-import/docs/rules/first.md generated vendored Normal file
View file

@ -0,0 +1,70 @@
# import/first
This rule reports any imports that come after non-import
statements.
## Rule Details
```js
import foo from './foo'
// some module-level initializer
initWith(foo)
import bar from './bar' // <- reported
```
Providing `absolute-first` as an option will report any absolute imports (i.e.
packages) that come after any relative imports:
```js
import foo from 'foo'
import bar from './bar'
import * as _ from 'lodash' // <- reported
```
If you really want import type ordering, check out [`import/order`].
Notably, `import`s are hoisted, which means the imported modules will be evaluated
before any of the statements interspersed between them. Keeping all `import`s together
at the top of the file may prevent surprises resulting from this part of the spec.
### On directives
Directives are allowed as long as they occur strictly before any `import` declarations,
as follows:
```js
'use super-mega-strict'
import { suchFoo } from 'lame-fake-module-name' // no report here
```
A directive in this case is assumed to be a single statement that contains only
a literal string-valued expression.
`'use strict'` would be a good example, except that [modules are always in strict
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
`export`s.
Given that, see [#255] for the reasoning.
### With Fixer
This rule contains a fixer to reorder in-body import to top, the following criteria applied:
1. Never re-order relative to each other, even if `absolute-first` is set.
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.
## When Not To Use It
If you don't mind imports being sprinkled throughout, you may not want to
enable this rule.
## Further Reading
- [`import/order`]: a major step up from `absolute-first`
- Issue [#255]
[`import/order`]: ./order.md
[#255]: https://github.com/import-js/eslint-plugin-import/issues/255

View file

@ -0,0 +1,117 @@
# import/group-exports
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.
**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.
## Rule Details
This rule warns whenever a single file contains multiple named export declarations or multiple assignments to `module.exports` (or `exports`).
### Valid
```js
// A single named export declaration -> ok
export const valid = true
```
```js
const first = true
const second = true
// A single named export declaration -> ok
export {
first,
second,
}
```
```js
// Aggregating exports -> ok
export { default as module1 } from 'module-1'
export { default as module2 } from 'module-2'
```
```js
// A single exports assignment -> ok
module.exports = {
first: true,
second: true
}
```
```js
const first = true
const second = true
// A single exports assignment -> ok
module.exports = {
first,
second,
}
```
```js
function test() {}
test.property = true
test.another = true
// A single exports assignment -> ok
module.exports = test
```
```flow js
const first = true;
type firstType = boolean
// A single named export declaration (type exports handled separately) -> ok
export {first}
export type {firstType}
```
### Invalid
```js
// Multiple named export statements -> not ok!
export const first = true
export const second = true
```
```js
// Aggregating exports from the same module -> not ok!
export { module1 } from 'module-1'
export { module2 } from 'module-1'
```
```js
// Multiple exports assignments -> not ok!
exports.first = true
exports.second = true
```
```js
// Multiple exports assignments -> not ok!
module.exports = {}
module.exports.first = true
```
```js
// Multiple exports assignments -> not ok!
module.exports = () => {}
module.exports.first = true
module.exports.second = true
```
```flow js
type firstType = boolean
type secondType = any
// Multiple named type export statements -> not ok!
export type {firstType}
export type {secondType}
```
## When Not To Use It
If you do not mind having your exports spread across the file, you can safely turn this rule off.

View file

@ -0,0 +1,3 @@
# imports-first
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).

View file

@ -0,0 +1,66 @@
# import/max-dependencies
Forbid modules to have too many dependencies (`import` or `require` statements).
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.
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).
## Options
This rule has the following options, with these defaults:
```js
"import/max-dependencies": ["error", {
"max": 10,
"ignoreTypeImports": false,
}]
```
### `max`
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.
Given a max value of `{"max": 2}`:
### Fail
```js
import a from './a'; // 1
const b = require('./b'); // 2
import c from './c'; // 3 - exceeds max!
```
### Pass
```js
import a from './a'; // 1
const anotherA = require('./a'); // still 1
import {x, y, z} from './foo'; // 2
```
### `ignoreTypeImports`
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`.
Given `{"max": 2, "ignoreTypeImports": true}`:
### Fail
```ts
import a from './a';
import b from './b';
import c from './c';
```
### Pass
```ts
import a from './a';
import b from './b';
import type c from './c'; // Doesn't count against max
```
## When Not To Use It
If you don't care how many dependencies a module has.

100
node_modules/eslint-plugin-import/docs/rules/named.md generated vendored Normal file
View file

@ -0,0 +1,100 @@
# import/named
Verifies that all named imports are part of the set of named exports in the referenced module.
For `export`, verifies that all named exports exist in the referenced module.
Note: for packages, the plugin will find exported names
from [`jsnext:main`] (deprecated) or `module`, if present in `package.json`.
Redux's npm module includes this key, and thereby is lintable, for example.
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.
[ignored]: ../../README.md#importignore
[unambiguously an ES module]: https://github.com/bmeck/UnambiguousJavaScriptGrammar
[Flow]: https://flow.org/
## Rule Details
Given:
```js
// ./foo.js
export const foo = "I'm so foo"
```
The following is considered valid:
```js
// ./bar.js
import { foo } from './foo'
// ES7 proposal
export { foo as bar } from './foo'
// node_modules without jsnext:main are not analyzed by default
// (import/ignore setting)
import { SomeNonsenseThatDoesntExist } from 'react'
```
...and the following are reported:
```js
// ./baz.js
import { notFoo } from './foo'
// ES7 proposal
export { notFoo as defNotBar } from './foo'
// will follow 'jsnext:main', if available
import { dontCreateStore } from 'redux'
```
### Settings
[`import/ignore`] can be provided as a setting to ignore certain modules (node_modules,
CoffeeScript, CSS if using Webpack, etc.).
Given:
```yaml
# .eslintrc (YAML)
---
settings:
import/ignore:
- node_modules # included by default, but replaced if explicitly configured
- *.coffee$ # can't parse CoffeeScript (unless a custom polyglot parser was configured)
```
and
```coffeescript
# ./whatever.coffee
exports.whatever = (foo) -> console.log foo
```
then the following is not reported:
```js
// ./foo.js
// can't be analyzed, and ignored, so not reported
import { notWhatever } from './whatever'
```
## When Not To Use It
If you are using CommonJS and/or modifying the exported namespace of any module at
runtime, you will likely see false positives with this rule.
## Further Reading
- [`import/ignore`] setting
- [`jsnext:main`] deprecation
- [`pkg.module`] (Rollup)
[`jsnext:main`]: https://github.com/jsforum/jsforum/issues/5
[`pkg.module`]: https://github.com/rollup/rollup/wiki/pkg.module
[`import/ignore`]: ../../README.md#importignore

View file

@ -0,0 +1,99 @@
# import/namespace
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`.).
Will report at the import declaration if there are _no_ exported names found.
Also, will report for computed references (i.e. `foo["bar"]()`).
Reports on assignment to a member of an imported namespace.
Note: for packages, the plugin will find exported names
from [`jsnext:main`], if present in `package.json`.
Redux's npm module includes this key, and thereby is lintable, for example.
A module path that is [ignored] or not [unambiguously an ES module] will not be reported when imported.
[ignored]: ../README.md#importignore
[unambiguously an ES module]: https://github.com/bmeck/UnambiguousJavaScriptGrammar
## Rule Details
Currently, this rule does not check for possible
redefinition of the namespace in an intermediate scope. Adherence to the ESLint
`no-shadow` rule for namespaces will prevent this from being a problem.
For [ES7], reports if an exported namespace would be empty (no names exported from the referenced module.)
Given:
```js
// @module ./named-exports
export const a = 1
const b = 2
export { b }
const c = 3
export { c as d }
export class ExportedClass { }
// ES7
export * as deep from './deep'
```
and:
```js
// @module ./deep
export const e = "MC2"
```
See what is valid and reported:
```js
// @module ./foo
import * as names from './named-exports'
function great() {
return names.a + names.b // so great https://youtu.be/ei7mb8UxEl8
}
function notGreat() {
doSomethingWith(names.c) // Reported: 'c' not found in imported namespace 'names'.
const { a, b, c } = names // also reported, only for 'c'
}
// also tunnels through re-exported namespaces!
function deepTrouble() {
doSomethingWith(names.deep.e) // fine
doSomethingWith(names.deep.f) // Reported: 'f' not found in deeply imported namespace 'names.deep'.
}
```
### Options
#### `allowComputed`
Defaults to `false`. When false, will report the following:
```js
/*eslint import/namespace: [2, { allowComputed: false }]*/
import * as a from './a'
function f(x) {
return a[x] // Unable to validate computed reference to imported namespace 'a'.
}
```
When set to `true`, the above computed namespace member reference is allowed, but
still can't be statically analyzed any further.
## Further Reading
- Lee Byron's [ES7] export proposal
- [`import/ignore`] setting
- [`jsnext:main`](Rollup)
[ES7]: https://github.com/leebyron/ecmascript-more-export-from
[`import/ignore`]: ../../README.md#importignore
[`jsnext:main`]: https://github.com/rollup/rollup/wiki/jsnext:main

View file

@ -0,0 +1,87 @@
# import/newline-after-import
Enforces having one or more empty lines after the last top-level import statement or require call.
+(fixable) The `--fix` option on the [command line] automatically fixes problems reported by this rule.
## Rule Details
This rule has one option, `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`.
Valid:
```js
import defaultExport from './foo'
const FOO = 'BAR'
```
```js
import defaultExport from './foo'
import { bar } from 'bar-lib'
const FOO = 'BAR'
```
```js
const FOO = require('./foo')
const BAR = require('./bar')
const BAZ = 1
```
Invalid:
```js
import * as foo from 'foo'
const FOO = 'BAR'
```
```js
import * as foo from 'foo'
const FOO = 'BAR'
import { bar } from 'bar-lib'
```
```js
const FOO = require('./foo')
const BAZ = 1
const BAR = require('./bar')
```
With `count` set to `2` this will be considered valid:
```js
import defaultExport from './foo'
const FOO = 'BAR'
```
With `count` set to `2` these will be considered invalid:
```js
import defaultExport from './foo'
const FOO = 'BAR'
```
```js
import defaultExport from './foo'
const FOO = 'BAR'
```
## Example options usage
```json
{
"rules": {
"import/newline-after-import": ["error", { "count": 2 }]
}
}
```
## When Not To Use It
If you like to visually group module imports with its usage, you don't want to use this rule.

View file

@ -0,0 +1,48 @@
# import/no-absolute-path: Forbid import of modules using absolute paths
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.
## Rule Details
### Fail
```js
import f from '/foo';
import f from '/some/path';
var f = require('/foo');
var f = require('/some/path');
```
### Pass
```js
import _ from 'lodash';
import foo from 'foo';
import foo from './foo';
var _ = require('lodash');
var foo = require('foo');
var foo = require('./foo');
```
### Options
By default, only ES6 imports and CommonJS `require` calls will have this rule enforced.
You may provide an options object providing true/false for any of
- `esmodule`: defaults to `true`
- `commonjs`: defaults to `true`
- `amd`: defaults to `false`
If `{ amd: true }` is provided, dependency paths for AMD-style `define` and `require`
calls will be resolved:
```js
/*eslint import/no-absolute-path: [2, { commonjs: false, amd: true }]*/
define(['/foo'], function (foo) { /*...*/ }) // reported
require(['/foo'], function (foo) { /*...*/ }) // reported
const foo = require('/foo') // ignored because of explicit `commonjs: false`
```

35
node_modules/eslint-plugin-import/docs/rules/no-amd.md generated vendored Normal file
View file

@ -0,0 +1,35 @@
# import/no-amd
Reports `require([array], ...)` and `define([array], ...)` function calls at the
module scope. Will not report if !=2 arguments, or first argument is not a literal array.
Intended for temporary use when migrating to pure ES6 modules.
## Rule Details
This will be reported:
```js
define(["a", "b"], function (a, b) { /* ... */ })
require(["b", "c"], function (b, c) { /* ... */ })
```
CommonJS `require` is still valid.
## When Not To Use It
If you don't mind mixing module systems (sometimes this is useful), you probably
don't want this rule.
It is also fairly noisy if you have a larger codebase that is being transitioned
from AMD to ES6 modules.
## Contributors
Special thanks to @xjamundx for donating his no-define rule as a start to this.
## Further Reading
- [`no-commonjs`](./no-commonjs.md): report CommonJS `require` and `exports`
- Source: https://github.com/xjamundx/eslint-plugin-modules

View file

@ -0,0 +1,73 @@
# import/no-anonymous-default-export
Reports if a module's default export is unnamed. This includes several types of unnamed data types; literals, object expressions, arrays, anonymous functions, arrow functions, and anonymous class declarations.
Ensuring that default exports are named helps improve the grepability of the codebase by encouraging the re-use of the same identifier for the module's default export at its declaration site and at its import sites.
## Options
By default, all types of anonymous default exports are forbidden, but any types can be selectively allowed by toggling them on in the options.
The complete default configuration looks like this.
```js
"import/no-anonymous-default-export": ["error", {
"allowArray": false,
"allowArrowFunction": false,
"allowAnonymousClass": false,
"allowAnonymousFunction": false,
"allowCallExpression": true, // The true value here is for backward compatibility
"allowLiteral": false,
"allowObject": false
}]
```
## Rule Details
### Fail
```js
export default []
export default () => {}
export default class {}
export default function () {}
/* eslint import/no-anonymous-default-export: [2, {"allowCallExpression": false}] */
export default foo(bar)
export default 123
export default {}
```
### Pass
```js
const foo = 123
export default foo
export default class MyClass() {}
export default function foo() {}
/* eslint import/no-anonymous-default-export: [2, {"allowArray": true}] */
export default []
/* eslint import/no-anonymous-default-export: [2, {"allowArrowFunction": true}] */
export default () => {}
/* eslint import/no-anonymous-default-export: [2, {"allowAnonymousClass": true}] */
export default class {}
/* eslint import/no-anonymous-default-export: [2, {"allowAnonymousFunction": true}] */
export default function () {}
export default foo(bar)
/* eslint import/no-anonymous-default-export: [2, {"allowLiteral": true}] */
export default 123
/* eslint import/no-anonymous-default-export: [2, {"allowObject": true}] */
export default {}
```

View file

@ -0,0 +1,95 @@
# import/no-commonjs
Reports `require([string])` function calls. Will not report if >1 argument,
or single argument is not a literal string.
Reports `module.exports` or `exports.*`, also.
Intended for temporary use when migrating to pure ES6 modules.
## Rule Details
This will be reported:
```js
var mod = require('./mod')
, common = require('./common')
, fs = require('fs')
, whateverModule = require('./not-found')
module.exports = { a: "b" }
exports.c = "d"
```
### Allow require
If `allowRequire` option is set to `true`, `require` calls are valid:
```js
/*eslint no-commonjs: [2, { allowRequire: true }]*/
var mod = require('./mod');
```
but `module.exports` is reported as usual.
### Allow conditional require
By default, conditional requires are allowed:
```js
var a = b && require("c")
if (typeof window !== "undefined") {
require('that-ugly-thing');
}
var fs = null;
try {
fs = require("fs")
} catch (error) {}
```
If the `allowConditionalRequire` option is set to `false`, they will be reported.
If you don't rely on synchronous module loading, check out [dynamic import](https://github.com/airbnb/babel-plugin-dynamic-import-node).
### Allow primitive modules
If `allowPrimitiveModules` option is set to `true`, the following is valid:
```js
/*eslint no-commonjs: [2, { allowPrimitiveModules: true }]*/
module.exports = "foo"
module.exports = function rule(context) { return { /* ... */ } }
```
but this is still reported:
```js
/*eslint no-commonjs: [2, { allowPrimitiveModules: true }]*/
module.exports = { x: "y" }
exports.z = function boop() { /* ... */ }
```
This is useful for things like ESLint rule modules, which must export a function as
the module.
## When Not To Use It
If you don't mind mixing module systems (sometimes this is useful), you probably
don't want this rule.
It is also fairly noisy if you have a larger codebase that is being transitioned
from CommonJS to ES6 modules.
## Contributors
Special thanks to @xjamundx for donating the module.exports and exports.* bits.
## Further Reading
- [`no-amd`](./no-amd.md): report on AMD `require`, `define`
- Source: https://github.com/xjamundx/eslint-plugin-modules

View file

@ -0,0 +1,92 @@
# import/no-cycle
Ensures that there is no resolvable path back to this module via its dependencies.
This includes cycles of depth 1 (imported module imports me) to `"∞"` (or `Infinity`), if the
[`maxDepth`](#maxdepth) option is not set.
```js
// dep-b.js
import './dep-a.js'
export function b() { /* ... */ }
```
```js
// dep-a.js
import { b } from './dep-b.js' // reported: Dependency cycle detected.
```
This rule does _not_ detect imports that resolve directly to the linted module;
for that, see [`no-self-import`].
## Rule Details
### Options
By default, this rule only detects cycles for ES6 imports, but see the [`no-unresolved` options](./no-unresolved.md#options) as this rule also supports the same `commonjs` and `amd` flags. However, these flags only impact which import types are _linted_; the
import/export infrastructure only registers `import` statements in dependencies, so
cycles created by `require` within imported modules may not be detected.
#### `maxDepth`
There is a `maxDepth` option available to prevent full expansion of very deep dependency trees:
```js
/*eslint import/no-cycle: [2, { maxDepth: 1 }]*/
// dep-c.js
import './dep-a.js'
```
```js
// dep-b.js
import './dep-c.js'
export function b() { /* ... */ }
```
```js
// dep-a.js
import { b } from './dep-b.js' // not reported as the cycle is at depth 2
```
This is not necessarily recommended, but available as a cost/benefit tradeoff mechanism
for reducing total project lint time, if needed.
#### `ignoreExternal`
An `ignoreExternal` option is available to prevent the cycle detection to expand to external modules:
```js
/*eslint import/no-cycle: [2, { ignoreExternal: true }]*/
// dep-a.js
import 'module-b/dep-b.js'
export function a() { /* ... */ }
```
```js
// node_modules/module-b/dep-b.js
import { a } from './dep-a.js' // not reported as this module is external
```
Its value is `false` by default, but can be set to `true` for reducing total project lint time, if needed.
## When Not To Use It
This rule is comparatively computationally expensive. If you are pressed for lint
time, or don't think you have an issue with dependency cycles, you may not want
this rule enabled.
## Further Reading
- [Original inspiring issue](https://github.com/import-js/eslint-plugin-import/issues/941)
- Rule to detect that module imports itself: [`no-self-import`]
- [`import/external-module-folders`] setting
[`no-self-import`]: ./no-self-import.md
[`import/external-module-folders`]: ../../README.md#importexternal-module-folders

View file

@ -0,0 +1,63 @@
# `import/no-default-export`
Prohibit default exports. Mostly an inverse of [`prefer-default-export`].
[`prefer-default-export`]: ./prefer-default-export.md
## Rule Details
The following patterns are considered warnings:
```javascript
// bad1.js
// There is a default export.
export const foo = 'foo';
const bar = 'bar';
export default 'bar';
```
```javascript
// bad2.js
// There is a default export.
const foo = 'foo';
export { foo as default }
```
The following patterns are not warnings:
```javascript
// good1.js
// There is only a single module export and it's a named export.
export const foo = 'foo';
```
```javascript
// good2.js
// There is more than one named export in the module.
export const foo = 'foo';
export const bar = 'bar';
```
```javascript
// good3.js
// There is more than one named export in the module
const foo = 'foo';
const bar = 'bar';
export { foo, bar }
```
```javascript
// export-star.js
// Any batch export will disable this rule. The remote module is not inspected.
export * from './other-module'
```
## When Not To Use It
If you don't care if default imports are used, or if you prefer default imports over named imports.

View file

@ -0,0 +1,61 @@
# `import/no-deprecated`
Reports use of a deprecated name, as indicated by a JSDoc block with a `@deprecated`
tag or TomDoc `Deprecated: ` comment.
using a JSDoc `@deprecated` tag:
```js
// @file: ./answer.js
/**
* this is what you get when you trust a mouse talk show
* @deprecated need to restart the experiment
* @returns {Number} nonsense
*/
export function multiply(six, nine) {
return 42
}
```
will report as such:
```js
import { multiply } from './answer' // Deprecated: need to restart the experiment
function whatever(y, z) {
return multiply(y, z) // Deprecated: need to restart the experiment
}
```
or using the TomDoc equivalent:
```js
// Deprecated: This is what you get when you trust a mouse talk show, need to
// restart the experiment.
//
// Returns a Number nonsense
export function multiply(six, nine) {
return 42
}
```
Only JSDoc is enabled by default. Other documentation styles can be enabled with
the `import/docstyle` setting.
```yaml
# .eslintrc.yml
settings:
import/docstyle: ['jsdoc', 'tomdoc']
```
### Worklist
- [x] report explicit imports on the import node
- [x] support namespaces
- [x] should bubble up through deep namespaces (#157)
- [x] report explicit imports at reference time (at the identifier) similar to namespace
- [x] mark module deprecated if file JSDoc has a @deprecated tag?
- [ ] don't flag redeclaration of imported, deprecated names
- [ ] flag destructuring

View file

@ -0,0 +1,69 @@
# import/no-duplicates
Reports if a resolved path is imported more than once.
+(fixable) The `--fix` option on the [command line] automatically fixes some problems reported by this rule.
ESLint core has a similar rule ([`no-duplicate-imports`](https://eslint.org/docs/rules/no-duplicate-imports)), but this version
is different in two key ways:
1. the paths in the source code don't have to exactly match, they just have to point to the same module on the filesystem. (i.e. `./foo` and `./foo.js`)
2. this version distinguishes Flow `type` imports from standard imports. ([#334](https://github.com/import-js/eslint-plugin-import/pull/334))
## Rule Details
Valid:
```js
import SomeDefaultClass, * as names from './mod'
// Flow `type` import from same module is fine
import type SomeType from './mod'
```
...whereas here, both `./mod` imports will be reported:
```js
import SomeDefaultClass from './mod'
// oops, some other import separated these lines
import foo from './some-other-mod'
import * as names from './mod'
// will catch this too, assuming it is the same target module
import { something } from './mod.js'
```
The motivation is that this is likely a result of two developers importing different
names from the same module at different times (and potentially largely different
locations in the file.) This rule brings both (or n-many) to attention.
### Query Strings
By default, this rule ignores query strings (i.e. paths followed by a question mark), and thus imports from `./mod?a` and `./mod?b` will be considered as duplicates. However you can use the option `considerQueryString` to handle them as different (primarily because browsers will resolve those imports differently).
Config:
```json
"import/no-duplicates": ["error", {"considerQueryString": true}]
```
And then the following code becomes valid:
```js
import minifiedMod from './mod?minify'
import noCommentsMod from './mod?comments=0'
import originalMod from './mod'
```
It will still catch duplicates when using the same module and the exact same query string:
```js
import SomeDefaultClass from './mod?minify'
// This is invalid, assuming `./mod` and `./mod.js` are the same target:
import * from './mod.js?minify'
```
## When Not To Use It
If the core ESLint version is good enough (i.e. you're _not_ using Flow and you _are_ using [`import/extensions`](./extensions.md)), keep it and don't use this.
If you like to split up imports across lines or may need to import a default and a namespace,
you may not want to enable this rule.

View file

@ -0,0 +1,23 @@
# import/no-dynamic-require: Forbid `require()` calls with expressions
The `require` method from CommonJS is used to import modules from different files. Unlike the ES6 `import` syntax, it can be given expressions that will be resolved at runtime. While this is sometimes necessary and useful, in most cases it isn't. Using expressions (for instance, concatenating a path and variable) as the argument makes it harder for tools to do static code analysis, or to find where in the codebase a module is used.
This rule checks every call to `require()` that uses expressions for the module name argument.
## Rule Details
### Fail
```js
require(name);
require('../' + name);
require(`../${name}`);
require(name());
```
### Pass
```js
require('../name');
require(`../name`);
```

View file

@ -0,0 +1,124 @@
# import/no-extraneous-dependencies: Forbid the use of extraneous packages
Forbid the import of external modules that are not declared in the `package.json`'s `dependencies`, `devDependencies`, `optionalDependencies`, `peerDependencies`, or `bundledDependencies`.
The closest parent `package.json` will be used. If no `package.json` is found, the rule will not lint anything. This behavior can be changed with the rule option `packageDir`.
Modules have to be installed for this rule to work.
### Options
This rule supports the following options:
`devDependencies`: If set to `false`, then the rule will show an error when `devDependencies` are imported. Defaults to `true`.
`optionalDependencies`: If set to `false`, then the rule will show an error when `optionalDependencies` are imported. Defaults to `true`.
`peerDependencies`: If set to `false`, then the rule will show an error when `peerDependencies` are imported. Defaults to `true`.
`bundledDependencies`: If set to `false`, then the rule will show an error when `bundledDependencies` are imported. Defaults to `true`.
You can set the options like this:
```js
"import/no-extraneous-dependencies": ["error", {"devDependencies": false, "optionalDependencies": false, "peerDependencies": false}]
```
You can also use an array of globs instead of literal booleans:
```js
"import/no-extraneous-dependencies": ["error", {"devDependencies": ["**/*.test.js", "**/*.spec.js"]}]
```
When using an array of globs, the setting will be set to `true` (no errors reported) if the name of the file being linted matches a single glob in the array, and `false` otherwise.
Also there is one more option called `packageDir`, this option is to specify the path to the folder containing package.json.
If provided as a relative path string, will be computed relative to the current working directory at linter execution time. If this is not ideal (does not work with some editor integrations), consider using `__dirname` to provide a path relative to your configuration.
```js
"import/no-extraneous-dependencies": ["error", {"packageDir": './some-dir/'}]
// or
"import/no-extraneous-dependencies": ["error", {"packageDir": path.join(__dirname, 'some-dir')}]
```
It may also be an array of multiple paths, to support monorepos or other novel project
folder layouts:
```js
"import/no-extraneous-dependencies": ["error", {"packageDir": ['./some-dir/', './root-pkg']}]
```
## Rule Details
Given the following `package.json`:
```json
{
"name": "my-project",
"...": "...",
"dependencies": {
"builtin-modules": "^1.1.1",
"lodash.cond": "^4.2.0",
"lodash.find": "^4.2.0",
"pkg-up": "^1.0.0"
},
"devDependencies": {
"ava": "^0.13.0",
"eslint": "^2.4.0",
"eslint-plugin-ava": "^1.3.0",
"xo": "^0.13.0"
},
"optionalDependencies": {
"lodash.isarray": "^4.0.0"
},
"peerDependencies": {
"react": ">=15.0.0 <16.0.0"
},
"bundledDependencies": [
"@generated/foo",
]
}
```
## Fail
```js
var _ = require('lodash');
import _ from 'lodash';
import react from 'react';
/* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": false}] */
import test from 'ava';
var test = require('ava');
/* eslint import/no-extraneous-dependencies: ["error", {"optionalDependencies": false}] */
import isArray from 'lodash.isarray';
var isArray = require('lodash.isarray');
/* eslint import/no-extraneous-dependencies: ["error", {"bundledDependencies": false}] */
import foo from '"@generated/foo"';
var foo = require('"@generated/foo"');
```
## Pass
```js
// Builtin and internal modules are fine
var path = require('path');
var foo = require('./foo');
import test from 'ava';
import find from 'lodash.find';
import isArray from 'lodash.isarray';
import foo from '"@generated/foo"';
/* eslint import/no-extraneous-dependencies: ["error", {"peerDependencies": true}] */
import react from 'react';
```
## When Not To Use It
If you do not have a `package.json` file in your project.

View file

@ -0,0 +1,74 @@
# no-import-module-exports
Reports the use of import declarations with CommonJS exports in any module
except for the [main module](https://docs.npmjs.com/files/package.json#main).
If you have multiple entry points or are using `js:next` this rule includes an
`exceptions` option which you can use to exclude those files from the rule.
## Options
#### `exceptions`
- An array of globs. The rule will be omitted from any file that matches a glob
in the options array. For example, the following setting will omit the rule
in the `some-file.js` file.
```json
"import/no-import-module-exports": ["error", {
"exceptions": ["**/*/some-file.js"]
}]
```
## Rule Details
### Fail
```js
import { stuff } from 'starwars'
module.exports = thing
import * as allThings from 'starwars'
exports.bar = thing
import thing from 'other-thing'
exports.foo = bar
import thing from 'starwars'
const baz = module.exports = thing
console.log(baz)
```
### Pass
Given the following package.json:
```json
{
"main": "lib/index.js",
}
```
```js
import thing from 'other-thing'
export default thing
const thing = require('thing')
module.exports = thing
const thing = require('thing')
exports.foo = bar
import thing from 'otherthing'
console.log(thing.module.exports)
// in lib/index.js
import foo from 'path';
module.exports = foo;
// in some-file.js
// eslint import/no-import-module-exports: ["error", {"exceptions": ["**/*/some-file.js"]}]
import foo from 'path';
module.exports = foo;
```
### Further Reading
- [webpack issue #4039](https://github.com/webpack/webpack/issues/4039)

View file

@ -0,0 +1,132 @@
# import/no-internal-modules
Use this rule to prevent importing the submodules of other modules.
## Rule Details
This rule has two mutally exclusive options that are arrays of [minimatch/glob patterns](https://github.com/isaacs/node-glob#glob-primer) patterns:
- `allow` that include paths and import statements that can be imported with reaching.
- `forbid` that exclude paths and import statements that can be imported with reaching.
### Examples
Given the following folder structure:
```
my-project
├── actions
│ └── getUser.js
│ └── updateUser.js
├── reducer
│ └── index.js
│ └── user.js
├── redux
│ └── index.js
│ └── configureStore.js
└── app
│ └── index.js
│ └── settings.js
└── entry.js
```
And the .eslintrc file:
```
{
...
"rules": {
"import/no-internal-modules": [ "error", {
"allow": [ "**/actions/*", "source-map-support/*" ],
} ]
}
}
```
The following patterns are considered problems:
```js
/**
* in my-project/entry.js
*/
import { settings } from './app/index'; // Reaching to "./app/index" is not allowed
import userReducer from './reducer/user'; // Reaching to "./reducer/user" is not allowed
import configureStore from './redux/configureStore'; // Reaching to "./redux/configureStore" is not allowed
export { settings } from './app/index'; // Reaching to "./app/index" is not allowed
export * from './reducer/user'; // Reaching to "./reducer/user" is not allowed
```
The following patterns are NOT considered problems:
```js
/**
* in my-project/entry.js
*/
import 'source-map-support/register';
import { settings } from '../app';
import getUser from '../actions/getUser';
export * from 'source-map-support/register';
export { settings } from '../app';
```
Given the following folder structure:
```
my-project
├── actions
│ └── getUser.js
│ └── updateUser.js
├── reducer
│ └── index.js
│ └── user.js
├── redux
│ └── index.js
│ └── configureStore.js
└── app
│ └── index.js
│ └── settings.js
└── entry.js
```
And the .eslintrc file:
```
{
...
"rules": {
"import/no-internal-modules": [ "error", {
"forbid": [ "**/actions/*", "source-map-support/*" ],
} ]
}
}
```
The following patterns are considered problems:
```js
/**
* in my-project/entry.js
*/
import 'source-map-support/register';
import getUser from '../actions/getUser';
export * from 'source-map-support/register';
export getUser from '../actions/getUser';
```
The following patterns are NOT considered problems:
```js
/**
* in my-project/entry.js
*/
import 'source-map-support';
import { getUser } from '../actions';
export * from 'source-map-support';
export { getUser } from '../actions';
```

View file

@ -0,0 +1,52 @@
# import/no-mutable-exports
Forbids the use of mutable exports with `var` or `let`.
## Rule Details
Valid:
```js
export const count = 1
export function getCount() {}
export class Counter {}
```
...whereas here exports will be reported:
```js
export let count = 2
export var count = 3
let count = 4
export { count } // reported here
```
## Functions/Classes
Note that exported function/class declaration identifiers may be reassigned,
but are not flagged by this rule at this time. They may be in the future, if a
reassignment is detected, i.e.
```js
// possible future behavior!
export class Counter {} // reported here: exported class is reassigned on line [x].
Counter = KitchenSink // not reported here unless you enable no-class-assign
// this pre-declaration reassignment is valid on account of function hoisting
getCount = function getDuke() {} // not reported here without no-func-assign
export function getCount() {} // reported here: exported function is reassigned on line [x].
```
To prevent general reassignment of these identifiers, exported or not, you may
want to enable the following core ESLint rules:
- [no-func-assign]
- [no-class-assign]
[no-func-assign]: https://eslint.org/docs/rules/no-func-assign
[no-class-assign]: https://eslint.org/docs/rules/no-class-assign
## When Not To Use It
If your environment correctly implements mutable export bindings.

View file

@ -0,0 +1,47 @@
# import/no-named-as-default-member
Reports use of an exported name as a property on the default export.
Rationale: Accessing a property that has a name that is shared by an exported
name from the same module is likely to be a mistake.
Named import syntax looks very similar to destructuring assignment. It's easy to
make the (incorrect) assumption that named exports are also accessible as
properties of the default export.
Furthermore, [in Babel 5 this is actually how things worked][blog]. This was
fixed in Babel 6. Before upgrading an existing codebase to Babel 6, it can be
useful to run this lint rule.
[blog]: https://kentcdodds.com/blog/misunderstanding-es6-modules-upgrading-babel-tears-and-a-solution
## Rule Details
Given:
```js
// foo.js
export default 'foo';
export const bar = 'baz';
```
...this would be valid:
```js
import foo, {bar} from './foo.js';
```
...and the following would be reported:
```js
// Caution: `foo` also has a named export `bar`.
// Check if you meant to write `import {bar} from './foo.js'` instead.
import foo from './foo.js';
const bar = foo.bar;
```
```js
// Caution: `foo` also has a named export `bar`.
// Check if you meant to write `import {bar} from './foo.js'` instead.
import foo from './foo.js';
const {bar} = foo;
```

View file

@ -0,0 +1,46 @@
# import/no-named-as-default
Reports use of an exported name as the locally imported name of a default export.
Rationale: using an exported name as the name of the default export is likely...
- *misleading*: others familiar with `foo.js` probably expect the name to be `foo`
- *a mistake*: only needed to import `bar` and forgot the brackets (the case that is prompting this)
## Rule Details
Given:
```js
// foo.js
export default 'foo';
export const bar = 'baz';
```
...this would be valid:
```js
import foo from './foo.js';
```
...and this would be reported:
```js
// message: Using exported name 'bar' as identifier for default export.
import bar from './foo.js';
```
For post-ES2015 `export` extensions, this also prevents exporting the default from a referenced module as a name within that module, for the same reasons:
```js
// valid:
export foo from './foo.js';
// message: Using exported name 'bar' as identifier for default export.
export bar from './foo.js';
```
## Further Reading
- ECMAScript Proposal: [export ns from]
- ECMAScript Proposal: [export default from]
[export ns from]: https://github.com/leebyron/ecmascript-export-ns-from
[export default from]: https://github.com/leebyron/ecmascript-export-default-from

View file

@ -0,0 +1,31 @@
# import/no-named-default
Reports use of a default export as a locally named import.
Rationale: the syntax exists to import default exports expressively, let's use it.
Note that type imports, as used by [Flow], are always ignored.
[Flow]: https://flow.org/
## Rule Details
Given:
```js
// foo.js
export default 'foo';
export const bar = 'baz';
```
...these would be valid:
```js
import foo from './foo.js';
import foo, { bar } from './foo.js';
```
...and these would be reported:
```js
// message: Using exported name 'bar' as identifier for default export.
import { default as foo } from './foo.js';
import { default as foo, bar } from './foo.js';
```

View file

@ -0,0 +1,77 @@
# `import/no-named-export`
Prohibit named exports. Mostly an inverse of [`no-default-export`].
[`no-default-export`]: ./no-default-export.md
## Rule Details
The following patterns are considered warnings:
```javascript
// bad1.js
// There is only a single module export and it's a named export.
export const foo = 'foo';
```
```javascript
// bad2.js
// There is more than one named export in the module.
export const foo = 'foo';
export const bar = 'bar';
```
```javascript
// bad3.js
// There is more than one named export in the module.
const foo = 'foo';
const bar = 'bar';
export { foo, bar }
```
```javascript
// bad4.js
// There is more than one named export in the module.
export * from './other-module'
```
```javascript
// bad5.js
// There is a default and a named export.
export const foo = 'foo';
const bar = 'bar';
export default 'bar';
```
The following patterns are not warnings:
```javascript
// good1.js
// There is only a single module export and it's a default export.
export default 'bar';
```
```javascript
// good2.js
// There is only a single module export and it's a default export.
const foo = 'foo';
export { foo as default }
```
```javascript
// good3.js
// There is only a single module export and it's a default export.
export default from './other-module';
```
## When Not To Use It
If you don't care if named imports are used, or if you prefer named imports over default imports.

View file

@ -0,0 +1,41 @@
# import/no-namespace
Enforce a convention of not using namespace (a.k.a. "wildcard" `*`) imports.
+(fixable) The `--fix` option on the [command line] automatically fixes problems reported by this rule, provided that the namespace object is only used for direct member access, e.g. `namespace.a`.
The `--fix` functionality for this rule requires ESLint 5 or newer.
### Options
This rule supports the following options:
- `ignore`: array of glob strings for modules that should be ignored by the rule.
## Rule Details
Valid:
```js
import defaultExport from './foo'
import { a, b } from './bar'
import defaultExport, { a, b } from './foobar'
```
```js
/* eslint import/no-namespace: ["error", {ignore: ['*.ext']}] */
import * as bar from './ignored-module.ext';
```
Invalid:
```js
import * as foo from 'foo';
```
```js
import defaultExport, * as foo from 'foo';
```
## When Not To Use It
If you want to use namespaces, you don't want to use this rule.

View file

@ -0,0 +1,40 @@
# import/no-nodejs-modules: No Node.js builtin modules
Forbid the use of Node.js builtin modules. Can be useful for client-side web projects that do not have access to those modules.
### Options
This rule supports the following options:
- `allow`: Array of names of allowed modules. Defaults to an empty array.
## Rule Details
### Fail
```js
import fs from 'fs';
import path from 'path';
var fs = require('fs');
var path = require('path');
```
### Pass
```js
import _ from 'lodash';
import foo from 'foo';
import foo from './foo';
var _ = require('lodash');
var foo = require('foo');
var foo = require('./foo');
/* eslint import/no-nodejs-modules: ["error", {"allow": ["path"]}] */
import path from 'path';
```
## When Not To Use It
If you have a project that is run mainly or partially using Node.js.

View file

@ -0,0 +1,66 @@
# import/no-relative-packages
Use this rule to prevent importing packages through relative paths.
It's useful in Yarn/Lerna workspaces, were it's possible to import a sibling
package using `../package` relative path, while direct `package` is the correct one.
### Examples
Given the following folder structure:
```
my-project
├── packages
│ ├── foo
│ │ ├── index.js
│ │ └── package.json
│ └── bar
│ ├── index.js
│ └── package.json
└── entry.js
```
And the .eslintrc file:
```
{
...
"rules": {
"import/no-relative-packages": "error"
}
}
```
The following patterns are considered problems:
```js
/**
* in my-project/packages/foo.js
*/
import bar from '../bar'; // Import sibling package using relative path
import entry from '../../entry.js'; // Import from parent package using relative path
/**
* in my-project/entry.js
*/
import bar from './packages/bar'; // Import child package using relative path
```
The following patterns are NOT considered problems:
```js
/**
* in my-project/packages/foo.js
*/
import bar from 'bar'; // Import sibling package using package name
/**
* in my-project/entry.js
*/
import bar from 'bar'; // Import sibling package using package name
```

View file

@ -0,0 +1,120 @@
# import/no-relative-parent-imports
Use this rule to prevent imports to folders in relative parent paths.
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.
To fix violations of this rule there are three general strategies. Given this example:
```
numbers
└── three.js
add.js
```
```js
// ./add.js
export default function (numbers) {
return numbers.reduce((sum, n) => sum + n, 0);
}
// ./numbers/three.js
import add from '../add'; // violates import/no-relative-parent-imports
export default function three() {
return add([1, 2]);
}
```
You can,
1. Move the file to be in a sibling folder (or higher) of the dependency.
`three.js` could be be in the same folder as `add.js`:
```
three.js
add.js
```
or since `add` doesn't have any imports, it could be in it's own directory (namespace):
```
math
└── add.js
three.js
```
2. Pass the dependency as an argument at runtime (dependency injection)
```js
// three.js
export default function three(add) {
return add([1, 2]);
}
// somewhere else when you use `three.js`:
import add from './add';
import three from './numbers/three';
console.log(three(add));
```
3. Make the dependency a package so it's globally available to all files in your project:
```js
import add from 'add'; // from https://www.npmjs.com/package/add
export default function three() {
return add([1,2]);
}
```
These are (respectively) static, dynamic & global solutions to graph-like dependency resolution.
### Examples
Given the following folder structure:
```
my-project
├── lib
│ ├── a.js
│ └── b.js
└── main.js
```
And the .eslintrc file:
```
{
...
"rules": {
"import/no-relative-parent-imports": "error"
}
}
```
The following patterns are considered problems:
```js
/**
* in my-project/lib/a.js
*/
import bar from '../main'; // Import parent file using a relative path
```
The following patterns are NOT considered problems:
```js
/**
* in my-project/main.js
*/
import foo from 'foo'; // Import package using module path
import a from './lib/a'; // Import child file using relative path
/**
* in my-project/lib/a.js
*/
import b from './b'; // Import sibling file using relative path
```

View file

@ -0,0 +1,126 @@
# import/no-restricted-paths: Restrict which files can be imported in a given folder
Some projects contain files which are not always meant to be executed in the same environment.
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 dont want to import server-only files in your client code.
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.
## Rule Details
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.
The default value for `basePath` is the current working directory.
Each zone consists of the `target` path, a `from` path, and an optional `except` and `message` attribute.
- `target` is the path where the restricted imports should be applied. It can be expressed by
- directory string path that matches all its containing files
- glob pattern matching all the targeted files
- `from` path defines the folder that is not allowed to be used in an import. It can be expressed by
- directory string path that matches all its containing files
- glob pattern matching all the files restricted to be imported
- `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.
- in case `from` is a glob pattern, `except` must be an array of glob patterns as well
- in case `from` is a directory path, `except` is relative to `from` and cannot backtrack to a parent directory.
- `message` - will be displayed in case of the rule violation.
### Examples
Given the following folder structure:
```
my-project
├── client
│ └── foo.js
│ └── baz.js
└── server
└── bar.js
```
and the current file being linted is `my-project/client/foo.js`.
The following patterns are considered problems when configuration set to `{ "zones": [ { "target": "./client", "from": "./server" } ] }`:
```js
import bar from '../server/bar';
```
The following patterns are not considered problems when configuration set to `{ "zones": [ { "target": "./client", "from": "./server" } ] }`:
```js
import baz from '../client/baz';
```
---------------
Given the following folder structure:
```
my-project
├── client
│ └── foo.js
│ └── baz.js
└── server
├── one
│ └── a.js
│ └── b.js
└── two
```
and the current file being linted is `my-project/server/one/a.js`.
and the current configuration is set to:
```
{ "zones": [ {
"target": "./tests/files/restricted-paths/server/one",
"from": "./tests/files/restricted-paths/server",
"except": ["./one"]
} ] }
```
The following pattern is considered a problem:
```js
import a from '../two/a'
```
The following pattern is not considered a problem:
```js
import b from './b'
```
---------------
Given the following folder structure:
```
my-project
├── client
└── foo.js
└── sub-module
└── bar.js
└── baz.js
```
and the current configuration is set to:
```
{ "zones": [ {
"target": "./tests/files/restricted-paths/client/!(sub-module)/**/*",
"from": "./tests/files/restricted-paths/client/sub-module/**/*",
} ] }
```
The following import is considered a problem in `my-project/client/foo.js`:
```js
import a from './sub-module/baz'
```
The following import is not considered a problem in `my-project/client/sub-module/bar.js`:
```js
import b from './baz'
```

View file

@ -0,0 +1,30 @@
# Forbid a module from importing itself (`import/no-self-import`)
Forbid a module from importing itself. This can sometimes happen during refactoring.
## Rule Details
### Fail
```js
// foo.js
import foo from './foo';
const foo = require('./foo');
```
```js
// index.js
import index from '.';
const index = require('.');
```
### Pass
```js
// foo.js
import bar from './bar';
const bar = require('./bar');
```

View file

@ -0,0 +1,59 @@
# import/no-unassigned-import: Forbid unassigned imports
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:
- The module is imported but not used
- 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.
This rule aims to remove modules with side-effects by reporting when a module is imported but not assigned.
### Options
This rule supports the following option:
`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).
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.
## Fail
```js
import 'should'
require('should')
// In <PROJECT_ROOT>/src/app.js
import '../styles/app.css'
// {"allow": ["styles/*.css"]}
```
## Pass
```js
import _ from 'foo'
import _, {foo} from 'foo'
import _, {foo as bar} from 'foo'
import {foo as bar} from 'foo'
import * as _ from 'foo'
const _ = require('foo')
const {foo} = require('foo')
const {foo: bar} = require('foo')
const [a, b] = require('foo')
const _ = require('foo')
// Module is not assigned, but it is used
bar(require('foo'))
require('foo').bar
require('foo').bar()
require('foo')()
// With allow option set
import './style.css' // {"allow": ["**/*.css"]}
import 'babel-register' // {"allow": ["babel-register"]}
// In <PROJECT_ROOT>/src/app.js
import './styles/app.css'
import '../scripts/register.js'
// {"allow": ["src/styles/**", "**/scripts/*.js"]}
```

View file

@ -0,0 +1,106 @@
# import/no-unresolved
Ensures an imported module can be resolved to a module on the local filesystem,
as defined by standard Node `require.resolve` behavior.
See [settings](../../README.md#settings) for customization options for the resolution (i.e.
additional filetypes, `NODE_PATH`, etc.)
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) {...})`.
To enable this, send `{ commonjs: true/false, amd: true/false }` as a rule option.
Both are disabled by default.
If you are using Webpack, see the section on [resolvers](../../README.md#resolvers).
## Rule Details
### Options
By default, only ES6 imports will be resolved:
```js
/*eslint import/no-unresolved: 2*/
import x from './foo' // reports if './foo' cannot be resolved on the filesystem
```
If `{commonjs: true}` is provided, single-argument `require` calls will be resolved:
```js
/*eslint import/no-unresolved: [2, { commonjs: true }]*/
const { default: x } = require('./foo') // reported if './foo' is not found
require(0) // ignored
require(['x', 'y'], function (x, y) { /*...*/ }) // ignored
```
Similarly, if `{ amd: true }` is provided, dependency paths for `define` and `require`
calls will be resolved:
```js
/*eslint import/no-unresolved: [2, { amd: true }]*/
define(['./foo'], function (foo) { /*...*/ }) // reported if './foo' is not found
require(['./foo'], function (foo) { /*...*/ }) // reported if './foo' is not found
const { default: x } = require('./foo') // ignored
```
Both may be provided, too:
```js
/*eslint import/no-unresolved: [2, { commonjs: true, amd: true }]*/
const { default: x } = require('./foo') // reported if './foo' is not found
define(['./foo'], function (foo) { /*...*/ }) // reported if './foo' is not found
require(['./foo'], function (foo) { /*...*/ }) // reported if './foo' is not found
```
#### `ignore`
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`].
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:
```js
/*eslint import/no-unresolved: [2, { ignore: ['\.img$'] }]*/
import { x } from './mod' // may be reported, if not resolved to a module
import coolImg from '../../img/coolImg.img' // will not be reported, even if not found
```
#### `caseSensitive`
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`.
```js
/*eslint import/no-unresolved: [2, { caseSensitive: true (default) | false }]*/
const { default: x } = require('./foo') // reported if './foo' is actually './Foo' and caseSensitive: true
```
#### `caseSensitiveStrict`
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.
```js
/*eslint import/no-unresolved: [2, { caseSensitiveStrict: true }]*/
// Absolute paths
import Foo from `/Users/fOo/bar/file.js` // reported, /Users/foo/bar/file.js
import Foo from `d:/fOo/bar/file.js` // reported, d:/foo/bar/file.js
// Relative paths, cwd is Users/foo/
import Foo from `./../fOo/bar/file.js` // reported
```
## When Not To Use It
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.
## Further Reading
- [Resolver plugins](../../README.md#resolver-plugins)
- [Node resolver](https://npmjs.com/package/eslint-import-resolver-node) (default)
- [Webpack resolver](https://npmjs.com/package/eslint-import-resolver-webpack)
- [`import/ignore`] global setting
[`import/ignore`]: ../../README.md#importignore

View file

@ -0,0 +1,107 @@
# import/no-unused-modules
Reports:
- modules without any exports
- individual exports not being statically `import`ed or `require`ed from other modules in the same project
- dynamic imports are supported if argument is a literal string
## Rule Details
### Usage
In order for this plugin to work, 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)
Example:
```
"rules: {
...otherRules,
"import/no-unused-modules": [1, {"unusedExports": true}]
}
```
### Options
This rule takes the following option:
- **`missingExports`**: if `true`, files without any exports are reported (defaults to `false`)
- **`unusedExports`**: if `true`, exports without any static usage within other modules are reported (defaults to `false`)
- `src`: an array with files/paths to be analyzed. It only applies to unused exports. Defaults to `process.cwd()`, if not provided
- `ignoreExports`: an array with files/paths for which unused exports will not be reported (e.g module entry points in a published package)
### Example for missing exports
#### The following will be reported
```js
const class MyClass { /*...*/ }
function makeClass() { return new MyClass(...arguments) }
```
#### The following will not be reported
```js
export default function () { /*...*/ }
```
```js
export const foo = function () { /*...*/ }
```
```js
export { foo, bar }
```
```js
export { foo as bar }
```
### Example for unused exports
given file-f:
```js
import { e } from 'file-a'
import { f } from 'file-b'
import * as fileC from 'file-c'
export { default, i0 } from 'file-d' // both will be reported
export const j = 99 // will be reported
```
and file-d:
```js
export const i0 = 9 // will not be reported
export const i1 = 9 // will be reported
export default () => {} // will not be reported
```
and file-c:
```js
export const h = 8 // will not be reported
export default () => {} // will be reported, as export * only considers named exports and ignores default exports
```
and file-b:
```js
import two, { b, c, doAnything } from 'file-a'
export const f = 6 // will not be reported
```
and file-a:
```js
const b = 2
const c = 3
const d = 4
export const a = 1 // will be reported
export { b, c } // will not be reported
export { d as e } // will not be reported
export function doAnything() {
// some code
} // will not be reported
export default 5 // will not be reported
```
#### Important Note
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`
## When not to use
If you don't mind having unused files or dead code within your codebase, you can disable this rule

View 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`.

View file

@ -0,0 +1,36 @@
# import/no-webpack-loader-syntax
Forbid Webpack loader syntax in imports.
[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:
```js
var moduleWithOneLoader = require("my-loader!./my-awesome-module");
```
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).
## Rule Details
### Fail
```js
import myModule from 'my-loader!my-module';
import theme from 'style!css!./theme.css';
var myModule = require('my-loader!./my-module');
var theme = require('style!css!./theme.css');
```
### Pass
```js
import myModule from 'my-module';
import theme from './theme.css';
var myModule = require('my-module');
var theme = require('./theme.css');
```
## When Not To Use It
If you have a project that doesn't use Webpack you can safely disable this rule.

315
node_modules/eslint-plugin-import/docs/rules/order.md generated vendored Normal file
View file

@ -0,0 +1,315 @@
# import/order: Enforce a convention in module import order
Enforce a convention in the order of `require()` / `import` statements.
+(fixable) The `--fix` option on the [command line] automatically fixes problems reported by this rule.
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:
```js
// 1. node "builtin" modules
import fs from 'fs';
import path from 'path';
// 2. "external" modules
import _ from 'lodash';
import chalk from 'chalk';
// 3. "internal" modules
// (if you have configured your path or webpack to handle your internal paths differently)
import foo from 'src/foo';
// 4. modules from a "parent" directory
import foo from '../foo';
import qux from '../../foo/qux';
// 5. "sibling" modules from the same or a sibling's directory
import bar from './bar';
import baz from './bar/baz';
// 6. "index" of the current directory
import main from './';
// 7. "object"-imports (only available in TypeScript)
import log = console.log;
// 8. "type" imports (only available in Flow and TypeScript)
import type { Foo } from 'foo';
```
Unassigned imports are ignored, as the order they are imported in may be important.
Statements using the ES6 `import` syntax must appear before any `require()` statements.
## Fail
```js
import _ from 'lodash';
import path from 'path'; // `path` import should occur before import of `lodash`
// -----
var _ = require('lodash');
var path = require('path'); // `path` import should occur before import of `lodash`
// -----
var path = require('path');
import foo from './foo'; // `import` statements must be before `require` statement
```
## Pass
```js
import path from 'path';
import _ from 'lodash';
// -----
var path = require('path');
var _ = require('lodash');
// -----
// Allowed as ̀`babel-register` is not assigned.
require('babel-register');
var path = require('path');
// -----
// Allowed as `import` must be before `require`
import foo from './foo';
var path = require('path');
```
## Options
This rule supports the following options:
### `groups: [array]`:
How groups are defined, and the order to respect. `groups` must be an array of `string` or [`string`]. The only allowed `string`s are:
`"builtin"`, `"external"`, `"internal"`, `"unknown"`, `"parent"`, `"sibling"`, `"index"`, `"object"`, `"type"`.
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:
```js
[
'builtin', // Built-in types are first
['sibling', 'parent'], // Then sibling and parent types. They can be mingled together
'index', // Then the index file
'object',
// Then the rest: internal and external type
]
```
The default value is `["builtin", "external", "parent", "sibling", "index"]`.
You can set the options like this:
```js
"import/order": ["error", {"groups": ["index", "sibling", "parent", "internal", "external", "builtin", "object", "type"]}]
```
### `pathGroups: [array of objects]`:
To be able to group by paths mostly needed with aliases pathGroups can be defined.
Properties of the objects
| property | required | type | description |
|----------------|:--------:|--------|---------------|
| pattern | x | string | minimatch pattern for the paths to be in this group (will not be used for builtins or externals) |
| patternOptions | | object | options for minimatch, default: { nocomment: true } |
| group | x | string | one of the allowed groups, the pathGroup will be positioned relative to this group |
| 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 |
```json
{
"import/order": ["error", {
"pathGroups": [
{
"pattern": "~/**",
"group": "external"
}
]
}]
}
```
### `pathGroupsExcludedImportTypes: [array]`:
This defines import types that are not handled by configured pathGroups.
This is mostly needed when you want to handle path groups that look like external imports.
Example:
```json
{
"import/order": ["error", {
"pathGroups": [
{
"pattern": "@app/**",
"group": "external",
"position": "after"
}
],
"pathGroupsExcludedImportTypes": ["builtin"]
}]
}
```
You can also use `patterns`(e.g., `react`, `react-router-dom`, etc).
Example:
```json
{
"import/order": [
"error",
{
"pathGroups": [
{
"pattern": "react",
"group": "builtin",
"position": "before"
}
],
"pathGroupsExcludedImportTypes": ["react"]
}
]
}
```
The default value is `["builtin", "external"]`.
### `newlines-between: [ignore|always|always-and-inside-groups|never]`:
Enforces or forbids new lines between import groups:
- If set to `ignore`, no errors related to new lines between import groups will be reported (default).
- 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.
- If set to `always-and-inside-groups`, it will act like `always` except newlines are allowed inside import groups.
- If set to `never`, no new lines are allowed in the entire import section.
With the default group setting, the following will be invalid:
```js
/* eslint import/order: ["error", {"newlines-between": "always"}] */
import fs from 'fs';
import path from 'path';
import index from './';
import sibling from './foo';
```
```js
/* eslint import/order: ["error", {"newlines-between": "always-and-inside-groups"}] */
import fs from 'fs';
import path from 'path';
import index from './';
import sibling from './foo';
```
```js
/* eslint import/order: ["error", {"newlines-between": "never"}] */
import fs from 'fs';
import path from 'path';
import index from './';
import sibling from './foo';
```
while those will be valid:
```js
/* eslint import/order: ["error", {"newlines-between": "always"}] */
import fs from 'fs';
import path from 'path';
import index from './';
import sibling from './foo';
```
```js
/* eslint import/order: ["error", {"newlines-between": "always-and-inside-groups"}] */
import fs from 'fs';
import path from 'path';
import index from './';
import sibling from './foo';
```
```js
/* eslint import/order: ["error", {"newlines-between": "never"}] */
import fs from 'fs';
import path from 'path';
import index from './';
import sibling from './foo';
```
### `alphabetize: {order: asc|desc|ignore, caseInsensitive: true|false}`:
Sort the order within each group in alphabetical manner based on **import path**:
- `order`: use `asc` to sort in ascending order, and `desc` to sort in descending order (default: `ignore`).
- `caseInsensitive`: use `true` to ignore case, and `false` to consider case (default: `false`).
Example setting:
```js
alphabetize: {
order: 'asc', /* sort in ascending order. Options: ['ignore', 'asc', 'desc'] */
caseInsensitive: true /* ignore case. Options: [true, false] */
}
```
This will fail the rule check:
```js
/* eslint import/order: ["error", {"alphabetize": {"order": "asc", "caseInsensitive": true}}] */
import React, { PureComponent } from 'react';
import aTypes from 'prop-types';
import { compose, apply } from 'xcompose';
import * as classnames from 'classnames';
import blist from 'BList';
```
While this will pass:
```js
/* eslint import/order: ["error", {"alphabetize": {"order": "asc", "caseInsensitive": true}}] */
import blist from 'BList';
import * as classnames from 'classnames';
import aTypes from 'prop-types';
import React, { PureComponent } from 'react';
import { compose, apply } from 'xcompose';
```
### `warnOnUnassignedImports: true|false`:
* default: `false`
Warns when unassigned imports are out of order. These warning will not be fixed
with `--fix` because unassigned imports are used for side-effects and changing the
import of order of modules with side effects can not be done automatically in a
way that is safe.
This will fail the rule check:
```js
/* eslint import/order: ["error", {"warnOnUnassignedImports": true}] */
import fs from 'fs';
import './styles.css';
import path from 'path';
```
While this will pass:
```js
/* eslint import/order: ["error", {"warnOnUnassignedImports": true}] */
import fs from 'fs';
import path from 'path';
import './styles.css';
```
## Related
- [`import/external-module-folders`] setting
- [`import/internal-regex`] setting
[`import/external-module-folders`]: ../../README.md#importexternal-module-folders
[`import/internal-regex`]: ../../README.md#importinternal-regex

View file

@ -0,0 +1,58 @@
# import/prefer-default-export
When there is only a single export from a module, prefer using default export over named export.
## Rule Details
The following patterns are considered warnings:
```javascript
// bad.js
// There is only a single module export and it's a named export.
export const foo = 'foo';
```
The following patterns are not warnings:
```javascript
// good1.js
// There is a default export.
export const foo = 'foo';
const bar = 'bar';
export default 'bar';
```
```javascript
// good2.js
// There is more than one named export in the module.
export const foo = 'foo';
export const bar = 'bar';
```
```javascript
// good3.js
// There is more than one named export in the module
const foo = 'foo';
const bar = 'bar';
export { foo, bar }
```
```javascript
// good4.js
// There is a default export.
const foo = 'foo';
export { foo as default }
```
```javascript
// export-star.js
// Any batch export will disable this rule. The remote module is not inspected.
export * from './other-module'
```

View file

@ -0,0 +1,54 @@
# import/unambiguous
Warn if a `module` could be mistakenly parsed as a `script` by a consumer leveraging
[Unambiguous JavaScript Grammar] to determine correct parsing goal.
Will respect the [`parserOptions.sourceType`] from ESLint config, i.e. files parsed
as `script` per that setting will not be reported.
This plugin uses [Unambiguous JavaScript Grammar] internally to decide whether
dependencies should be parsed as modules and searched for exports matching the
`import`ed names, so it may be beneficial to keep this rule on even if your application
will run in an explicit `module`-only environment.
## Rule Details
For files parsed as `module` by ESLint, the following are valid:
```js
import 'foo'
function x() { return 42 }
```
```js
export function x() { return 42 }
```
```js
(function x() { return 42 })()
export {} // simple way to mark side-effects-only file as 'module' without any imports/exports
```
...whereas the following file would be reported:
```js
(function x() { return 42 })()
```
## When Not To Use It
If your application environment will always know via [some other means](https://github.com/nodejs/node-eps/issues/13)
how to parse, regardless of syntax, you may not need this rule.
Remember, though, that this plugin uses this strategy internally, so if you were
to `import` from a module with no `import`s or `export`s, this plugin would not
report it as it would not be clear whether it should be considered a `script` or
a `module`.
## Further Reading
- [Unambiguous JavaScript Grammar]
- [`parserOptions.sourceType`]
- [node-eps#13](https://github.com/nodejs/node-eps/issues/13)
[`parserOptions.sourceType`]: https://eslint.org/docs/user-guide/configuring#specifying-parser-options
[Unambiguous JavaScript Grammar]: https://github.com/nodejs/node-eps/blob/HEAD/002-es-modules.md#32-determining-if-source-is-an-es-module

834
node_modules/eslint-plugin-import/lib/ExportMap.js generated vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,23 @@
'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports.
getContextPackagePath = getContextPackagePath;exports.
getFilePackagePath = getFilePackagePath;exports.
getFilePackageName = getFilePackageName;var _path = require('path');var _pkgUp = require('eslint-module-utils/pkgUp');var _pkgUp2 = _interopRequireDefault(_pkgUp);var _readPkgUp2 = require('eslint-module-utils/readPkgUp');var _readPkgUp3 = _interopRequireDefault(_readPkgUp2);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}function getContextPackagePath(context) {return getFilePackagePath(context.getPhysicalFilename ? context.getPhysicalFilename() : context.getFilename());}function getFilePackagePath(filePath) {var fp = (0, _pkgUp2['default'])({ cwd: filePath });return (0, _path.dirname)(fp);}function getFilePackageName(filePath) {var _readPkgUp =
(0, _readPkgUp3['default'])({ cwd: filePath, normalize: false }),pkg = _readPkgUp.pkg,path = _readPkgUp.path;
if (pkg) {
// recursion in case of intermediate esm package.json without name found
return pkg.name || getFilePackageName((0, _path.dirname)((0, _path.dirname)(path)));
}
return null;
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb3JlL3BhY2thZ2VQYXRoLmpzIl0sIm5hbWVzIjpbImdldENvbnRleHRQYWNrYWdlUGF0aCIsImdldEZpbGVQYWNrYWdlUGF0aCIsImdldEZpbGVQYWNrYWdlTmFtZSIsImNvbnRleHQiLCJnZXRQaHlzaWNhbEZpbGVuYW1lIiwiZ2V0RmlsZW5hbWUiLCJmaWxlUGF0aCIsImZwIiwiY3dkIiwibm9ybWFsaXplIiwicGtnIiwicGF0aCIsIm5hbWUiXSwibWFwcGluZ3MiOiI7Ozs7O0FBS2dCQSxxQixHQUFBQSxxQjs7OztBQUlBQyxrQixHQUFBQSxrQjs7Ozs7QUFLQUMsa0IsR0FBQUEsa0IsQ0FkaEIsNEJBQ0Esa0QsNkNBQ0EsMkQscUpBR08sU0FBU0YscUJBQVQsQ0FBK0JHLE9BQS9CLEVBQXdDLENBQzdDLE9BQU9GLG1CQUFtQkUsUUFBUUMsbUJBQVIsR0FBOEJELFFBQVFDLG1CQUFSLEVBQTlCLEdBQThERCxRQUFRRSxXQUFSLEVBQWpGLENBQVAsQ0FDRCxDQUVNLFNBQVNKLGtCQUFULENBQTRCSyxRQUE1QixFQUFzQyxDQUMzQyx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cm4gZGlybmFtZShmcCk7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiBnZXRGaWxlUGFja2FnZU5hbWUoZmlsZVBhdGgpIHtcbiAgY29uc3QgeyBwa2csIHBhdGggfSA9IHJlYWRQa2dVcCh7IGN3ZDogZmlsZVBhdGgsIG5vcm1hbGl6ZTogZmFsc2UgfSk7XG4gIGlmIChwa2cpIHtcbiAgICAvLyByZWN1cnNpb24gaW4gY2FzZSBvZiBpbnRlcm1lZGlhdGUgZXNtIHBhY2thZ2UuanNvbiB3aXRob3V0IG5hbWUgZm91bmRcbiAgICByZXR1cm4gcGtnLm5hbWUgfHwgZ2V0RmlsZVBhY2thZ2VOYW1lKGRpcm5hbWUoZGlybmFtZShwYXRoKSkpO1xuICB9XG4gIHJldHVybiBudWxsO1xufVxuIl19

View file

@ -0,0 +1,11 @@
'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports['default'] =
isStaticRequire; // todo: merge with module visitor
function isStaticRequire(node) {return node &&
node.callee &&
node.callee.type === 'Identifier' &&
node.callee.name === 'require' &&
node.arguments.length === 1 &&
node.arguments[0].type === 'Literal' &&
typeof node.arguments[0].value === 'string';
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb3JlL3N0YXRpY1JlcXVpcmUuanMiXSwibmFtZXMiOlsiaXNTdGF0aWNSZXF1aXJlIiwibm9kZSIsImNhbGxlZSIsInR5cGUiLCJuYW1lIiwiYXJndW1lbnRzIiwibGVuZ3RoIiwidmFsdWUiXSwibWFwcGluZ3MiOiI7QUFDd0JBLGUsRUFEeEI7QUFDZSxTQUFTQSxlQUFULENBQXlCQyxJQUF6QixFQUErQixDQUM1QyxPQUFPQTtBQUNMQSxPQUFLQyxNQURBO0FBRUxELE9BQUtDLE1BQUwsQ0FBWUMsSUFBWixLQUFxQixZQUZoQjtBQUdMRixPQUFLQyxNQUFMLENBQVlFLElBQVosS0FBcUIsU0FIaEI7QUFJTEgsT0FBS0ksU0FBTCxDQUFlQyxNQUFmLEtBQTBCLENBSnJCO0FBS0xMLE9BQUtJLFNBQUwsQ0FBZSxDQUFmLEVBQWtCRixJQUFsQixLQUEyQixTQUx0QjtBQU1MLFNBQU9GLEtBQUtJLFNBQUwsQ0FBZSxDQUFmLEVBQWtCRSxLQUF6QixLQUFtQyxRQU5yQztBQU9EIiwiZmlsZSI6InN0YXRpY1JlcXVpcmUuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLyB0b2RvOiBtZXJnZSB3aXRoIG1vZHVsZSB2aXNpdG9yXG5leHBvcnQgZGVmYXVsdCBmdW5jdGlvbiBpc1N0YXRpY1JlcXVpcmUobm9kZSkge1xuICByZXR1cm4gbm9kZSAmJlxuICAgIG5vZGUuY2FsbGVlICYmXG4gICAgbm9kZS5jYWxsZWUudHlwZSA9PT0gJ0lkZW50aWZpZXInICYmXG4gICAgbm9kZS5jYWxsZWUubmFtZSA9PT0gJ3JlcXVpcmUnICYmXG4gICAgbm9kZS5hcmd1bWVudHMubGVuZ3RoID09PSAxICYmXG4gICAgbm9kZS5hcmd1bWVudHNbMF0udHlwZSA9PT0gJ0xpdGVyYWwnICYmXG4gICAgdHlwZW9mIG5vZGUuYXJndW1lbnRzWzBdLnZhbHVlID09PSAnc3RyaW5nJztcbn1cbiJdfQ==

8
node_modules/eslint-plugin-import/lib/docsUrl.js generated vendored Normal file
View file

@ -0,0 +1,8 @@
'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports['default'] =
docsUrl;var _package = require('../package.json');var _package2 = _interopRequireDefault(_package);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}var repoUrl = 'https://github.com/import-js/eslint-plugin-import';function docsUrl(ruleName) {var commitish = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'v' + String(_package2['default'].version);
return repoUrl + '/blob/' + String(commitish) + '/docs/rules/' + String(ruleName) + '.md';
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9kb2NzVXJsLmpzIl0sIm5hbWVzIjpbImRvY3NVcmwiLCJyZXBvVXJsIiwicnVsZU5hbWUiLCJjb21taXRpc2giLCJwa2ciLCJ2ZXJzaW9uIl0sIm1hcHBpbmdzIjoiOzs7O0FBSXdCQSxPLENBSnhCLDBDLGdKQUVBLElBQU1DLFVBQVUsbURBQWhCLENBRWUsU0FBU0QsT0FBVCxDQUFpQkUsUUFBakIsRUFBMEQsS0FBL0JDLFNBQStCLG9GQUFmQyxxQkFBSUMsT0FBVztBQUN2RSxTQUFVSixPQUFWLHFCQUEwQkUsU0FBMUIsNEJBQWtERCxRQUFsRDtBQUNEIiwiZmlsZSI6ImRvY3NVcmwuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgcGtnIGZyb20gJy4uL3BhY2thZ2UuanNvbic7XG5cbmNvbnN0IHJlcG9VcmwgPSAnaHR0cHM6Ly9naXRodWIuY29tL2ltcG9ydC1qcy9lc2xpbnQtcGx1Z2luLWltcG9ydCc7XG5cbmV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIGRvY3NVcmwocnVsZU5hbWUsIGNvbW1pdGlzaCA9IGB2JHtwa2cudmVyc2lvbn1gKSB7XG4gIHJldHVybiBgJHtyZXBvVXJsfS9ibG9iLyR7Y29tbWl0aXNofS9kb2NzL3J1bGVzLyR7cnVsZU5hbWV9Lm1kYDtcbn1cbiJdfQ==

View file

@ -0,0 +1,5 @@
"use strict";Object.defineProperty(exports, "__esModule", { value: true });exports["default"] = importDeclaration;function importDeclaration(context) {
var ancestors = context.getAncestors();
return ancestors[ancestors.length - 1];
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbXBvcnREZWNsYXJhdGlvbi5qcyJdLCJuYW1lcyI6WyJpbXBvcnREZWNsYXJhdGlvbiIsImNvbnRleHQiLCJhbmNlc3RvcnMiLCJnZXRBbmNlc3RvcnMiLCJsZW5ndGgiXSwibWFwcGluZ3MiOiJnR0FBd0JBLGlCLENBQVQsU0FBU0EsaUJBQVQsQ0FBMkJDLE9BQTNCLEVBQW9DO0FBQ2pELE1BQU1DLFlBQVlELFFBQVFFLFlBQVIsRUFBbEI7QUFDQSxTQUFPRCxVQUFVQSxVQUFVRSxNQUFWLEdBQW1CLENBQTdCLENBQVA7QUFDRCIsImZpbGUiOiJpbXBvcnREZWNsYXJhdGlvbi5qcyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIGltcG9ydERlY2xhcmF0aW9uKGNvbnRleHQpIHtcbiAgY29uc3QgYW5jZXN0b3JzID0gY29udGV4dC5nZXRBbmNlc3RvcnMoKTtcbiAgcmV0dXJuIGFuY2VzdG9yc1thbmNlc3RvcnMubGVuZ3RoIC0gMV07XG59XG4iXX0=

69
node_modules/eslint-plugin-import/lib/index.js generated vendored Normal file

File diff suppressed because one or more lines are too long

40
node_modules/eslint-plugin-import/lib/rules/default.js generated vendored Normal file
View file

@ -0,0 +1,40 @@
'use strict';var _ExportMap = require('../ExportMap');var _ExportMap2 = _interopRequireDefault(_ExportMap);
var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
module.exports = {
meta: {
type: 'problem',
docs: {
url: (0, _docsUrl2['default'])('default') },
schema: [] },
create: function () {function create(context) {
function checkDefault(specifierType, node) {
var defaultSpecifier = node.specifiers.find(
function (specifier) {return specifier.type === specifierType;});
if (!defaultSpecifier) return;
var imports = _ExportMap2['default'].get(node.source.value, context);
if (imports == null) return;
if (imports.errors.length) {
imports.reportErrors(context, node);
} else if (imports.get('default') === undefined) {
context.report({
node: defaultSpecifier,
message: 'No default export found in imported module "' + String(node.source.value) + '".' });
}
}
return {
'ImportDeclaration': checkDefault.bind(null, 'ImportDefaultSpecifier'),
'ExportNamedDeclaration': checkDefault.bind(null, 'ExportDefaultSpecifier') };
}return create;}() };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9kZWZhdWx0LmpzIl0sIm5hbWVzIjpbIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwidHlwZSIsImRvY3MiLCJ1cmwiLCJzY2hlbWEiLCJjcmVhdGUiLCJjb250ZXh0IiwiY2hlY2tEZWZhdWx0Iiwic3BlY2lmaWVyVHlwZSIsIm5vZGUiLCJkZWZhdWx0U3BlY2lmaWVyIiwic3BlY2lmaWVycyIsImZpbmQiLCJzcGVjaWZpZXIiLCJpbXBvcnRzIiwiRXhwb3J0cyIsImdldCIsInNvdXJjZSIsInZhbHVlIiwiZXJyb3JzIiwibGVuZ3RoIiwicmVwb3J0RXJyb3JzIiwidW5kZWZpbmVkIiwicmVwb3J0IiwibWVzc2FnZSIsImJpbmQiXSwibWFwcGluZ3MiOiJhQUFBLHlDO0FBQ0EscUM7O0FBRUFBLE9BQU9DLE9BQVAsR0FBaUI7QUFDZkMsUUFBTTtBQUNKQyxVQUFNLFNBREY7QUFFSkMsVUFBTTtBQUNKQyxXQUFLLDBCQUFRLFNBQVIsQ0FERCxFQUZGOztBQUtKQyxZQUFRLEVBTEosRUFEUzs7O0FBU2ZDLFFBVGUsK0JBU1JDLE9BVFEsRUFTQzs7QUFFZCxlQUFTQyxZQUFULENBQXNCQyxhQUF0QixFQUFxQ0MsSUFBckMsRUFBMkM7O0FBRXpDLFlBQU1DLG1CQUFtQkQsS0FBS0UsVUFBTCxDQUFnQkMsSUFBaEI7QUFDdkIscUNBQWFDLFVBQVVaLElBQVYsS0FBbUJPLGFBQWhDLEVBRHVCLENBQXpCOzs7QUFJQSxZQUFJLENBQUNFLGdCQUFMLEVBQXVCO0FBQ3ZCLFlBQU1JLFVBQVVDLHVCQUFR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GUpIHtcblxuICAgICAgY29uc3QgZGVmYXVsdFNwZWNpZmllciA9IG5vZGUuc3BlY2lmaWVycy5maW5kKFxuICAgICAgICBzcGVjaWZpZXIgPT4gc3BlY2lmaWVyLnR5cGUgPT09IHNwZWNpZmllclR5cGUsXG4gICAgICApO1xuXG4gICAgICBpZiAoIWRlZmF1bHRTcGVjaWZpZXIpIHJldHVybjtcbiAgICAgIGNvbnN0IGltcG9ydHMgPSBFeHBvcnRzLmdldChub2RlLnNvdXJjZS52YWx1ZSwgY29udGV4dCk7XG4gICAgICBpZiAoaW1wb3J0cyA9PSBudWxsKSByZXR1cm47XG5cbiAgICAgIGlmIChpbXBvcnRzLmVycm9ycy5sZW5ndGgpIHtcbiAgICAgICAgaW1wb3J0cy5yZXBvcnRFcnJvcnMoY29udGV4dCwgbm9kZSk7XG4gICAgICB9IGVsc2UgaWYgKGltcG9ydHMuZ2V0KCdkZWZhdWx0JykgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICBjb250ZXh0LnJlcG9ydCh7XG4gICAgICAgICAgbm9kZTogZGVmYXVsdFNwZWNpZmllcixcbiAgICAgICAgICBtZXNzYWdlOiBgTm8gZGVmYXVsdCBleHBvcnQgZm91bmQgaW4gaW1wb3J0ZWQgbW9kdWxlIFwiJHtub2RlLnNvdXJjZS52YWx1ZX1cIi5gLFxuICAgICAgICB9KTtcbiAgICAgIH1cbiAgICB9XG5cbiAgICByZXR1cm4ge1xuICAgICAgJ0ltcG9ydERlY2xhcmF0aW9uJzogY2hlY2tEZWZhdWx0LmJpbmQobnVsbCwgJ0ltcG9ydERlZmF1bHRTcGVjaWZpZXInKSxcbiAgICAgICdFeHBvcnROYW1lZERlY2xhcmF0aW9uJzogY2hlY2tEZWZhdWx0LmJpbmQobnVsbCwgJ0V4cG9ydERlZmF1bHRTcGVjaWZpZXInKSxcbiAgICB9O1xuICB9LFxufTtcbiJdfQ==

File diff suppressed because one or more lines are too long

176
node_modules/eslint-plugin-import/lib/rules/export.js generated vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,41 @@
'use strict';var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
function isNonExportStatement(_ref) {var type = _ref.type;
return type !== 'ExportDefaultDeclaration' &&
type !== 'ExportNamedDeclaration' &&
type !== 'ExportAllDeclaration';
}
module.exports = {
meta: {
type: 'suggestion',
docs: {
url: (0, _docsUrl2['default'])('exports-last') },
schema: [] },
create: function () {function create(context) {
return {
Program: function () {function Program(_ref2) {var body = _ref2.body;
var lastNonExportStatementIndex = body.reduce(function () {function findLastIndex(acc, item, index) {
if (isNonExportStatement(item)) {
return index;
}
return acc;
}return findLastIndex;}(), -1);
if (lastNonExportStatementIndex !== -1) {
body.slice(0, lastNonExportStatementIndex).forEach(function () {function checkNonExport(node) {
if (!isNonExportStatement(node)) {
context.report({
node: node,
message: 'Export statements should appear at the end of the file' });
}
}return checkNonExport;}());
}
}return Program;}() };
}return create;}() };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9leHBvcnRzLWxhc3QuanMiXSwibmFtZXMiOlsiaXNOb25FeHBvcnRTdGF0ZW1lbnQiLCJ0eXBlIiwibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJkb2NzIiwidXJsIiwic2NoZW1hIiwiY3JlYXRlIiwiY29udGV4dCIsIlByb2dyYW0iLCJib2R5IiwibGFzdE5vbkV4cG9ydFN0YXRlbWVudEluZGV4IiwicmVkdWNlIiwiZmluZExhc3RJbmRleCIsImFjYyIsIml0ZW0iLCJpbmRleCIsInNsaWNlIiwiZm9yRWFjaCIsImNoZWNrTm9uRXhwb3J0Iiwibm9kZSIsInJlcG9ydCIsIm1lc3NhZ2UiXSwibWFwcGluZ3MiOiJhQUFBLHFDOztBQUVBLFNBQVNBLG9CQUFUL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Y2goZnVuY3Rpb24gY2hlY2tOb25FeHBvcnQobm9kZSkge1xuICAgICAgICAgICAgaWYgKCFpc05vbkV4cG9ydFN0YXRlbWVudChub2RlKSkge1xuICAgICAgICAgICAgICBjb250ZXh0LnJlcG9ydCh7XG4gICAgICAgICAgICAgICAgbm9kZSxcbiAgICAgICAgICAgICAgICBtZXNzYWdlOiAnRXhwb3J0IHN0YXRlbWVudHMgc2hvdWxkIGFwcGVhciBhdCB0aGUgZW5kIG9mIHRoZSBmaWxlJyxcbiAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgfTtcbiAgfSxcbn07XG4iXX0=

File diff suppressed because one or more lines are too long

138
node_modules/eslint-plugin-import/lib/rules/first.js generated vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,13 @@
'use strict';var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
var first = require('./first');
var newMeta = Object.assign({}, first.meta, {
deprecated: true,
docs: {
url: (0, _docsUrl2['default'])('imports-first', '7b25c1cb95ee18acc1531002fd343e1e6031f9ed') } });
module.exports = Object.assign({}, first, { meta: newMeta });
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9pbXBvcnRzLWZpcnN0LmpzIl0sIm5hbWVzIjpbImZpcnN0IiwicmVxdWlyZSIsIm5ld01ldGEiLCJPYmplY3QiLCJhc3NpZ24iLCJtZXRhIiwiZGVwcmVjYXRlZCIsImRvY3MiLCJ1cmwiLCJtb2R1bGUiLCJleHBvcnRzIl0sIm1hcHBpbmdzIjoiYUFBQSxxQzs7QUFFQSxJQUFNQSxRQUFRQyxRQUFRLFNBQVIsQ0FBZDs7QUFFQSxJQUFNQyxVQUFVQyxPQUFPQyxNQUFQLENBQWMsRUFBZCxFQUFrQkosTUFBTUssSUFBeEIsRUFBOEI7QUFDNUNDLGNBQVksSUFEZ0M7QUFFNUNDLFFBQU07QUFDSkMsU0FBSywwQkFBUSxlQUFSLEVBQXlCLDBDQUF6QixDQURELEVBRnNDLEVBQTlCLENBQWhCOzs7O0FBT0FDLE9BQU9DLE9BQVAsR0FBaUJQLE9BQU9DLE1BQVAsQ0FBYyxFQUFkLEVBQWtCSixLQUFsQixFQUF5QixFQUFFSyxNQUFNSCxPQUFSLEVBQXpCLENBQWpCIiwiZmlsZSI6ImltcG9ydHMtZmlyc3QuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgZG9jc1VybCBmcm9tICcuLi9kb2NzVXJsJztcblxuY29uc3QgZmlyc3QgPSByZXF1aXJlKCcuL2ZpcnN0Jyk7XG5cbmNvbnN0IG5ld01ldGEgPSBPYmplY3QuYXNzaWduKHt9LCBmaXJzdC5tZXRhLCB7XG4gIGRlcHJlY2F0ZWQ6IHRydWUsXG4gIGRvY3M6IHtcbiAgICB1cmw6IGRvY3NVcmwoJ2ltcG9ydHMtZmlyc3QnLCAnN2IyNWMxY2I5NWVlMThhY2MxNTMxMDAyZmQzNDNlMWU2MDMxZjllZCcpLFxuICB9LFxufSk7XG5cbm1vZHVsZS5leHBvcnRzID0gT2JqZWN0LmFzc2lnbih7fSwgZmlyc3QsIHsgbWV0YTogbmV3TWV0YSB9KTtcbiJdfQ==

View file

@ -0,0 +1,54 @@
'use strict';var _moduleVisitor = require('eslint-module-utils/moduleVisitor');var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor);
var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
var DEFAULT_MAX = 10;
var DEFAULT_IGNORE_TYPE_IMPORTS = false;
var TYPE_IMPORT = 'type';
var countDependencies = function countDependencies(dependencies, lastNode, context) {var _ref =
context.options[0] || { max: DEFAULT_MAX },max = _ref.max;
if (dependencies.size > max) {
context.report(lastNode, 'Maximum number of dependencies (' + String(max) + ') exceeded.');
}
};
module.exports = {
meta: {
type: 'suggestion',
docs: {
url: (0, _docsUrl2['default'])('max-dependencies') },
schema: [
{
'type': 'object',
'properties': {
'max': { 'type': 'number' },
'ignoreTypeImports': { 'type': 'boolean' } },
'additionalProperties': false }] },
create: function () {function create(context) {var _ref2 =
context.options[0] || {},_ref2$ignoreTypeImpor = _ref2.ignoreTypeImports,ignoreTypeImports = _ref2$ignoreTypeImpor === undefined ? DEFAULT_IGNORE_TYPE_IMPORTS : _ref2$ignoreTypeImpor;
var dependencies = new Set(); // keep track of dependencies
var lastNode = void 0; // keep track of the last node to report on
return Object.assign({
'Program:exit': function () {function ProgramExit() {
countDependencies(dependencies, lastNode, context);
}return ProgramExit;}() },
(0, _moduleVisitor2['default'])(function (source, _ref3) {var importKind = _ref3.importKind;
if (importKind !== TYPE_IMPORT || !ignoreTypeImports) {
dependencies.add(source.value);
}
lastNode = source;
}, { commonjs: true }));
}return create;}() };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9tYXgtZGVwZW5kZW5jaWVzLmpzIl0sIm5hbWVzIjpbIkRFRkFVTFRfTUFYIiwiREVGQVVMVF9JR05PUkVfVFlQRV9JTVBPUlRTIiwiVFlQRV9JTVBPUlQiLCJjb3VudERlcGVuZGVuY2llcyIsImRlcGVuZGVuY2llcyIsImxhc3ROb2RlIiwiY29udGV4dCIsIm9wdGlvbnMiLCJtYXgiLCJzaXplIiwicmVwb3J0IiwibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJ0eXBlIiwiZG9jcyIsInVybCIsInNjaGVtYSIsImNyZWF0ZSIsImlnbm9yZVR5cGVJbXBvcnRzIiwiU2V0IiwiT2JqZWN0IiwiYXNzaWduIiwic291cm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MsIGxhc3ROb2RlLCBjb250ZXh0KTtcbiAgICAgIH0sXG4gICAgfSwgbW9kdWxlVmlzaXRvcigoc291cmNlLCB7IGltcG9ydEtpbmQgfSkgPT4ge1xuICAgICAgaWYgKGltcG9ydEtpbmQgIT09IFRZUEVfSU1QT1JUIHx8ICFpZ25vcmVUeXBlSW1wb3J0cykge1xuICAgICAgICBkZXBlbmRlbmNpZXMuYWRkKHNvdXJjZS52YWx1ZSk7XG4gICAgICB9XG4gICAgICBsYXN0Tm9kZSA9IHNvdXJjZTtcbiAgICB9LCB7IGNvbW1vbmpzOiB0cnVlIH0pKTtcbiAgfSxcbn07XG4iXX0=

138
node_modules/eslint-plugin-import/lib/rules/named.js generated vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,24 @@
'use strict';var _moduleVisitor = require('eslint-module-utils/moduleVisitor');var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor);
var _importType = require('../core/importType');
var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
module.exports = {
meta: {
type: 'suggestion',
docs: {
url: (0, _docsUrl2['default'])('no-absolute-path') },
schema: [(0, _moduleVisitor.makeOptionsSchema)()] },
create: function () {function create(context) {
function reportIfAbsolute(source) {
if (typeof source.value === 'string' && (0, _importType.isAbsolute)(source.value)) {
context.report(source, 'Do not import modules using an absolute path');
}
}
var options = Object.assign({ esmodule: true, commonjs: true }, context.options[0]);
return (0, _moduleVisitor2['default'])(reportIfAbsolute, options);
}return create;}() };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1hYnNvbHV0ZS1wYXRoLmpzIl0sIm5hbWVzIjpbIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwidHlwZSIsImRvY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V0aWxzL21vZHVsZVZpc2l0b3InO1xuaW1wb3J0IHsgaXNBYnNvbHV0ZSB9IGZyb20gJy4uL2NvcmUvaW1wb3J0VHlwZSc7XG5pbXBvcnQgZG9jc1VybCBmcm9tICcuLi9kb2NzVXJsJztcblxubW9kdWxlLmV4cG9ydHMgPSB7XG4gIG1ldGE6IHtcbiAgICB0eXBlOiAnc3VnZ2VzdGlvbicsXG4gICAgZG9jczoge1xuICAgICAgdXJsOiBkb2NzVXJsKCduby1hYnNvbHV0ZS1wYXRoJyksXG4gICAgfSxcbiAgICBzY2hlbWE6IFsgbWFrZU9wdGlvbnNTY2hlbWEoKSBdLFxuICB9LFxuXG4gIGNyZWF0ZShjb250ZXh0KSB7XG4gICAgZnVuY3Rpb24gcmVwb3J0SWZBYnNvbHV0ZShzb3VyY2UpIHtcbiAgICAgIGlmICh0eXBlb2Ygc291cmNlLnZhbHVlID09PSAnc3RyaW5nJyAmJiBpc0Fic29sdXRlKHNvdXJjZS52YWx1ZSkpIHtcbiAgICAgICAgY29udGV4dC5yZXBvcnQoc291cmNlLCAnRG8gbm90IGltcG9ydCBtb2R1bGVzIHVzaW5nIGFuIGFic29sdXRlIHBhdGgnKTtcbiAgICAgIH1cbiAgICB9XG5cbiAgICBjb25zdCBvcHRpb25zID0gT2JqZWN0LmFzc2lnbih7IGVzbW9kdWxlOiB0cnVlLCBjb21tb25qczogdHJ1ZSB9LCBjb250ZXh0Lm9wdGlvbnNbMF0pO1xuICAgIHJldHVybiBtb2R1bGVWaXNpdG9yKHJlcG9ydElmQWJzb2x1dGUsIG9wdGlvbnMpO1xuICB9LFxufTtcbiJdfQ==

46
node_modules/eslint-plugin-import/lib/rules/no-amd.js generated vendored Normal file
View file

@ -0,0 +1,46 @@
'use strict';
var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
module.exports = {
meta: {
type: 'suggestion',
docs: {
url: (0, _docsUrl2['default'])('no-amd') },
schema: [] },
create: function () {function create(context) {
return {
'CallExpression': function () {function CallExpression(node) {
if (context.getScope().type !== 'module') return;
if (node.callee.type !== 'Identifier') return;
if (node.callee.name !== 'require' &&
node.callee.name !== 'define') return;
// todo: capture define((require, module, exports) => {}) form?
if (node.arguments.length !== 2) return;
var modules = node.arguments[0];
if (modules.type !== 'ArrayExpression') return;
// todo: check second arg type? (identifier or callback)
context.report(node, 'Expected imports instead of AMD ' + String(node.callee.name) + '().');
}return CallExpression;}() };
}return create;}() }; /**
* @fileoverview Rule to prefer imports to AMD
* @author Jamund Ferguson
*/
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1hbWQuanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJ0eXBlIiwiZG9jcyIsInVybCIsInNjaGVtYSIsImNyZWF0ZSIsImNvbnRleHQiLCJub2RlIiwiZ2V0U2NvcGUiLCJjYWxsZWUiLCJuYW1lIiwiYXJndW1lbnRzIiwibGVuZ3RoIiwibW9kdWxlcyIsInJlcG9ydCJdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFLQSxxQzs7QUFFQTtBQUNBO0FBQ0E7O0FBRUFBLE9BQU9DLE9BQVAsR0FBaUI7QUFDZkMsUUFBTTtBQUNKQyxVQUFNLFlBREY7QUFFSkMsVUFBTTtBQUNKQyxXQUFLLDBCQUFRLFFBQVIsQ0FERCxFQUZGOztBQUtKQyxZQUFRLEVBTEosRUFEUzs7O0FBU2ZDLFFBVGUsK0JBU1JDLE9BVFEsRUFTQztBQUNkLGFBQU87QUFDTCx1Q0FBa0Isd0JBQVVDLElBQVYsRUFBZ0I7QUFDaEMsZ0JBQUlELFFBQVFFLFFBQVIsR0FBbUJQLElBQW5CLEtBQTRCLFFBQWhDL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6IHtcbiAgICB0eXBlOiAnc3VnZ2VzdGlvbicsXG4gICAgZG9jczoge1xuICAgICAgdXJsOiBkb2NzVXJsKCduby1hbWQnKSxcbiAgICB9LFxuICAgIHNjaGVtYTogW10sXG4gIH0sXG5cbiAgY3JlYXRlKGNvbnRleHQpIHtcbiAgICByZXR1cm4ge1xuICAgICAgJ0NhbGxFeHByZXNzaW9uJzogZnVuY3Rpb24gKG5vZGUpIHtcbiAgICAgICAgaWYgKGNvbnRleHQuZ2V0U2NvcGUoKS50eXBlICE9PSAnbW9kdWxlJykgcmV0dXJuO1xuXG4gICAgICAgIGlmIChub2RlLmNhbGxlZS50eXBlICE9PSAnSWRlbnRpZmllcicpIHJldHVybjtcbiAgICAgICAgaWYgKG5vZGUuY2FsbGVlLm5hbWUgIT09ICdyZXF1aXJlJyAmJlxuICAgICAgICAgICAgbm9kZS5jYWxsZWUubmFtZSAhPT0gJ2RlZmluZScpIHJldHVybjtcblxuICAgICAgICAvLyB0b2RvOiBjYXB0dXJlIGRlZmluZSgocmVxdWlyZSwgbW9kdWxlLCBleHBvcnRzKSA9PiB7fSkgZm9ybT9cbiAgICAgICAgaWYgKG5vZGUuYXJndW1lbnRzLmxlbmd0aCAhPT0gMikgcmV0dXJuO1xuXG4gICAgICAgIGNvbnN0IG1vZHVsZXMgPSBub2RlLmFyZ3VtZW50c1swXTtcbiAgICAgICAgaWYgKG1vZHVsZXMudHlwZSAhPT0gJ0FycmF5RXhwcmVzc2lvbicpIHJldHVybjtcblxuICAgICAgICAvLyB0b2RvOiBjaGVjayBzZWNvbmQgYXJnIHR5cGU/IChpZGVudGlmaWVyIG9yIGNhbGxiYWNrKVxuXG4gICAgICAgIGNvbnRleHQucmVwb3J0KG5vZGUsIGBFeHBlY3RlZCBpbXBvcnRzIGluc3RlYWQgb2YgQU1EICR7bm9kZS5jYWxsZWUubmFtZX0oKS5gKTtcbiAgICAgIH0sXG4gICAgfTtcblxuICB9LFxufTtcbiJdfQ==

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

131
node_modules/eslint-plugin-import/lib/rules/no-cycle.js generated vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,41 @@
'use strict';var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
module.exports = {
meta: {
type: 'suggestion',
docs: {
url: (0, _docsUrl2['default'])('no-default-export') },
schema: [] },
create: function () {function create(context) {
// ignore non-modules
if (context.parserOptions.sourceType !== 'module') {
return {};
}
var preferNamed = 'Prefer named exports.';
var noAliasDefault = function () {function noAliasDefault(_ref) {var local = _ref.local;return (
'Do not alias `' + String(local.name) + '` as `default`. Just export ' + ('`' + String(
local.name) + '` itself instead.'));}return noAliasDefault;}();
return {
ExportDefaultDeclaration: function () {function ExportDefaultDeclaration(node) {
context.report({ node: node, message: preferNamed });
}return ExportDefaultDeclaration;}(),
ExportNamedDeclaration: function () {function ExportNamedDeclaration(node) {
node.specifiers.forEach(function (specifier) {
if (specifier.type === 'ExportDefaultSpecifier' &&
specifier.exported.name === 'default') {
context.report({ node: node, message: preferNamed });
} else if (specifier.type === 'ExportSpecifier' &&
specifier.exported.name === 'default') {
context.report({ node: node, message: noAliasDefault(specifier) });
}
});
}return ExportNamedDeclaration;}() };
}return create;}() };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1kZWZhdWx0LWV4cG9ydC5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIiwibWV0YSIsInR5cGUiLCJkb2NzIiwidXJsIiwic2NoZW1hIiwiY3JlYXRlIiwiY29udGV4dCIsInBhcnNlck9wdGlvbnMiLCJzb3VyY2VUeXBlIiwicHJlZmVyTmFtZWQiLCJub0FsaWFzRGVmYXVsdCIsImxvY2FsIiwibmFtZSIsIkV4cG9ydERlZmF1bH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wubmFtZX1cXGAgaXRzZWxmIGluc3RlYWQuYDtcblxuICAgIHJldHVybiB7XG4gICAgICBFeHBvcnREZWZhdWx0RGVjbGFyYXRpb24obm9kZSkge1xuICAgICAgICBjb250ZXh0LnJlcG9ydCh7IG5vZGUsIG1lc3NhZ2U6IHByZWZlck5hbWVkIH0pO1xuICAgICAgfSxcblxuICAgICAgRXhwb3J0TmFtZWREZWNsYXJhdGlvbihub2RlKSB7XG4gICAgICAgIG5vZGUuc3BlY2lmaWVycy5mb3JFYWNoKHNwZWNpZmllciA9PiB7XG4gICAgICAgICAgaWYgKHNwZWNpZmllci50eXBlID09PSAnRXhwb3J0RGVmYXVsdFNwZWNpZmllcicgJiZcbiAgICAgICAgICAgICAgc3BlY2lmaWVyLmV4cG9ydGVkLm5hbWUgPT09ICdkZWZhdWx0Jykge1xuICAgICAgICAgICAgY29udGV4dC5yZXBvcnQoeyBub2RlLCBtZXNzYWdlOiBwcmVmZXJOYW1lZCB9KTtcbiAgICAgICAgICB9IGVsc2UgaWYgKHNwZWNpZmllci50eXBlID09PSAnRXhwb3J0U3BlY2lmaWVyJyAmJlxuICAgICAgICAgICAgICBzcGVjaWZpZXIuZXhwb3J0ZWQubmFtZSA9PT0gJ2RlZmF1bHQnKSB7XG4gICAgICAgICAgICBjb250ZXh0LnJlcG9ydCh7IG5vZGUsIG1lc3NhZ2U6IG5vQWxpYXNEZWZhdWx0KHNwZWNpZmllcikgfSk7XG4gICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgIH0sXG4gICAgfTtcbiAgfSxcbn07XG4iXX0=

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,64 @@
'use strict';var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
function isRequire(node) {
return node &&
node.callee &&
node.callee.type === 'Identifier' &&
node.callee.name === 'require' &&
node.arguments.length >= 1;
}
function isDynamicImport(node) {
return node &&
node.callee &&
node.callee.type === 'Import';
}
function isStaticValue(arg) {
return arg.type === 'Literal' ||
arg.type === 'TemplateLiteral' && arg.expressions.length === 0;
}
module.exports = {
meta: {
type: 'suggestion',
docs: {
url: (0, _docsUrl2['default'])('no-dynamic-require') },
schema: [
{
type: 'object',
properties: {
esmodule: {
type: 'boolean' } },
additionalProperties: false }] },
create: function () {function create(context) {
var options = context.options[0] || {};
return {
CallExpression: function () {function CallExpression(node) {
if (!node.arguments[0] || isStaticValue(node.arguments[0])) {
return;
}
if (isRequire(node)) {
return context.report({
node: node,
message: 'Calls to require() should use string literals' });
}
if (options.esmodule && isDynamicImport(node)) {
return context.report({
node: node,
message: 'Calls to import() should use string literals' });
}
}return CallExpression;}() };
}return create;}() };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1keW5hbWljLXJlcXVpcmUuanMiXSwibmFtZXMiOlsiaXNSZXF1aXJlIiwibm9kZSIsImNhbGxlZSIsInR5cGUiLCJuYW1lIiwiYXJndW1lbnRzIiwibGVuZ3RoIiwiaXNEeW5hbWljSW1wb3J0IiwiaXNTdGF0aWNWYWx1ZSIsImFyZyIsImV4cHJlc3Npb25zIiwibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJkb2NzIiwidXJsIiwic2NoZW1hIiwicHJvcGVydGllcyIsImVzbW9kdWxlIiwiYWRkaXRpb25hbFByb3BlcnRpZXMiLCJjcmVhdGUiLCJjb250ZXh0Iiwib3B0aW9ucyIsIkNhbGxFeHByZXNzaW9uIiwicmVwb3J0IiwibWVzc2FnZSJdLCJtYXBwaW5ncyI6ImFBQUEscUM7O0FBRUEsU0FBU0EsU0FBVCxDQUFtQkMsSUFBbkIsRUFBeUI7QUFDdkIsU0FBT0E7QUFDTEEsT0FBS0MsTUFEQTtBQUVMRCxPQUFLQyxNQUFMLENBQVlDLElBQVos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cuZXhwcmVzc2lvbnMubGVuZ3RoID09PSAwKTtcbn1cblxubW9kdWxlLmV4cG9ydHMgPSB7XG4gIG1ldGE6IHtcbiAgICB0eXBlOiAnc3VnZ2VzdGlvbicsXG4gICAgZG9jczoge1xuICAgICAgdXJsOiBkb2NzVXJsKCduby1keW5hbWljLXJlcXVpcmUnKSxcbiAgICB9LFxuICAgIHNjaGVtYTogW1xuICAgICAge1xuICAgICAgICB0eXBlOiAnb2JqZWN0JyxcbiAgICAgICAgcHJvcGVydGllczoge1xuICAgICAgICAgIGVzbW9kdWxlOiB7XG4gICAgICAgICAgICB0eXBlOiAnYm9vbGVhbicsXG4gICAgICAgICAgfSxcbiAgICAgICAgfSxcbiAgICAgICAgYWRkaXRpb25hbFByb3BlcnRpZXM6IGZhbHNlLFxuICAgICAgfSxcbiAgICBdLFxuICB9LFxuXG4gIGNyZWF0ZShjb250ZXh0KSB7XG4gICAgY29uc3Qgb3B0aW9ucyA9IGNvbnRleHQub3B0aW9uc1swXSB8fCB7fTtcblxuICAgIHJldHVybiB7XG4gICAgICBDYWxsRXhwcmVzc2lvbihub2RlKSB7XG4gICAgICAgIGlmICghbm9kZS5hcmd1bWVudHNbMF0gfHwgaXNTdGF0aWNWYWx1ZShub2RlLmFyZ3VtZW50c1swXSkpIHtcbiAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGlzUmVxdWlyZShub2RlKSkge1xuICAgICAgICAgIHJldHVybiBjb250ZXh0LnJlcG9ydCh7XG4gICAgICAgICAgICBub2RlLFxuICAgICAgICAgICAgbWVzc2FnZTogJ0NhbGxzIHRvIHJlcXVpcmUoKSBzaG91bGQgdXNlIHN0cmluZyBsaXRlcmFscycsXG4gICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG9wdGlvbnMuZXNtb2R1bGUgJiYgaXNEeW5hbWljSW1wb3J0KG5vZGUpKSB7XG4gICAgICAgICAgcmV0dXJuIGNvbnRleHQucmVwb3J0KHtcbiAgICAgICAgICAgIG5vZGUsXG4gICAgICAgICAgICBtZXNzYWdlOiAnQ2FsbHMgdG8gaW1wb3J0KCkgc2hvdWxkIHVzZSBzdHJpbmcgbGl0ZXJhbHMnLFxuICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICB9LFxuICAgIH07XG4gIH0sXG59O1xuIl19

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,57 @@
'use strict';var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
module.exports = {
meta: {
type: 'suggestion',
docs: {
url: (0, _docsUrl2['default'])('no-mutable-exports') },
schema: [] },
create: function () {function create(context) {
function checkDeclaration(node) {var
kind = node.kind;
if (kind === 'var' || kind === 'let') {
context.report(node, 'Exporting mutable \'' + String(kind) + '\' binding, use \'const\' instead.');
}
}
function checkDeclarationsInScope(_ref, name) {var variables = _ref.variables;var _iteratorNormalCompletion = true;var _didIteratorError = false;var _iteratorError = undefined;try {
for (var _iterator = variables[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {var variable = _step.value;
if (variable.name === name) {var _iteratorNormalCompletion2 = true;var _didIteratorError2 = false;var _iteratorError2 = undefined;try {
for (var _iterator2 = variable.defs[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {var def = _step2.value;
if (def.type === 'Variable' && def.parent) {
checkDeclaration(def.parent);
}
}} catch (err) {_didIteratorError2 = true;_iteratorError2 = err;} finally {try {if (!_iteratorNormalCompletion2 && _iterator2['return']) {_iterator2['return']();}} finally {if (_didIteratorError2) {throw _iteratorError2;}}}
}
}} catch (err) {_didIteratorError = true;_iteratorError = err;} finally {try {if (!_iteratorNormalCompletion && _iterator['return']) {_iterator['return']();}} finally {if (_didIteratorError) {throw _iteratorError;}}}
}
function handleExportDefault(node) {
var scope = context.getScope();
if (node.declaration.name) {
checkDeclarationsInScope(scope, node.declaration.name);
}
}
function handleExportNamed(node) {
var scope = context.getScope();
if (node.declaration) {
checkDeclaration(node.declaration);
} else if (!node.source) {var _iteratorNormalCompletion3 = true;var _didIteratorError3 = false;var _iteratorError3 = undefined;try {
for (var _iterator3 = node.specifiers[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {var specifier = _step3.value;
checkDeclarationsInScope(scope, specifier.local.name);
}} catch (err) {_didIteratorError3 = true;_iteratorError3 = err;} finally {try {if (!_iteratorNormalCompletion3 && _iterator3['return']) {_iterator3['return']();}} finally {if (_didIteratorError3) {throw _iteratorError3;}}}
}
}
return {
'ExportDefaultDeclaration': handleExportDefault,
'ExportNamedDeclaration': handleExportNamed };
}return create;}() };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1tdXRhYmxlLWV4cG9ydHMuanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJ0eXBlIiwiZG9jcyIsInVybCIsInNjaGVtYSIsImNyZWF0ZSIsImNvbnRleHQiLCJjaGVja0RlY2xhcmF0aW9uIiwibm9kZSIsImtpbmQiLCJyZXBvcnQiLCJjaGVja0RlY2xhcmF0aW9uc0luU2NvcGUiLCJuYW1lIiwidmFyaWFibGVzIiwidmFyaWFibGUiLCJkZWZzIiwiZGVmIiwicGFyZW50IiwiaGFuZGxlRXhwb3J0RGVmYXVsdCIsInNjb3BlIiwiZ2V0U2NvcGUiLCJkZWNsYXJhdGlvbiIsImhhbmRsZUV4cG9ydE5hbWVkIiwic291cmNlIiwic3BlY2lmaWVycyIsInNwZWNpZmllciIsImxvY2FsIl0sIm1hcHBpbmdzIjoiYUFBQSxxQz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ZiBub2RlLnNwZWNpZmllcnMpIHtcbiAgICAgICAgICBjaGVja0RlY2xhcmF0aW9uc0luU2NvcGUoc2NvcGUsIHNwZWNpZmllci5sb2NhbC5uYW1lKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiB7XG4gICAgICAnRXhwb3J0RGVmYXVsdERlY2xhcmF0aW9uJzogaGFuZGxlRXhwb3J0RGVmYXVsdCxcbiAgICAgICdFeHBvcnROYW1lZERlY2xhcmF0aW9uJzogaGFuZGxlRXhwb3J0TmFtZWQsXG4gICAgfTtcbiAgfSxcbn07XG4iXX0=

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,43 @@
'use strict';var _ExportMap = require('../ExportMap');var _ExportMap2 = _interopRequireDefault(_ExportMap);
var _importDeclaration = require('../importDeclaration');var _importDeclaration2 = _interopRequireDefault(_importDeclaration);
var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
module.exports = {
meta: {
type: 'problem',
docs: {
url: (0, _docsUrl2['default'])('no-named-as-default') },
schema: [] },
create: function () {function create(context) {
function checkDefault(nameKey, defaultSpecifier) {
// #566: default is a valid specifier
if (defaultSpecifier[nameKey].name === 'default') return;
var declaration = (0, _importDeclaration2['default'])(context);
var imports = _ExportMap2['default'].get(declaration.source.value, context);
if (imports == null) return;
if (imports.errors.length) {
imports.reportErrors(context, declaration);
return;
}
if (imports.has('default') &&
imports.has(defaultSpecifier[nameKey].name)) {
context.report(defaultSpecifier,
'Using exported name \'' + defaultSpecifier[nameKey].name +
'\' as identifier for default export.');
}
}
return {
'ImportDefaultSpecifier': checkDefault.bind(null, 'local'),
'ExportDefaultSpecifier': checkDefault.bind(null, 'exported') };
}return create;}() };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1uYW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iAoZGVmYXVsdFNwZWNpZmllcltuYW1lS2V5XS5uYW1lID09PSAnZGVmYXVsdCcpIHJldHVybjtcblxuICAgICAgY29uc3QgZGVjbGFyYXRpb24gPSBpbXBvcnREZWNsYXJhdGlvbihjb250ZXh0KTtcblxuICAgICAgY29uc3QgaW1wb3J0cyA9IEV4cG9ydHMuZ2V0KGRlY2xhcmF0aW9uLnNvdXJjZS52YWx1ZSwgY29udGV4dCk7XG4gICAgICBpZiAoaW1wb3J0cyA9PSBudWxsKSByZXR1cm47XG5cbiAgICAgIGlmIChpbXBvcnRzLmVycm9ycy5sZW5ndGgpIHtcbiAgICAgICAgaW1wb3J0cy5yZXBvcnRFcnJvcnMoY29udGV4dCwgZGVjbGFyYXRpb24pO1xuICAgICAgICByZXR1cm47XG4gICAgICB9XG5cbiAgICAgIGlmIChpbXBvcnRzLmhhcygnZGVmYXVsdCcpICYmXG4gICAgICAgICAgaW1wb3J0cy5oYXMoZGVmYXVsdFNwZWNpZmllcltuYW1lS2V5XS5uYW1lKSkge1xuXG4gICAgICAgIGNvbnRleHQucmVwb3J0KGRlZmF1bHRTcGVjaWZpZXIsXG4gICAgICAgICAgJ1VzaW5nIGV4cG9ydGVkIG5hbWUgXFwnJyArIGRlZmF1bHRTcGVjaWZpZXJbbmFtZUtleV0ubmFtZSArXG4gICAgICAgICAgJ1xcJyBhcyBpZGVudGlmaWVyIGZvciBkZWZhdWx0IGV4cG9ydC4nKTtcblxuICAgICAgfVxuICAgIH1cbiAgICByZXR1cm4ge1xuICAgICAgJ0ltcG9ydERlZmF1bHRTcGVjaWZpZXInOiBjaGVja0RlZmF1bHQuYmluZChudWxsLCAnbG9jYWwnKSxcbiAgICAgICdFeHBvcnREZWZhdWx0U3BlY2lmaWVyJzogY2hlY2tEZWZhdWx0LmJpbmQobnVsbCwgJ2V4cG9ydGVkJyksXG4gICAgfTtcbiAgfSxcbn07XG4iXX0=

View file

@ -0,0 +1,29 @@
'use strict';var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
module.exports = {
meta: {
type: 'suggestion',
docs: {
url: (0, _docsUrl2['default'])('no-named-default') },
schema: [] },
create: function () {function create(context) {
return {
'ImportDeclaration': function () {function ImportDeclaration(node) {
node.specifiers.forEach(function (im) {
if (im.importKind === 'type' || im.importKind === 'typeof') {
return;
}
if (im.type === 'ImportSpecifier' && im.imported.name === 'default') {
context.report({
node: im.local,
message: 'Use default import syntax to import \'' + String(im.local.name) + '\'.' });
}
});
}return ImportDeclaration;}() };
}return create;}() };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1uYW1lZC1kZWZhdWx0LmpzIl0sIm5hbWVzIjpbIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwidHlwZSIsImRvY3MiLCJ1cmwiLCJzY2hlbWEiLCJjcmVhdGUiLCJjb250ZXh0Iiwibm9kZSIsInNwZWNpZmllcnMiLCJmb3JFYWNoIiwiaW0iLCJpbXBvcnRLaW5kIiwiaW1wb3J0ZWQiLCJuYW1lIiwicmVwb3J0IiwibG9jYWwiLCJtZXNzYWdlIl0sIm1hcHBpbmdzIjoiYUFBQSxxQzs7QUFFQUEsT0FBT0MsT0FBUCxHQUFpQjtBQUNmQyxRQUFNO0FBQ0pDLFVBQU0sWUFERjtBQUVKQyxVQUFNO0FBQ0pDLFdBQUssMEJBQVEsa0JBQVIsQ0FERCxFQUZGOztBQUtKQyxZQUFRLEVBTEosRUFEUzs7O0FBU2ZDLFFBVGUsK0JBU1JDLE9BVFEsRUFTQztBQUNkLGFBQU87QUFDTCwwQ0FBcUIsMkJBQVVDLElBQVYsRUFBZ0I7QUFDbkNBLGlCQUFLQyxVQUFMLENBQWdCQyxPQUFoQixDQUF3QixVQUFVQyxFQUFWLEVBQWM7QUFDcEMsa0JBQUlBLEdB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XBvcnRlZC5uYW1lID09PSAnZGVmYXVsdCcpIHtcbiAgICAgICAgICAgIGNvbnRleHQucmVwb3J0KHtcbiAgICAgICAgICAgICAgbm9kZTogaW0ubG9jYWwsXG4gICAgICAgICAgICAgIG1lc3NhZ2U6IGBVc2UgZGVmYXVsdCBpbXBvcnQgc3ludGF4IHRvIGltcG9ydCAnJHtpbS5sb2NhbC5uYW1lfScuYCB9KTtcbiAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgfSxcbiAgICB9O1xuICB9LFxufTtcbiJdfQ==

View file

@ -0,0 +1,35 @@
'use strict';var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
module.exports = {
meta: {
type: 'suggestion',
docs: { url: (0, _docsUrl2['default'])('no-named-export') },
schema: [] },
create: function () {function create(context) {
// ignore non-modules
if (context.parserOptions.sourceType !== 'module') {
return {};
}
var message = 'Named exports are not allowed.';
return {
ExportAllDeclaration: function () {function ExportAllDeclaration(node) {
context.report({ node: node, message: message });
}return ExportAllDeclaration;}(),
ExportNamedDeclaration: function () {function ExportNamedDeclaration(node) {
if (node.specifiers.length === 0) {
return context.report({ node: node, message: message });
}
var someNamed = node.specifiers.some(function (specifier) {return specifier.exported.name !== 'default';});
if (someNamed) {
context.report({ node: node, message: message });
}
}return ExportNamedDeclaration;}() };
}return create;}() };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1uYW1lZC1leHBvcnQuanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJ0eXBlIiwiZG9jcyIsInVybCIsInNjaGVtYSIsImNyZWF0ZSIsImNvbnRleHQiLCJwYXJzZXJPcHRpb25zIiwic291cmNlVHlwZSIsIm1lc3NhZ2UiLCJFeHBvcnRBbGxEZWNsYXJh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mYXVsdCcpO1xuICAgICAgICBpZiAoc29tZU5hbWVkKSB7XG4gICAgICAgICAgY29udGV4dC5yZXBvcnQoeyBub2RlLCBtZXNzYWdlIH0pO1xuICAgICAgICB9XG4gICAgICB9LFxuICAgIH07XG4gIH0sXG59O1xuIl19

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,42 @@
'use strict';var _importType = require('../core/importType');var _importType2 = _interopRequireDefault(_importType);
var _moduleVisitor = require('eslint-module-utils/moduleVisitor');var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor);
var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
function reportIfMissing(context, node, allowed, name) {
if (allowed.indexOf(name) === -1 && (0, _importType2['default'])(name, context) === 'builtin') {
context.report(node, 'Do not import Node.js builtin module "' + name + '"');
}
}
module.exports = {
meta: {
type: 'suggestion',
docs: {
url: (0, _docsUrl2['default'])('no-nodejs-modules') },
schema: [
{
type: 'object',
properties: {
allow: {
type: 'array',
uniqueItems: true,
items: {
type: 'string' } } },
additionalProperties: false }] },
create: function () {function create(context) {
var options = context.options[0] || {};
var allowed = options.allow || [];
return (0, _moduleVisitor2['default'])(function (source, node) {
reportIfMissing(context, node, allowed, source.value);
}, { commonjs: true });
}return create;}() };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1ub2RlanMtbW9kdWxlcy5qcyJdLCJuYW1lcyI6WyJyZXBvcnRJZk1pc3NpbmciLCJjb250ZXh0Iiwibm9kZSIsImFsbG93ZWQiLCJuYW1lIiwiaW5kZXhPZiIsInJlcG9ydCIsIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwidHlwZSIsImRvY3MiLCJ1cmwiLCJzY2hlbWEiLCJwcm9wZXJ0aWVzIiwiYWxsb3ciLCJ1bmlxdWVJdGVtc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biAgICAgICAgICAgIHVuaXF1ZUl0ZW1zOiB0cnVlLFxuICAgICAgICAgICAgaXRlbXM6IHtcbiAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsXG4gICAgICAgICAgICB9LFxuICAgICAgICAgIH0sXG4gICAgICAgIH0sXG4gICAgICAgIGFkZGl0aW9uYWxQcm9wZXJ0aWVzOiBmYWxzZSxcbiAgICAgIH0sXG4gICAgXSxcbiAgfSxcblxuICBjcmVhdGUoY29udGV4dCkge1xuICAgIGNvbnN0IG9wdGlvbnMgPSBjb250ZXh0Lm9wdGlvbnNbMF0gfHwge307XG4gICAgY29uc3QgYWxsb3dlZCA9IG9wdGlvbnMuYWxsb3cgfHwgW107XG5cbiAgICByZXR1cm4gbW9kdWxlVmlzaXRvcigoc291cmNlLCBub2RlKSA9PiB7XG4gICAgICByZXBvcnRJZk1pc3NpbmcoY29udGV4dCwgbm9kZSwgYWxsb3dlZCwgc291cmNlLnZhbHVlKTtcbiAgICB9LCB7IGNvbW1vbmpzOiB0cnVlIH0pO1xuICB9LFxufTtcbiJdfQ==

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,49 @@
'use strict';var _moduleVisitor = require('eslint-module-utils/moduleVisitor');var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor);
var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);
var _path = require('path');
var _resolve = require('eslint-module-utils/resolve');var _resolve2 = _interopRequireDefault(_resolve);
var _importType = require('../core/importType');var _importType2 = _interopRequireDefault(_importType);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
module.exports = {
meta: {
type: 'suggestion',
docs: {
url: (0, _docsUrl2['default'])('no-relative-parent-imports') },
schema: [(0, _moduleVisitor.makeOptionsSchema)()] },
create: function () {function noRelativePackages(context) {
var myPath = context.getPhysicalFilename ? context.getPhysicalFilename() : context.getFilename();
if (myPath === '<text>') return {}; // can't check a non-file
function checkSourceValue(sourceNode) {
var depPath = sourceNode.value;
if ((0, _importType2['default'])(depPath, context) === 'external') {// ignore packages
return;
}
var absDepPath = (0, _resolve2['default'])(depPath, context);
if (!absDepPath) {// unable to resolve path
return;
}
var relDepPath = (0, _path.relative)((0, _path.dirname)(myPath), absDepPath);
if ((0, _importType2['default'])(relDepPath, context) === 'parent') {
context.report({
node: sourceNode,
message: 'Relative imports from parent directories are not allowed. ' + 'Please either pass what you\'re importing through at runtime ' + ('(dependency injection), move `' + String(
(0, _path.basename)(myPath)) + '` to same ') + ('directory as `' + String(
depPath) + '` or consider making `' + String(depPath) + '` a package.') });
}
}
return (0, _moduleVisitor2['default'])(checkSourceValue, context.options[0]);
}return noRelativePackages;}() };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1yZWxhdGl2ZS1wYXJlbnQtaW1wb3J0cy5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIiwibWV0YSIsInR5cGUiLCJkb2NzIiwidXJsIiwic2NoZW1hIiwiY3JlYXRlIiwibm9SZWxhdGl2ZVBhY2thZ2VzIiwiY29udGV4dCIsIm15UGF0aCIsImdldFBoeXNpY2FsRmlsZW5hbWUiLCJnZXRGaWxlbmFtZSIsImNoZWNrU291cmNlVmFsdWUiLCJzb3VyY2VOb2RlIiwiZGVwUGF0aCIsInZhbHVlIiwiYWJzRGVwUGF0aCIsInJlbERlcFBhdGgiLCJyZXBvcnQiLCJub2RlIiwibWVzc2FnZSIsIm9wdGlvbnMiXSwibWFwcGluZ3MiOiJhQUFBLGtFO0FBQ0EscUM7QUFDQTtBQUNBLHNEOztBQUVBLGdEOztBQUVBQSxPQUFPQyxPQUFQLEdBQWlCO0FBQ2ZDLFFBQU07QUFDSkMsVUFBTSxZQURGO0FBRUpDLFVBQU07QUFDSkMsV0FBSywwQkFBUSw0QkFBUixDQURELEVBRkY7O0FBS0pDLFlBQVEsQ0FBQyx1Q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dGlvbnNbMF0pO1xuICB9LFxufTtcbiJdfQ==

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,38 @@
'use strict';
var _resolve = require('eslint-module-utils/resolve');var _resolve2 = _interopRequireDefault(_resolve);
var _moduleVisitor = require('eslint-module-utils/moduleVisitor');var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor);
var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}
function isImportingSelf(context, node, requireName) {
var filePath = context.getPhysicalFilename ? context.getPhysicalFilename() : context.getFilename();
// If the input is from stdin, this test can't fail
if (filePath !== '<text>' && filePath === (0, _resolve2['default'])(requireName, context)) {
context.report({
node: node,
message: 'Module imports itself.' });
}
} /**
* @fileOverview Forbids a module from importing itself
* @author Gio d'Amelio
*/module.exports = { meta: {
type: 'problem',
docs: {
description: 'Forbid a module from importing itself',
recommended: true,
url: (0, _docsUrl2['default'])('no-self-import') },
schema: [] },
create: function () {function create(context) {
return (0, _moduleVisitor2['default'])(function (source, node) {
isImportingSelf(context, node, source.value);
}, { commonjs: true });
}return create;}() };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1zZWxmLWltcG9ydC5qcyJdLCJuYW1lcyI6WyJpc0ltcG9ydGluZ1NlbGYiLCJjb250ZXh0Iiwibm9kZSIsInJlcXVpcmVOYW1lIiwiZmlsZVBhdGgiLCJnZXRQaHlzaWNhbEZpbGVuYW1lIiwiZ2V0RmlsZW5hbWUiLCJyZXBvcnQiLCJtZXNzYWdlIiwibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJ0eXBlIiwiZG9jcyIsImRlc2NyaXB0aW9uIiwicmVjb21tZW5kZWQiLCJ1cmwiLCJzY2hlbWEiLCJjcmVhdGUiLCJzb3VyY2UiLCJ2YWx1ZSIsImNvbW1v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gY3JlYXRlKGNvbnRleHQpIHtcbiAgICByZXR1cm4gbW9kdWxlVmlzaXRvcigoc291cmNlLCBub2RlKSA9PiB7XG4gICAgICBpc0ltcG9ydGluZ1NlbGYoY29udGV4dCwgbm9kZSwgc291cmNlLnZhbHVlKTtcbiAgICB9LCB7IGNvbW1vbmpzOiB0cnVlIH0pO1xuICB9LFxufTtcbiJdfQ==

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show more